Skip to contentSkip to conversation

drm/exynos: unify plane update path and avoid DPMS for planes

PATCH New Gustavo Padovan 1 participant 7 messages Nov 26, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover drm/exynos: unify plane update path and avoid DPMS for planes

From: Gustavo Padovan <[email protected]>

This series is try to unify all the paths on exynos DRM that handle plane updates. Now SetPlane, PageFlip and SetCrtc (fb changed only) are all processed by the same function: exynos_update_plane().

In the unify process the DPMS operations were removed since we are not in full modeset path.

This applies on top of my last cleanup[0] and is part of my ongoing cleanup work on exynos drm.

[0] http://www.spinics.net/lists/linux-samsung-soc/msg39502.html

Gustavo Padovan (6):
drm/exynos: Don't touch DPMS when updating overlay planes drm/exynos: don't do any DPMS operation while updating planes drm/exynos: remove exynos_plane_commit() wrapper drm/exynos: unify plane update on exynos_update_plane() drm/exynos: call exynos_update_plane() directly on page flips drm/exynos: remove exynos_drm_crtc_mode_set_commit()

 drivers/gpu/drm/exynos/exynos_drm_crtc.c  | 31 ++++++++++++-------------------
 drivers/gpu/drm/exynos/exynos_drm_plane.c | 18 ++++++------------
 drivers/gpu/drm/exynos/exynos_drm_plane.h |  6 +++++-
 3 files changed, 23 insertions(+), 32 deletions(-)
Signature · 6 lines
1.9.3

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw

PATCH 1/6 drm/exynos: Don't touch DPMS when updating overlay planes

From: Gustavo Padovan <[email protected]>

DPMS settings should only be changed by a full modeset. exynos_plane_update() should only care about updating the planes itself and nothing else.

---
 drivers/gpu/drm/exynos/exynos_drm_plane.c | 1 -
 1 file changed, 1 deletion(-)
drivers/gpu/drm/exynos/exynos_drm_plane.c +0 -1
index 843f741..4fe3c2b 100644
@@ -190,7 +190,6 @@ exynos_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
 		return ret;
 
 	exynos_plane_commit(plane);
-	exynos_plane_dpms(plane, DRM_MODE_DPMS_ON);
 
 	return 0;
 }
Signature · 6 lines
1.9.3

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw

PATCH 2/6 drm/exynos: don't do any DPMS operation while updating planes

In reply to Gustavo Padovan

From: Gustavo Padovan <[email protected]>

DPMS only makes sense when the mode changes, for plane update changes do not perform any dpms operation.

This move places the win_commit() and commit() calls directly in the code instead of calling exynos_drm_crtc_commit() thus avoiding DPMS operations.

---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/exynos/exynos_drm_crtc.c +7 -1
index 13c7ba5..e946b5f5 100644
@@ -115,6 +115,8 @@ static int exynos_drm_crtc_mode_set_commit(struct drm_crtc *crtc, int x, int y,
 					  struct drm_framebuffer *old_fb)
 {
 	struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
+	struct exynos_drm_manager *manager = exynos_crtc->manager;
+	struct exynos_drm_plane *exynos_plane = to_exynos_plane(crtc->primary);
 	struct drm_framebuffer *fb = crtc->primary->fb;
 	unsigned int crtc_w;
 	unsigned int crtc_h;
@@ -134,7 +136,11 @@ static int exynos_drm_crtc_mode_set_commit(struct drm_crtc *crtc, int x, int y,
 	if (ret)
 		return ret;
 
-	exynos_drm_crtc_commit(crtc);
+	if (manager->ops->win_commit)
+		manager->ops->win_commit(manager, exynos_plane->zpos);
+
+	if (manager->ops->commit)
+		manager->ops->commit(manager);
 
 	return 0;
 }
Signature · 6 lines
1.9.3

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#3 lore raw

PATCH 3/6 drm/exynos: remove exynos_plane_commit() wrapper

In reply to Gustavo Padovan

From: Gustavo Padovan <[email protected]>

It's doing nothing but calling exynos_crtc->ops->win_commit(), so let's call this directly to avoid extra layers of abstraction.

---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c  |  4 +++-
 drivers/gpu/drm/exynos/exynos_drm_plane.c | 15 +++++----------
 drivers/gpu/drm/exynos/exynos_drm_plane.h |  1 -
 3 files changed, 8 insertions(+), 12 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_crtc.c +3 -1
index e946b5f5..a43e25d 100644
@@ -59,10 +59,12 @@ static void exynos_drm_crtc_commit(struct drm_crtc *crtc)
 {
 	struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
 	struct exynos_drm_manager *manager = exynos_crtc->manager;
+	struct exynos_drm_plane *exynos_plane = to_exynos_plane(crtc->primary);
 
 	exynos_drm_crtc_dpms(crtc, DRM_MODE_DPMS_ON);
 
-	exynos_plane_commit(crtc->primary);
+	if (manager->ops->win_commit)
+		manager->ops->win_commit(manager, exynos_plane->zpos);
 
 	if (manager->ops->commit)
 		manager->ops->commit(manager);
drivers/gpu/drm/exynos/exynos_drm_plane.c +5 -10
index 4fe3c2b..aa9cc9a 100644
@@ -139,15 +139,6 @@ int exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc,
 	return 0;
 }
 
-void exynos_plane_commit(struct drm_plane *plane)
-{
-	struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane);
-	struct exynos_drm_manager *manager = to_exynos_crtc(plane->crtc)->manager;
-
-	if (manager->ops->win_commit)
-		manager->ops->win_commit(manager, exynos_plane->zpos);
-}
-
 void exynos_plane_dpms(struct drm_plane *plane, int mode)
 {
 	struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane);
