Skip to contentSkip to conversation

drm/plane-helper: Skip prepare_fb/cleanup_fb when newfb==oldfb

PATCH In review Matt Roper 3 participants 3 messages Jan 19, 2015 – Jan 20, 2015

Subsystems (2)
lore
Share & tools
lore

Matt Roper

author
#0 lore raw

PATCH 1/1 drm/plane-helper: Skip prepare_fb/cleanup_fb when newfb==oldfb

When commiting a plane update where the framebuffer doesn't change, we can skip the prepare_fb/cleanup_fb steps. This also allows us to avoid an unnecessary vblank wait at the end of the operation when we're just moving a plane and not changing its image (e.g., for a cursor).

At the moment, i915 is the only upstream driver using the transitional plane helpers, and thus the only driver affected by this change.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=88540

---
 drivers/gpu/drm/drm_plane_helper.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_plane_helper.c +9 -1
index f24c4cf..7a5814a 100644
@@ -435,7 +435,8 @@ int drm_plane_helper_commit(struct drm_plane *plane,
 			goto out;
 	}
 
-	if (plane_funcs->prepare_fb && plane_state->fb) {
+	if (plane_funcs->prepare_fb && plane_state->fb &&
+	    plane_state->fb != old_fb) {
 		ret = plane_funcs->prepare_fb(plane, plane_state->fb);
 		if (ret)
 			goto out;
@@ -456,6 +457,13 @@ int drm_plane_helper_commit(struct drm_plane *plane,
 			crtc_funcs[i]->atomic_flush(crtc[i]);
 	}
 
+	/*
+	 * If we only moved the plane and didn't change fb's, there's no need to
+	 * wait for vblank.
+	 */
+	if (plane->state->fb == old_fb)
+		goto out;
+
 	for (i = 0; i < 2; i++) {
 		if (!crtc[i])
 			continue;
Signature · 6 lines
1.8.5.1

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

Thanks for the fix.

Quoted 50 lines · Matt Roper

When commiting a plane update where the framebuffer doesn't change, we can skip the prepare_fb/cleanup_fb steps. This also allows us to avoid an unnecessary vblank wait at the end of the operation when we're just moving a plane and not changing its image (e.g., for a cursor).

At the moment, i915 is the only upstream driver using the transitional plane helpers, and thus the only driver affected by this change.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=88540

---
 drivers/gpu/drm/drm_plane_helper.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_plane_helper.c +9 -2
index f24c4cf..7a5814a 100644
@@ -435,7 +435,8 @@ int drm_plane_helper_commit(struct drm_plane *plane,
                        goto out;
        }
 
-       if (plane_funcs->prepare_fb && plane_state->fb) {
+       if (plane_funcs->prepare_fb && plane_state->fb &&
+           plane_state->fb != old_fb) {
                ret = plane_funcs->prepare_fb(plane, plane_state->fb);
                if (ret)
                        goto out;
@@ -456,6 +457,13 @@ int drm_plane_helper_commit(struct drm_plane *plane,
                        crtc_funcs[i]->atomic_flush(crtc[i]);
        }
 
+       /*
+        * If we only moved the plane and didn't change fb's, there's no need to
+        * wait for vblank.
+        */
+       if (plane->state->fb == old_fb)
+               goto out;
+
        for (i = 0; i < 2; i++) {
                if (!crtc[i])
                        continue;
--

1.8.5.1

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

Signature · 6 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw
Quoted 16 lines · Rodrigo Vivi

Thanks for the fix.

Quoted 11 lines · Matt Roper

When commiting a plane update where the framebuffer doesn't change, we can skip the prepare_fb/cleanup_fb steps. This also allows us to avoid an unnecessary vblank wait at the end of the operation when we're just moving a plane and not changing its image (e.g., for a cursor).

At the moment, i915 is the only upstream driver using the transitional plane helpers, and thus the only driver affected by this change.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=88540

Thanks for the quick patch. I've added the citation to the patch for atomic helpers and merged this to topic/atomic-core. -Daniel

Quoted 49 lines
Quoted 39 lines
---
 drivers/gpu/drm/drm_plane_helper.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_plane_helper.c +9 -2
index f24c4cf..7a5814a 100644
@@ -435,7 +435,8 @@ int drm_plane_helper_commit(struct drm_plane *plane,
                        goto out;
        }
 
-       if (plane_funcs->prepare_fb && plane_state->fb) {
+       if (plane_funcs->prepare_fb && plane_state->fb &&
+           plane_state->fb != old_fb) {
                ret = plane_funcs->prepare_fb(plane, plane_state->fb);
                if (ret)
                        goto out;
@@ -456,6 +457,13 @@ int drm_plane_helper_commit(struct drm_plane *plane,
                        crtc_funcs[i]->atomic_flush(crtc[i]);
        }
 
+       /*
+        * If we only moved the plane and didn't change fb's, there's no need to
+        * wait for vblank.
+        */
+       if (plane->state->fb == old_fb)
+               goto out;
+
        for (i = 0; i < 2; i++) {
                if (!crtc[i])
                        continue;
--

1.8.5.1

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

Signature · 6 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel