From e5264c433c8094d1723a011e1749bafcdac61beb Mon Sep 17 00:00:00 2001 From: zhong jiang Date: Fri, 17 Aug 2018 10:24:06 +0800 Subject: [PATCH 01/38] gpu: do not double put device node in zx_drm_probe for_each_available_child_of_node will get and put the node properly, the following of_node_put will lead to the double put. So just remove it. Signed-off-by: zhong jiang Signed-off-by: Shawn Guo Link: https://patchwork.freedesktop.org/patch/msgid/1534472646-10368-1-git-send-email-zhongjiang@huawei.com --- drivers/gpu/drm/zte/zx_drm_drv.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/gpu/drm/zte/zx_drm_drv.c b/drivers/gpu/drm/zte/zx_drm_drv.c index 6f4205e80378..d7b9870212da 100644 --- a/drivers/gpu/drm/zte/zx_drm_drv.c +++ b/drivers/gpu/drm/zte/zx_drm_drv.c @@ -161,10 +161,8 @@ static int zx_drm_probe(struct platform_device *pdev) if (ret) return ret; - for_each_available_child_of_node(parent, child) { + for_each_available_child_of_node(parent, child) component_match_add(dev, &match, compare_of, child); - of_node_put(child); - } return component_master_add_with_match(dev, &zx_drm_master_ops, match); } From e267364a6e1be8cccb16cec5b695e038c81a81a1 Mon Sep 17 00:00:00 2001 From: Kieran Bingham Date: Wed, 19 Sep 2018 16:56:58 +0100 Subject: [PATCH 02/38] drm/atomic: Initialise planes with opaque alpha values MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Planes without an alpha property, using __drm_atomic_helper_plane_reset will have their plane state alpha initialised as zero, which represents a transparent alpha. If this value is then used for the plane, it may not be visible by default, and thus doesn't represent a good initialisation state. Update the default state->alpha value to DRM_BLEND_ALPHA_OPAQUE unconditionally when the plane is reset. Signed-off-by: Kieran Bingham Reviewed-by: Ville Syrjälä Reviewed-by: Alexandru Gheorghe Reviewed-by: Laurent Pinchart Signed-off-by: Alexandru Gheorghe Link: https://patchwork.freedesktop.org/patch/msgid/20180919155700.10342-2-kieran.bingham+renesas@ideasonboard.com --- drivers/gpu/drm/drm_atomic_helper.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 3cf1aa132778..e49b22381048 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -3569,9 +3569,7 @@ void __drm_atomic_helper_plane_reset(struct drm_plane *plane, state->plane = plane; state->rotation = DRM_MODE_ROTATE_0; - /* Reset the alpha value to fully opaque if it matters */ - if (plane->alpha_property) - state->alpha = plane->alpha_property->values[1]; + state->alpha = DRM_BLEND_ALPHA_OPAQUE; state->pixel_blend_mode = DRM_MODE_BLEND_PREMULTI; plane->state = state; From 4f724df717c6d2334d01c93a6a89755691ae4440 Mon Sep 17 00:00:00 2001 From: Sean Paul Date: Wed, 19 Sep 2018 16:39:57 -0400 Subject: [PATCH 03/38] MAINTAINERS: Move udl drm driver to drm-misc tree Move udl maintenance into drm-misc tree. I've also signed up to be a reviewer, but have kept it at Odd Fixes level of support. Cc: Dave Airlie Cc: David Airlie Cc: Gustavo Padovan Cc: Maarten Lankhorst Acked-by: Dave Airlie Signed-off-by: Sean Paul Link: https://patchwork.freedesktop.org/patch/msgid/20180919204026.3217-1-sean@poorly.run --- MAINTAINERS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 9d9068ed4ee5..ba1dbb8735b8 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -4720,8 +4720,11 @@ F: drivers/gpu/drm/tdfx/ DRM DRIVER FOR USB DISPLAYLINK VIDEO ADAPTERS M: Dave Airlie +R: Sean Paul +L: dri-devel@lists.freedesktop.org S: Odd Fixes F: drivers/gpu/drm/udl/ +T: git git://anongit.freedesktop.org/drm/drm-misc DRM DRIVER FOR VMWARE VIRTUAL GPU M: "VMware Graphics" From 14e86c01413ed4cb69525e5eb60731d03ea7630c Mon Sep 17 00:00:00 2001 From: Wei Yongjun Date: Sat, 15 Sep 2018 01:53:19 +0000 Subject: [PATCH 04/38] drm/vkms: Fix possible memory leak in _vkms_get_crc() 'vaddr_out' is malloced in _vkms_get_crc() and should be freed before leaving from the error handling cases, otherwise it will cause memory leak. Fixes: db7f419c06d7 ("drm/vkms: Compute CRC with Cursor Plane") Signed-off-by: Wei Yongjun Signed-off-by: Daniel Vetter Link: https://patchwork.freedesktop.org/patch/msgid/1536976399-1295-1-git-send-email-weiyongjun1@huawei.com --- drivers/gpu/drm/vkms/vkms_crc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/vkms/vkms_crc.c b/drivers/gpu/drm/vkms/vkms_crc.c index 0a2745646dfa..9d9e8146db90 100644 --- a/drivers/gpu/drm/vkms/vkms_crc.c +++ b/drivers/gpu/drm/vkms/vkms_crc.c @@ -125,6 +125,7 @@ static uint32_t _vkms_get_crc(struct vkms_crc_data *primary_crc, mutex_lock(&vkms_obj->pages_lock); if (WARN_ON(!vkms_obj->vaddr)) { mutex_unlock(&vkms_obj->pages_lock); + kfree(vaddr_out); return crc; } From adbc8208e6620ddfa10fd863cb0a4ec0c54d8625 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Roberto=20de=20Souza?= Date: Tue, 18 Sep 2018 10:48:09 -0700 Subject: [PATCH 05/38] drm: Return -EOPNOTSUPP in drm_setclientcap() when driver do not support KMS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit All DRM_CLIENT capabilities are tied to KMS support, so returning -EOPNOTSUPP when KMS is not supported. v2: returning -EOPNOTSUPP(same value as posix ENOTSUP and available in uapi) instead of -ENOTSUPP v3: adding comments about the feature requirement about capabilities Cc: Chris Wilson Signed-off-by: José Roberto de Souza Signed-off-by: Daniel Vetter Link: https://patchwork.freedesktop.org/patch/msgid/20180918174809.17123-1-jose.souza@intel.com --- drivers/gpu/drm/drm_ioctl.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c index 60dfbfae6a02..94bd872d56c4 100644 --- a/drivers/gpu/drm/drm_ioctl.c +++ b/drivers/gpu/drm/drm_ioctl.c @@ -306,6 +306,12 @@ drm_setclientcap(struct drm_device *dev, void *data, struct drm_file *file_priv) { struct drm_set_client_cap *req = data; + /* No render-only settable capabilities for now */ + + /* Below caps that only works with KMS drivers */ + if (!drm_core_check_feature(dev, DRIVER_MODESET)) + return -EOPNOTSUPP; + switch (req->capability) { case DRM_CLIENT_CAP_STEREO_3D: if (req->value > 1) From 1664691a659f6115bae26e6256166e08b50def4e Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Thu, 20 Sep 2018 21:05:29 +0100 Subject: [PATCH 06/38] drm: Use default dma_fence hooks where possible for null syncobj Both the .enable_signaling and .release of the null syncobj fence can be replaced by the default callbacks for a small reduction in code size. In particular the default callback for .release was changed in commit e28bd101ae1b ("drm: rename null fence to stub fence in syncobj v2") which neglected its RCU protection. Fixes: e28bd101ae1b ("drm: rename null fence to stub fence in syncobj v2") Signed-off-by: Chris Wilson Reviewed-by: Tvrtko Ursulin Link: https://patchwork.freedesktop.org/patch/msgid/20180920200530.2836-1-chris@chris-wilson.co.uk Reviewed-by: Daniel Vetter --- drivers/gpu/drm/drm_syncobj.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c index 497729202bfe..e254f97fed7d 100644 --- a/drivers/gpu/drm/drm_syncobj.c +++ b/drivers/gpu/drm/drm_syncobj.c @@ -66,20 +66,9 @@ static const char *drm_syncobj_stub_fence_get_name(struct dma_fence *fence) return "syncobjstub"; } -static bool drm_syncobj_stub_fence_enable_signaling(struct dma_fence *fence) -{ - return !dma_fence_is_signaled(fence); -} - -static void drm_syncobj_stub_fence_release(struct dma_fence *f) -{ - kfree(f); -} static const struct dma_fence_ops drm_syncobj_stub_fence_ops = { .get_driver_name = drm_syncobj_stub_fence_get_name, .get_timeline_name = drm_syncobj_stub_fence_get_name, - .enable_signaling = drm_syncobj_stub_fence_enable_signaling, - .release = drm_syncobj_stub_fence_release, }; From 12fec62aea6ea67512f0ddabf960c9270b6d1b05 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Thu, 20 Sep 2018 21:05:30 +0100 Subject: [PATCH 07/38] drm: Fix syncobj handing of schedule() returning 0 After schedule() returns 0, we must do one last check of COND to determine the reason for the wakeup with 0 jiffies remaining before reporting the timeout -- otherwise we may lose the signal due to scheduler delays. References: https://bugs.freedesktop.org/show_bug.cgi?id=106690 Signed-off-by: Chris Wilson Reviewed-by: Tvrtko Ursulin Link: https://patchwork.freedesktop.org/patch/msgid/20180920200530.2836-2-chris@chris-wilson.co.uk Reviewed-by: Daniel Vetter --- drivers/gpu/drm/drm_syncobj.c | 41 +++++++++++++---------------------- 1 file changed, 15 insertions(+), 26 deletions(-) diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c index e254f97fed7d..5bcb3ef9b256 100644 --- a/drivers/gpu/drm/drm_syncobj.c +++ b/drivers/gpu/drm/drm_syncobj.c @@ -672,7 +672,6 @@ static signed long drm_syncobj_array_wait_timeout(struct drm_syncobj **syncobjs, { struct syncobj_wait_entry *entries; struct dma_fence *fence; - signed long ret; uint32_t signaled_count, i; entries = kcalloc(count, sizeof(*entries), GFP_KERNEL); @@ -692,7 +691,7 @@ static signed long drm_syncobj_array_wait_timeout(struct drm_syncobj **syncobjs, if (flags & DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT) { continue; } else { - ret = -EINVAL; + timeout = -EINVAL; goto cleanup_entries; } } @@ -704,12 +703,6 @@ static signed long drm_syncobj_array_wait_timeout(struct drm_syncobj **syncobjs, } } - /* Initialize ret to the max of timeout and 1. That way, the - * default return value indicates a successful wait and not a - * timeout. - */ - ret = max_t(signed long, timeout, 1); - if (signaled_count == count || (signaled_count > 0 && !(flags & DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL))) @@ -760,18 +753,17 @@ static signed long drm_syncobj_array_wait_timeout(struct drm_syncobj **syncobjs, goto done_waiting; if (timeout == 0) { - /* If we are doing a 0 timeout wait and we got - * here, then we just timed out. - */ - ret = 0; + timeout = -ETIME; goto done_waiting; } - ret = schedule_timeout(ret); + if (signal_pending(current)) { + timeout = -ERESTARTSYS; + goto done_waiting; + } - if (ret > 0 && signal_pending(current)) - ret = -ERESTARTSYS; - } while (ret > 0); + timeout = schedule_timeout(timeout); + } while (1); done_waiting: __set_current_state(TASK_RUNNING); @@ -788,7 +780,7 @@ cleanup_entries: } kfree(entries); - return ret; + return timeout; } /** @@ -829,19 +821,16 @@ static int drm_syncobj_array_wait(struct drm_device *dev, struct drm_syncobj **syncobjs) { signed long timeout = drm_timeout_abs_to_jiffies(wait->timeout_nsec); - signed long ret = 0; uint32_t first = ~0; - ret = drm_syncobj_array_wait_timeout(syncobjs, - wait->count_handles, - wait->flags, - timeout, &first); - if (ret < 0) - return ret; + timeout = drm_syncobj_array_wait_timeout(syncobjs, + wait->count_handles, + wait->flags, + timeout, &first); + if (timeout < 0) + return timeout; wait->first_signaled = first; - if (ret == 0) - return -ETIME; return 0; } From 6129369a96183f28c7912dfd37cb5869433aa904 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Sat, 8 Sep 2018 15:46:29 +0200 Subject: [PATCH 08/38] drm/fb-helper: Improve error reporting in setup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Improve error reporting in drm_fb_helper_fbdev_setup() by printing the error code. This is useful for drivers that choose to not fall over just because fbdev doesen't work, but still wants clues to why it failed. This way they don't have to provide an error message themselves. Signed-off-by: Noralf Trønnes Acked-by: Sam Ravnborg Link: https://patchwork.freedesktop.org/patch/msgid/20180908134648.2582-2-noralf@tronnes.org --- drivers/gpu/drm/drm_fb_helper.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index 8e95d0f7c71d..bf2190c5add5 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c @@ -2846,7 +2846,7 @@ int drm_fb_helper_fbdev_setup(struct drm_device *dev, if (!max_conn_count) max_conn_count = dev->mode_config.num_connector; if (!max_conn_count) { - DRM_DEV_ERROR(dev->dev, "No connectors\n"); + DRM_DEV_ERROR(dev->dev, "fbdev: No connectors\n"); return -EINVAL; } @@ -2854,13 +2854,13 @@ int drm_fb_helper_fbdev_setup(struct drm_device *dev, ret = drm_fb_helper_init(dev, fb_helper, max_conn_count); if (ret < 0) { - DRM_DEV_ERROR(dev->dev, "Failed to initialize fbdev helper\n"); + DRM_DEV_ERROR(dev->dev, "fbdev: Failed to initialize (ret=%d)\n", ret); return ret; } ret = drm_fb_helper_single_add_all_connectors(fb_helper); if (ret < 0) { - DRM_DEV_ERROR(dev->dev, "Failed to add connectors\n"); + DRM_DEV_ERROR(dev->dev, "fbdev: Failed to add connectors (ret=%d)\n", ret); goto err_drm_fb_helper_fini; } @@ -2869,7 +2869,7 @@ int drm_fb_helper_fbdev_setup(struct drm_device *dev, ret = drm_fb_helper_initial_config(fb_helper, preferred_bpp); if (ret < 0) { - DRM_DEV_ERROR(dev->dev, "Failed to set fbdev configuration\n"); + DRM_DEV_ERROR(dev->dev, "fbdev: Failed to set configuration (ret=%d)\n", ret); goto err_drm_fb_helper_fini; } From 941e97c124a02e0544d64422ab28264ccb13fe81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Sat, 8 Sep 2018 15:46:36 +0200 Subject: [PATCH 09/38] drm/arm/hdlcd: Use drm_fbdev_generic_setup() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The CMA helper is already using the drm_fb_helper_generic_probe part of the generic fbdev emulation. This patch makes full use of the generic fbdev emulation by using its drm_client callbacks. This means that drm_mode_config_funcs->output_poll_changed and drm_driver->lastclose are now handled by the emulation code. Additionally fbdev unregister happens automatically on drm_dev_unregister(). The drm_fbdev_generic_setup() call is put after drm_dev_register() in the driver. This is done to highlight the fact that fbdev emulation is an internal client that makes use of the driver, it is not part of the driver as such. If fbdev setup fails, an error is printed, but the driver succeeds probing. Cc: Liviu Dudau Signed-off-by: Noralf Trønnes Acked-by: Sam Ravnborg Acked-by: Liviu Dudau Link: https://patchwork.freedesktop.org/patch/msgid/20180908134648.2582-9-noralf@tronnes.org --- drivers/gpu/drm/arm/hdlcd_drv.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c index 0ed1cde98cf8..dfad8d06d108 100644 --- a/drivers/gpu/drm/arm/hdlcd_drv.c +++ b/drivers/gpu/drm/arm/hdlcd_drv.c @@ -103,7 +103,6 @@ setup_fail: static const struct drm_mode_config_funcs hdlcd_mode_config_funcs = { .fb_create = drm_gem_fb_create, - .output_poll_changed = drm_fb_helper_output_poll_changed, .atomic_check = drm_atomic_helper_check, .atomic_commit = drm_atomic_helper_commit, }; @@ -233,7 +232,6 @@ static struct drm_driver hdlcd_driver = { .driver_features = DRIVER_HAVE_IRQ | DRIVER_GEM | DRIVER_MODESET | DRIVER_PRIME | DRIVER_ATOMIC, - .lastclose = drm_fb_helper_lastclose, .irq_handler = hdlcd_irq, .irq_preinstall = hdlcd_irq_preinstall, .irq_postinstall = hdlcd_irq_postinstall, @@ -308,19 +306,15 @@ static int hdlcd_drm_bind(struct device *dev) drm_mode_config_reset(drm); drm_kms_helper_poll_init(drm); - ret = drm_fb_cma_fbdev_init(drm, 32, 0); - if (ret) - goto err_fbdev; - ret = drm_dev_register(drm, 0); if (ret) goto err_register; + drm_fbdev_generic_setup(drm, 32); + return 0; err_register: - drm_fb_cma_fbdev_fini(drm); -err_fbdev: drm_kms_helper_poll_fini(drm); err_vblank: pm_runtime_disable(drm->dev); @@ -346,7 +340,6 @@ static void hdlcd_drm_unbind(struct device *dev) struct hdlcd_drm_private *hdlcd = drm->dev_private; drm_dev_unregister(drm); - drm_fb_cma_fbdev_fini(drm); drm_kms_helper_poll_fini(drm); component_unbind_all(dev, drm); of_node_put(hdlcd->crtc.port); From 9595809896d7ecfdf779b803055c0eb4ae846921 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Sat, 8 Sep 2018 15:46:37 +0200 Subject: [PATCH 10/38] drm/arm/mali: Use drm_fbdev_generic_setup() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The CMA helper is already using the drm_fb_helper_generic_probe part of the generic fbdev emulation. This patch makes full use of the generic fbdev emulation by using its drm_client callbacks. This means that drm_mode_config_funcs->output_poll_changed and drm_driver->lastclose are now handled by the emulation code. Additionally fbdev unregister happens automatically on drm_dev_unregister(). The drm_fbdev_generic_setup() call is put after drm_dev_register() in the driver. This is done to highlight the fact that fbdev emulation is an internal client that makes use of the driver, it is not part of the driver as such. If fbdev setup fails, an error is printed, but the driver succeeds probing. Cc: Liviu Dudau Cc: Brian Starkey Signed-off-by: Noralf Trønnes Acked-by: Sam Ravnborg Acked-by: Liviu Dudau Link: https://patchwork.freedesktop.org/patch/msgid/20180908134648.2582-10-noralf@tronnes.org --- drivers/gpu/drm/arm/malidp_drv.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c index 08b5bb219816..3171ffaadd77 100644 --- a/drivers/gpu/drm/arm/malidp_drv.c +++ b/drivers/gpu/drm/arm/malidp_drv.c @@ -260,7 +260,6 @@ static const struct drm_mode_config_helper_funcs malidp_mode_config_helpers = { static const struct drm_mode_config_funcs malidp_mode_config_funcs = { .fb_create = drm_gem_fb_create, - .output_poll_changed = drm_fb_helper_output_poll_changed, .atomic_check = drm_atomic_helper_check, .atomic_commit = drm_atomic_helper_commit, }; @@ -450,7 +449,6 @@ static int malidp_debugfs_init(struct drm_minor *minor) static struct drm_driver malidp_driver = { .driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC | DRIVER_PRIME, - .lastclose = drm_fb_helper_lastclose, .gem_free_object_unlocked = drm_gem_cma_free_object, .gem_vm_ops = &drm_gem_cma_vm_ops, .dumb_create = malidp_dumb_create, @@ -762,22 +760,18 @@ static int malidp_bind(struct device *dev) drm_mode_config_reset(drm); - ret = drm_fb_cma_fbdev_init(drm, 32, 0); - if (ret) - goto fbdev_fail; - drm_kms_helper_poll_init(drm); ret = drm_dev_register(drm, 0); if (ret) goto register_fail; + drm_fbdev_generic_setup(drm, 32); + return 0; register_fail: - drm_fb_cma_fbdev_fini(drm); drm_kms_helper_poll_fini(drm); -fbdev_fail: pm_runtime_get_sync(dev); vblank_fail: malidp_se_irq_fini(hwdev); @@ -814,7 +808,6 @@ static void malidp_unbind(struct device *dev) struct malidp_hw_device *hwdev = malidp->dev; drm_dev_unregister(drm); - drm_fb_cma_fbdev_fini(drm); drm_kms_helper_poll_fini(drm); pm_runtime_get_sync(dev); drm_crtc_vblank_off(&malidp->crtc); From f53705fd98030a814fb8e9c05bbed9d0c49d211b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Sat, 8 Sep 2018 15:46:39 +0200 Subject: [PATCH 11/38] drm/imx: Use drm_fbdev_generic_setup() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The CMA helper is already using the drm_fb_helper_generic_probe part of the generic fbdev emulation. This patch makes full use of the generic fbdev emulation by using its drm_client callbacks. This means that drm_mode_config_funcs->output_poll_changed and drm_driver->lastclose are now handled by the emulation code. Additionally fbdev unregister happens automatically on drm_dev_unregister(). The drm_fbdev_generic_setup() call is put after drm_dev_register() in the driver. This is done to highlight the fact that fbdev emulation is an internal client that makes use of the driver, it is not part of the driver as such. If fbdev setup fails, an error is printed, but the driver succeeds probing. CONFIG_DRM_FBDEV_EMULATION wasn't honoured by the CMA helper, but it is by drm_fb_helper. Cc: Philipp Zabel Signed-off-by: Noralf Trønnes Acked-by: Sam Ravnborg Tested-by: Philipp Zabel Acked-by: Philipp Zabel Link: https://patchwork.freedesktop.org/patch/msgid/20180908134648.2582-12-noralf@tronnes.org --- drivers/gpu/drm/imx/imx-drm-core.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c index 5ea0c82f9957..a70f3131a377 100644 --- a/drivers/gpu/drm/imx/imx-drm-core.c +++ b/drivers/gpu/drm/imx/imx-drm-core.c @@ -86,7 +86,6 @@ static int imx_drm_atomic_check(struct drm_device *dev, static const struct drm_mode_config_funcs imx_drm_mode_config_funcs = { .fb_create = drm_gem_fb_create, - .output_poll_changed = drm_fb_helper_output_poll_changed, .atomic_check = imx_drm_atomic_check, .atomic_commit = drm_atomic_helper_commit, }; @@ -165,7 +164,6 @@ static const struct drm_ioctl_desc imx_drm_ioctls[] = { static struct drm_driver imx_drm_driver = { .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME | DRIVER_ATOMIC, - .lastclose = drm_fb_helper_lastclose, .gem_free_object_unlocked = drm_gem_cma_free_object, .gem_vm_ops = &drm_gem_cma_vm_ops, .dumb_create = drm_gem_cma_dumb_create, @@ -263,30 +261,23 @@ static int imx_drm_bind(struct device *dev) * The fb helper takes copies of key hardware information, so the * crtcs/connectors/encoders must not change after this point. */ -#if IS_ENABLED(CONFIG_DRM_FBDEV_EMULATION) if (legacyfb_depth != 16 && legacyfb_depth != 32) { dev_warn(dev, "Invalid legacyfb_depth. Defaulting to 16bpp\n"); legacyfb_depth = 16; } - ret = drm_fb_cma_fbdev_init(drm, legacyfb_depth, MAX_CRTC); - if (ret) - goto err_unbind; -#endif drm_kms_helper_poll_init(drm); ret = drm_dev_register(drm, 0); if (ret) - goto err_fbhelper; + goto err_poll_fini; + + drm_fbdev_generic_setup(drm, legacyfb_depth); return 0; -err_fbhelper: +err_poll_fini: drm_kms_helper_poll_fini(drm); -#if IS_ENABLED(CONFIG_DRM_FBDEV_EMULATION) - drm_fb_cma_fbdev_fini(drm); -err_unbind: -#endif component_unbind_all(drm->dev, drm); err_kms: drm_mode_config_cleanup(drm); @@ -303,8 +294,6 @@ static void imx_drm_unbind(struct device *dev) drm_kms_helper_poll_fini(drm); - drm_fb_cma_fbdev_fini(drm); - drm_mode_config_cleanup(drm); component_unbind_all(drm->dev, drm); From 30f7b5e7c26337520e0bbd6ef644a145c075c5a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Sat, 8 Sep 2018 15:46:40 +0200 Subject: [PATCH 12/38] drm/pl111: Use drm_fbdev_generic_setup() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The CMA helper is already using the drm_fb_helper_generic_probe part of the generic fbdev emulation. This patch makes full use of the generic fbdev emulation by using its drm_client callbacks. This means that drm_mode_config_funcs->output_poll_changed and drm_driver->lastclose are now handled by the emulation code. Additionally fbdev unregister happens automatically on drm_dev_unregister(). The drm_fbdev_generic_setup() call is put after drm_dev_register() in the driver. This is done to highlight the fact that fbdev emulation is an internal client that makes use of the driver, it is not part of the driver as such. If fbdev setup fails, an error is printed, but the driver succeeds probing. Cc: Eric Anholt Signed-off-by: Noralf Trønnes Acked-by: Sam Ravnborg Acked-by: Eric Anholt Link: https://patchwork.freedesktop.org/patch/msgid/20180908134648.2582-13-noralf@tronnes.org --- drivers/gpu/drm/pl111/pl111_drv.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/pl111/pl111_drv.c b/drivers/gpu/drm/pl111/pl111_drv.c index 47fe30223444..33e0483d62ae 100644 --- a/drivers/gpu/drm/pl111/pl111_drv.c +++ b/drivers/gpu/drm/pl111/pl111_drv.c @@ -194,8 +194,6 @@ static int pl111_modeset_init(struct drm_device *dev) drm_mode_config_reset(dev); - drm_fb_cma_fbdev_init(dev, priv->variant->fb_bpp, 0); - drm_kms_helper_poll_init(dev); goto finish; @@ -232,7 +230,6 @@ DEFINE_DRM_GEM_CMA_FOPS(drm_fops); static struct drm_driver pl111_drm_driver = { .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME | DRIVER_ATOMIC, - .lastclose = drm_fb_helper_lastclose, .ioctls = NULL, .fops = &drm_fops, .name = "pl111", @@ -332,6 +329,8 @@ static int pl111_amba_probe(struct amba_device *amba_dev, if (ret < 0) goto dev_put; + drm_fbdev_generic_setup(drm, priv->variant->fb_bpp); + return 0; dev_put: @@ -348,7 +347,6 @@ static int pl111_amba_remove(struct amba_device *amba_dev) struct pl111_drm_dev_private *priv = drm->dev_private; drm_dev_unregister(drm); - drm_fb_cma_fbdev_fini(drm); if (priv->panel) drm_panel_bridge_remove(priv->bridge); drm_mode_config_cleanup(drm); From 0f26e5ce3e62c66ec0717b22d82eee8e29fe7b4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Sat, 8 Sep 2018 15:46:41 +0200 Subject: [PATCH 13/38] drm/sti: Use drm_fbdev_generic_setup() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The CMA helper is already using the drm_fb_helper_generic_probe part of the generic fbdev emulation. This patch makes full use of the generic fbdev emulation by using its drm_client callbacks. This means that drm_mode_config_funcs->output_poll_changed and drm_driver->lastclose are now handled by the emulation code. Additionally fbdev unregister happens automatically on drm_dev_unregister(). If drm_fbdev_generic_setup() fails, an error is printed by the function. drm_fbdev_generic_setup() handles mode_config.num_connector being zero. In that case it retries fbdev setup on the next .output_poll_changed. Cc: Benjamin Gaignard Cc: Vincent Abriou Signed-off-by: Noralf Trønnes Acked-by: Sam Ravnborg Acked-by: Benjamin Gaignard Link: https://patchwork.freedesktop.org/patch/msgid/20180908134648.2582-14-noralf@tronnes.org --- drivers/gpu/drm/sti/sti_drv.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c index 832fc43960ee..6dced8abcf16 100644 --- a/drivers/gpu/drm/sti/sti_drv.c +++ b/drivers/gpu/drm/sti/sti_drv.c @@ -121,7 +121,6 @@ err: static const struct drm_mode_config_funcs sti_mode_config_funcs = { .fb_create = drm_gem_fb_create, - .output_poll_changed = drm_fb_helper_output_poll_changed, .atomic_check = drm_atomic_helper_check, .atomic_commit = drm_atomic_helper_commit, }; @@ -206,7 +205,6 @@ static void sti_cleanup(struct drm_device *ddev) { struct sti_private *private = ddev->dev_private; - drm_fb_cma_fbdev_fini(ddev); drm_kms_helper_poll_fini(ddev); component_unbind_all(ddev->dev, ddev); kfree(private); @@ -236,11 +234,7 @@ static int sti_bind(struct device *dev) drm_mode_config_reset(ddev); - if (ddev->mode_config.num_connector) { - ret = drm_fb_cma_fbdev_init(ddev, 32, 0); - if (ret) - DRM_DEBUG_DRIVER("Warning: fails to create fbdev\n"); - } + drm_fbdev_generic_setup(ddev, 32); return 0; From 1e70d7a568fc6e1e9df1b7e86216b44ce7d1eb1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Sat, 8 Sep 2018 15:46:45 +0200 Subject: [PATCH 14/38] drm/tve200: Use drm_fbdev_generic_setup() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The CMA helper is already using the drm_fb_helper_generic_probe part of the generic fbdev emulation. This patch makes full use of the generic fbdev emulation by using its drm_client callbacks. This means that drm_mode_config_funcs->output_poll_changed and drm_driver->lastclose are now handled by the emulation code. Additionally fbdev unregister happens automatically on drm_dev_unregister(). The drm_fbdev_generic_setup() call is put after drm_dev_register() in the driver. This is done to highlight the fact that fbdev emulation is an internal client that makes use of the driver, it is not part of the driver as such. If fbdev setup fails, an error is printed, but the driver succeeds probing. Cc: Linus Walleij Signed-off-by: Noralf Trønnes Acked-by: Sam Ravnborg Acked-by: Linus Walleij Link: https://patchwork.freedesktop.org/patch/msgid/20180908134648.2582-18-noralf@tronnes.org --- drivers/gpu/drm/tve200/tve200_drv.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/tve200/tve200_drv.c b/drivers/gpu/drm/tve200/tve200_drv.c index ac344ddb23bc..72efcecb44f7 100644 --- a/drivers/gpu/drm/tve200/tve200_drv.c +++ b/drivers/gpu/drm/tve200/tve200_drv.c @@ -126,12 +126,6 @@ static int tve200_modeset_init(struct drm_device *dev) } drm_mode_config_reset(dev); - - /* - * Passing in 16 here will make the RGB656 mode the default - * Passing in 32 will use XRGB8888 mode - */ - drm_fb_cma_fbdev_init(dev, 16, 0); drm_kms_helper_poll_init(dev); goto finish; @@ -149,7 +143,6 @@ DEFINE_DRM_GEM_CMA_FOPS(drm_fops); static struct drm_driver tve200_drm_driver = { .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME | DRIVER_ATOMIC, - .lastclose = drm_fb_helper_lastclose, .ioctls = NULL, .fops = &drm_fops, .name = "tve200", @@ -245,6 +238,12 @@ static int tve200_probe(struct platform_device *pdev) if (ret < 0) goto clk_disable; + /* + * Passing in 16 here will make the RGB565 mode the default + * Passing in 32 will use XRGB8888 mode + */ + drm_fbdev_generic_setup(drm, 16); + return 0; clk_disable: @@ -260,7 +259,6 @@ static int tve200_remove(struct platform_device *pdev) struct tve200_drm_dev_private *priv = drm->dev_private; drm_dev_unregister(drm); - drm_fb_cma_fbdev_fini(drm); if (priv->panel) drm_panel_bridge_remove(priv->bridge); drm_mode_config_cleanup(drm); From 233386d8f22b62ea9c725226067b89c3ecb701d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Sat, 8 Sep 2018 15:46:46 +0200 Subject: [PATCH 15/38] drm/vc4: Use drm_fbdev_generic_setup() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The CMA helper is already using the drm_fb_helper_generic_probe part of the generic fbdev emulation. This patch makes full use of the generic fbdev emulation by using its drm_client callbacks. This means that drm_mode_config_funcs->output_poll_changed and drm_driver->lastclose are now handled by the emulation code. Additionally fbdev unregister happens automatically on drm_dev_unregister(). The drm_fbdev_generic_setup() call is put after drm_dev_register() in the driver. This is done to highlight the fact that fbdev emulation is an internal client that makes use of the driver, it is not part of the driver as such. If fbdev setup fails, an error is printed, but the driver succeeds probing. drm_fbdev_generic_setup() handles mode_config.num_connector being zero. In that case it retries fbdev setup on the next .output_poll_changed. Cc: Eric Anholt Signed-off-by: Noralf Trønnes Acked-by: Sam Ravnborg Acked-by: Eric Anholt Link: https://patchwork.freedesktop.org/patch/msgid/20180908134648.2582-19-noralf@tronnes.org --- drivers/gpu/drm/vc4/vc4_drv.c | 5 ++--- drivers/gpu/drm/vc4/vc4_kms.c | 6 ------ 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c index e2a15c63a81f..1f1780ccdbdf 100644 --- a/drivers/gpu/drm/vc4/vc4_drv.c +++ b/drivers/gpu/drm/vc4/vc4_drv.c @@ -178,7 +178,6 @@ static struct drm_driver vc4_drm_driver = { DRIVER_RENDER | DRIVER_PRIME | DRIVER_SYNCOBJ), - .lastclose = drm_fb_helper_lastclose, .open = vc4_open, .postclose = vc4_close, .irq_handler = vc4_irq, @@ -288,6 +287,8 @@ static int vc4_drm_bind(struct device *dev) vc4_kms_load(drm); + drm_fbdev_generic_setup(drm, 32); + return 0; unbind_all: @@ -307,8 +308,6 @@ static void vc4_drm_unbind(struct device *dev) drm_dev_unregister(drm); - drm_fb_cma_fbdev_fini(drm); - drm_mode_config_cleanup(drm); drm_atomic_private_obj_fini(&vc4->ctm_manager); diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_kms.c index ca5aa7fba769..127468785f74 100644 --- a/drivers/gpu/drm/vc4/vc4_kms.c +++ b/drivers/gpu/drm/vc4/vc4_kms.c @@ -19,8 +19,6 @@ #include #include #include -#include -#include #include #include "vc4_drv.h" #include "vc4_regs.h" @@ -394,7 +392,6 @@ vc4_atomic_check(struct drm_device *dev, struct drm_atomic_state *state) } static const struct drm_mode_config_funcs vc4_mode_funcs = { - .output_poll_changed = drm_fb_helper_output_poll_changed, .atomic_check = vc4_atomic_check, .atomic_commit = vc4_atomic_commit, .fb_create = vc4_fb_create, @@ -434,9 +431,6 @@ int vc4_kms_load(struct drm_device *dev) drm_mode_config_reset(dev); - if (dev->mode_config.num_connector) - drm_fb_cma_fbdev_init(dev, 32, 0); - drm_kms_helper_poll_init(dev); return 0; From c3a8d6ea73ec051b121b75ac61973e688e809fe4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Sat, 8 Sep 2018 15:46:47 +0200 Subject: [PATCH 16/38] drm/zte: Use drm_fbdev_generic_setup() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The CMA helper is already using the drm_fb_helper_generic_probe part of the generic fbdev emulation. This patch makes full use of the generic fbdev emulation by using its drm_client callbacks. This means that drm_mode_config_funcs->output_poll_changed and drm_driver->lastclose are now handled by the emulation code. Additionally fbdev unregister happens automatically on drm_dev_unregister(). The drm_fbdev_generic_setup() call is put after drm_dev_register() in the driver. This is done to highlight the fact that fbdev emulation is an internal client that makes use of the driver, it is not part of the driver as such. If fbdev setup fails, an error is printed, but the driver succeeds probing. Cc: Shawn Guo Signed-off-by: Noralf Trønnes Acked-by: Sam Ravnborg Acked-by: Shawn Guo Link: https://patchwork.freedesktop.org/patch/msgid/20180908134648.2582-20-noralf@tronnes.org --- drivers/gpu/drm/zte/zx_drm_drv.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/zte/zx_drm_drv.c b/drivers/gpu/drm/zte/zx_drm_drv.c index d7b9870212da..11ef17c2d1c1 100644 --- a/drivers/gpu/drm/zte/zx_drm_drv.c +++ b/drivers/gpu/drm/zte/zx_drm_drv.c @@ -31,7 +31,6 @@ static const struct drm_mode_config_funcs zx_drm_mode_config_funcs = { .fb_create = drm_gem_fb_create, - .output_poll_changed = drm_fb_helper_output_poll_changed, .atomic_check = drm_atomic_helper_check, .atomic_commit = drm_atomic_helper_commit, }; @@ -41,7 +40,6 @@ DEFINE_DRM_GEM_CMA_FOPS(zx_drm_fops); static struct drm_driver zx_drm_driver = { .driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_PRIME | DRIVER_ATOMIC, - .lastclose = drm_fb_helper_lastclose, .gem_free_object_unlocked = drm_gem_cma_free_object, .gem_vm_ops = &drm_gem_cma_vm_ops, .dumb_create = drm_gem_cma_dumb_create, @@ -101,20 +99,14 @@ static int zx_drm_bind(struct device *dev) drm_mode_config_reset(drm); drm_kms_helper_poll_init(drm); - ret = drm_fb_cma_fbdev_init(drm, 32, 0); - if (ret) { - DRM_DEV_ERROR(dev, "failed to init cma fbdev: %d\n", ret); - goto out_poll_fini; - } - ret = drm_dev_register(drm, 0); if (ret) - goto out_fbdev_fini; + goto out_poll_fini; + + drm_fbdev_generic_setup(drm, 32); return 0; -out_fbdev_fini: - drm_fb_cma_fbdev_fini(drm); out_poll_fini: drm_kms_helper_poll_fini(drm); drm_mode_config_cleanup(drm); @@ -131,7 +123,6 @@ static void zx_drm_unbind(struct device *dev) struct drm_device *drm = dev_get_drvdata(dev); drm_dev_unregister(drm); - drm_fb_cma_fbdev_fini(drm); drm_kms_helper_poll_fini(drm); drm_mode_config_cleanup(drm); component_unbind_all(dev, drm); From af334c5d41a9d3b9df3204d50a9a8f566ef64c66 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Thu, 20 Sep 2018 08:29:23 +0200 Subject: [PATCH 17/38] drm/virtio: pass virtio_gpu_object to virtio_gpu_cmd_transfer_to_host_{2d, 3d} Pass virtio_gpu_object down to virtio_gpu_cmd_transfer_to_host_2d and virtio_gpu_cmd_transfer_to_host_3d functions, instead of passing just the virtio resource handle. This is needed to lookup the scatter list of the object, for dma sync. Signed-off-by: Gerd Hoffmann Reviewed-by: Jiandi An Tested-by: Jiandi An Link: http://patchwork.freedesktop.org/patch/msgid/20180920062924.6514-1-kraxel@redhat.com --- drivers/gpu/drm/virtio/virtgpu_drv.h | 6 ++++-- drivers/gpu/drm/virtio/virtgpu_fb.c | 2 +- drivers/gpu/drm/virtio/virtgpu_ioctl.c | 4 ++-- drivers/gpu/drm/virtio/virtgpu_plane.c | 4 ++-- drivers/gpu/drm/virtio/virtgpu_vq.c | 20 ++++++++------------ 5 files changed, 17 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio/virtgpu_drv.h index a2d79e18bda7..253fcf018dbe 100644 --- a/drivers/gpu/drm/virtio/virtgpu_drv.h +++ b/drivers/gpu/drm/virtio/virtgpu_drv.h @@ -270,7 +270,8 @@ void virtio_gpu_cmd_create_resource(struct virtio_gpu_device *vgdev, void virtio_gpu_cmd_unref_resource(struct virtio_gpu_device *vgdev, uint32_t resource_id); void virtio_gpu_cmd_transfer_to_host_2d(struct virtio_gpu_device *vgdev, - uint32_t resource_id, uint64_t offset, + struct virtio_gpu_object *bo, + uint64_t offset, __le32 width, __le32 height, __le32 x, __le32 y, struct virtio_gpu_fence **fence); @@ -316,7 +317,8 @@ void virtio_gpu_cmd_transfer_from_host_3d(struct virtio_gpu_device *vgdev, struct virtio_gpu_box *box, struct virtio_gpu_fence **fence); void virtio_gpu_cmd_transfer_to_host_3d(struct virtio_gpu_device *vgdev, - uint32_t resource_id, uint32_t ctx_id, + struct virtio_gpu_object *bo, + uint32_t ctx_id, uint64_t offset, uint32_t level, struct virtio_gpu_box *box, struct virtio_gpu_fence **fence); diff --git a/drivers/gpu/drm/virtio/virtgpu_fb.c b/drivers/gpu/drm/virtio/virtgpu_fb.c index b9678c4082ac..3364b0970dd2 100644 --- a/drivers/gpu/drm/virtio/virtgpu_fb.c +++ b/drivers/gpu/drm/virtio/virtgpu_fb.c @@ -95,7 +95,7 @@ static int virtio_gpu_dirty_update(struct virtio_gpu_framebuffer *fb, offset = (y * fb->base.pitches[0]) + x * bpp; - virtio_gpu_cmd_transfer_to_host_2d(vgdev, obj->hw_res_handle, + virtio_gpu_cmd_transfer_to_host_2d(vgdev, obj, offset, cpu_to_le32(w), cpu_to_le32(h), diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virtio/virtgpu_ioctl.c index 7bdf6f0e58a5..f16b875d6a46 100644 --- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c +++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c @@ -429,11 +429,11 @@ static int virtio_gpu_transfer_to_host_ioctl(struct drm_device *dev, void *data, convert_to_hw_box(&box, &args->box); if (!vgdev->has_virgl_3d) { virtio_gpu_cmd_transfer_to_host_2d - (vgdev, qobj->hw_res_handle, offset, + (vgdev, qobj, offset, box.w, box.h, box.x, box.y, NULL); } else { virtio_gpu_cmd_transfer_to_host_3d - (vgdev, qobj->hw_res_handle, + (vgdev, qobj, vfpriv ? vfpriv->ctx_id : 0, offset, args->level, &box, &fence); reservation_object_add_excl_fence(qobj->tbo.resv, diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c b/drivers/gpu/drm/virtio/virtgpu_plane.c index 88f2fb8c61c4..682a977d68c1 100644 --- a/drivers/gpu/drm/virtio/virtgpu_plane.c +++ b/drivers/gpu/drm/virtio/virtgpu_plane.c @@ -158,7 +158,7 @@ static void virtio_gpu_primary_plane_update(struct drm_plane *plane, handle = bo->hw_res_handle; if (bo->dumb) { virtio_gpu_cmd_transfer_to_host_2d - (vgdev, handle, 0, + (vgdev, bo, 0, cpu_to_le32(plane->state->src_w >> 16), cpu_to_le32(plane->state->src_h >> 16), cpu_to_le32(plane->state->src_x >> 16), @@ -217,7 +217,7 @@ static void virtio_gpu_cursor_plane_update(struct drm_plane *plane, if (bo && bo->dumb && (plane->state->fb != old_state->fb)) { /* new cursor -- update & wait */ virtio_gpu_cmd_transfer_to_host_2d - (vgdev, handle, 0, + (vgdev, bo, 0, cpu_to_le32(plane->state->crtc_w), cpu_to_le32(plane->state->crtc_h), 0, 0, &fence); diff --git a/drivers/gpu/drm/virtio/virtgpu_vq.c b/drivers/gpu/drm/virtio/virtgpu_vq.c index df32811f2c3e..4e2e037aed34 100644 --- a/drivers/gpu/drm/virtio/virtgpu_vq.c +++ b/drivers/gpu/drm/virtio/virtgpu_vq.c @@ -483,28 +483,26 @@ void virtio_gpu_cmd_resource_flush(struct virtio_gpu_device *vgdev, } void virtio_gpu_cmd_transfer_to_host_2d(struct virtio_gpu_device *vgdev, - uint32_t resource_id, uint64_t offset, + struct virtio_gpu_object *bo, + uint64_t offset, __le32 width, __le32 height, __le32 x, __le32 y, struct virtio_gpu_fence **fence) { struct virtio_gpu_transfer_to_host_2d *cmd_p; struct virtio_gpu_vbuffer *vbuf; - struct virtio_gpu_fbdev *vgfbdev = vgdev->vgfbdev; - struct virtio_gpu_framebuffer *fb = &vgfbdev->vgfb; - struct virtio_gpu_object *obj = gem_to_virtio_gpu_obj(fb->base.obj[0]); bool use_dma_api = !virtio_has_iommu_quirk(vgdev->vdev); if (use_dma_api) dma_sync_sg_for_device(vgdev->vdev->dev.parent, - obj->pages->sgl, obj->pages->nents, + bo->pages->sgl, bo->pages->nents, DMA_TO_DEVICE); cmd_p = virtio_gpu_alloc_cmd(vgdev, &vbuf, sizeof(*cmd_p)); memset(cmd_p, 0, sizeof(*cmd_p)); cmd_p->hdr.type = cpu_to_le32(VIRTIO_GPU_CMD_TRANSFER_TO_HOST_2D); - cmd_p->resource_id = cpu_to_le32(resource_id); + cmd_p->resource_id = cpu_to_le32(bo->hw_res_handle); cmd_p->offset = cpu_to_le64(offset); cmd_p->r.width = width; cmd_p->r.height = height; @@ -791,21 +789,19 @@ virtio_gpu_cmd_resource_create_3d(struct virtio_gpu_device *vgdev, } void virtio_gpu_cmd_transfer_to_host_3d(struct virtio_gpu_device *vgdev, - uint32_t resource_id, uint32_t ctx_id, + struct virtio_gpu_object *bo, + uint32_t ctx_id, uint64_t offset, uint32_t level, struct virtio_gpu_box *box, struct virtio_gpu_fence **fence) { struct virtio_gpu_transfer_host_3d *cmd_p; struct virtio_gpu_vbuffer *vbuf; - struct virtio_gpu_fbdev *vgfbdev = vgdev->vgfbdev; - struct virtio_gpu_framebuffer *fb = &vgfbdev->vgfb; - struct virtio_gpu_object *obj = gem_to_virtio_gpu_obj(fb->base.obj[0]); bool use_dma_api = !virtio_has_iommu_quirk(vgdev->vdev); if (use_dma_api) dma_sync_sg_for_device(vgdev->vdev->dev.parent, - obj->pages->sgl, obj->pages->nents, + bo->pages->sgl, bo->pages->nents, DMA_TO_DEVICE); cmd_p = virtio_gpu_alloc_cmd(vgdev, &vbuf, sizeof(*cmd_p)); @@ -813,7 +809,7 @@ void virtio_gpu_cmd_transfer_to_host_3d(struct virtio_gpu_device *vgdev, cmd_p->hdr.type = cpu_to_le32(VIRTIO_GPU_CMD_TRANSFER_TO_HOST_3D); cmd_p->hdr.ctx_id = cpu_to_le32(ctx_id); - cmd_p->resource_id = cpu_to_le32(resource_id); + cmd_p->resource_id = cpu_to_le32(bo->hw_res_handle); cmd_p->box = *box; cmd_p->offset = cpu_to_le64(offset); cmd_p->level = cpu_to_le32(level); From 059b5eb5d9554dea689430ad3872dcb37a35053d Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Fri, 21 Sep 2018 15:46:59 +0200 Subject: [PATCH 18/38] drm: move native byte order quirk to new drm_driver_legacy_fb_format function Turns out we need the pixel format fixup not only for the addfb ioctl, but also for fbdev emulation code. Ideally we would place it in drm_mode_legacy_fb_format(). That would create alot of churn though, and most drivers don't care because they never ever run on a big endian platform. So add a new drm_driver_legacy_fb_format() function instead which looks at the mode_config->quirk_addfb_prefer_host_byte_order flag. Signed-off-by: Gerd Hoffmann Reviewed-by: Daniel Vetter Link: http://patchwork.freedesktop.org/patch/msgid/20180921134704.12826-2-kraxel@redhat.com --- drivers/gpu/drm/drm_fourcc.c | 30 ++++++++++++++++++++++++++++++ drivers/gpu/drm/drm_framebuffer.c | 13 +------------ include/drm/drm_fourcc.h | 2 ++ 3 files changed, 33 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/drm_fourcc.c b/drivers/gpu/drm/drm_fourcc.c index be1d6aaef651..7c6d3922ed40 100644 --- a/drivers/gpu/drm/drm_fourcc.c +++ b/drivers/gpu/drm/drm_fourcc.c @@ -95,6 +95,36 @@ uint32_t drm_mode_legacy_fb_format(uint32_t bpp, uint32_t depth) } EXPORT_SYMBOL(drm_mode_legacy_fb_format); +/** + * drm_driver_legacy_fb_format - compute drm fourcc code from legacy description + * @bpp: bits per pixels + * @depth: bit depth per pixel + * @native: use host native byte order + * + * Computes a drm fourcc pixel format code for the given @bpp/@depth values. + * Unlike drm_mode_legacy_fb_format() this looks at the drivers mode_config, + * and depending on the quirk_addfb_prefer_host_byte_order flag it returns + * little endian byte order or host byte order framebuffer formats. + */ +uint32_t drm_driver_legacy_fb_format(struct drm_device *dev, + uint32_t bpp, uint32_t depth) +{ + uint32_t fmt = drm_mode_legacy_fb_format(bpp, depth); + + if (dev->mode_config.quirk_addfb_prefer_host_byte_order) { + if (fmt == DRM_FORMAT_XRGB8888) + fmt = DRM_FORMAT_HOST_XRGB8888; + if (fmt == DRM_FORMAT_ARGB8888) + fmt = DRM_FORMAT_HOST_ARGB8888; + if (fmt == DRM_FORMAT_RGB565) + fmt = DRM_FORMAT_HOST_RGB565; + if (fmt == DRM_FORMAT_XRGB1555) + fmt = DRM_FORMAT_HOST_XRGB1555; + } + return fmt; +} +EXPORT_SYMBOL(drm_driver_legacy_fb_format); + /** * drm_get_format_name - fill a string with a drm fourcc format's name * @format: format to compute name of diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c index 1ee3d6b44280..1e2126101c18 100644 --- a/drivers/gpu/drm/drm_framebuffer.c +++ b/drivers/gpu/drm/drm_framebuffer.c @@ -116,7 +116,7 @@ int drm_mode_addfb(struct drm_device *dev, struct drm_mode_fb_cmd *or, if (!drm_core_check_feature(dev, DRIVER_MODESET)) return -EOPNOTSUPP; - r.pixel_format = drm_mode_legacy_fb_format(or->bpp, or->depth); + r.pixel_format = drm_driver_legacy_fb_format(dev, or->bpp, or->depth); if (r.pixel_format == DRM_FORMAT_INVALID) { DRM_DEBUG("bad {bpp:%d, depth:%d}\n", or->bpp, or->depth); return -EINVAL; @@ -133,17 +133,6 @@ int drm_mode_addfb(struct drm_device *dev, struct drm_mode_fb_cmd *or, r.pixel_format == DRM_FORMAT_XRGB2101010) r.pixel_format = DRM_FORMAT_XBGR2101010; - if (dev->mode_config.quirk_addfb_prefer_host_byte_order) { - if (r.pixel_format == DRM_FORMAT_XRGB8888) - r.pixel_format = DRM_FORMAT_HOST_XRGB8888; - if (r.pixel_format == DRM_FORMAT_ARGB8888) - r.pixel_format = DRM_FORMAT_HOST_ARGB8888; - if (r.pixel_format == DRM_FORMAT_RGB565) - r.pixel_format = DRM_FORMAT_HOST_RGB565; - if (r.pixel_format == DRM_FORMAT_XRGB1555) - r.pixel_format = DRM_FORMAT_HOST_XRGB1555; - } - ret = drm_mode_addfb2(dev, &r, file_priv); if (ret) return ret; diff --git a/include/drm/drm_fourcc.h b/include/drm/drm_fourcc.h index fac831c40106..865ef60c17af 100644 --- a/include/drm/drm_fourcc.h +++ b/include/drm/drm_fourcc.h @@ -88,6 +88,8 @@ const struct drm_format_info * drm_get_format_info(struct drm_device *dev, const struct drm_mode_fb_cmd2 *mode_cmd); uint32_t drm_mode_legacy_fb_format(uint32_t bpp, uint32_t depth); +uint32_t drm_driver_legacy_fb_format(struct drm_device *dev, + uint32_t bpp, uint32_t depth); int drm_format_num_planes(uint32_t format); int drm_format_plane_cpp(uint32_t format, int plane); int drm_format_horz_chroma_subsampling(uint32_t format); From 184bef8924c95d43c1476d21034c14c8582f487f Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Fri, 21 Sep 2018 15:47:00 +0200 Subject: [PATCH 19/38] drm: use drm_driver_legacy_fb_format in drm_gem_fbdev_fb_create Creating framebuffers for fbdev emulation should use the correct format code too, so switch drm_gem_fbdev_fb_create() over to use the new drm_driver_legacy_fb_format() function. Signed-off-by: Gerd Hoffmann Reviewed-by: Daniel Vetter Link: http://patchwork.freedesktop.org/patch/msgid/20180921134704.12826-3-kraxel@redhat.com --- drivers/gpu/drm/drm_gem_framebuffer_helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_gem_framebuffer_helper.c b/drivers/gpu/drm/drm_gem_framebuffer_helper.c index 7607f9cd6f77..ded7a379ac35 100644 --- a/drivers/gpu/drm/drm_gem_framebuffer_helper.c +++ b/drivers/gpu/drm/drm_gem_framebuffer_helper.c @@ -316,8 +316,8 @@ drm_gem_fbdev_fb_create(struct drm_device *dev, if (pitch_align) mode_cmd.pitches[0] = roundup(mode_cmd.pitches[0], pitch_align); - mode_cmd.pixel_format = drm_mode_legacy_fb_format(sizes->surface_bpp, - sizes->surface_depth); + mode_cmd.pixel_format = drm_driver_legacy_fb_format(dev, sizes->surface_bpp, + sizes->surface_depth); if (obj->size < mode_cmd.pitches[0] * mode_cmd.height) return ERR_PTR(-EINVAL); From 48b442238250bd27edfef13ab314b295b2734cc4 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Fri, 21 Sep 2018 15:47:01 +0200 Subject: [PATCH 20/38] drm/bochs: fix DRM_FORMAT_* handling for big endian machines. Use DRM_FORMAT_HOST_XRGB8888, so we are using the correct format code on bigendian machines. Also set the quirk_addfb_prefer_host_byte_order mode_config bit so drm_mode_addfb() asks for the correct format code. Create our own plane and use drm_crtc_init_with_planes() instead of depending on the default created by drm_crtc_init(). That way the plane format list is correct on bigendian machines. Also re-add the framebuffer format check dropped by "df2052cc92 bochs: convert to drm_fb_helper_fbdev_setup/teardown". With this patch applied both ADDFB and ADDFB2 ioctls work correctly in the bochs-drm.ko driver on big endian machines. Without the patch only ADDFB (which still seems to be used by the majority of userspace) works correctly. Signed-off-by: Gerd Hoffmann Acked-by: Daniel Vetter Link: http://patchwork.freedesktop.org/patch/msgid/20180921134704.12826-4-kraxel@redhat.com --- drivers/gpu/drm/bochs/bochs_fbdev.c | 17 +++++++++++---- drivers/gpu/drm/bochs/bochs_kms.c | 34 ++++++++++++++++++++++++++++- 2 files changed, 46 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/bochs/bochs_fbdev.c b/drivers/gpu/drm/bochs/bochs_fbdev.c index 8f4d6c052f7b..c46fdae44ea3 100644 --- a/drivers/gpu/drm/bochs/bochs_fbdev.c +++ b/drivers/gpu/drm/bochs/bochs_fbdev.c @@ -63,9 +63,8 @@ static int bochsfb_create(struct drm_fb_helper *helper, mode_cmd.width = sizes->surface_width; mode_cmd.height = sizes->surface_height; - mode_cmd.pitches[0] = mode_cmd.width * ((sizes->surface_bpp + 7) / 8); - mode_cmd.pixel_format = drm_mode_legacy_fb_format(sizes->surface_bpp, - sizes->surface_depth); + mode_cmd.pitches[0] = sizes->surface_width * 4; + mode_cmd.pixel_format = DRM_FORMAT_HOST_XRGB8888; size = mode_cmd.pitches[0] * mode_cmd.height; /* alloc, pin & map bo */ @@ -137,8 +136,18 @@ static const struct drm_fb_helper_funcs bochs_fb_helper_funcs = { .fb_probe = bochsfb_create, }; +static struct drm_framebuffer * +bochs_gem_fb_create(struct drm_device *dev, struct drm_file *file, + const struct drm_mode_fb_cmd2 *mode_cmd) +{ + if (mode_cmd->pixel_format != DRM_FORMAT_HOST_XRGB8888) + return ERR_PTR(-EINVAL); + + return drm_gem_fb_create(dev, file, mode_cmd); +} + const struct drm_mode_config_funcs bochs_mode_funcs = { - .fb_create = drm_gem_fb_create, + .fb_create = bochs_gem_fb_create, }; int bochs_fbdev_init(struct bochs_device *bochs) diff --git a/drivers/gpu/drm/bochs/bochs_kms.c b/drivers/gpu/drm/bochs/bochs_kms.c index ea9a43d31bf1..f3fdaf945605 100644 --- a/drivers/gpu/drm/bochs/bochs_kms.c +++ b/drivers/gpu/drm/bochs/bochs_kms.c @@ -126,12 +126,43 @@ static const struct drm_crtc_helper_funcs bochs_helper_funcs = { .commit = bochs_crtc_commit, }; +static const uint32_t bochs_formats[] = { + DRM_FORMAT_HOST_XRGB8888, +}; + +static struct drm_plane *bochs_primary_plane(struct drm_device *dev) +{ + struct drm_plane *primary; + int ret; + + primary = kzalloc(sizeof(*primary), GFP_KERNEL); + if (primary == NULL) { + DRM_DEBUG_KMS("Failed to allocate primary plane\n"); + return NULL; + } + + ret = drm_universal_plane_init(dev, primary, 0, + &drm_primary_helper_funcs, + bochs_formats, + ARRAY_SIZE(bochs_formats), + NULL, + DRM_PLANE_TYPE_PRIMARY, NULL); + if (ret) { + kfree(primary); + primary = NULL; + } + + return primary; +} + static void bochs_crtc_init(struct drm_device *dev) { struct bochs_device *bochs = dev->dev_private; struct drm_crtc *crtc = &bochs->crtc; + struct drm_plane *primary = bochs_primary_plane(dev); - drm_crtc_init(dev, crtc, &bochs_crtc_funcs); + drm_crtc_init_with_planes(dev, crtc, primary, NULL, + &bochs_crtc_funcs, NULL); drm_crtc_helper_add(crtc, &bochs_helper_funcs); } @@ -250,6 +281,7 @@ int bochs_kms_init(struct bochs_device *bochs) bochs->dev->mode_config.fb_base = bochs->fb_base; bochs->dev->mode_config.preferred_depth = 24; bochs->dev->mode_config.prefer_shadow = 0; + bochs->dev->mode_config.quirk_addfb_prefer_host_byte_order = true; bochs->dev->mode_config.funcs = &bochs_mode_funcs; From 86351de023dd3607b1b519f58c11154b217ec031 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Fri, 21 Sep 2018 15:47:02 +0200 Subject: [PATCH 21/38] drm/bochs: support changing byteorder at mode set time Add bochs_hw_set_*_endian() helper functions, to set the framebuffer byteorder at mode set time. Support both DRM_FORMAT_XRGB8888 and DRM_FORMAT_BGRX8888 framebuffer formats, no matter what the native machine byte order is. Signed-off-by: Gerd Hoffmann Acked-by: Daniel Vetter Link: http://patchwork.freedesktop.org/patch/msgid/20180921134704.12826-5-kraxel@redhat.com --- drivers/gpu/drm/bochs/bochs.h | 4 +- drivers/gpu/drm/bochs/bochs_fbdev.c | 3 +- drivers/gpu/drm/bochs/bochs_hw.c | 64 ++++++++++++++++++++++------- drivers/gpu/drm/bochs/bochs_kms.c | 8 +++- 4 files changed, 61 insertions(+), 18 deletions(-) diff --git a/drivers/gpu/drm/bochs/bochs.h b/drivers/gpu/drm/bochs/bochs.h index b4f6bb521900..e7a69077e45a 100644 --- a/drivers/gpu/drm/bochs/bochs.h +++ b/drivers/gpu/drm/bochs/bochs.h @@ -58,6 +58,7 @@ struct bochs_device { void __iomem *fb_map; unsigned long fb_base; unsigned long fb_size; + unsigned long qext_size; /* mode */ u16 xres; @@ -121,7 +122,8 @@ int bochs_hw_init(struct drm_device *dev); void bochs_hw_fini(struct drm_device *dev); void bochs_hw_setmode(struct bochs_device *bochs, - struct drm_display_mode *mode); + struct drm_display_mode *mode, + const struct drm_format_info *format); void bochs_hw_setbase(struct bochs_device *bochs, int x, int y, u64 addr); diff --git a/drivers/gpu/drm/bochs/bochs_fbdev.c b/drivers/gpu/drm/bochs/bochs_fbdev.c index c46fdae44ea3..dd3c7df267da 100644 --- a/drivers/gpu/drm/bochs/bochs_fbdev.c +++ b/drivers/gpu/drm/bochs/bochs_fbdev.c @@ -140,7 +140,8 @@ static struct drm_framebuffer * bochs_gem_fb_create(struct drm_device *dev, struct drm_file *file, const struct drm_mode_fb_cmd2 *mode_cmd) { - if (mode_cmd->pixel_format != DRM_FORMAT_HOST_XRGB8888) + if (mode_cmd->pixel_format != DRM_FORMAT_XRGB8888 && + mode_cmd->pixel_format != DRM_FORMAT_BGRX8888) return ERR_PTR(-EINVAL); return drm_gem_fb_create(dev, file, mode_cmd); diff --git a/drivers/gpu/drm/bochs/bochs_hw.c b/drivers/gpu/drm/bochs/bochs_hw.c index 16e4f1caccca..cacff73a64ab 100644 --- a/drivers/gpu/drm/bochs/bochs_hw.c +++ b/drivers/gpu/drm/bochs/bochs_hw.c @@ -47,11 +47,33 @@ static void bochs_dispi_write(struct bochs_device *bochs, u16 reg, u16 val) } } +static void bochs_hw_set_big_endian(struct bochs_device *bochs) +{ + if (bochs->qext_size < 8) + return; + + writel(0xbebebebe, bochs->mmio + 0x604); +} + +static void bochs_hw_set_little_endian(struct bochs_device *bochs) +{ + if (bochs->qext_size < 8) + return; + + writel(0x1e1e1e1e, bochs->mmio + 0x604); +} + +#ifdef __BIG_ENDIAN +#define bochs_hw_set_native_endian(_b) bochs_hw_set_big_endian(_b) +#else +#define bochs_hw_set_native_endian(_b) bochs_hw_set_little_endian(_b) +#endif + int bochs_hw_init(struct drm_device *dev) { struct bochs_device *bochs = dev->dev_private; struct pci_dev *pdev = dev->pdev; - unsigned long addr, size, mem, ioaddr, iosize, qext_size; + unsigned long addr, size, mem, ioaddr, iosize; u16 id; if (pdev->resource[2].flags & IORESOURCE_MEM) { @@ -117,19 +139,14 @@ int bochs_hw_init(struct drm_device *dev) ioaddr); if (bochs->mmio && pdev->revision >= 2) { - qext_size = readl(bochs->mmio + 0x600); - if (qext_size < 4 || qext_size > iosize) + bochs->qext_size = readl(bochs->mmio + 0x600); + if (bochs->qext_size < 4 || bochs->qext_size > iosize) { + bochs->qext_size = 0; goto noext; - DRM_DEBUG("Found qemu ext regs, size %ld\n", qext_size); - if (qext_size >= 8) { -#ifdef __BIG_ENDIAN - writel(0xbebebebe, bochs->mmio + 0x604); -#else - writel(0x1e1e1e1e, bochs->mmio + 0x604); -#endif - DRM_DEBUG(" qext endian: 0x%x\n", - readl(bochs->mmio + 0x604)); } + DRM_DEBUG("Found qemu ext regs, size %ld\n", + bochs->qext_size); + bochs_hw_set_native_endian(bochs); } noext: @@ -150,7 +167,8 @@ void bochs_hw_fini(struct drm_device *dev) } void bochs_hw_setmode(struct bochs_device *bochs, - struct drm_display_mode *mode) + struct drm_display_mode *mode, + const struct drm_format_info *format) { bochs->xres = mode->hdisplay; bochs->yres = mode->vdisplay; @@ -158,8 +176,12 @@ void bochs_hw_setmode(struct bochs_device *bochs, bochs->stride = mode->hdisplay * (bochs->bpp / 8); bochs->yres_virtual = bochs->fb_size / bochs->stride; - DRM_DEBUG_DRIVER("%dx%d @ %d bpp, vy %d\n", + DRM_DEBUG_DRIVER("%dx%d @ %d bpp, format %c%c%c%c, vy %d\n", bochs->xres, bochs->yres, bochs->bpp, + (format->format >> 0) & 0xff, + (format->format >> 8) & 0xff, + (format->format >> 16) & 0xff, + (format->format >> 24) & 0xff, bochs->yres_virtual); bochs_vga_writeb(bochs, 0x3c0, 0x20); /* unblank */ @@ -177,6 +199,20 @@ void bochs_hw_setmode(struct bochs_device *bochs, bochs_dispi_write(bochs, VBE_DISPI_INDEX_ENABLE, VBE_DISPI_ENABLED | VBE_DISPI_LFB_ENABLED); + + switch (format->format) { + case DRM_FORMAT_XRGB8888: + bochs_hw_set_little_endian(bochs); + break; + case DRM_FORMAT_BGRX8888: + bochs_hw_set_big_endian(bochs); + break; + default: + /* should not happen */ + DRM_ERROR("%s: Huh? Got framebuffer format 0x%x", + __func__, format->format); + break; + }; } void bochs_hw_setbase(struct bochs_device *bochs, diff --git a/drivers/gpu/drm/bochs/bochs_kms.c b/drivers/gpu/drm/bochs/bochs_kms.c index f3fdaf945605..9bc5b438aefd 100644 --- a/drivers/gpu/drm/bochs/bochs_kms.c +++ b/drivers/gpu/drm/bochs/bochs_kms.c @@ -77,7 +77,10 @@ static int bochs_crtc_mode_set(struct drm_crtc *crtc, struct bochs_device *bochs = container_of(crtc, struct bochs_device, crtc); - bochs_hw_setmode(bochs, mode); + if (WARN_ON(crtc->primary->fb == NULL)) + return -EINVAL; + + bochs_hw_setmode(bochs, mode, crtc->primary->fb->format); bochs_crtc_mode_set_base(crtc, x, y, old_fb); return 0; } @@ -127,7 +130,8 @@ static const struct drm_crtc_helper_funcs bochs_helper_funcs = { }; static const uint32_t bochs_formats[] = { - DRM_FORMAT_HOST_XRGB8888, + DRM_FORMAT_XRGB8888, + DRM_FORMAT_BGRX8888, }; static struct drm_plane *bochs_primary_plane(struct drm_device *dev) From 42fd9e6c29b39481fd4ef31715c6f0c427966f20 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Fri, 21 Sep 2018 15:47:03 +0200 Subject: [PATCH 22/38] drm/virtio: fix DRM_FORMAT_* handling Use DRM_FORMAT_HOST_XRGB8888, so we are using the correct format code on bigendian machines. Also set the quirk_addfb_prefer_host_byte_order mode_config bit so drm_mode_addfb() asks for the correct format code. Both DRM_FORMAT_* and VIRTIO_GPU_FORMAT_* are defined to be little endian, so using a different mapping on bigendian machines is wrong. It's there because of broken drm_mode_addfb() behavior. So with drm_mode_addfb() being fixed we can fix this too. While wading through the code I've noticed we have a little issue in virtio: We attach a format to the bo when it is created (DRM_IOCTL_MODE_CREATE_DUMB), not when we map it as framebuffer (DRM_IOCTL_MODE_ADDFB). Easy way out: Support a single format only. Pick DRM_FORMAT_HOST_XRGB8888, it is the only one actually used in practice. Drop unused mappings in virtio_gpu_translate_format(). With this patch applied both ADDFB and ADDFB2 ioctls work correctly in the virtio-gpu.ko driver on big endian machines. Without the patch only ADDFB (which still seems to be used by the majority of userspace) works correctly. Signed-off-by: Gerd Hoffmann Acked-by: Daniel Vetter Link: http://patchwork.freedesktop.org/patch/msgid/20180921134704.12826-6-kraxel@redhat.com --- drivers/gpu/drm/virtio/virtgpu_display.c | 5 +++ drivers/gpu/drm/virtio/virtgpu_fb.c | 2 +- drivers/gpu/drm/virtio/virtgpu_gem.c | 7 ++- drivers/gpu/drm/virtio/virtgpu_plane.c | 54 +----------------------- 4 files changed, 13 insertions(+), 55 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c b/drivers/gpu/drm/virtio/virtgpu_display.c index 0379d6897659..8f8fed471e34 100644 --- a/drivers/gpu/drm/virtio/virtgpu_display.c +++ b/drivers/gpu/drm/virtio/virtgpu_display.c @@ -307,6 +307,10 @@ virtio_gpu_user_framebuffer_create(struct drm_device *dev, struct virtio_gpu_framebuffer *virtio_gpu_fb; int ret; + if (mode_cmd->pixel_format != DRM_FORMAT_HOST_XRGB8888 && + mode_cmd->pixel_format != DRM_FORMAT_HOST_ARGB8888) + return ERR_PTR(-ENOENT); + /* lookup object associated with res handle */ obj = drm_gem_object_lookup(file_priv, mode_cmd->handles[0]); if (!obj) @@ -355,6 +359,7 @@ int virtio_gpu_modeset_init(struct virtio_gpu_device *vgdev) int i; drm_mode_config_init(vgdev->ddev); + vgdev->ddev->mode_config.quirk_addfb_prefer_host_byte_order = true; vgdev->ddev->mode_config.funcs = &virtio_gpu_mode_funcs; vgdev->ddev->mode_config.helper_private = &virtio_mode_config_helpers; diff --git a/drivers/gpu/drm/virtio/virtgpu_fb.c b/drivers/gpu/drm/virtio/virtgpu_fb.c index 3364b0970dd2..e1e41efabec1 100644 --- a/drivers/gpu/drm/virtio/virtgpu_fb.c +++ b/drivers/gpu/drm/virtio/virtgpu_fb.c @@ -226,7 +226,7 @@ static int virtio_gpufb_create(struct drm_fb_helper *helper, mode_cmd.width = sizes->surface_width; mode_cmd.height = sizes->surface_height; mode_cmd.pitches[0] = mode_cmd.width * 4; - mode_cmd.pixel_format = drm_mode_legacy_fb_format(32, 24); + mode_cmd.pixel_format = DRM_FORMAT_HOST_XRGB8888; format = virtio_gpu_translate_format(mode_cmd.pixel_format); if (format == 0) diff --git a/drivers/gpu/drm/virtio/virtgpu_gem.c b/drivers/gpu/drm/virtio/virtgpu_gem.c index 0f2768eacaee..82c817f37cf7 100644 --- a/drivers/gpu/drm/virtio/virtgpu_gem.c +++ b/drivers/gpu/drm/virtio/virtgpu_gem.c @@ -90,7 +90,10 @@ int virtio_gpu_mode_dumb_create(struct drm_file *file_priv, uint32_t resid; uint32_t format; - pitch = args->width * ((args->bpp + 1) / 8); + if (args->bpp != 32) + return -EINVAL; + + pitch = args->width * 4; args->size = pitch * args->height; args->size = ALIGN(args->size, PAGE_SIZE); @@ -99,7 +102,7 @@ int virtio_gpu_mode_dumb_create(struct drm_file *file_priv, if (ret) goto fail; - format = virtio_gpu_translate_format(DRM_FORMAT_XRGB8888); + format = virtio_gpu_translate_format(DRM_FORMAT_HOST_XRGB8888); virtio_gpu_resource_id_get(vgdev, &resid); virtio_gpu_cmd_create_resource(vgdev, resid, format, args->width, args->height); diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c b/drivers/gpu/drm/virtio/virtgpu_plane.c index 682a977d68c1..a9f4ae7d4483 100644 --- a/drivers/gpu/drm/virtio/virtgpu_plane.c +++ b/drivers/gpu/drm/virtio/virtgpu_plane.c @@ -28,22 +28,11 @@ #include static const uint32_t virtio_gpu_formats[] = { - DRM_FORMAT_XRGB8888, - DRM_FORMAT_ARGB8888, - DRM_FORMAT_BGRX8888, - DRM_FORMAT_BGRA8888, - DRM_FORMAT_RGBX8888, - DRM_FORMAT_RGBA8888, - DRM_FORMAT_XBGR8888, - DRM_FORMAT_ABGR8888, + DRM_FORMAT_HOST_XRGB8888, }; static const uint32_t virtio_gpu_cursor_formats[] = { -#ifdef __BIG_ENDIAN - DRM_FORMAT_BGRA8888, -#else - DRM_FORMAT_ARGB8888, -#endif + DRM_FORMAT_HOST_ARGB8888, }; uint32_t virtio_gpu_translate_format(uint32_t drm_fourcc) @@ -51,32 +40,6 @@ uint32_t virtio_gpu_translate_format(uint32_t drm_fourcc) uint32_t format; switch (drm_fourcc) { -#ifdef __BIG_ENDIAN - case DRM_FORMAT_XRGB8888: - format = VIRTIO_GPU_FORMAT_X8R8G8B8_UNORM; - break; - case DRM_FORMAT_ARGB8888: - format = VIRTIO_GPU_FORMAT_A8R8G8B8_UNORM; - break; - case DRM_FORMAT_BGRX8888: - format = VIRTIO_GPU_FORMAT_B8G8R8X8_UNORM; - break; - case DRM_FORMAT_BGRA8888: - format = VIRTIO_GPU_FORMAT_B8G8R8A8_UNORM; - break; - case DRM_FORMAT_RGBX8888: - format = VIRTIO_GPU_FORMAT_R8G8B8X8_UNORM; - break; - case DRM_FORMAT_RGBA8888: - format = VIRTIO_GPU_FORMAT_R8G8B8A8_UNORM; - break; - case DRM_FORMAT_XBGR8888: - format = VIRTIO_GPU_FORMAT_X8B8G8R8_UNORM; - break; - case DRM_FORMAT_ABGR8888: - format = VIRTIO_GPU_FORMAT_A8B8G8R8_UNORM; - break; -#else case DRM_FORMAT_XRGB8888: format = VIRTIO_GPU_FORMAT_B8G8R8X8_UNORM; break; @@ -89,19 +52,6 @@ uint32_t virtio_gpu_translate_format(uint32_t drm_fourcc) case DRM_FORMAT_BGRA8888: format = VIRTIO_GPU_FORMAT_A8R8G8B8_UNORM; break; - case DRM_FORMAT_RGBX8888: - format = VIRTIO_GPU_FORMAT_X8B8G8R8_UNORM; - break; - case DRM_FORMAT_RGBA8888: - format = VIRTIO_GPU_FORMAT_A8B8G8R8_UNORM; - break; - case DRM_FORMAT_XBGR8888: - format = VIRTIO_GPU_FORMAT_R8G8B8X8_UNORM; - break; - case DRM_FORMAT_ABGR8888: - format = VIRTIO_GPU_FORMAT_R8G8B8A8_UNORM; - break; -#endif default: /* * This should not happen, we handle everything listed From 9dd3cb243ddfc1408f373bf17b03aa0e2a7784c9 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Fri, 21 Sep 2018 15:47:04 +0200 Subject: [PATCH 23/38] drm: move quirk_addfb_prefer_xbgr_30bpp handling to drm_driver_legacy_fb_format too Signed-off-by: Gerd Hoffmann Reviewed-by: Daniel Vetter Link: http://patchwork.freedesktop.org/patch/msgid/20180921134704.12826-7-kraxel@redhat.com --- drivers/gpu/drm/drm_fourcc.c | 5 +++++ drivers/gpu/drm/drm_framebuffer.c | 4 ---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/drm_fourcc.c b/drivers/gpu/drm/drm_fourcc.c index 7c6d3922ed40..90a1c846fc25 100644 --- a/drivers/gpu/drm/drm_fourcc.c +++ b/drivers/gpu/drm/drm_fourcc.c @@ -121,6 +121,11 @@ uint32_t drm_driver_legacy_fb_format(struct drm_device *dev, if (fmt == DRM_FORMAT_XRGB1555) fmt = DRM_FORMAT_HOST_XRGB1555; } + + if (dev->mode_config.quirk_addfb_prefer_xbgr_30bpp && + fmt == DRM_FORMAT_XRGB2101010) + fmt = DRM_FORMAT_XBGR2101010; + return fmt; } EXPORT_SYMBOL(drm_driver_legacy_fb_format); diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c index 1e2126101c18..3bf729d0aae5 100644 --- a/drivers/gpu/drm/drm_framebuffer.c +++ b/drivers/gpu/drm/drm_framebuffer.c @@ -129,10 +129,6 @@ int drm_mode_addfb(struct drm_device *dev, struct drm_mode_fb_cmd *or, r.pitches[0] = or->pitch; r.handles[0] = or->handle; - if (dev->mode_config.quirk_addfb_prefer_xbgr_30bpp && - r.pixel_format == DRM_FORMAT_XRGB2101010) - r.pixel_format = DRM_FORMAT_XBGR2101010; - ret = drm_mode_addfb2(dev, &r, file_priv); if (ret) return ret; From 02c87cabd6f1a6de151f999690393c3b8ad07b90 Mon Sep 17 00:00:00 2001 From: Ezequiel Garcia Date: Tue, 25 Sep 2018 18:16:04 +0200 Subject: [PATCH 24/38] virtio: Add virtio_gpu_object_kunmap() Implement a virtio_gpu_object_kunmap() to unmap the kernel mapping, and use it in the TTM object destroy path. Signed-off-by: Ezequiel Garcia Link: http://patchwork.freedesktop.org/patch/msgid/20180925161606.17980-2-ezequiel@collabora.com Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/virtio/virtgpu_drv.h | 1 + drivers/gpu/drm/virtio/virtgpu_object.c | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio/virtgpu_drv.h index 253fcf018dbe..6669bf4c4ca3 100644 --- a/drivers/gpu/drm/virtio/virtgpu_drv.h +++ b/drivers/gpu/drm/virtio/virtgpu_drv.h @@ -363,6 +363,7 @@ void virtio_gpu_fence_event_process(struct virtio_gpu_device *vdev, int virtio_gpu_object_create(struct virtio_gpu_device *vgdev, unsigned long size, bool kernel, bool pinned, struct virtio_gpu_object **bo_ptr); +void virtio_gpu_object_kunmap(struct virtio_gpu_object *bo); int virtio_gpu_object_kmap(struct virtio_gpu_object *bo, void **ptr); int virtio_gpu_object_get_sg_table(struct virtio_gpu_device *qdev, struct virtio_gpu_object *bo); diff --git a/drivers/gpu/drm/virtio/virtgpu_object.c b/drivers/gpu/drm/virtio/virtgpu_object.c index 9f2f470efd9b..113eae00d293 100644 --- a/drivers/gpu/drm/virtio/virtgpu_object.c +++ b/drivers/gpu/drm/virtio/virtgpu_object.c @@ -37,6 +37,8 @@ static void virtio_gpu_ttm_bo_destroy(struct ttm_buffer_object *tbo) virtio_gpu_cmd_unref_resource(vgdev, bo->hw_res_handle); if (bo->pages) virtio_gpu_object_free_sg_table(bo); + if (bo->vmap) + virtio_gpu_object_kunmap(bo); drm_gem_object_release(&bo->gem_base); kfree(bo); } @@ -99,6 +101,12 @@ int virtio_gpu_object_create(struct virtio_gpu_device *vgdev, return 0; } +void virtio_gpu_object_kunmap(struct virtio_gpu_object *bo) +{ + bo->vmap = NULL; + ttm_bo_kunmap(&bo->kmap); +} + int virtio_gpu_object_kmap(struct virtio_gpu_object *bo, void **ptr) { bool is_iomem; From a20c4173c4219d85ba7775fde584cd34305a0b3d Mon Sep 17 00:00:00 2001 From: Ezequiel Garcia Date: Tue, 25 Sep 2018 18:16:05 +0200 Subject: [PATCH 25/38] virtio: Rework virtio_gpu_object_kmap() Currently, virtio_gpu_object_kmap() is only called by virtio_gpufb_create(), when a DRM framebuffer is created. Thus, instead of returning the vmap'ed address, emit a warning if virtio_gpu_object_kmap is called on an already mapped object. With this change, kmap/kunmap calls are now balanced. Signed-off-by: Ezequiel Garcia Link: http://patchwork.freedesktop.org/patch/msgid/20180925161606.17980-3-ezequiel@collabora.com Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/virtio/virtgpu_drv.h | 2 +- drivers/gpu/drm/virtio/virtgpu_fb.c | 10 ++-------- drivers/gpu/drm/virtio/virtgpu_object.c | 11 +++-------- 3 files changed, 6 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio/virtgpu_drv.h index 6669bf4c4ca3..d29f0c7c768c 100644 --- a/drivers/gpu/drm/virtio/virtgpu_drv.h +++ b/drivers/gpu/drm/virtio/virtgpu_drv.h @@ -364,7 +364,7 @@ int virtio_gpu_object_create(struct virtio_gpu_device *vgdev, unsigned long size, bool kernel, bool pinned, struct virtio_gpu_object **bo_ptr); void virtio_gpu_object_kunmap(struct virtio_gpu_object *bo); -int virtio_gpu_object_kmap(struct virtio_gpu_object *bo, void **ptr); +int virtio_gpu_object_kmap(struct virtio_gpu_object *bo); int virtio_gpu_object_get_sg_table(struct virtio_gpu_device *qdev, struct virtio_gpu_object *bo); void virtio_gpu_object_free_sg_table(struct virtio_gpu_object *bo); diff --git a/drivers/gpu/drm/virtio/virtgpu_fb.c b/drivers/gpu/drm/virtio/virtgpu_fb.c index e1e41efabec1..cea749f4ec39 100644 --- a/drivers/gpu/drm/virtio/virtgpu_fb.c +++ b/drivers/gpu/drm/virtio/virtgpu_fb.c @@ -203,12 +203,6 @@ static struct fb_ops virtio_gpufb_ops = { .fb_imageblit = virtio_gpu_3d_imageblit, }; -static int virtio_gpu_vmap_fb(struct virtio_gpu_device *vgdev, - struct virtio_gpu_object *obj) -{ - return virtio_gpu_object_kmap(obj, NULL); -} - static int virtio_gpufb_create(struct drm_fb_helper *helper, struct drm_fb_helper_surface_size *sizes) { @@ -241,9 +235,9 @@ static int virtio_gpufb_create(struct drm_fb_helper *helper, virtio_gpu_cmd_create_resource(vgdev, resid, format, mode_cmd.width, mode_cmd.height); - ret = virtio_gpu_vmap_fb(vgdev, obj); + ret = virtio_gpu_object_kmap(obj); if (ret) { - DRM_ERROR("failed to vmap fb %d\n", ret); + DRM_ERROR("failed to kmap fb %d\n", ret); goto err_obj_vmap; } diff --git a/drivers/gpu/drm/virtio/virtgpu_object.c b/drivers/gpu/drm/virtio/virtgpu_object.c index 113eae00d293..eca765537470 100644 --- a/drivers/gpu/drm/virtio/virtgpu_object.c +++ b/drivers/gpu/drm/virtio/virtgpu_object.c @@ -107,22 +107,17 @@ void virtio_gpu_object_kunmap(struct virtio_gpu_object *bo) ttm_bo_kunmap(&bo->kmap); } -int virtio_gpu_object_kmap(struct virtio_gpu_object *bo, void **ptr) +int virtio_gpu_object_kmap(struct virtio_gpu_object *bo) { bool is_iomem; int r; - if (bo->vmap) { - if (ptr) - *ptr = bo->vmap; - return 0; - } + WARN_ON(bo->vmap); + r = ttm_bo_kmap(&bo->tbo, 0, bo->tbo.num_pages, &bo->kmap); if (r) return r; bo->vmap = ttm_kmap_obj_virtual(&bo->kmap, &is_iomem); - if (ptr) - *ptr = bo->vmap; return 0; } From a03fb71716ee60d1d763f1f27773cbbaec1359ed Mon Sep 17 00:00:00 2001 From: Ezequiel Garcia Date: Tue, 25 Sep 2018 18:16:06 +0200 Subject: [PATCH 26/38] virtio: Support prime objects vmap/vunmap Implement vmap/vunmap so we can export dmabufs to other drivers, such as video4linux. Tested with a virtio-gpu / vivid (virtual capture driver) pipeline, where the vivid driver imports the dmabufs exported by virtio-gpu. Note that dma_buf_vmap() does its own vmap counting, so it's not needed to take care of it in the driver. Signed-off-by: Ezequiel Garcia Link: http://patchwork.freedesktop.org/patch/msgid/20180925161606.17980-4-ezequiel@collabora.com Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/virtio/virtgpu_prime.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_prime.c b/drivers/gpu/drm/virtio/virtgpu_prime.c index d27a1688714f..86ce0ae93f59 100644 --- a/drivers/gpu/drm/virtio/virtgpu_prime.c +++ b/drivers/gpu/drm/virtio/virtgpu_prime.c @@ -55,13 +55,18 @@ struct drm_gem_object *virtgpu_gem_prime_import_sg_table( void *virtgpu_gem_prime_vmap(struct drm_gem_object *obj) { - WARN_ONCE(1, "not implemented"); - return ERR_PTR(-ENODEV); + struct virtio_gpu_object *bo = gem_to_virtio_gpu_obj(obj); + int ret; + + ret = virtio_gpu_object_kmap(bo); + if (ret) + return NULL; + return bo->vmap; } void virtgpu_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr) { - WARN_ONCE(1, "not implemented"); + virtio_gpu_object_kunmap(gem_to_virtio_gpu_obj(obj)); } int virtgpu_gem_prime_mmap(struct drm_gem_object *obj, From c814738257d6606aac76d3d8bdefeb05e04c3b28 Mon Sep 17 00:00:00 2001 From: Sean Paul Date: Wed, 19 Sep 2018 16:39:58 -0400 Subject: [PATCH 27/38] MAINTAINERS: Move mxsfb drm driver to drm-misc tree Another "small driver" moving into drm-misc. Stefan has also offered to co-maintain it. Cc: Marek Vasut Cc: Stefan Agner Cc: David Airlie Cc: Gustavo Padovan Cc: Maarten Lankhorst Acked-by: Stefan Agner Signed-off-by: Sean Paul Link: https://patchwork.freedesktop.org/patch/msgid/20180919204026.3217-2-sean@poorly.run --- MAINTAINERS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index ba1dbb8735b8..7184d53dcbd8 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -9891,9 +9891,12 @@ F: drivers/media/tuners/mxl5007t.* MXSFB DRM DRIVER M: Marek Vasut +M: Stefan Agner +L: dri-devel@lists.freedesktop.org S: Supported F: drivers/gpu/drm/mxsfb/ F: Documentation/devicetree/bindings/display/mxsfb.txt +T: git git://anongit.freedesktop.org/drm/drm-misc MYRICOM MYRI-10G 10GbE DRIVER (MYRI10GE) M: Chris Lee From ac3b35f11a06964f5fe7f6ea9a190a28a7994704 Mon Sep 17 00:00:00 2001 From: Thomas Zimmermann Date: Wed, 26 Sep 2018 14:02:12 +0200 Subject: [PATCH 28/38] drm/udl: Replace drm_dev_unref with drm_dev_put This patch unifies the naming of DRM functions for reference counting of struct drm_device. The resulting code is more aligned with the rest of the Linux kernel interfaces. Signed-off-by: Thomas Zimmermann Signed-off-by: Sean Paul Link: https://patchwork.freedesktop.org/patch/msgid/20180926120212.25359-1-tzimmermann@suse.de --- drivers/gpu/drm/udl/udl_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/udl/udl_drv.c b/drivers/gpu/drm/udl/udl_drv.c index 9ef515df724b..a63e3011e971 100644 --- a/drivers/gpu/drm/udl/udl_drv.c +++ b/drivers/gpu/drm/udl/udl_drv.c @@ -94,7 +94,7 @@ static int udl_usb_probe(struct usb_interface *interface, return 0; err_free: - drm_dev_unref(dev); + drm_dev_put(dev); return r; } From 9c942096baeb37cf69df564bcf45fc37314e7e66 Mon Sep 17 00:00:00 2001 From: Thomas Zimmermann Date: Wed, 26 Sep 2018 13:56:40 +0200 Subject: [PATCH 29/38] drm/tegra: Replace drm_dev_unref with drm_dev_put This patch unifies the naming of DRM functions for reference counting of struct drm_device. The resulting code is more aligned with the rest of the Linux kernel interfaces. Signed-off-by: Thomas Zimmermann Signed-off-by: Thierry Reding Link: https://patchwork.freedesktop.org/patch/msgid/20180926115640.24755-1-tzimmermann@suse.de --- drivers/gpu/drm/tegra/drm.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c index b424bc911b95..8cdb610561ba 100644 --- a/drivers/gpu/drm/tegra/drm.c +++ b/drivers/gpu/drm/tegra/drm.c @@ -1189,16 +1189,16 @@ static int host1x_drm_probe(struct host1x_device *dev) err = drm_fb_helper_remove_conflicting_framebuffers(NULL, "tegradrmfb", false); if (err < 0) - goto unref; + goto put; err = drm_dev_register(drm, 0); if (err < 0) - goto unref; + goto put; return 0; -unref: - drm_dev_unref(drm); +put: + drm_dev_put(drm); return err; } @@ -1207,7 +1207,7 @@ static int host1x_drm_remove(struct host1x_device *dev) struct drm_device *drm = dev_get_drvdata(&dev->dev); drm_dev_unregister(drm); - drm_dev_unref(drm); + drm_dev_put(drm); return 0; } From 626a2c52f1050b4581a0ffcd71245505b24315a2 Mon Sep 17 00:00:00 2001 From: Leonard Crestez Date: Mon, 17 Sep 2018 16:42:11 +0300 Subject: [PATCH 30/38] drm/mxsfb: Move axi clk enable/disable to crtc enable/disable The main axi clk is disabled at the end of mxsfb_crtc_mode_set_nofb and immediately reenabled in mxsfb_enable_controller. Avoid this by moving the handling of axi clk one level up to mxsfb_crtc_enable. Do the same for mxsfb_crtc_disable for symmetry. This shouldn't have any functional effect. Signed-off-by: Leonard Crestez Reviewed-by: Stefan Agner Reviewed-by: Sean Paul Signed-off-by: Stefan Agner Link: https://patchwork.freedesktop.org/patch/msgid/985c1f1cad250bd9ca154b3e4b3f913c310eeabd.1537191359.git.leonard.crestez@nxp.com --- drivers/gpu/drm/mxsfb/mxsfb_crtc.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/mxsfb/mxsfb_crtc.c b/drivers/gpu/drm/mxsfb/mxsfb_crtc.c index 0abe77675b76..e4fcbb65b969 100644 --- a/drivers/gpu/drm/mxsfb/mxsfb_crtc.c +++ b/drivers/gpu/drm/mxsfb/mxsfb_crtc.c @@ -129,7 +129,6 @@ static void mxsfb_enable_controller(struct mxsfb_drm_private *mxsfb) if (mxsfb->clk_disp_axi) clk_prepare_enable(mxsfb->clk_disp_axi); clk_prepare_enable(mxsfb->clk); - mxsfb_enable_axi_clk(mxsfb); /* If it was disabled, re-enable the mode again */ writel(CTRL_DOTCLK_MODE, mxsfb->base + LCDC_CTRL + REG_SET); @@ -159,8 +158,6 @@ static void mxsfb_disable_controller(struct mxsfb_drm_private *mxsfb) reg &= ~VDCTRL4_SYNC_SIGNALS_ON; writel(reg, mxsfb->base + LCDC_VDCTRL4); - mxsfb_disable_axi_clk(mxsfb); - clk_disable_unprepare(mxsfb->clk); if (mxsfb->clk_disp_axi) clk_disable_unprepare(mxsfb->clk_disp_axi); @@ -208,7 +205,6 @@ static void mxsfb_crtc_mode_set_nofb(struct mxsfb_drm_private *mxsfb) * running. This may lead to shifted pictures (FIFO issue?), so * first stop the controller and drain its FIFOs. */ - mxsfb_enable_axi_clk(mxsfb); /* Mandatory eLCDIF reset as per the Reference Manual */ err = mxsfb_reset_block(mxsfb->base); @@ -269,12 +265,11 @@ static void mxsfb_crtc_mode_set_nofb(struct mxsfb_drm_private *mxsfb) writel(SET_DOTCLK_H_VALID_DATA_CNT(m->hdisplay), mxsfb->base + LCDC_VDCTRL4); - - mxsfb_disable_axi_clk(mxsfb); } void mxsfb_crtc_enable(struct mxsfb_drm_private *mxsfb) { + mxsfb_enable_axi_clk(mxsfb); mxsfb_crtc_mode_set_nofb(mxsfb); mxsfb_enable_controller(mxsfb); } @@ -282,6 +277,7 @@ void mxsfb_crtc_enable(struct mxsfb_drm_private *mxsfb) void mxsfb_crtc_disable(struct mxsfb_drm_private *mxsfb) { mxsfb_disable_controller(mxsfb); + mxsfb_disable_axi_clk(mxsfb); } void mxsfb_plane_atomic_update(struct mxsfb_drm_private *mxsfb, From 2dc3620eac2df1545bc4a4b9110dcc7961c24a50 Mon Sep 17 00:00:00 2001 From: Leonard Crestez Date: Mon, 17 Sep 2018 16:42:12 +0300 Subject: [PATCH 31/38] drm/mxsfb: Fix initial corrupt frame when activating display LCDIF will repeatedly display data from CUR_BUF and set CUR_BUF to NEXT_BUF when done. Since we are only ever writing to NEXT_BUF the display will show an initial corrupt frame. Fix by writing the FB paddr to both CUR_BUF and NEXT_BUF when activating the CRTC. Signed-off-by: Leonard Crestez Tested-by: Philipp Zabel Reviewed-by: Stefan Agner Reviewed-by: Sean Paul Signed-off-by: Stefan Agner Link: https://patchwork.freedesktop.org/patch/msgid/7cdac9c064cc2b8a3d237934f186da98cefe6cb3.1537191359.git.leonard.crestez@nxp.com --- drivers/gpu/drm/mxsfb/mxsfb_crtc.c | 45 +++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/mxsfb/mxsfb_crtc.c b/drivers/gpu/drm/mxsfb/mxsfb_crtc.c index e4fcbb65b969..24b1f0c1432e 100644 --- a/drivers/gpu/drm/mxsfb/mxsfb_crtc.c +++ b/drivers/gpu/drm/mxsfb/mxsfb_crtc.c @@ -193,6 +193,21 @@ static int mxsfb_reset_block(void __iomem *reset_addr) return clear_poll_bit(reset_addr, MODULE_CLKGATE); } +static dma_addr_t mxsfb_get_fb_paddr(struct mxsfb_drm_private *mxsfb) +{ + struct drm_framebuffer *fb = mxsfb->pipe.plane.state->fb; + struct drm_gem_cma_object *gem; + + if (!fb) + return 0; + + gem = drm_fb_cma_get_gem_obj(fb, 0); + if (!gem) + return 0; + + return gem->paddr; +} + static void mxsfb_crtc_mode_set_nofb(struct mxsfb_drm_private *mxsfb) { struct drm_display_mode *m = &mxsfb->pipe.crtc.state->adjusted_mode; @@ -269,8 +284,18 @@ static void mxsfb_crtc_mode_set_nofb(struct mxsfb_drm_private *mxsfb) void mxsfb_crtc_enable(struct mxsfb_drm_private *mxsfb) { + dma_addr_t paddr; + mxsfb_enable_axi_clk(mxsfb); mxsfb_crtc_mode_set_nofb(mxsfb); + + /* Write cur_buf as well to avoid an initial corrupt frame */ + paddr = mxsfb_get_fb_paddr(mxsfb); + if (paddr) { + writel(paddr, mxsfb->base + mxsfb->devdata->cur_buf); + writel(paddr, mxsfb->base + mxsfb->devdata->next_buf); + } + mxsfb_enable_controller(mxsfb); } @@ -285,12 +310,8 @@ void mxsfb_plane_atomic_update(struct mxsfb_drm_private *mxsfb, { struct drm_simple_display_pipe *pipe = &mxsfb->pipe; struct drm_crtc *crtc = &pipe->crtc; - struct drm_framebuffer *fb = pipe->plane.state->fb; struct drm_pending_vblank_event *event; - struct drm_gem_cma_object *gem; - - if (!crtc) - return; + dma_addr_t paddr; spin_lock_irq(&crtc->dev->event_lock); event = crtc->state->event; @@ -305,12 +326,10 @@ void mxsfb_plane_atomic_update(struct mxsfb_drm_private *mxsfb, } spin_unlock_irq(&crtc->dev->event_lock); - if (!fb) - return; - - gem = drm_fb_cma_get_gem_obj(fb, 0); - - mxsfb_enable_axi_clk(mxsfb); - writel(gem->paddr, mxsfb->base + mxsfb->devdata->next_buf); - mxsfb_disable_axi_clk(mxsfb); + paddr = mxsfb_get_fb_paddr(mxsfb); + if (paddr) { + mxsfb_enable_axi_clk(mxsfb); + writel(paddr, mxsfb->base + mxsfb->devdata->next_buf); + mxsfb_disable_axi_clk(mxsfb); + } } From 4201f4e8484509499a40feb9fd6a6642f453f61e Mon Sep 17 00:00:00 2001 From: Leonard Crestez Date: Mon, 17 Sep 2018 16:42:13 +0300 Subject: [PATCH 32/38] drm/mxsfb: Add pm_runtime calls to pipe_enable/disable Adding lcdif nodes to a power domain currently results in black/corrupted screens or hangs because power is not correctly enabled when required. Ensure power is on when display is active by adding pm_runtime_get/put_sync to mxsfb_pipe_enable/disable. Signed-off-by: Leonard Crestez Reviewed-by: Stefan Agner Reviewed-by: Sean Paul Signed-off-by: Stefan Agner Link: https://patchwork.freedesktop.org/patch/msgid/ee88148399c63494cda4129b05444b0ac331b7a7.1537191359.git.leonard.crestez@nxp.com --- drivers/gpu/drm/mxsfb/mxsfb_drv.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.c b/drivers/gpu/drm/mxsfb/mxsfb_drv.c index ffe5137ccaf8..68d79f5dc0d3 100644 --- a/drivers/gpu/drm/mxsfb/mxsfb_drv.c +++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.c @@ -103,7 +103,9 @@ static void mxsfb_pipe_enable(struct drm_simple_display_pipe *pipe, struct drm_plane_state *plane_state) { struct mxsfb_drm_private *mxsfb = drm_pipe_to_mxsfb_drm_private(pipe); + struct drm_device *drm = pipe->plane.dev; + pm_runtime_get_sync(drm->dev); drm_panel_prepare(mxsfb->panel); mxsfb_crtc_enable(mxsfb); drm_panel_enable(mxsfb->panel); @@ -112,10 +114,12 @@ static void mxsfb_pipe_enable(struct drm_simple_display_pipe *pipe, static void mxsfb_pipe_disable(struct drm_simple_display_pipe *pipe) { struct mxsfb_drm_private *mxsfb = drm_pipe_to_mxsfb_drm_private(pipe); + struct drm_device *drm = pipe->plane.dev; drm_panel_disable(mxsfb->panel); mxsfb_crtc_disable(mxsfb); drm_panel_unprepare(mxsfb->panel); + pm_runtime_put_sync(drm->dev); } static void mxsfb_pipe_update(struct drm_simple_display_pipe *pipe, From f0525a1c922eefe8cb1a23a026ea90bad400797e Mon Sep 17 00:00:00 2001 From: Leonard Crestez Date: Mon, 17 Sep 2018 16:42:14 +0300 Subject: [PATCH 33/38] drm/mxsfb: Add PM_SLEEP support Since power to the lcdif block can be lost on suspend implement PM_SLEEP_OPS using drm_mode_config_helper_suspend/resume to save/restore the current mode. Signed-off-by: Leonard Crestez Reviewed-by: Stefan Agner Reviewed-by: Sean Paul Signed-off-by: Stefan Agner Link: https://patchwork.freedesktop.org/patch/msgid/cfa1a4083eefd112362e640deeb2e120584ac3f5.1537191359.git.leonard.crestez@nxp.com --- drivers/gpu/drm/mxsfb/mxsfb_drv.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.c b/drivers/gpu/drm/mxsfb/mxsfb_drv.c index 68d79f5dc0d3..5199a1febc01 100644 --- a/drivers/gpu/drm/mxsfb/mxsfb_drv.c +++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.c @@ -418,6 +418,26 @@ static int mxsfb_remove(struct platform_device *pdev) return 0; } +#ifdef CONFIG_PM_SLEEP +static int mxsfb_suspend(struct device *dev) +{ + struct drm_device *drm = dev_get_drvdata(dev); + + return drm_mode_config_helper_suspend(drm); +} + +static int mxsfb_resume(struct device *dev) +{ + struct drm_device *drm = dev_get_drvdata(dev); + + return drm_mode_config_helper_resume(drm); +} +#endif + +static const struct dev_pm_ops mxsfb_pm_ops = { + SET_SYSTEM_SLEEP_PM_OPS(mxsfb_suspend, mxsfb_resume) +}; + static struct platform_driver mxsfb_platform_driver = { .probe = mxsfb_probe, .remove = mxsfb_remove, @@ -425,6 +445,7 @@ static struct platform_driver mxsfb_platform_driver = { .driver = { .name = "mxsfb", .of_match_table = mxsfb_dt_ids, + .pm = &mxsfb_pm_ops, }, }; From 9f19fd3bd894d694bfb4a352d649bd972ff7e43b Mon Sep 17 00:00:00 2001 From: Leonard Crestez Date: Mon, 17 Sep 2018 16:42:15 +0300 Subject: [PATCH 34/38] drm/mxsfb: Switch to drm_atomic_helper_commit_tail_rpm The lcdif block is only powered on when display is active so plane updates when not enabled are not valid. Writing to an unpowered IP block is mostly ignored but can trigger bus errors on some chips. Prevent this situation by switching to drm_atomic_helper_commit_tail_rpm and having the drm core ensure atomic_plane_update is only called while the crtc is active. This avoids having to keep track of "enabled" bits inside the mxsfb driver. This also requires handling the vblank event for disable from mxsfb_pipe_disable. Signed-off-by: Leonard Crestez Suggested-by: Stefan Agner Reviewed-by: Stefan Agner Reviewed-by: Sean Paul Signed-off-by: Stefan Agner Link: https://patchwork.freedesktop.org/patch/msgid/c19c0c00ed42e8e8f7965aa4821ac295abc5cd05.1537191359.git.leonard.crestez@nxp.com --- drivers/gpu/drm/mxsfb/mxsfb_drv.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.c b/drivers/gpu/drm/mxsfb/mxsfb_drv.c index 5199a1febc01..2393e6d16ffd 100644 --- a/drivers/gpu/drm/mxsfb/mxsfb_drv.c +++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.c @@ -98,6 +98,10 @@ static const struct drm_mode_config_funcs mxsfb_mode_config_funcs = { .atomic_commit = drm_atomic_helper_commit, }; +static const struct drm_mode_config_helper_funcs mxsfb_mode_config_helpers = { + .atomic_commit_tail = drm_atomic_helper_commit_tail_rpm, +}; + static void mxsfb_pipe_enable(struct drm_simple_display_pipe *pipe, struct drm_crtc_state *crtc_state, struct drm_plane_state *plane_state) @@ -115,11 +119,21 @@ static void mxsfb_pipe_disable(struct drm_simple_display_pipe *pipe) { struct mxsfb_drm_private *mxsfb = drm_pipe_to_mxsfb_drm_private(pipe); struct drm_device *drm = pipe->plane.dev; + struct drm_crtc *crtc = &pipe->crtc; + struct drm_pending_vblank_event *event; drm_panel_disable(mxsfb->panel); mxsfb_crtc_disable(mxsfb); drm_panel_unprepare(mxsfb->panel); pm_runtime_put_sync(drm->dev); + + spin_lock_irq(&drm->event_lock); + event = crtc->state->event; + if (event) { + crtc->state->event = NULL; + drm_crtc_send_vblank_event(crtc, event); + } + spin_unlock_irq(&drm->event_lock); } static void mxsfb_pipe_update(struct drm_simple_display_pipe *pipe, @@ -234,6 +248,7 @@ static int mxsfb_load(struct drm_device *drm, unsigned long flags) drm->mode_config.max_width = MXSFB_MAX_XRES; drm->mode_config.max_height = MXSFB_MAX_YRES; drm->mode_config.funcs = &mxsfb_mode_config_funcs; + drm->mode_config.helper_private = &mxsfb_mode_config_helpers; drm_mode_config_reset(drm); From 3b9356194d878f5bc0b4d0b9e8419f449a16e5b5 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Wed, 26 Sep 2018 14:50:34 +0200 Subject: [PATCH 35/38] MAINTAINERS: Move fsl-dcu driver to drm-misc tree The driver is mostly in maintenance mode. Using drm-misc is a good fit and should make maintenance a bit easier. Signed-off-by: Stefan Agner Acked-by: Sean Paul Link: https://patchwork.freedesktop.org/patch/msgid/20180926125034.4095-1-stefan@agner.ch --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index 7184d53dcbd8..4ddeb2074447 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -4824,6 +4824,7 @@ F: drivers/gpu/drm/fsl-dcu/ F: Documentation/devicetree/bindings/display/fsl,dcu.txt F: Documentation/devicetree/bindings/display/fsl,tcon.txt F: Documentation/devicetree/bindings/display/panel/nec,nl4827hc19-05b.txt +T: git git://anongit.freedesktop.org/drm/drm-misc DRM DRIVERS FOR FREESCALE IMX M: Philipp Zabel From a74c0aa524050e5fd6c275a153b1f37283f6e37c Mon Sep 17 00:00:00 2001 From: Thomas Zimmermann Date: Wed, 26 Sep 2018 13:43:12 +0200 Subject: [PATCH 36/38] drm/fsl-dcu: Replace drm_dev_unref with drm_dev_put This patch unifies the naming of DRM functions for reference counting of struct drm_device. The resulting code is more aligned with the rest of the Linux kernel interfaces. Signed-off-by: Thomas Zimmermann Signed-off-by: Stefan Agner Link: https://patchwork.freedesktop.org/patch/msgid/20180926114312.23097-1-tzimmermann@suse.de --- drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c index 80232321a244..0496be5212e1 100644 --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c @@ -353,12 +353,12 @@ static int fsl_dcu_drm_probe(struct platform_device *pdev) ret = drm_dev_register(drm, 0); if (ret < 0) - goto unref; + goto put; return 0; -unref: - drm_dev_unref(drm); +put: + drm_dev_put(drm); unregister_pix_clk: clk_unregister(fsl_dev->pix_clk); disable_clk: @@ -371,7 +371,7 @@ static int fsl_dcu_drm_remove(struct platform_device *pdev) struct fsl_dcu_drm_device *fsl_dev = platform_get_drvdata(pdev); drm_dev_unregister(fsl_dev->drm); - drm_dev_unref(fsl_dev->drm); + drm_dev_put(fsl_dev->drm); clk_disable_unprepare(fsl_dev->clk); clk_unregister(fsl_dev->pix_clk); From 3dcf0f306d9d6e6657022eee287ef0ff4e5d7140 Mon Sep 17 00:00:00 2001 From: Chen-Yu Tsai Date: Fri, 21 Sep 2018 22:27:43 +0800 Subject: [PATCH 37/38] Revert "drm/sun4i: Remove R40 display pipeline compatibles" This reverts commit 3510e7a7f91088159bfc67e8abdc9f9e77d28870. During the 4.19 merge window for drm-misc, two patches critical to supporting the display pipeline on the Allwinner R40 SoC were missed. They were applied later but missed the merge window deadline. As a result 4.19-rc1 kernel would crash on the R40 when it couldn't parse the new device tree structure. We ended up removing support for the R40 display pipeline for 4.19. Since the missing patches are already merged for 4.20, we can now revert the commit that removed support. Signed-off-by: Chen-Yu Tsai Signed-off-by: Sean Paul Link: https://patchwork.freedesktop.org/patch/msgid/20180921142743.8711-1-wens@csie.org --- drivers/gpu/drm/sun4i/sun4i_drv.c | 1 + drivers/gpu/drm/sun4i/sun8i_mixer.c | 24 ++++++++++++++++++++++++ drivers/gpu/drm/sun4i/sun8i_tcon_top.c | 1 + 3 files changed, 26 insertions(+) diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c index 9027ddde4262..1e41c3f5fd6d 100644 --- a/drivers/gpu/drm/sun4i/sun4i_drv.c +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c @@ -402,6 +402,7 @@ static const struct of_device_id sun4i_drv_of_table[] = { { .compatible = "allwinner,sun8i-a33-display-engine" }, { .compatible = "allwinner,sun8i-a83t-display-engine" }, { .compatible = "allwinner,sun8i-h3-display-engine" }, + { .compatible = "allwinner,sun8i-r40-display-engine" }, { .compatible = "allwinner,sun8i-v3s-display-engine" }, { .compatible = "allwinner,sun9i-a80-display-engine" }, { .compatible = "allwinner,sun50i-a64-display-engine" }, diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.c b/drivers/gpu/drm/sun4i/sun8i_mixer.c index 091f6cf40353..8b3d02b146b7 100644 --- a/drivers/gpu/drm/sun4i/sun8i_mixer.c +++ b/drivers/gpu/drm/sun4i/sun8i_mixer.c @@ -545,6 +545,22 @@ static const struct sun8i_mixer_cfg sun8i_h3_mixer0_cfg = { .vi_num = 1, }; +static const struct sun8i_mixer_cfg sun8i_r40_mixer0_cfg = { + .ccsc = 0, + .mod_rate = 297000000, + .scaler_mask = 0xf, + .ui_num = 3, + .vi_num = 1, +}; + +static const struct sun8i_mixer_cfg sun8i_r40_mixer1_cfg = { + .ccsc = 1, + .mod_rate = 297000000, + .scaler_mask = 0x3, + .ui_num = 1, + .vi_num = 1, +}; + static const struct sun8i_mixer_cfg sun8i_v3s_mixer_cfg = { .vi_num = 2, .ui_num = 1, @@ -582,6 +598,14 @@ static const struct of_device_id sun8i_mixer_of_table[] = { .compatible = "allwinner,sun8i-h3-de2-mixer-0", .data = &sun8i_h3_mixer0_cfg, }, + { + .compatible = "allwinner,sun8i-r40-de2-mixer-0", + .data = &sun8i_r40_mixer0_cfg, + }, + { + .compatible = "allwinner,sun8i-r40-de2-mixer-1", + .data = &sun8i_r40_mixer1_cfg, + }, { .compatible = "allwinner,sun8i-v3s-de2-mixer", .data = &sun8i_v3s_mixer_cfg, diff --git a/drivers/gpu/drm/sun4i/sun8i_tcon_top.c b/drivers/gpu/drm/sun4i/sun8i_tcon_top.c index 9831a9fe2cf4..3040a79f298f 100644 --- a/drivers/gpu/drm/sun4i/sun8i_tcon_top.c +++ b/drivers/gpu/drm/sun4i/sun8i_tcon_top.c @@ -252,6 +252,7 @@ static int sun8i_tcon_top_remove(struct platform_device *pdev) /* sun4i_drv uses this list to check if a device node is a TCON TOP */ const struct of_device_id sun8i_tcon_top_of_table[] = { + { .compatible = "allwinner,sun8i-r40-tcon-top" }, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, sun8i_tcon_top_of_table); From c2b70ffcd34eca60013d90bd6cd56e60b07adef8 Mon Sep 17 00:00:00 2001 From: Jernej Skrabec Date: Mon, 25 Jun 2018 14:02:53 +0200 Subject: [PATCH 38/38] dt-bindings: display: sun4i-drm: Add R40 mixer compatibles R40 DE2 mixers are similar to those found in A83T, except it needs different clock settings. Add a compatibles for them. Reviewed-by: Chen-Yu Tsai Acked-by: Rob Herring Signed-off-by: Jernej Skrabec Signed-off-by: Sean Paul Link: https://patchwork.freedesktop.org/patch/msgid/20180625120304.7543-14-jernej.skrabec@siol.net --- Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt b/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt index 22d6dda587c5..7854fff4fc16 100644 --- a/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt +++ b/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt @@ -376,6 +376,8 @@ Required properties: * allwinner,sun8i-a83t-de2-mixer-0 * allwinner,sun8i-a83t-de2-mixer-1 * allwinner,sun8i-h3-de2-mixer-0 + * allwinner,sun8i-r40-de2-mixer-0 + * allwinner,sun8i-r40-de2-mixer-1 * allwinner,sun8i-v3s-de2-mixer * allwinner,sun50i-a64-de2-mixer-0 * allwinner,sun50i-a64-de2-mixer-1