[Experimental] [WIP] Wayland/EGL: Auto-detect GPUs with EGL_EXT_device_enumeration #88516
+299
−349
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #88364.
NOTE: This has been very lightly tested as I can't get my hands on a multi-GPU setup
This is based on the approach (and probing code) proposed by @hpvb, with a bunch of changes.
In short, we use the new
EGL_EXT_device_enumeration
(and all of its various dependencies) to select and probe the various graphics cards a system offers. This has the advantage of giving us greater control and predictability compared toDRI_PRIME
.With this, we should also be able to probe for whether a device is DRM backed1 or just a software rasterizer2, although this is not yet plumbed in.
Note that, unlike the old
DRI_PRIME
approach, we can't fork to avoid driver crashes like we did there as the device handles are not guaranteed to be consistent (nor in the same order) between invocations, although I got guaranteed that this is not supposed to happen, not even on proprietary drivers3 (perhaps things just got better?)This approach is currently only implemented in the Wayland backend, although everything has been done into the generic
EGLManager
. We also embed the vendor priority map into theOS_LinuxBSD
class so that it can be shared with other code, such as the GLX prober.Marking as WIP as there are some things missing or unsure (HW/SW detection, a way to disable this thing) and because I couldn't test this to its fullest extent.
Footnotes
EGL_EXT_device_drm ↩
EGL_MESA_device_software ↩
https://oftc.irclog.whitequark.org/dri-devel/2024-02-10#32912345 ↩