[Mesa-dev] [PATCH mesa] egl/dri3: implement query surface hook
Brendan King
brendan.king at imgtec.com
Fri Feb 24 15:55:21 UTC 2017
Hi,
On 20/02/17 07:57, Tapani Pälli wrote:
> Hi;
>
> On 02/17/2017 05:12 PM, Eric Engestrom wrote:
>> From: Brendan King <Brendan.King at imgtec.com>
>>
>> This is a DRI3 version of a change made for DRI2
>> (4d6d4f939e0af4252e0b, "egl/dri2: implement query surface hook"),
>> that fixed failures in dEQP-EGL.functional.resize.surface_size.grow
>> and dEQP-EGL.functional.resize.surface_size.shrink.
>
> Do these tests fail on some platform? When debugging the original
> failures this failed for me only when using DRI2. It's nice to be
> consistent but is it possible that this is not necessary because of
> differences between DRI2 and DRI3?
>
The tests failed on the PowerVR driver. The tests resize the drawable
before calling eglSwapBuffers, and query the drawable width and height
after the call. The driver hasn't started drawing the next frame at this
point, and so hasn't requested the new buffers for the drawable yet,
hence the old width and height were being returned.
>
>> Cc: Tapani Pälli <tapani.palli at intel.com>
>> Cc: Mark Janes <mark.a.janes at intel.com>
>> Cc: Chad Versace <chadversary at chromium.org>
>> Signed-off-by: Brendan King <Brendan.King at imgtec.com>
>> ---
>> src/egl/drivers/dri2/platform_x11_dri3.c | 20 ++++++++++++++++++++
>> src/loader/loader_dri3_helper.c | 23 +++++++++++++++++++++++
>> src/loader/loader_dri3_helper.h | 2 ++
>> 3 files changed, 45 insertions(+)
>>
>> diff --git a/src/egl/drivers/dri2/platform_x11_dri3.c
>> b/src/egl/drivers/dri2/platform_x11_dri3.c
>> index c4747144d1..c4a54431cc 100644
>> --- a/src/egl/drivers/dri2/platform_x11_dri3.c
>> +++ b/src/egl/drivers/dri2/platform_x11_dri3.c
>> @@ -419,6 +419,25 @@ dri3_query_buffer_age(_EGLDriver *drv,
>> _EGLDisplay *dpy, _EGLSurface *surf)
>> return loader_dri3_query_buffer_age(&dri3_surf->loader_drawable);
>> }
>>
>> +static EGLBoolean
>> +dri3_query_surface(_EGLDriver *drv, _EGLDisplay *dpy,
>> + _EGLSurface *surf, EGLint attribute,
>> + EGLint *value)
>> +{
>> + struct dri3_egl_surface *dri3_surf = dri3_egl_surface(surf);
>> +
>> + switch (attribute) {
>> + case EGL_WIDTH:
>> + case EGL_HEIGHT:
>> + loader_dri3_update_drawable_geometry(&dri3_surf->loader_drawable);
>> + break;
>> + default:
>> + break;
>> + }
>> +
>> + return _eglQuerySurface(drv, dpy, surf, attribute, value);
>> +}
>> +
>> static __DRIdrawable *
>> dri3_get_dri_drawable(_EGLSurface *surf)
>> {
>> @@ -441,6 +460,7 @@ struct dri2_egl_display_vtbl
>> dri3_x11_display_vtbl = {
>> .post_sub_buffer = dri2_fallback_post_sub_buffer,
>> .copy_buffers = dri3_copy_buffers,
>> .query_buffer_age = dri3_query_buffer_age,
>> + .query_surface = dri3_query_surface,
>> .create_wayland_buffer_from_image =
>> dri2_fallback_create_wayland_buffer_from_image,
>> .get_sync_values = dri3_get_sync_values,
>> .get_dri_drawable = dri3_get_dri_drawable,
>> diff --git a/src/loader/loader_dri3_helper.c
>> b/src/loader/loader_dri3_helper.c
>> index 6e5d1b8843..493a7f5218 100644
>> --- a/src/loader/loader_dri3_helper.c
>> +++ b/src/loader/loader_dri3_helper.c
>> @@ -1408,3 +1408,26 @@ loader_dri3_get_buffers(__DRIdrawable
>> *driDrawable,
>>
>> return true;
>> }
>> +
>> +/** loader_dri3_update_drawable_geometry
>> + *
>> + * Get the current drawable geometry.
>> + */
>> +void
>> +loader_dri3_update_drawable_geometry(struct loader_dri3_drawable *draw)
>> +{
>> + xcb_get_geometry_cookie_t geom_cookie;
>> + xcb_get_geometry_reply_t *geom_reply;
>> +
>> + geom_cookie = xcb_get_geometry(draw->conn, draw->drawable);
>> +
>> + geom_reply = xcb_get_geometry_reply(draw->conn, geom_cookie, NULL);
>> +
>> + if (geom_reply) {
>> + draw->width = geom_reply->width;
>> + draw->height = geom_reply->height;
>> + draw->vtable->set_drawable_size(draw, draw->width, draw->height);
>> +
>> + free(geom_reply);
>> + }
>> +}
>> diff --git a/src/loader/loader_dri3_helper.h
>> b/src/loader/loader_dri3_helper.h
>> index 1d1f15ebb9..a865e46355 100644
>> --- a/src/loader/loader_dri3_helper.h
>> +++ b/src/loader/loader_dri3_helper.h
>> @@ -239,4 +239,6 @@ loader_dri3_get_buffers(__DRIdrawable *driDrawable,
>> uint32_t buffer_mask,
>> struct __DRIimageList *buffers);
>>
>> +void
>> +loader_dri3_update_drawable_geometry(struct loader_dri3_drawable
>> *draw);
>> #endif
>>
More information about the mesa-dev
mailing list