All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/plane-helper: Skip prepare_fb/cleanup_fb when newfb==oldfb
@ 2015-01-19 16:31 Matt Roper
  2015-01-19 18:45 ` Rodrigo Vivi
  0 siblings, 1 reply; 3+ messages in thread
From: Matt Roper @ 2015-01-19 16:31 UTC (permalink / raw)
  To: dri-devel

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.

Reported-by: Jeremiah Mahler <jmmahler@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=88540
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
---
 drivers/gpu/drm/drm_plane_helper.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c
index f24c4cf..7a5814a 100644
--- a/drivers/gpu/drm/drm_plane_helper.c
+++ b/drivers/gpu/drm/drm_plane_helper.c
@@ -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
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/plane-helper: Skip prepare_fb/cleanup_fb when newfb==oldfb
  2015-01-19 16:31 [PATCH] drm/plane-helper: Skip prepare_fb/cleanup_fb when newfb==oldfb Matt Roper
@ 2015-01-19 18:45 ` Rodrigo Vivi
  2015-01-20  5:53   ` Daniel Vetter
  0 siblings, 1 reply; 3+ messages in thread
From: Rodrigo Vivi @ 2015-01-19 18:45 UTC (permalink / raw)
  To: Matt Roper; +Cc: DRI mailing list

Thanks for the fix.

Tested-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

On Mon, Jan 19, 2015 at 8:31 AM, Matt Roper <matthew.d.roper@intel.com> wrote:
> 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.
>
> Reported-by: Jeremiah Mahler <jmmahler@gmail.com>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=88540
> Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
> ---
>  drivers/gpu/drm/drm_plane_helper.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c
> index f24c4cf..7a5814a 100644
> --- a/drivers/gpu/drm/drm_plane_helper.c
> +++ b/drivers/gpu/drm/drm_plane_helper.c
> @@ -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
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel



-- 
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/plane-helper: Skip prepare_fb/cleanup_fb when newfb==oldfb
  2015-01-19 18:45 ` Rodrigo Vivi
@ 2015-01-20  5:53   ` Daniel Vetter
  0 siblings, 0 replies; 3+ messages in thread
From: Daniel Vetter @ 2015-01-20  5:53 UTC (permalink / raw)
  To: Rodrigo Vivi; +Cc: DRI mailing list

On Mon, Jan 19, 2015 at 10:45:09AM -0800, Rodrigo Vivi wrote:
> Thanks for the fix.
> 
> Tested-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> 
> On Mon, Jan 19, 2015 at 8:31 AM, Matt Roper <matthew.d.roper@intel.com> wrote:
> > 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.
> >
> > Reported-by: Jeremiah Mahler <jmmahler@gmail.com>
> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=88540
> > Signed-off-by: Matt Roper <matthew.d.roper@intel.com>

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

> > ---
> >  drivers/gpu/drm/drm_plane_helper.c | 10 +++++++++-
> >  1 file changed, 9 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c
> > index f24c4cf..7a5814a 100644
> > --- a/drivers/gpu/drm/drm_plane_helper.c
> > +++ b/drivers/gpu/drm/drm_plane_helper.c
> > @@ -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
> > dri-devel@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/dri-devel
> 
> 
> 
> -- 
> Rodrigo Vivi
> Blog: http://blog.vivi.eng.br
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-01-20  5:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-19 16:31 [PATCH] drm/plane-helper: Skip prepare_fb/cleanup_fb when newfb==oldfb Matt Roper
2015-01-19 18:45 ` Rodrigo Vivi
2015-01-20  5:53   ` Daniel Vetter

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.