egl/gbm: Ensure EGLConfigs match GBM surface format
authorDaniel Stone <daniels@collabora.com>
Tue, 6 Feb 2018 17:59:05 +0000 (17:59 +0000)
committerDaniel Stone <daniels@collabora.com>
Fri, 9 Feb 2018 16:17:16 +0000 (16:17 +0000)
commit37a8d907cc167279f44e2e15f980cd93869a51f9
tree1f8dcfc116c45b109c35aa5d2c033a76948c9055
parent8174e5b49e96a98a585b13074d6f1a68e70629d7
egl/gbm: Ensure EGLConfigs match GBM surface format

When we create an EGL window surface on a GBM surface, ensure that the
EGLConfig is compatible with the GBM format, notwithstanding XRGB/ARGB
interchange.

For example, rendering with an XRGB8888 EGLConfig on to an ARGB8888
gbm_surface (and vice-versa) are acceptable, but rendering with an
XRGB2101010 EGLConfig on to an XRGB8888 gbm_surface will now be
rejected.

This was previously allowed through; when 10bpc formats were enabled,
clients which picked a completely random EGL config and hoped/assumed
they were XRGB8888 would break.

If you have bisected a failure to start a GBM/KMS client to this commit,
please look at its EGLConfig selection (e.g. through eglChooseConfigs),
and add an EGL_NATIVE_VISUAL_ID == gbm_surface format match to the
attribs for config selection.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Tested-by: Ilia Mirkin <imirkin@alum.mit.edu>
src/egl/drivers/dri2/platform_drm.c