All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/atomic-helper: Skip vblank waits for unchanged fbs
@ 2014-11-24 20:42 Daniel Vetter
  2014-11-24 21:34 ` Jasper St. Pierre
  2014-11-25  8:25 ` [PATCH] drm/atomic-helper: Skip vblank waits for shuang.he
  0 siblings, 2 replies; 4+ messages in thread
From: Daniel Vetter @ 2014-11-24 20:42 UTC (permalink / raw)
  To: DRI Development
  Cc: Daniel Vetter, Intel Graphics Development, Jasper St. Pierre,
	Daniel Vetter

Especially with legacy cursor ioctls existing userspace assumes that
you can pile up lots of updates in one go. The super-proper way to
support this would be a special commit mode which overwrites the last
update. But getting there will be quite a bit of work.

Meanwhile do what pretty much all the drivers have done for the plane
update functions: Simply skip the vblank wait for the buffer cleanup
if the buffer is the same. Since the universal cursor plane code will
not recreate framebuffers needlessly this allows us to not slow down
legacy pageflip events while someone moves the cursor around.

v2: Drop the async plane update hunk from a previous attempt at this
issue.

v3: Fix up kerneldoc.

v4: Don't oops so badly. Reported by Jasper.

Cc: Rob Clark <robdclark@gmail.com>
Cc: "Jasper St. Pierre" <jstpierre@mecheye.net>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
 drivers/gpu/drm/drm_atomic_helper.c | 34 +++++++++++++++++++++++++++++++++-
 1 file changed, 33 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index af37f1edd3ed..0d32039d072f 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -748,6 +748,33 @@ static void wait_for_fences(struct drm_device *dev,
 	}
 }
 
