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

Matt Turner mattst88 at gmail.com
Fri Mar 11 17:38:17 UTC 2016


On Fri, Mar 11, 2016 at 12:24 AM, Pielech, Adrian
<adrian.pielech at intel.com> 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++ comments.

> +   if (!(draw->Type & EGL_PBUFFER_BIT)) {
> +       xcb_generic_error_t *error = NULL;

Other places in this file using this same pattern don't initialize
error. I don't think the initialization is needed.

After this line (which is appropriately indented) everything is misindented.

> +        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);

These two lines need to be wrapped to fit within 80 columns. No space
between function name and open parenthesis (though I do see some
inconsistency in this file).

> +        if (reply != NULL)
> +        {

Brace goes on the line with the if.

> +          dri2_surf->base.Width = reply->width;
> +          dri2_surf->base.Height = reply->height;
> +          free(reply);
> +        }
> +        if (error != NULL)
> +          free(error);

The rest isn't properly indented. We use 3-space indent.


More information about the mesa-dev mailing list