[Mesa-dev] [PATCH] egl: check if colorspace/surface type is supported

Tapani Pälli tapani.palli at intel.com
Wed May 2 06:18:31 UTC 2018


We will need to handle this on other backends as well, dri2 and wayland 
at least would stumble to same issue, maybe fix them all in one go? 
Looks like android, surfaceless and drm backends check the returned 
config already.

On 04/30/2018 02:51 PM, Juan A. Suarez Romero wrote:
> According to EGL 1.4 spec, section 3.5.1 ("Creating On-Screen Rendering
> Surfaces"), if config does not support the colorspace or alpha format
> attributes specified in attrib_list (as defined for
> eglCreateWindowSurface), an EGL_BAD_MATCH error is generated.
> 
> This fixes dEQP-EGL.functional.wide_color.*_888_colorspace_srgb (still
> not merged,
> https://android-review.googlesource.com/c/platform/external/deqp/+/667322),
> which is crashing when trying to create a windows surface with RGB888
> configuration and sRGB colorspace.
> ---
>   src/egl/drivers/dri2/platform_x11_dri3.c | 5 +++++
>   1 file changed, 5 insertions(+)
> 
> diff --git a/src/egl/drivers/dri2/platform_x11_dri3.c b/src/egl/drivers/dri2/platform_x11_dri3.c
> index a41e40156df..5cb6d65c0a3 100644
> --- a/src/egl/drivers/dri2/platform_x11_dri3.c
> +++ b/src/egl/drivers/dri2/platform_x11_dri3.c
> @@ -183,6 +183,11 @@ dri3_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
>      dri_config = dri2_get_dri_config(dri2_conf, type,
>                                       dri3_surf->surf.base.GLColorspace);
>   
> +   if (!dri_config) {
> +      _eglError(EGL_BAD_MATCH, "Unsupported surfacetype/colorspace configuration");
> +      goto cleanup_pixmap;
> +   }
> +
>      if (loader_dri3_drawable_init(dri2_dpy->conn, drawable,
>                                    dri2_dpy->dri_screen,
>                                    dri2_dpy->is_different_gpu,
> 


More information about the mesa-dev mailing list