Blame SOURCES/0004-renderer-native-Allow-forcing-EGLStream-backend.patch

5c9faf
From 4c23158f81c3c4b91353150fd4c28246ce1e692f Mon Sep 17 00:00:00 2001
5c9faf
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
5c9faf
Date: Fri, 3 Dec 2021 11:07:00 +0100
5c9faf
Subject: [PATCH 4/5] renderer/native: Allow forcing EGLStream backend
5c9faf
5c9faf
The GBM support in the NVIDIA driver is fairly new, and to make it
5c9faf
easier to identify whether a problem encountered is related to using GBM
5c9faf
instead of EGLStreams, add a debug environment variable to force using
5c9faf
EGLStream instead of GBM.
5c9faf
5c9faf
To force using EGLStream instead of GBM, use
5c9faf
5c9faf
    MUTTER_DEBUG_FORCE_EGL_STREAM=1
5c9faf
5c9faf
Related: https://gitlab.gnome.org/GNOME/mutter/-/issues/2045
5c9faf
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2132>
5c9faf
(cherry picked from commit d43cc776ef733251fc02e8e62669ea4ba7e68e2c)
5c9faf
---
5c9faf
 src/backends/native/meta-renderer-native.c | 26 ++++++++++++++++------
5c9faf
 1 file changed, 19 insertions(+), 7 deletions(-)
5c9faf
5c9faf
diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c
5c9faf
index e7460fbf1..0cd7a27d6 100644
5c9faf
--- a/src/backends/native/meta-renderer-native.c
5c9faf
+++ b/src/backends/native/meta-renderer-native.c
5c9faf
@@ -1765,7 +1765,7 @@ meta_renderer_native_create_renderer_gpu_data (MetaRendererNative  *renderer_nat
5c9faf
                                                MetaGpuKms          *gpu_kms,
5c9faf
                                                GError             **error)
5c9faf
 {
5c9faf
-  MetaRendererNativeGpuData *gbm_renderer_gpu_data;
5c9faf
+  MetaRendererNativeGpuData *gbm_renderer_gpu_data = NULL;
5c9faf
   GError *gbm_error = NULL;
5c9faf
 #ifdef HAVE_EGL_DEVICE
5c9faf
   MetaRendererNativeGpuData *egl_stream_renderer_gpu_data;
5c9faf
@@ -1775,14 +1775,26 @@ meta_renderer_native_create_renderer_gpu_data (MetaRendererNative  *renderer_nat
5c9faf
   if (!gpu_kms)
5c9faf
     return create_renderer_gpu_data_surfaceless (renderer_native, error);
5c9faf
 
5c9faf
-  gbm_renderer_gpu_data = create_renderer_gpu_data_gbm (renderer_native,
5c9faf
-                                                        gpu_kms,
5c9faf
-                                                        &gbm_error);
5c9faf
-  if (gbm_renderer_gpu_data)
5c9faf
+#ifdef HAVE_EGL_DEVICE
5c9faf
+  if (g_strcmp0 (getenv ("MUTTER_DEBUG_FORCE_EGL_STREAM"), "1") != 0)
5c9faf
+#endif
5c9faf
+    {
5c9faf
+      gbm_renderer_gpu_data = create_renderer_gpu_data_gbm (renderer_native,
5c9faf
+                                                            gpu_kms,
5c9faf
+                                                            &gbm_error);
5c9faf
+      if (gbm_renderer_gpu_data)
5c9faf
+        {
5c9faf
+          if (gbm_renderer_gpu_data->secondary.is_hardware_rendering)
5c9faf
+            return gbm_renderer_gpu_data;
5c9faf
+        }
5c9faf
+    }
5c9faf
+#ifdef HAVE_EGL_DEVICE
5c9faf
+  else
5c9faf
     {
5c9faf
-      if (gbm_renderer_gpu_data->secondary.is_hardware_rendering)
5c9faf
-        return gbm_renderer_gpu_data;
5c9faf
+      g_set_error (&gbm_error, G_IO_ERROR, G_IO_ERROR_FAILED,
5c9faf
+                   "GBM backend was disabled using env var");
5c9faf
     }
5c9faf
+#endif
5c9faf
 
5c9faf
 #ifdef HAVE_EGL_DEVICE
5c9faf
   egl_stream_renderer_gpu_data =
5c9faf
-- 
5c9faf
2.35.1
5c9faf