From patchwork Thu Oct 18 10:02:12 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Inki Dae X-Patchwork-Id: 1609601 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id 90BC8DFB34 for ; Thu, 18 Oct 2012 10:19:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 652F1A0A1F for ; Thu, 18 Oct 2012 03:19:53 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by gabe.freedesktop.org (Postfix) with ESMTP id 62F269E8BA for ; Thu, 18 Oct 2012 03:02:25 -0700 (PDT) Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MC30066R2J0NJ20@mailout3.samsung.com> for dri-devel@lists.freedesktop.org; Thu, 18 Oct 2012 19:02:14 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [203.254.230.41]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 1B.5E.18144.6A3DF705; Thu, 18 Oct 2012 19:02:14 +0900 (KST) X-AuditID: cbfee61b-b7fd46d0000046e0-a2-507fd3a67971 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id F9.5E.18144.6A3DF705; Thu, 18 Oct 2012 19:02:14 +0900 (KST) Received: from daeinki-desktop.10.32.193.11 ([10.90.51.53]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MC300L8P2JPU6Y0@mmp1.samsung.com> for dri-devel@lists.freedesktop.org; Thu, 18 Oct 2012 19:02:14 +0900 (KST) From: Inki Dae To: airlied@linux.ie, dri-devel@lists.freedesktop.org Subject: [PATCH] drm/exynos: fix display on issue Date: Thu, 18 Oct 2012 19:02:12 +0900 Message-id: <1350554532-10514-1-git-send-email-inki.dae@samsung.com> X-Mailer: git-send-email 1.7.4.1 DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrKLMWRmVeSWpSXmKPExsVy+t8zTd1ll+sDDB4eV7K48vU9mwOjx/3u 40wBjFFcNimpOZllqUX6dglcGZNWvWIuaFCtmH1oMnMD40+5LkZODgkBE4llu/awQNhiEhfu rWfrYuTiEBJYxigx5c1MJpiiyzP2MEIkFjFKrD7XwQ7hrGeSOLLvDjtIFZuAqsTEFffZQGwR AVOJjklLwcYyCxRKLOx5CmYLCxhKbJ+4khnEZgGqP3VpH1g9r4CLRP+MfmaIbQoSC+69ZYOo EZD4NvkQUC8HUFxWYtMBZpC9EgI72CSOL7gCVS8pcXDFDZYJjIILGBlWMYqmFiQXFCel5xrp FSfmFpfmpesl5+duYoSElfQOxlUNFocYBTgYlXh4L/fUBwixJpYVV+YeYpTgYFYS4V25CSjE m5JYWZValB9fVJqTWnyI0QfokonMUqLJ+cCQzyuJNzQ2MDY0tDQ0M7U0NcAhrCTO2+yREiAk kJ5YkpqdmlqQWgQzjomDU6qB0f5ZXcfifVITS1YJ95Rebb//SlTlXIhJT9r2eTsENB2O1r5r 3lFU1bjxm1xSb0j3qVunm2/GJ4Wpflhy7rZM1Qe93VyB4duX3L1secCs9ktufvjkc9+47rLt O/3F9PapEwYH5l++Ib1oacOhXC2DIsUHbGY187w+FopVJDn9CbgbxPDuRMTLR0osxRmJhlrM RcWJANkk0NlYAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrCLMWRmVeSWpSXmKPExsVy+t9jAd1ll+sDDFbsk7S48vU9mwOjx/3u 40wBjFENjDYZqYkpqUUKqXnJ+SmZeem2St7B8c7xpmYGhrqGlhbmSgp5ibmptkouPgG6bpk5 QGOVFMoSc0qBQgGJxcVK+naYJoSGuOlawDRG6PqGBMH1GBmggYR1jBmTVr1iLmhQrZh9aDJz A+NPuS5GTg4JAROJyzP2MELYYhIX7q1n62Lk4hASWMQosfpcBzuEs55J4si+O+wgVWwCqhIT V9xnA7FFBEwlOiYtZQGxmQUKJRb2PAWzhQUMJbZPXMkMYrMA1Z+6tA+snlfARaJ/Rj8zxDYF iQX33rJNYORewMiwilE0tSC5oDgpPddIrzgxt7g0L10vOT93EyM4aJ9J72Bc1WBxiFGAg1GJ h/dyT32AEGtiWXFl7iFGCQ5mJRHelZuAQrwpiZVVqUX58UWlOanFhxh9gLZPZJYSTc4HRlRe SbyhsYmZkaWRmbGJubExDmElcd5mj5QAIYH0xJLU7NTUgtQimHFMHJxSDYx5hZxfHTPy/qmc Mnu4wdRwGvMzh/WbviWpfL2dKpbou+f7/RS/Wxrt3F9eb/I+tffq1BzDlqqwUo415X4y6hMr tr6QdRRm+aV0oMci453j9qA5n0+rT6j45zDF9X6x85rt6i5HWOJuqHI8cp2tI7D6evZLjtvf bd03/JikqXj4TLjtv4O6+wKUWIozEg21mIuKEwELw9kIhwIAAA== X-CFilter-Loop: Reflected Cc: kyungmin.park@samsung.com, sw0312.kim@samsung.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org When crtc_funcs->dpms callback is called, exynos_crtc->dpms and exynos_encoder->dpms are changed to new mode. But if user requests dpms mode operation, OFF -> ON, when crtc's dpms callback is called, exynos_encoder->dpms is also changed to ON. This makes encoder's dpms callback call be ignored so display power couldn't become on again. This patch removes exynos_encoder->dpms changing and adds 'updated' variable to exynos_drm_encoder structure to avoid duplicated overlay updating. Signed-off-by: Inki Dae Signed-off-by: Kyungmin Park --- drivers/gpu/drm/exynos/exynos_drm_connector.c | 1 + drivers/gpu/drm/exynos/exynos_drm_encoder.c | 33 +++++++++++++------------ 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_connector.c b/drivers/gpu/drm/exynos/exynos_drm_connector.c index 18c2718..0f68a28 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_connector.c +++ b/drivers/gpu/drm/exynos/exynos_drm_connector.c @@ -374,6 +374,7 @@ struct drm_connector *exynos_drm_connector_create(struct drm_device *dev, exynos_connector->encoder_id = encoder->base.id; exynos_connector->manager = manager; exynos_connector->dpms = DRM_MODE_DPMS_OFF; + connector->dpms = DRM_MODE_DPMS_OFF; connector->encoder = encoder; err = drm_mode_connector_attach_encoder(connector, encoder); diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.c b/drivers/gpu/drm/exynos/exynos_drm_encoder.c index e51503f..241ad1e 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_encoder.c +++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.c @@ -43,12 +43,14 @@ * @manager: specific encoder has its own manager to control a hardware * appropriately and we can access a hardware drawing on this manager. * @dpms: store the encoder dpms value. + * @updated: indicate whether overlay data updating is needed or not. */ struct exynos_drm_encoder { struct drm_crtc *old_crtc; struct drm_encoder drm_encoder; struct exynos_drm_manager *manager; - int dpms; + int dpms; + bool updated; }; static void exynos_drm_connector_power(struct drm_encoder *encoder, int mode) @@ -85,7 +87,9 @@ static void exynos_drm_encoder_dpms(struct drm_encoder *encoder, int mode) switch (mode) { case DRM_MODE_DPMS_ON: if (manager_ops && manager_ops->apply) - manager_ops->apply(manager->dev); + if (!exynos_encoder->updated) + manager_ops->apply(manager->dev); + exynos_drm_connector_power(encoder, mode); exynos_encoder->dpms = mode; break; @@ -94,6 +98,7 @@ static void exynos_drm_encoder_dpms(struct drm_encoder *encoder, int mode) case DRM_MODE_DPMS_OFF: exynos_drm_connector_power(encoder, mode); exynos_encoder->dpms = mode; + exynos_encoder->updated = false; break; default: DRM_ERROR("unspecified mode %d\n", mode); @@ -205,13 +210,22 @@ static void exynos_drm_encoder_prepare(struct drm_encoder *encoder) static void exynos_drm_encoder_commit(struct drm_encoder *encoder) { - struct exynos_drm_manager *manager = exynos_drm_get_manager(encoder); + struct exynos_drm_encoder *exynos_encoder = to_exynos_encoder(encoder); + struct exynos_drm_manager *manager = exynos_encoder->manager; struct exynos_drm_manager_ops *manager_ops = manager->ops; DRM_DEBUG_KMS("%s\n", __FILE__); if (manager_ops && manager_ops->commit) manager_ops->commit(manager->dev); + + /* + * this will avoid one issue that overlay data is updated to + * real hardware two times. + * And this variable will be used to check if the data was + * already updated or not by exynos_drm_encoder_dpms function. + */ + exynos_encoder->updated = true; } static void exynos_drm_encoder_disable(struct drm_encoder *encoder) @@ -401,19 +415,6 @@ void exynos_drm_encoder_crtc_dpms(struct drm_encoder *encoder, void *data) manager_ops->dpms(manager->dev, mode); /* - * set current mode to new one so that data aren't updated into - * registers by drm_helper_connector_dpms two times. - * - * in case that drm_crtc_helper_set_mode() is called, - * overlay_ops->commit() and manager_ops->commit() callbacks - * can be called two times, first at drm_crtc_helper_set_mode() - * and second at drm_helper_connector_dpms(). - * so with this setting, when drm_helper_connector_dpms() is called - * encoder->funcs->dpms() will be ignored. - */ - exynos_encoder->dpms = mode; - - /* * if this condition is ok then it means that the crtc is already * detached from encoder and last function for detaching is properly * done, so clear pipe from manager to prevent repeated call.