egl/drm: get compatible render-only device fd for kms-only device
authorLeandro Ribeiro <leandro.ribeiro@collabora.com>
Mon, 4 Sep 2023 16:53:12 +0000 (13:53 -0300)
committerMarge Bot <emma+marge@anholt.net>
Tue, 17 Oct 2023 20:31:13 +0000 (20:31 +0000)
commit88c03ddd345fe6b0cd16c11cb5c5309f8d7d16ff
tree1721699b53ccefeecb247d04400382c3c86ed21b
parente10d8cd5dd2bd1ea5a0475d0c2160255f94643c1
egl/drm: get compatible render-only device fd for kms-only device

Things have been working by accident for split display/render SoCs when
using the GBM platform.

The device fd given to the GBM platform may be associated with a
KMS-only device, so _eglFindDevice() should find nothing (because the
global EGLDevice list only has render-capable devices). The only thing
making it work is that we don't error out when we go through the
EGLDevice list and can't find the device we are looking for. We simply
return the last EGLDevice from the list.

This patch fixes that. Now we look for a compatible render-only device
for the KMS-only in the GBM platform.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24825>
src/egl/drivers/dri2/platform_drm.c