All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Paul <seanpaul@chromium.org>
To: dri-devel@lists.freedesktop.org, inki.dae@samsung.com
Cc: marcheu@chromium.org
Subject: [PATCH 08/23] drm/exynos: Remove dpms link between encoder/connector
Date: Thu, 10 Oct 2013 20:30:21 -0400	[thread overview]
Message-ID: <1381451436-10089-9-git-send-email-seanpaul@chromium.org> (raw)
In-Reply-To: <1381451436-10089-1-git-send-email-seanpaul@chromium.org>

This patch removes the call from encoder dpms into connector dpms (which
will then call back into encoder dpms through the helper function). The
callback is likely to keep connector->dpms in the right state when
initiating dpms from crtc or encoder, but this isn't the right way to do
it. This patch is the first step towards rationalizing power management
in the exynos drm driver.

This patch also removes the apply() callback from the dpms path. It's
incorrect to assume apply should be called from dpms. If it's a
requirement for the individual hardware drivers, they should call it
internally.

Signed-off-by: Sean Paul <seanpaul@chromium.org>
---
 drivers/gpu/drm/exynos/exynos_drm_connector.c | 42 ++-------------------
 drivers/gpu/drm/exynos/exynos_drm_connector.h |  4 --
 drivers/gpu/drm/exynos/exynos_drm_encoder.c   | 53 ++-------------------------
 3 files changed, 7 insertions(+), 92 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_connector.c b/drivers/gpu/drm/exynos/exynos_drm_connector.c
index 830fa3d..2a5639a 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_connector.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_connector.c
@@ -26,7 +26,6 @@ struct exynos_drm_connector {
 	struct drm_connector	drm_connector;
 	uint32_t		encoder_id;
 	struct exynos_drm_manager *manager;
-	uint32_t		dpms;
 };
 
 static int exynos_drm_connector_get_modes(struct drm_connector *connector)
@@ -119,7 +118,8 @@ static int exynos_drm_connector_mode_valid(struct drm_connector *connector,
 	return ret;
 }
 
-struct drm_encoder *exynos_drm_best_encoder(struct drm_connector *connector)
+static struct drm_encoder *exynos_drm_best_encoder(
+		struct drm_connector *connector)
 {
 	struct drm_device *dev = connector->dev;
 	struct exynos_drm_connector *exynos_connector =
@@ -146,41 +146,6 @@ static struct drm_connector_helper_funcs exynos_connector_helper_funcs = {
 	.best_encoder	= exynos_drm_best_encoder,
 };
 
-void exynos_drm_display_power(struct drm_connector *connector, int mode)
-{
-	struct drm_encoder *encoder = exynos_drm_best_encoder(connector);
-	struct exynos_drm_connector *exynos_connector;
-	struct exynos_drm_manager *manager = exynos_drm_get_manager(encoder);
-	struct exynos_drm_display_ops *display_ops = manager->display_ops;
-
-	exynos_connector = to_exynos_connector(connector);
-
-	if (exynos_connector->dpms == mode) {
-		DRM_DEBUG_KMS("desired dpms mode is same as previous one.\n");
-		return;
-	}
-
-	if (display_ops && display_ops->power_on)
-		display_ops->power_on(manager->dev, mode);
-
-	exynos_connector->dpms = mode;
-}
-
-static void exynos_drm_connector_dpms(struct drm_connector *connector,
-					int mode)
-{
-	/*
-	 * in case that drm_crtc_helper_set_mode() is called,
-	 * encoder/crtc->funcs->dpms() will be just returned
-	 * because they already were DRM_MODE_DPMS_ON so only
-	 * exynos_drm_display_power() will be called.
-	 */
-	drm_helper_connector_dpms(connector, mode);
-
-	exynos_drm_display_power(connector, mode);
-
-}
-
 static int exynos_drm_connector_fill_modes(struct drm_connector *connector,
 				unsigned int max_width, unsigned int max_height)
 {
@@ -236,7 +201,7 @@ static void exynos_drm_connector_destroy(struct drm_connector *connector)
 }
 
 static struct drm_connector_funcs exynos_connector_funcs = {
-	.dpms		= exynos_drm_connector_dpms,
+	.dpms		= drm_helper_connector_dpms,
 	.fill_modes	= exynos_drm_connector_fill_modes,
 	.detect		= exynos_drm_connector_detect,
 	.destroy	= exynos_drm_connector_destroy,
@@ -281,7 +246,6 @@ 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;
 
diff --git a/drivers/gpu/drm/exynos/exynos_drm_connector.h b/drivers/gpu/drm/exynos/exynos_drm_connector.h
index 547c6b5..4eb20d7 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_connector.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_connector.h
@@ -17,8 +17,4 @@
 struct drm_connector *exynos_drm_connector_create(struct drm_device *dev,
 						   struct drm_encoder *encoder);
 
-struct drm_encoder *exynos_drm_best_encoder(struct drm_connector *connector);
-
-void exynos_drm_display_power(struct drm_connector *connector, int mode);
-
 #endif
diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.c b/drivers/gpu/drm/exynos/exynos_drm_encoder.c
index e0c50a8..f701d3e 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_encoder.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.c
@@ -29,37 +29,20 @@
  * @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;
-	bool				updated;
 };
 
-static void exynos_drm_connector_power(struct drm_encoder *encoder, int mode)
-{
-	struct drm_device *dev = encoder->dev;
-	struct drm_connector *connector;
-
-	list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
-		if (exynos_drm_best_encoder(connector) == encoder) {
-			DRM_DEBUG_KMS("connector[%d] dpms[%d]\n",
-					connector->base.id, mode);
-
-			exynos_drm_display_power(connector, mode);
-		}
-	}
-}
-
 static void exynos_drm_encoder_dpms(struct drm_encoder *encoder, int mode)
 {
 	struct drm_device *dev = encoder->dev;
 	struct exynos_drm_manager *manager = exynos_drm_get_manager(encoder);
-	struct exynos_drm_manager_ops *manager_ops = manager->ops;
 	struct exynos_drm_encoder *exynos_encoder = to_exynos_encoder(encoder);
+	struct exynos_drm_display_ops *display_ops = manager->display_ops;
 
 	DRM_DEBUG_KMS("encoder dpms: %d\n", mode);
 
@@ -68,30 +51,10 @@ static void exynos_drm_encoder_dpms(struct drm_encoder *encoder, int mode)
 		return;
 	}
 
