[Mesa-dev] [PATCH] egl/dri2: implement query surface hook

Tapani Pälli tapani.palli at intel.com
Wed Dec 21 05:58:55 UTC 2016


On 12/20/2016 08:58 PM, Chad Versace wrote:
> On Tue 20 Dec 2016, Tapani Pälli wrote:
>> This makes better guarantee that the values we return are
>> in sync what the underlying drawable currently has.
>>
>> Together with dEQP change bug #98327 this fixes following test:
>>
>>     dEQP-EGL.functional.resize.surface_size.grow
>>
>> Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
>> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98327
>> ---
>>   src/egl/drivers/dri2/platform_x11.c | 30 ++++++++++++++++++++++++++++++
>>   1 file changed, 30 insertions(+)
>
>> diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c
>> index db7d3b9..0c5d577 100644
>> --- a/src/egl/drivers/dri2/platform_x11.c
>> +++ b/src/egl/drivers/dri2/platform_x11.c
>> @@ -395,6 +395,34 @@ dri2_x11_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf)
>>   }
>>   
>>   /**
>> + * Function utilizes swrastGetDrawableInfo to get surface
>> + * geometry from x server and calls default query surface
>> + * implementation that returns the updated values.
>> + *
>> + * In case of errors we still return values that we currently
>> + * have.
>> + */
>> +static EGLBoolean
>> +dri2_query_surface(_EGLDriver *drv, _EGLDisplay *dpy,
>> +                   _EGLSurface *surf, EGLint attribute,
>> +                   EGLint *value)
>> +{
>> +   struct dri2_egl_display *dri2_dpy = dri2_egl_display(dpy);
>> +   struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf);
>> +   int x, y, w = -1, h = -1;
>> +
>> +   __DRIdrawable *drawable = dri2_dpy->vtbl->get_dri_drawable(surf);
>> +   swrastGetDrawableInfo(drawable, &x, &y, &w, &h, dri2_surf);
>> +
>> +   if (w != -1 && h != -1) {
>> +      surf->Width = w;
>> +      surf->Height = h;
>> +   }
>> +
>> +   return _eglQuerySurface(drv, dpy, surf, attribute, value);
>> +}
> The patch looks correct to me, but it incurs a X11 roundtrip even when
> unneeded. A little change would ensure the roundtrip happens only when
> needed. This is the same technique that platform_android.c uses to avoid
> a SurfaceFlinger roundtrip.
>
>     switch (attribute) {
>     case EGL_WIDTH:
>     case EGL_HEIGHT:
>         ...  /* Do what the patch does. Update width, height with swrastGetDrawableInfo. */
>         break;
>     default:
>         /* Do nothing */
>         break;
>     }

Right, makes sense. I'll make this modification and send v2.

>     return _eglQuerySurface(drv, dpy, surf, attribute, value);
>
> By the way, I also can't reproduce the bug 98327. I'm using Archlinux
> with Openbox, a non-compositing window manager. The only apps on my
> screen are xterm and dEQP test windows.


The only setup where I'm able to reproduce this myself is Ubuntu running 
Unity desktop with DRI2. Are you running on DRI2 or DRI3?

// Tapani



More information about the mesa-dev mailing list