Re: [Mesa-dev] [PATCH v2] egl/wayland: Try to use wl_surface.damage_buffer for SwapBuffersWithDamage
On 16 February 2016 at 16:37, Daniel Stonewrote: > Hi, > > On 16 February 2016 at 16:34, Derek Foreman wrote: >> +try_damage_buffer(struct dri2_egl_surface *dri2_surf, >> + const EGLint *rects, >> + EGLint n_rects) >> +{ >> +/* The WL_SURFACE_DAMAGE_BUFFER_SINCE_VERSION macro and >> + * wl_proxy_get_version() were both introduced in wayland 1.10. >> + * Instead of bumping our wayland dependency we just make this >> + * function conditional on the required 1.10 features, falling >> + * back to old (correct but suboptimal) behaviour for older >> + * wayland. >> + */ >> +#ifdef WL_SURFACE_DAMAGE_BUFFER_SINCE_VERSION > > It still bumps the runtime requirement, i.e. once built against >=1.10 > it can only ever be run against >= 1.10. Maybe dlsym is overkill, but > OTOH maybe not ... > We have enough places in mesa which require build-time version <= run-time version. If one is brave enough to go the opposite way, I'm sorry but they get what they're asking for - a rainbow of issues ;-) Distros tend to follow this so things should be fine imho. Cheers, Emil ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v2] egl/wayland: Try to use wl_surface.damage_buffer for SwapBuffersWithDamage
On Wed, Feb 17, 2016 at 8:00 AM, Derek Foremanwrote: > On 16/02/16 10:37 AM, Daniel Stone wrote: > > Hi, > > > > On 16 February 2016 at 16:34, Derek Foreman > wrote: > >> +try_damage_buffer(struct dri2_egl_surface *dri2_surf, > >> + const EGLint *rects, > >> + EGLint n_rects) > >> +{ > >> +/* The WL_SURFACE_DAMAGE_BUFFER_SINCE_VERSION macro and > >> + * wl_proxy_get_version() were both introduced in wayland 1.10. > >> + * Instead of bumping our wayland dependency we just make this > >> + * function conditional on the required 1.10 features, falling > >> + * back to old (correct but suboptimal) behaviour for older > >> + * wayland. > >> + */ > >> +#ifdef WL_SURFACE_DAMAGE_BUFFER_SINCE_VERSION > > > > It still bumps the runtime requirement, i.e. once built against >=1.10 > > it can only ever be run against >= 1.10. Maybe dlsym is overkill, but > > OTOH maybe not ... > > Yup, that's true. > > I kind of just assumed distros would set their own dependency > information to whatever libwayland they actually built against. > > I hadn't given much thought to building mesa against a new libwayland > then downgrading libwayland or transplanting that mesa to a system with > older wayland. > > I can re-do this with runtime dlsym checking for wl_proxy_get_version() > if that's preferred - someone else can make that decision because I > don't have a strong opinion either way. :) > I just added ajax to the CC. He's the person who will have to deal with the back-porting fall-out so I'll let him venture an opinion. Personally, I don't really care either way. --Jason ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v2] egl/wayland: Try to use wl_surface.damage_buffer for SwapBuffersWithDamage
On 16/02/16 10:37 AM, Daniel Stone wrote: > Hi, > > On 16 February 2016 at 16:34, Derek Foremanwrote: >> +try_damage_buffer(struct dri2_egl_surface *dri2_surf, >> + const EGLint *rects, >> + EGLint n_rects) >> +{ >> +/* The WL_SURFACE_DAMAGE_BUFFER_SINCE_VERSION macro and >> + * wl_proxy_get_version() were both introduced in wayland 1.10. >> + * Instead of bumping our wayland dependency we just make this >> + * function conditional on the required 1.10 features, falling >> + * back to old (correct but suboptimal) behaviour for older >> + * wayland. >> + */ >> +#ifdef WL_SURFACE_DAMAGE_BUFFER_SINCE_VERSION > > It still bumps the runtime requirement, i.e. once built against >=1.10 > it can only ever be run against >= 1.10. Maybe dlsym is overkill, but > OTOH maybe not ... Yup, that's true. I kind of just assumed distros would set their own dependency information to whatever libwayland they actually built against. I hadn't given much thought to building mesa against a new libwayland then downgrading libwayland or transplanting that mesa to a system with older wayland. I can re-do this with runtime dlsym checking for wl_proxy_get_version() if that's preferred - someone else can make that decision because I don't have a strong opinion either way. :) Thanks, Derek ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v2] egl/wayland: Try to use wl_surface.damage_buffer for SwapBuffersWithDamage
Hi, On 16 February 2016 at 16:34, Derek Foremanwrote: > +try_damage_buffer(struct dri2_egl_surface *dri2_surf, > + const EGLint *rects, > + EGLint n_rects) > +{ > +/* The WL_SURFACE_DAMAGE_BUFFER_SINCE_VERSION macro and > + * wl_proxy_get_version() were both introduced in wayland 1.10. > + * Instead of bumping our wayland dependency we just make this > + * function conditional on the required 1.10 features, falling > + * back to old (correct but suboptimal) behaviour for older > + * wayland. > + */ > +#ifdef WL_SURFACE_DAMAGE_BUFFER_SINCE_VERSION It still bumps the runtime requirement, i.e. once built against >=1.10 it can only ever be run against >= 1.10. Maybe dlsym is overkill, but OTOH maybe not ... Cheers, Daniel ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v2] egl/wayland: Try to use wl_surface.damage_buffer for SwapBuffersWithDamage
Since commit d1314de293e9e4a63c35f094c3893aaaed8580b4 we ignore damage passed to SwapBuffersWithDamage. Wayland 1.10 now has functionality that allows us to properly process those damage rectangles, and a way to query if it's available. Now we can use wl_surface.damage_buffer and interpret the incoming damage as being in buffer co-ordinates. Reviewed-by: Jason EkstrandReviewed-by: Pekka Paalanen Signed-off-by: Derek Foreman --- Changes from v1: Add comment explaining why the call to wl_proxy_get_version() is hidden by the seemingly unrelated macro. src/egl/drivers/dri2/platform_wayland.c | 39 ++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c index c2438f7..341acb7 100644 --- a/src/egl/drivers/dri2/platform_wayland.c +++ b/src/egl/drivers/dri2/platform_wayland.c @@ -653,6 +653,37 @@ create_wl_buffer(struct dri2_egl_surface *dri2_surf) _buffer_listener, dri2_surf); } +static EGLBoolean +try_damage_buffer(struct dri2_egl_surface *dri2_surf, + const EGLint *rects, + EGLint n_rects) +{ +/* The WL_SURFACE_DAMAGE_BUFFER_SINCE_VERSION macro and + * wl_proxy_get_version() were both introduced in wayland 1.10. + * Instead of bumping our wayland dependency we just make this + * function conditional on the required 1.10 features, falling + * back to old (correct but suboptimal) behaviour for older + * wayland. + */ +#ifdef WL_SURFACE_DAMAGE_BUFFER_SINCE_VERSION + int i; + + if (wl_proxy_get_version((struct wl_proxy *) dri2_surf->wl_win->surface) + < WL_SURFACE_DAMAGE_BUFFER_SINCE_VERSION) + return EGL_FALSE; + + for (i = 0; i < n_rects; i++) { + const int *rect = [i * 4]; + + wl_surface_damage_buffer(dri2_surf->wl_win->surface, + rect[0], + dri2_surf->base.Height - rect[1] - rect[3], + rect[2], rect[3]); + } + return EGL_TRUE; +#endif + return EGL_FALSE; +} /** * Called via eglSwapBuffers(), drv->API.SwapBuffers(). */ @@ -703,10 +734,12 @@ dri2_wl_swap_buffers_with_damage(_EGLDriver *drv, dri2_surf->dx = 0; dri2_surf->dy = 0; - /* We deliberately ignore the damage region and post maximum damage, due to + /* If the compositor doesn't support damage_buffer, we deliberately +* ignore the damage region and post maximum damage, due to * https://bugs.freedesktop.org/78190 */ - wl_surface_damage(dri2_surf->wl_win->surface, - 0, 0, INT32_MAX, INT32_MAX); + if (!n_rects || !try_damage_buffer(dri2_surf, rects, n_rects)) + wl_surface_damage(dri2_surf->wl_win->surface, +0, 0, INT32_MAX, INT32_MAX); if (dri2_dpy->is_different_gpu) { _EGLContext *ctx = _eglGetCurrentContext(); -- 2.7.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev