[Mesa-dev] [PATCH] egl: updating surface size on x11

Michel Dänzer michel at daenzer.net
Fri Mar 11 09:45:10 UTC 2016


On 11.03.2016 17:24, Pielech, Adrian wrote:
> I've found that EGLSurface width and height are not updated after window resizing on x11.
> Here is the patch for this issue.
> 
> ---
>  src/egl/drivers/dri2/platform_x11.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c
> index a09632d..f3e78db 100644
> --- a/src/egl/drivers/dri2/platform_x11.c
> +++ b/src/egl/drivers/dri2/platform_x11.c
> @@ -835,6 +835,22 @@ dri2_x11_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw)
>     struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
>     struct dri2_egl_surface *dri2_surf = dri2_egl_surface(draw);
>  
> +   //Updating surface width and height fields for querying
> +   //size by eglQuerySurface with EGL_WIDTH, EGL_HEIGHT
> +   //It's needed for window surface when window is resized

No C++ style comments in C code please.


> +   if (!(draw->Type & EGL_PBUFFER_BIT)) {
> +       xcb_generic_error_t *error = NULL;
> +        xcb_get_geometry_cookie_t cookie = xcb_get_geometry (dri2_dpy->conn, dri2_surf->drawable);
> +        xcb_get_geometry_reply_t *reply = xcb_get_geometry_reply (dri2_dpy->conn, cookie, &error);
> +        if (reply != NULL)
> +        {
> +          dri2_surf->base.Width = reply->width;
> +          dri2_surf->base.Height = reply->height;
> +          free(reply);
> +        }
> +        if (error != NULL)
> +          free(error);
> +   }
> +
>     if (dri2_dpy->dri2) {
>        int64_t ret_val = dri2_x11_swap_buffers_msc(drv, disp, draw, 0, 0, 0);
>        if (ret_val != -1) {
> 

Are you using DRI3? With DRI2, this should be taken care of in
dri2_x11_get_buffers(_with_format).


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer


More information about the mesa-dev mailing list