@@ -181,6 +172,9 @@ exynos_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
 		     uint32_t src_x, uint32_t src_y,
 		     uint32_t src_w, uint32_t src_h)
 {
+
+	struct exynos_drm_manager *manager = to_exynos_crtc(crtc)->manager;
+	struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane);
 	int ret;
 
 	ret = exynos_plane_mode_set(plane, crtc, fb, crtc_x, crtc_y,
@@ -189,7 +183,8 @@ exynos_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
 	if (ret < 0)
 		return ret;
 
-	exynos_plane_commit(plane);
+	if (manager->ops->win_commit)
+		manager->ops->win_commit(manager, exynos_plane->zpos);
 
 	return 0;
 }
drivers/gpu/drm/exynos/exynos_drm_plane.h +0 -1
index 0d1986b..3c23989 100644
@@ -14,7 +14,6 @@ int exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc,
 			  unsigned int crtc_w, unsigned int crtc_h,
 			  uint32_t src_x, uint32_t src_y,
 			  uint32_t src_w, uint32_t src_h);
-void exynos_plane_commit(struct drm_plane *plane);
 void exynos_plane_dpms(struct drm_plane *plane, int mode);
 struct drm_plane *exynos_plane_init(struct drm_device *dev,
 				    unsigned long possible_crtcs,
Signature · 6 lines
1.9.3

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#4 lore raw

PATCH 4/6 drm/exynos: unify plane update on exynos_update_plane()

In reply to Gustavo Padovan

From: Gustavo Padovan <[email protected]>

We can safely use the exynos_update_plane() to update the plane framebuffer for both the overlay and primary planes.

Note that this patch removes a call to manager->ops->commit() in exynos_drm_crtc_mode_set_commit(). The commit() call is used only by the fimd driver to set underlying timings and need only in full modeset operations. For plane update only win_commit is needed.

---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c  | 17 ++---------------
 drivers/gpu/drm/exynos/exynos_drm_plane.c |  2 +-
 drivers/gpu/drm/exynos/exynos_drm_plane.h |  5 +++++
 3 files changed, 8 insertions(+), 16 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_crtc.c +2 -15
index a43e25d..4c8bd4d 100644
@@ -117,12 +117,9 @@ static int exynos_drm_crtc_mode_set_commit(struct drm_crtc *crtc, int x, int y,
 					  struct drm_framebuffer *old_fb)
 {
 	struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
-	struct exynos_drm_manager *manager = exynos_crtc->manager;
-	struct exynos_drm_plane *exynos_plane = to_exynos_plane(crtc->primary);
 	struct drm_framebuffer *fb = crtc->primary->fb;
 	unsigned int crtc_w;
 	unsigned int crtc_h;
-	int ret;
 
 	/* when framebuffer changing is requested, crtc's dpms should be on */
 	if (exynos_crtc->dpms > DRM_MODE_DPMS_ON) {
@@ -133,18 +130,8 @@ static int exynos_drm_crtc_mode_set_commit(struct drm_crtc *crtc, int x, int y,
 	crtc_w = fb->width - x;
 	crtc_h = fb->height - y;
 
-	ret = exynos_plane_mode_set(crtc->primary, crtc, fb, 0, 0,
-				    crtc_w, crtc_h, x, y, crtc_w, crtc_h);
-	if (ret)
-		return ret;
-
-	if (manager->ops->win_commit)
-		manager->ops->win_commit(manager, exynos_plane->zpos);
-
-	if (manager->ops->commit)
-		manager->ops->commit(manager);
-
-	return 0;
+	return exynos_update_plane(crtc->primary, crtc, fb, 0, 0,
+				   crtc_w, crtc_h, x, y, crtc_w, crtc_h);
 }
 
 static int exynos_drm_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
drivers/gpu/drm/exynos/exynos_drm_plane.c +1 -1
index aa9cc9a..dadd306 100644
@@ -165,7 +165,7 @@ void exynos_plane_dpms(struct drm_plane *plane, int mode)
 	}
 }
 
-static int
+int
 exynos_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
 		     struct drm_framebuffer *fb, int crtc_x, int crtc_y,
 		     unsigned int crtc_w, unsigned int crtc_h,
drivers/gpu/drm/exynos/exynos_drm_plane.h +5 -0
index 3c23989..d25c079 100644
@@ -14,6 +14,11 @@ int exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc,
 			  unsigned int crtc_w, unsigned int crtc_h,
 			  uint32_t src_x, uint32_t src_y,
 			  uint32_t src_w, uint32_t src_h);
