[Mesa-dev] [PATCH] egl: do not initialize w, h in dri2_query_surface

Eric Engestrom eric.engestrom at imgtec.com
Mon Aug 7 14:24:08 UTC 2017


On Monday, 2017-08-07 14:59:32 +0300, Tapani Pälli wrote:
> They always get initialized to zero by swrastGetDrawableInfo. Valid
> X11 Drawable minimum size is 1x1, so we can detect success/change by
> checking against 0.
> 
> Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
> Reported-by: Emil Velikov <emil.velikov at collabora.com>

Reviewed-by: Eric Engestrom <eric.engestrom at imgtec.com>

> ---
>  src/egl/drivers/dri2/platform_x11.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c
> index 61e700f..4917004 100644
> --- a/src/egl/drivers/dri2/platform_x11.c
> +++ b/src/egl/drivers/dri2/platform_x11.c
> @@ -412,7 +412,7 @@ dri2_query_surface(_EGLDriver *drv, _EGLDisplay *dpy,
>  {
>     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;
> +   int x, y, w, h;
>  
>     __DRIdrawable *drawable = dri2_dpy->vtbl->get_dri_drawable(surf);
>  
> @@ -420,7 +420,7 @@ dri2_query_surface(_EGLDriver *drv, _EGLDisplay *dpy,
>     case EGL_WIDTH:
>     case EGL_HEIGHT:
>        swrastGetDrawableInfo(drawable, &x, &y, &w, &h, dri2_surf);
> -      if (w != -1 && h != -1) {
> +      if (w != 0 && h != 0) {
>           surf->Width = w;
>           surf->Height = h;
>        }
> -- 
> 2.9.4
> 


More information about the mesa-dev mailing list