+static bool framebuffer_changed(struct drm_device *dev,
+				struct drm_atomic_state *old_state,
+				struct drm_crtc *crtc)
+{
+	struct drm_plane *plane;
+	struct drm_plane_state *old_plane_state;
+	int nplanes = old_state->dev->mode_config.num_total_plane;
+	int i;
+
+	for (i = 0; i < nplanes; i++) {
+		plane = old_state->planes[i];
+		old_plane_state = old_state->plane_states[i];
+
+		if (!plane)
+			continue;
+
+		if (plane->state->crtc != crtc &&
+		    old_plane_state->crtc != crtc)
+			continue;
+
+		if (plane->state->fb != old_plane_state->fb)
+			return true;
+	}
+
+	return false;
+}
+
 /**
  * drm_atomic_helper_wait_for_vblanks - wait for vblank on crtcs
  * @dev: DRM device
@@ -755,7 +782,9 @@ static void wait_for_fences(struct drm_device *dev,
  *
  * Helper to, after atomic commit, wait for vblanks on all effected
  * crtcs (ie. before cleaning up old framebuffers using
- * drm_atomic_helper_cleanup_planes())
+ * drm_atomic_helper_cleanup_planes()). It will only wait on crtcs where the
+ * framebuffers have actually changed to optimize for the legacy cursor and
+ * plane update use-case.
  */
 void
 drm_atomic_helper_wait_for_vblanks(struct drm_device *dev,
@@ -781,6 +810,9 @@ drm_atomic_helper_wait_for_vblanks(struct drm_device *dev,
 		if (!crtc->state->enable)
 			continue;
 
+		if (!framebuffer_changed(dev, old_state, crtc))
+			continue;
+
 		ret = drm_crtc_vblank_get(crtc);
 		if (ret != 0)
 			continue;
-- 
2.1.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH] drm/atomic-helper: Skip vblank waits for unchanged fbs
  2014-11-24 20:42 [PATCH] drm/atomic-helper: Skip vblank waits for unchanged fbs Daniel Vetter
@ 2014-11-24 21:34 ` Jasper St. Pierre
  2014-11-25  8:25 ` [PATCH] drm/atomic-helper: Skip vblank waits for shuang.he
  1 sibling, 0 replies; 4+ messages in thread
From: Jasper St. Pierre @ 2014-11-24 21:34 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: Daniel Vetter, Intel Graphics Development, DRI Development


[-- Attachment #1.1: Type: text/plain, Size: 3569 bytes --]

With the oops fix:

Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
Tested-by: Jasper St. Pierre <jstpierre@mecheye.net>

On Mon, Nov 24, 2014 at 12:42 PM, Daniel Vetter <daniel.vetter@ffwll.ch>
wrote:

> Especially with legacy cursor ioctls existing userspace assumes that
> you can pile up lots of updates in one go. The super-proper way to
> support this would be a special commit mode which overwrites the last
> update. But getting there will be quite a bit of work.
>
> Meanwhile do what pretty much all the drivers have done for the plane
> update functions: Simply skip the vblank wait for the buffer cleanup
> if the buffer is the same. Since the universal cursor plane code will
> not recreate framebuffers needlessly this allows us to not slow down
> legacy pageflip events while someone moves the cursor around.
>
> v2: Drop the async plane update hunk from a previous attempt at this
> issue.
>
> v3: Fix up kerneldoc.
>
> v4: Don't oops so badly. Reported by Jasper.
>
> Cc: Rob Clark <robdclark@gmail.com>
> Cc: "Jasper St. Pierre" <jstpierre@mecheye.net>
> Reviewed-by: Rob Clark <robdclark@gmail.com>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> ---
>  drivers/gpu/drm/drm_atomic_helper.c | 34
> +++++++++++++++++++++++++++++++++-
>  1 file changed, 33 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c
> b/drivers/gpu/drm/drm_atomic_helper.c
> index af37f1edd3ed..0d32039d072f 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -748,6 +748,33 @@ static void wait_for_fences(struct drm_device *dev,
>         }
>  }
>
> +static bool framebuffer_changed(struct drm_device *dev,
> +                               struct drm_atomic_state *old_state,
> +                               struct drm_crtc *crtc)
> +{
> +       struct drm_plane *plane;
> +       struct drm_plane_state *old_plane_state;
> +       int nplanes = old_state->dev->mode_config.num_total_plane;
> +       int i;
> +
> +       for (i = 0; i < nplanes; i++) {
> +               plane = old_state->planes[i];
> +               old_plane_state = old_state->plane_states[i];
> +
> +               if (!plane)
> +                       continue;
> +
> +               if (plane->state->crtc != crtc &&
> +                   old_plane_state->crtc != crtc)
> +                       continue;
> +
> +               if (plane->state->fb != old_plane_state->fb)
> +                       return true;
> +       }
> +
> +       return false;
> +}
> +
>  /**
>   * drm_atomic_helper_wait_for_vblanks - wait for vblank on crtcs
>   * @dev: DRM device
> @@ -755,7 +782,9 @@ static void wait_for_fences(struct drm_device *dev,
>   *
>   * Helper to, after atomic commit, wait for vblanks on all effected
>   * crtcs (ie. before cleaning up old framebuffers using
> - * drm_atomic_helper_cleanup_planes())
> + * drm_atomic_helper_cleanup_planes()). It will only wait on crtcs where
> the
> + * framebuffers have actually changed to optimize for the legacy cursor
> and
> + * plane update use-case.
>   */
>  void
>  drm_atomic_helper_wait_for_vblanks(struct drm_device *dev,
> @@ -781,6 +810,9 @@ drm_atomic_helper_wait_for_vblanks(struct drm_device
> *dev,
>                 if (!crtc->state->enable)
>                         continue;
>
> +               if (!framebuffer_changed(dev, old_state, crtc))
> +                       continue;
> +
>                 ret = drm_crtc_vblank_get(crtc);
>                 if (ret != 0)
>                         continue;
> --
> 2.1.1
>
>


-- 
  Jasper

[-- Attachment #1.2: Type: text/html, Size: 4943 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH] drm/atomic-helper: Skip vblank waits for
  2014-11-24 19:34 [PATCH] drm/atomic-helper: Skip vblank waits for unchanged fbs Daniel Vetter
@ 2014-11-25  5:07 ` shuang.he
  0 siblings, 0 replies; 4+ messages in thread
From: shuang.he @ 2014-11-25  5:07 UTC (permalink / raw)
  To: shuang.he, intel-gfx, daniel.vetter

Tested-By: PRC QA PRTS (Patch Regression Test System Contact: shuang.he@intel.com)
-------------------------------------Summary-------------------------------------
Platform          Delta          drm-intel-nightly          Series Applied
PNV                                  367/367              367/367
ILK                 -5              375/375              370/375
SNB                 -1              450/450              449/450
IVB                 -2              503/503              501/503
BYT                                  289/289              289/289
HSW                 -3              567/567              564/567
BDW                                  417/417              417/417
-------------------------------------Detailed-------------------------------------
Platform  Test                                drm-intel-nightly          Series Applied
 ILK  igt_gem_reset_stats_close-pending-fork-render      TIMEOUT(10, M37M26)PASS(1, M26)      TIMEOUT(1, M37)
*ILK  igt_drv_suspend_fence-restore-tiled2untiled      PASS(2, M37)      DMESG_WARN(1, M37)
*ILK  igt_drv_suspend_fence-restore-untiled      PASS(2, M37)      DMESG_WARN(1, M37)
*ILK  igt_drv_suspend_forcewake      PASS(2, M37)      DMESG_WARN(1, M37)
 ILK  igt_kms_flip_vblank-vs-hang      TIMEOUT(10, M37M26)PASS(1, M26)      TIMEOUT(1, M37)
*SNB  igt_kms_rotation_crc_primary-rotation      PASS(2, M22)      DMESG_WARN(1, M22)
 IVB  igt_gem_bad_reloc_negative-reloc      NSPT(14, M34M21M4)PASS(1, M21)      NSPT(1, M34)
 IVB  igt_gem_bad_reloc_negative-reloc-lut      NSPT(3, M21M34M4)PASS(15, M21M34M4)      NSPT(1, M34)
 HSW  igt_gem_bad_reloc_negative-reloc-lut      NSPT(24, M40M20M19)PASS(1, M20)      NSPT(1, M20)
*HSW  igt_kms_rotation_crc_primary-rotation      PASS(23, M20M40M19)      DMESG_WARN(1, M20)
*HSW  igt_pm_rc6_residency_rc6-accuracy      PASS(25, M20M40M19)      FAIL(1, M20)
Note: You need to pay more attention to line start with '*'
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH] drm/atomic-helper: Skip vblank waits for
  2014-11-24 20:42 [PATCH] drm/atomic-helper: Skip vblank waits for unchanged fbs Daniel Vetter
  2014-11-24 21:34 ` Jasper St. Pierre
@ 2014-11-25  8:25 ` shuang.he
  1 sibling, 0 replies; 4+ messages in thread
From: shuang.he @ 2014-11-25  8:25 UTC (permalink / raw)
  To: shuang.he, intel-gfx, daniel.vetter

Tested-By: PRC QA PRTS (Patch Regression Test System Contact: shuang.he@intel.com)
-------------------------------------Summary-------------------------------------
Platform          Delta          drm-intel-nightly          Series Applied
PNV                                  367/367              367/367
ILK                 -6              375/375              369/375
SNB                                  450/450              450/450
IVB                 -2              503/503              501/503
BYT                                  289/289              289/289
HSW                 -4              567/567              563/567
BDW                                  417/417              417/417
-------------------------------------Detailed-------------------------------------
Platform  Test                                drm-intel-nightly          Series Applied
 ILK  igt_gem_reset_stats_close-pending-fork-render      TIMEOUT(12, M37M26)PASS(1, M26)      TIMEOUT(1, M37)
*ILK  igt_drv_suspend_debugfs-reader      PASS(2, M37)      DMESG_WARN(1, M37)
*ILK  igt_drv_suspend_fence-restore-tiled2untiled      PASS(3, M37)      DMESG_WARN(1, M37)
*ILK  igt_drv_suspend_fence-restore-untiled      PASS(3, M37)      DMESG_WARN(1, M37)
*ILK  igt_drv_suspend_forcewake      PASS(3, M37)      DMESG_WARN(1, M37)
 ILK  igt_kms_flip_vblank-vs-hang      TIMEOUT(12, M37M26)PASS(1, M26)      TIMEOUT(1, M37)
 IVB  igt_gem_bad_reloc_negative-reloc      NSPT(14, M34M21M4)PASS(1, M21)      NSPT(1, M4)
 IVB  igt_gem_bad_reloc_negative-reloc-lut      NSPT(3, M21M34M4)PASS(15, M21M34M4)      NSPT(1, M4)
 HSW  igt_gem_bad_reloc_negative-reloc-lut      NSPT(24, M40M20M19)PASS(1, M20)      NSPT(1, M40)
*HSW  igt_kms_flip_dpms-vs-vblank-race      PASS(2, M20M40)      DMESG_WARN(1, M40)
*HSW  igt_kms_rotation_crc_primary-rotation      PASS(23, M20M40M19)      DMESG_WARN(1, M40)
*HSW  igt_pm_rc6_residency_rc6-accuracy      PASS(25, M20M40M19)      FAIL(1, M40)
Note: You need to pay more attention to line start with '*'
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

end of thread, other threads:[~2014-11-25  8:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-24 20:42 [PATCH] drm/atomic-helper: Skip vblank waits for unchanged fbs Daniel Vetter
2014-11-24 21:34 ` Jasper St. Pierre
2014-11-25  8:25 ` [PATCH] drm/atomic-helper: Skip vblank waits for shuang.he
  -- strict thread matches above, loose matches on Subject: below --
2014-11-24 19:34 [PATCH] drm/atomic-helper: Skip vblank waits for unchanged fbs Daniel Vetter
2014-11-25  5:07 ` [PATCH] drm/atomic-helper: Skip vblank waits for shuang.he

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.