+int exynos_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
+			struct drm_framebuffer *fb, int crtc_x, int crtc_y,
+			unsigned int crtc_w, unsigned int crtc_h,
+			uint32_t src_x, uint32_t src_y,
+			uint32_t src_w, uint32_t src_h);
 void exynos_plane_dpms(struct drm_plane *plane, int mode);
 struct drm_plane *exynos_plane_init(struct drm_device *dev,
 				    unsigned long possible_crtcs,
Signature · 6 lines
1.9.3

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#5 lore raw

PATCH 5/6 drm/exynos: call exynos_update_plane() directly on page flips

In reply to Gustavo Padovan

From: Gustavo Padovan <[email protected]>

Avoid an extra call to exynos_drm_crtc_mode_set_commit() that only calls exynos_update_plane().

---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_crtc.c +6 -2
index 4c8bd4d..185dabe 100644
@@ -176,6 +176,7 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc *crtc,
 	struct exynos_drm_private *dev_priv = dev->dev_private;
 	struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
 	struct drm_framebuffer *old_fb = crtc->primary->fb;
+	unsigned int crtc_w, crtc_h;
 	int ret = -EINVAL;
 
 	/* when the page flip is requested, crtc's dpms should be on */
@@ -207,8 +208,11 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc *crtc,
 		spin_unlock_irq(&dev->event_lock);
 
 		crtc->primary->fb = fb;
-		ret = exynos_drm_crtc_mode_set_commit(crtc, crtc->x, crtc->y,
-						    NULL);
+		crtc_w = fb->width - crtc->x;
+		crtc_h = fb->height - crtc->y;
+		ret = exynos_update_plane(crtc->primary, crtc, fb, 0, 0,
+					  crtc_w, crtc_h, crtc->x, crtc->y,
+					  crtc_w, crtc_h);
 		if (ret) {
 			crtc->primary->fb = old_fb;
 
Signature · 6 lines
1.9.3

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#6 lore raw

PATCH 6/6 drm/exynos: remove exynos_drm_crtc_mode_set_commit()

In reply to Gustavo Padovan

From: Gustavo Padovan <[email protected]>

This was just as extra chain in the call stack. We just rename it to _set_base() and let it do everything alone.

---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_crtc.c +1 -7
index 185dabe..5b3d182 100644
@@ -113,7 +113,7 @@ exynos_drm_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode,
 				     crtc_w, crtc_h, x, y, crtc_w, crtc_h);
 }
 
-static int exynos_drm_crtc_mode_set_commit(struct drm_crtc *crtc, int x, int y,
+static int exynos_drm_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
 					  struct drm_framebuffer *old_fb)
 {
 	struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
@@ -134,12 +134,6 @@ static int exynos_drm_crtc_mode_set_commit(struct drm_crtc *crtc, int x, int y,
 				   crtc_w, crtc_h, x, y, crtc_w, crtc_h);
 }
 
-static int exynos_drm_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
-					  struct drm_framebuffer *old_fb)
-{
-	return exynos_drm_crtc_mode_set_commit(crtc, x, y, old_fb);
-}
-
 static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
 {
 	struct drm_plane *plane;
Signature · 6 lines
1.9.3

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel