Skip to content

egl: use device dispatch if at least one vendor suceeds

Ronan Pigott requested to merge brocellous/libglvnd:vendordev into master

Currently, in InitDeviceListInternal if any egl vendor fails to list its devices for any reason the construction of the device list is abandoned. That means that even if we have one vendor successfully serving the application, the failure of another vendor library will break any api calls related to egl devices.

Instead, if a vendor fails queryDevicesEXT the device mapping logic should proceed as if it listed no devices. If the relevant device belongs to the failed vendor then the dispatch will still fail with EGL_BAD_DEVICE.

My motivation for this change is that in wlroots there is this innocuous bit of code:

EGLAttrib device_attrib;
if (!egl->procs.eglQueryDisplayAttribEXT(egl->display, EGL_DEVICE_EXT, &device_attrib)) {
	wlr_log(WLR_ERROR, "eglQueryDisplayAttribEXT(EGL_DEVICE_EXT) failed");
	goto error;
}
egl->device = (EGLDeviceEXT)device_attrib;

device_exts_str = egl->procs.eglQueryDeviceStringEXT(egl->device, EGL_EXTENSIONS);
if (device_exts_str == NULL) {
	wlr_log(WLR_ERROR, "eglQueryDeviceStringEXT(EGL_EXTENSIONS) failed");
	goto error;
}

I have both the mesa and nvidia egl vendor libraries installed on my machine and, for whatever reason, the nvidia egl library returns failure on eglQueryDevicesEXT. I wouldn't expect this to be a problem but because of the issue described above it causes the compositor to fail in eglQueryDeviceString, even when it does not use (or does not intend to use) the nvidia device. With this change, the dispatch succeeds with the mesa device passed to the call.

Edited by Ronan Pigott

Merge request reports