<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Feb 11, 2016 at 8:34 AM, Derek Foreman <span dir="ltr"><<a href="mailto:derekf@osg.samsung.com" target="_blank">derekf@osg.samsung.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Since commit d1314de293e9e4a63c35f094c3893aaaed8580b4 we ignore<br>
damage passed to SwapBuffersWithDamage.<br>
<br>
Wayland 1.10 now has functionality that allows us to properly<br>
process those damage rectangles, and a way to query if it's<br>
available.<br>
<br>
Now we can use wl_surface.damage_buffer and interpret the incoming<br>
damage as being in buffer co-ordinates.<br>
<br>
Signed-off-by: Derek Foreman <<a href="mailto:derekf@osg.samsung.com">derekf@osg.samsung.com</a>><br></blockquote><div><br></div><div>Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>> <br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
---<br>
src/egl/drivers/dri2/platform_wayland.c | 32 +++++++++++++++++++++++++++++---<br>
1 file changed, 29 insertions(+), 3 deletions(-)<br>
<br>
diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c<br>
index c2438f7..b5a5b59 100644<br>
--- a/src/egl/drivers/dri2/platform_wayland.c<br>
+++ b/src/egl/drivers/dri2/platform_wayland.c<br>
@@ -653,6 +653,30 @@ create_wl_buffer(struct dri2_egl_surface *dri2_surf)<br>
&wl_buffer_listener, dri2_surf);<br>
}<br>
<br>
+static EGLBoolean<br>
+try_damage_buffer(struct dri2_egl_surface *dri2_surf,<br>
+ const EGLint *rects,<br>
+ EGLint n_rects)<br>
+{<br>
+#ifdef WL_SURFACE_DAMAGE_BUFFER_SINCE_VERSION<br>
+ int i;<br>
+<br>
+ if (wl_proxy_get_version((struct wl_proxy *) dri2_surf->wl_win->surface)<br>
+ < WL_SURFACE_DAMAGE_BUFFER_SINCE_VERSION)<br>
+ return EGL_FALSE;<br>
+<br>
+ for (i = 0; i < n_rects; i++) {<br>
+ const int *rect = &rects[i * 4];<br>
+<br>
+ wl_surface_damage_buffer(dri2_surf->wl_win->surface,<br>
+ rect[0],<br>
+ dri2_surf->base.Height - rect[1] - rect[3],<br>
+ rect[2], rect[3]);<br>
+ }<br>
+ return EGL_TRUE;<br>
+#endif<br>
+ return EGL_FALSE;<br>
+}<br>
/**<br>
* Called via eglSwapBuffers(), drv->API.SwapBuffers().<br>
*/<br>
@@ -703,10 +727,12 @@ dri2_wl_swap_buffers_with_damage(_EGLDriver *drv,<br>
dri2_surf->dx = 0;<br>
dri2_surf->dy = 0;<br>
<br>
- /* We deliberately ignore the damage region and post maximum damage, due to<br>
+ /* If the compositor doesn't support damage_buffer, we deliberately<br>
+ * ignore the damage region and post maximum damage, due to<br>
* <a href="https://bugs.freedesktop.org/78190" rel="noreferrer" target="_blank">https://bugs.freedesktop.org/78190</a> */<br>
- wl_surface_damage(dri2_surf->wl_win->surface,<br>
- 0, 0, INT32_MAX, INT32_MAX);<br>
+ if (!n_rects || !try_damage_buffer(dri2_surf, rects, n_rects))<br>
+ wl_surface_damage(dri2_surf->wl_win->surface,<br>
+ 0, 0, INT32_MAX, INT32_MAX);<br>
<br>
if (dri2_dpy->is_different_gpu) {<br>
_EGLContext *ctx = _eglGetCurrentContext();<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.7.0<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div></div>