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