[Mesa-stable] [Mesa-dev] [PATCH] egl: Pass the correct X visual depth to xcb_put_image().

Jose Fonseca jfonseca at vmware.com
Fri Jan 23 07:24:13 PST 2015


It looks like nobody really cares, so I'll take it as consent.

This only happens if X requires 24bit visuals. Maybe a minority of 
drivers do that.  At least Intel X driver does.

BTW, this should go to stable branches too.

Jose

On 19/01/15 23:09, Jose Fonseca wrote:
> From: José Fonseca <jfonseca at vmware.com>
>
> The dri2_x11_add_configs_for_visuals() function happily matches a 32
> bits EGLconfig with a 24 bits X visual.  However it was passing 32bits
> depth to xcb_put_image(), making X server unhappy:
>
>    https://github.com/apitrace/apitrace/issues/313#issuecomment-70571911
>
> PS: I rarely use the Mesa DRI software rasterizers (I usually use the
> non-DRI Xlib SW renderers), but every time I try them they seem broken
> at some fundamental level.  I wonder if it's just me or if nobody truly
> uses them on a daily basis.
> ---
>   src/egl/drivers/dri2/platform_x11.c | 24 +++++++++++++-----------
>   1 file changed, 13 insertions(+), 11 deletions(-)
>
> diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c
> index dd88e90..cbcf6a7 100644
> --- a/src/egl/drivers/dri2/platform_x11.c
> +++ b/src/egl/drivers/dri2/platform_x11.c
> @@ -49,8 +49,7 @@ dri2_x11_swap_interval(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf,
>
>   static void
>   swrastCreateDrawable(struct dri2_egl_display * dri2_dpy,
> -                     struct dri2_egl_surface * dri2_surf,
> -                     int depth)
> +                     struct dri2_egl_surface * dri2_surf)
>   {
>      uint32_t           mask;
>      const uint32_t     function = GXcopy;
> @@ -66,8 +65,7 @@ swrastCreateDrawable(struct dri2_egl_display * dri2_dpy,
>      valgc[0] = function;
>      valgc[1] = False;
>      xcb_create_gc(dri2_dpy->conn, dri2_surf->swapgc, dri2_surf->drawable, mask, valgc);
> -   dri2_surf->depth = depth;
> -   switch (depth) {
> +   switch (dri2_surf->depth) {
>         case 32:
>         case 24:
>            dri2_surf->bytes_per_pixel = 4;
> @@ -82,7 +80,7 @@ swrastCreateDrawable(struct dri2_egl_display * dri2_dpy,
>            dri2_surf->bytes_per_pixel = 0;
>            break;
>         default:
> -         _eglLog(_EGL_WARNING, "unsupported depth %d", depth);
> +         _eglLog(_EGL_WARNING, "unsupported depth %d", dri2_surf->depth);
>      }
>   }
>
> @@ -257,12 +255,6 @@ dri2_x11_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
>         _eglError(EGL_BAD_ALLOC, "dri2->createNewDrawable");
>         goto cleanup_pixmap;
>      }
> -
> -   if (dri2_dpy->dri2) {
> -      xcb_dri2_create_drawable (dri2_dpy->conn, dri2_surf->drawable);
> -   } else {
> -      swrastCreateDrawable(dri2_dpy, dri2_surf, _eglGetConfigKey(conf, EGL_BUFFER_SIZE));
> -   }
>
>      if (type != EGL_PBUFFER_BIT) {
>         cookie = xcb_get_geometry (dri2_dpy->conn, dri2_surf->drawable);
> @@ -275,9 +267,19 @@ dri2_x11_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
>
>         dri2_surf->base.Width = reply->width;
>         dri2_surf->base.Height = reply->height;
> +      dri2_surf->depth = reply->depth;
>         free(reply);
>      }
>
> +   if (dri2_dpy->dri2) {
> +      xcb_dri2_create_drawable (dri2_dpy->conn, dri2_surf->drawable);
> +   } else {
> +      if (type == EGL_PBUFFER_BIT) {
> +         dri2_surf->depth = _eglGetConfigKey(conf, EGL_BUFFER_SIZE);
> +      }
> +      swrastCreateDrawable(dri2_dpy, dri2_surf);
> +   }
> +
>      /* we always copy the back buffer to front */
>      dri2_surf->base.PostSubBufferSupportedNV = EGL_TRUE;
>
>



More information about the mesa-stable mailing list