[Mesa-dev] [PATCH] egl/dri2: implement query surface hook
Chad Versace
chadversary at chromium.org
Tue Dec 20 18:58:46 UTC 2016
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;
}
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.
More information about the mesa-dev
mailing list