-	mutex_lock(&dev->struct_mutex);
-
-	switch (mode) {
-	case DRM_MODE_DPMS_ON:
-		if (manager_ops && manager_ops->apply)
-			if (!exynos_encoder->updated)
-				manager_ops->apply(manager->ctx);
-
-		exynos_drm_connector_power(encoder, mode);
-		exynos_encoder->dpms = mode;
-		break;
-	case DRM_MODE_DPMS_STANDBY:
-	case DRM_MODE_DPMS_SUSPEND:
-	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);
-		break;
-	}
+	if (display_ops && display_ops->power_on)
+		display_ops->power_on(manager->ctx, mode);
 
-	mutex_unlock(&dev->struct_mutex);
+	exynos_encoder->dpms = mode;
 }
 
 static bool
@@ -198,14 +161,6 @@ static void exynos_drm_encoder_commit(struct drm_encoder *encoder)
 		manager_ops->commit(manager->ctx);
 
 	/*
-	 * 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;
-
-	/*
 	 * In case of setcrtc, there is no way to update encoder's dpms
 	 * so update it here.
 	 */
-- 
1.8.4

  parent reply	other threads:[~2013-10-11  0:31 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-11  0:30 [PATCH 00/23] drm/exynos: Refactor parts of the exynos driver Sean Paul
2013-10-11  0:30 ` [PATCH 01/23] drm/exynos: Remove useless slab.h include Sean Paul
2013-10-11  0:30 ` [PATCH 02/23] drm/exynos: Merge overlay_ops into manager_ops Sean Paul
2013-10-11  0:30 ` [PATCH 03/23] drm/exynos: Add an initialize function to manager and display Sean Paul
2013-10-11  0:30 ` [PATCH 04/23] drm/exynos: Use manager_op initialize in fimd Sean Paul
2013-10-11  0:30 ` [PATCH 05/23] drm/exynos: hdmi: Implement initialize op for hdmi Sean Paul
2013-10-11  0:30 ` [PATCH 06/23] drm/exynos: Pass context in manager ops instead of dev Sean Paul
2013-10-12  6:44   ` Inki Dae
2013-10-14 12:42   ` Inki Dae
2013-10-14 14:18     ` Sean Paul
2013-10-14 15:07       ` Inki Dae
2013-10-11  0:30 ` [PATCH 07/23] drm/exynos: Pass context in display_ops " Sean Paul
2013-10-11  0:30 ` Sean Paul [this message]
2013-10-11  0:30 ` [PATCH 09/23] drm/exynos: Rename display_op power_on to dpms Sean Paul
2013-10-11  0:30 ` [PATCH 10/23] drm/exynos: Don't keep dpms state in encoder Sean Paul
2013-10-11  0:30 ` [PATCH 11/23] drm/exynos: Use unsigned long for possible_crtcs Sean Paul
2013-10-11  0:30 ` [PATCH 12/23] drm/exynos: Split manager/display/subdrv Sean Paul
2013-10-12  0:42   ` Inki Dae
2013-10-12  2:06     ` Sean Paul
2013-10-12  3:49       ` Inki Dae
2013-10-12  4:19         ` Sean Paul
2013-10-12  4:30           ` Inki Dae
2013-10-14 15:24   ` Inki Dae
2013-10-15  4:09     ` Inki Dae
2013-10-15 18:12       ` Sean Paul
2013-10-16  2:17         ` Inki Dae
2013-10-11  0:30 ` [PATCH 13/23] drm/exynos: hdmi: remove the i2c drivers and use devtree Sean Paul
2013-10-11  0:30 ` [PATCH 14/23] drm/exynos: Remove exynos_drm_hdmi shim Sean Paul
2013-10-11  0:30 ` [PATCH 15/23] drm/exynos: Use drm_mode_copy to copy modes Sean Paul
2013-10-11  0:30 ` [PATCH 16/23] drm/exynos: Disable unused crtc planes from crtc Sean Paul
2013-10-11  0:30 ` [PATCH 17/23] drm/exynos: Add mode_set manager operation Sean Paul
2013-10-11  0:30 ` [PATCH 18/23] drm/exynos: Implement mode_fixup " Sean Paul
2013-10-11  0:30 ` [PATCH 19/23] drm/exynos: Use mode_set to configure fimd Sean Paul
2013-10-11  0:30 ` [PATCH 20/23] drm/exynos: Remove unused/useless fimd_context members Sean Paul
2013-10-11  0:30 ` [PATCH 21/23] drm/exynos: Move dp driver from video/ to drm/ Sean Paul
2013-10-11  0:30 ` [PATCH 22/23] drm/exynos: Move display implementation into dp Sean Paul
2013-10-11  0:30 ` [PATCH 23/23] ARM: dts: Move display-timings node from fimd to dp Sean Paul
2013-10-12  2:26 ` [PATCH 00/23] drm/exynos: Refactor parts of the exynos driver Tomasz Figa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1381451436-10089-9-git-send-email-seanpaul@chromium.org \
    --to=seanpaul@chromium.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=inki.dae@samsung.com \
    --cc=marcheu@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.