MetaRendererNative: Give EGLDevice backend priority over GBM

With GLVND, whenever we have both Mesa's and NVIDIA's drives installed
in the system, initializing the GBM backend will always succeed,
regardless of what GPU you have on your system.

This is due to GBM's software rendering fallback.

It seems better to initialize the EGLDevice backend first, which will
fail to find a device match when given a non-NVIDIA GPU.

https://bugzilla.gnome.org/show_bug.cgi?id=784272
This commit is contained in:
Miguel A. Vico 2017-06-27 18:31:48 -07:00 committed by Jonas Ådahl
parent 80e5955918
commit 7eea82d3d7

View File

@ -2070,16 +2070,21 @@ meta_renderer_native_initable_init (GInitable *initable,
GError *egl_device_error = NULL; GError *egl_device_error = NULL;
#endif #endif
if (init_gbm (renderer_native, &gbm_error))
return TRUE;
#ifdef HAVE_EGL_DEVICE #ifdef HAVE_EGL_DEVICE
/* Try to initialize the EGLDevice backend first. Whenever we use a
* non-NVIDIA GPU, the EGLDevice enumeration function won't find a match, and
* we'll fall back to GBM (which will always succeed as it has a software
* rendering fallback)
*/
if (init_egl_device (renderer_native, &egl_device_error)) if (init_egl_device (renderer_native, &egl_device_error))
return TRUE;
#endif
if (init_gbm (renderer_native, &gbm_error))
{ {
g_error_free (gbm_error); g_error_free (egl_device_error);
return TRUE; return TRUE;
} }
#endif
g_set_error (error, G_IO_ERROR, g_set_error (error, G_IO_ERROR,
G_IO_ERROR_FAILED, G_IO_ERROR_FAILED,