[mutter] MetaRendererNative: Give EGLDevice backend priority over GBM



commit 7eea82d3d7c0b23740890ff8969de4853904acd1
Author: Miguel A. Vico <mvicomoya nvidia com>
Date:   Tue Jun 27 18:31:48 2017 -0700

    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

 src/backends/native/meta-renderer-native.c |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c
index 9aad373..93d76cd 100644
--- a/src/backends/native/meta-renderer-native.c
+++ b/src/backends/native/meta-renderer-native.c
@@ -2070,16 +2070,21 @@ meta_renderer_native_initable_init (GInitable     *initable,
   GError *egl_device_error = NULL;
 #endif
 
-  if (init_gbm (renderer_native, &gbm_error))
-    return TRUE;
-
 #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))
+    return TRUE;
+#endif
+
+  if (init_gbm (renderer_native, &gbm_error))
     {
-      g_error_free (gbm_error);
+      g_error_free (egl_device_error);
       return TRUE;
     }
-#endif
 
   g_set_error (error, G_IO_ERROR,
                G_IO_ERROR_FAILED,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]