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

Emil Velikov emil.l.velikov at gmail.com
Thu Jun 22 15:17:40 UTC 2017


Hi Tapani,

On 21 December 2016 at 08:21, Tapani Pälli <tapani.palli at intel.com> wrote:
> This makes better guarantee that the values we return are
> in sync what the underlying drawable currently has.
>
> Together with dEQP change in bug #98327 this fixes following test:
>
>    dEQP-EGL.functional.resize.surface_size.grow
>
> v2: avoid unnecessary x11 roundtrips (Chad Versace)
>
> 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 | 36 ++++++++++++++++++++++++++++++++++++
>  1 file changed, 36 insertions(+)
>
> diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c
> index db7d3b9..9a93b19 100644
> --- a/src/egl/drivers/dri2/platform_x11.c
> +++ b/src/egl/drivers/dri2/platform_x11.c
> @@ -395,6 +395,40 @@ 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);
> +
> +   switch (attribute) {
> +   case EGL_WIDTH:
> +   case EGL_HEIGHT:
> +      swrastGetDrawableInfo(drawable, &x, &y, &w, &h, dri2_surf);
> +      if (w != -1 && h != -1) {
> +         surf->Width = w;
> +         surf->Height = h;
> +      }
Since swrastGetDrawableInfo() has no return type, it always zeroes
w/h. Thus the conditional is always true.
Two possible solutions include:
 - change the function to indicate success, having a wrapped up
version (which discards the return value) to keep the DRI driver
happy.
 - Use different magic values 0/-1/other, although in all fairness I'm
not sure which ones are valid.

Thanks
Emil


More information about the mesa-dev mailing list