kathenas / rpms / mutter

Forked from rpms/mutter 5 years ago
Clone

Blame SOURCES/0001-renderer-native-Choose-first-EGL-config-for-non-GBM-.patch

776610
From c647bd7807d90d6b268aecc02f51ee5df1692684 Mon Sep 17 00:00:00 2001
776610
From: "Miguel A. Vico" <mvicomoya@nvidia.com>
776610
Date: Thu, 7 Jun 2018 23:29:44 +0000
776610
Subject: [PATCH] renderer/native: Choose first EGL config for non-GBM backends
776610
776610
Commit 712ec30cd9be1f180c3789e7e6a042c5f7b5781d added the logic to only
776610
choose EGL configs that match the GBM_FORMAT_XRGB8888 pixel format.
776610
However, there won't be any EGL config satisfying such criteria for
776610
non-GBM backends, such as EGLDevice.
776610
776610
This change will let us choose the first EGL config for the EGLDevice
776610
backend, while still forcing GBM_FORMAT_XRGB8888 configs for the GBM
776610
one.
776610
776610
Related to: https://gitlab.gnome.org/GNOME/mutter/issues/2
776610
776610
776610
(cherry picked from commit 1bf2eb95b502ed0419b0fe8979c022cacaf79e84)
776610
---
776610
 src/backends/native/meta-renderer-native.c | 65 ++++++++++++++++------
776610
 1 file changed, 48 insertions(+), 17 deletions(-)
776610
776610
diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c
776610
index 250a6b6c1..d0da98f74 100644
776610
--- a/src/backends/native/meta-renderer-native.c
776610
+++ b/src/backends/native/meta-renderer-native.c
776610
@@ -993,14 +993,29 @@ meta_renderer_native_choose_egl_config (CoglDisplay  *cogl_display,
776610
   CoglRendererEGL *cogl_renderer_egl = cogl_renderer->winsys;
776610
   MetaBackend *backend = meta_get_backend ();
776610
   MetaEgl *egl = meta_backend_get_egl (backend);
776610
+  MetaRendererNativeGpuData *renderer_gpu_data = cogl_renderer_egl->platform;
776610
   EGLDisplay egl_display = cogl_renderer_egl->edpy;
776610
 
776610
-  return choose_egl_config_from_gbm_format (egl,
776610
-                                            egl_display,
776610
-                                            attributes,
776610
-                                            GBM_FORMAT_XRGB8888,
776610
-                                            out_config,
776610
-                                            error);
776610
+  switch (renderer_gpu_data->mode)
776610
+    {
776610
+    case META_RENDERER_NATIVE_MODE_GBM:
776610
+      return choose_egl_config_from_gbm_format (egl,
776610
+                                                egl_display,
776610
+                                                attributes,
776610
+                                                GBM_FORMAT_XRGB8888,
776610
+                                                out_config,
776610
+                                                error);
776610
+#ifdef HAVE_EGL_DEVICE
776610
+    case META_RENDERER_NATIVE_MODE_EGL_DEVICE:
776610
+      return meta_egl_choose_first_config (egl,
776610
+                                           egl_display,
776610
+                                           attributes,
776610
+                                           out_config,
776610
+                                           error);
776610
+#endif
776610
+    }
776610
+
776610
+  return FALSE;
776610
 }
776610
 
776610
 static gboolean
776610
@@ -2923,10 +2938,11 @@ meta_renderer_native_set_property (GObject      *object,
776610
 }
776610
 
776610
 static gboolean
776610
-create_secondary_egl_config (MetaEgl   *egl,
776610
-                             EGLDisplay egl_display,
776610
-                             EGLConfig *egl_config,
776610
-                             GError   **error)
776610
+create_secondary_egl_config (MetaEgl               *egl,
776610
+                             MetaRendererNativeMode mode,
776610
+                             EGLDisplay             egl_display,
776610
+                             EGLConfig             *egl_config,
776610
+                             GError               **error)
776610
 {
776610
   EGLint attributes[] = {
776610
     EGL_RED_SIZE, 1,
776610
@@ -2939,12 +2955,26 @@ create_secondary_egl_config (MetaEgl   *egl,
776610
     EGL_NONE
776610
   };
776610
 
776610
-  return choose_egl_config_from_gbm_format (egl,
776610
-                                            egl_display,
776610
-                                            attributes,
776610
-                                            GBM_FORMAT_XRGB8888,
776610
-                                            egl_config,
776610
-                                            error);
776610
+  switch (mode)
776610
+    {
776610
+    case META_RENDERER_NATIVE_MODE_GBM:
776610
+      return choose_egl_config_from_gbm_format (egl,
776610
+                                                egl_display,
776610
+                                                attributes,
776610
+                                                GBM_FORMAT_XRGB8888,
776610
+                                                egl_config,
776610
+                                                error);
776610
+#ifdef HAVE_EGL_DEVICE
776610
+    case META_RENDERER_NATIVE_MODE_EGL_DEVICE:
776610
+      return meta_egl_choose_first_config (egl,
776610
+                                           egl_display,
776610
+                                           attributes,
776610
+                                           egl_config,
776610
+                                           error);
776610
+#endif
776610
+    }
776610
+
776610
+  return FALSE;
776610
 }
776610
 
776610
 static EGLContext
776610
@@ -2988,7 +3018,8 @@ init_secondary_gpu_data_gpu (MetaRendererNativeGpuData *renderer_gpu_data,
776610
   EGLContext egl_context;
776610
   char **missing_gl_extensions;
776610
 
776610
-  if (!create_secondary_egl_config (egl,egl_display, &egl_config, error))
776610
+  if (!create_secondary_egl_config (egl, renderer_gpu_data->mode, egl_display,
776610
+                                    &egl_config, error))
776610
     return FALSE;
776610
 
776610
   egl_context = create_secondary_egl_context (egl, egl_display, egl_config, error);
776610
-- 
776610
2.19.1
776610