egl: fix EGL_EXT_device_drm_render_node for split display/render SoCs
In !11797 (merged),
EGL_EXT_device_drm_render_node
support was added. But it still does not work
for split display/render SoCs.
Let's say that we have a Wayland compositor, and it uses gbm_create_device()
passing the KMS device that it wants to use as output. Then it creates an EGLDisplay from the GBM device in order to render using the GPU.
The problem is that in this case (split display/render SoCs), KMSRO magically finds the device under the hood. The compositor can use EGL_EXT_device_drm_render_node
to query the GPU device, but it will receive the KMS device instead.
In order to fix this, the solution we've tried !12796 (closed), which basically gets the GPU node from KMSRO. But it brings problems that we can't avoid:
- we mutate the EGLDevice across the
eglInitalize()
boundary, or - we provide different EGLDevice details based on which is executed first -
eglQueryDevicesEXT()
oreglInitialize()
In order to fix this properly (without the issue described above), we need somehow to have the information of what KMS device is related to what render device before we create the EGLDevice global list.
Talking to @xexaxo I've found out that he had already proposed some sort of KMS device <> render device mapping in src/loader
using PCI ID's (before KMSRO was even implemented). This could be used by EGL and by KMKSRO itself, as the current approach seems to depend on driver probe order and is not deterministic as the mapping would be.
So I've decided to write this in order to discuss the possibility of having this mapping logic.