|
|
1e895f |
From 425710866438a62843b96272a6cbc6c22174f10c Mon Sep 17 00:00:00 2001
|
|
|
1e895f |
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
|
|
1e895f |
Date: Mon, 11 Oct 2021 10:39:43 +0200
|
|
|
1e895f |
Subject: [PATCH 2/5] renderer/native: Try the gbm renderer before the
|
|
|
1e895f |
EGLDevice renderer
|
|
|
1e895f |
|
|
|
1e895f |
This switches the order of what renderer mode is tried first, so that
|
|
|
1e895f |
the gbm renderer mode is preferred on an NVIDIA driver where it is
|
|
|
1e895f |
supported.
|
|
|
1e895f |
|
|
|
1e895f |
We fall back to still try the EGLDevice renderer mode if the created gbm
|
|
|
1e895f |
renderer is not hardware accelerated.
|
|
|
1e895f |
|
|
|
1e895f |
The last fallback is still to use the gbm renderer, even if it is not
|
|
|
1e895f |
hardware accelerated, as this is needed when hardware acceleration isn't
|
|
|
1e895f |
available at all. The original reason for the old order was due to the
|
|
|
1e895f |
fact that a gbm renderer without hardware acceleration would succeed
|
|
|
1e895f |
even on NVIDIA driver that didn't support gbm.
|
|
|
1e895f |
|
|
|
1e895f |
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2051>
|
|
|
1e895f |
(cherry picked from commit 8fc1325e8e713dfa05a12c47e6e981e50d3cda61)
|
|
|
1e895f |
---
|
|
|
1e895f |
src/backends/native/meta-renderer-native.c | 44 +++++++++++-----------
|
|
|
1e895f |
1 file changed, 23 insertions(+), 21 deletions(-)
|
|
|
1e895f |
|
|
|
1e895f |
diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c
|
|
|
1e895f |
index f92f648e5..c851619a1 100644
|
|
|
1e895f |
--- a/src/backends/native/meta-renderer-native.c
|
|
|
1e895f |
+++ b/src/backends/native/meta-renderer-native.c
|
|
|
1e895f |
@@ -1754,38 +1754,40 @@ meta_renderer_native_create_renderer_gpu_data (MetaRendererNative *renderer_nat
|
|
|
1e895f |
MetaGpuKms *gpu_kms,
|
|
|
1e895f |
GError **error)
|
|
|
1e895f |
{
|
|
|
1e895f |
- MetaRendererNativeGpuData *renderer_gpu_data;
|
|
|
1e895f |
+ MetaRendererNativeGpuData *gbm_renderer_gpu_data;
|
|
|
1e895f |
GError *gbm_error = NULL;
|
|
|
1e895f |
#ifdef HAVE_EGL_DEVICE
|
|
|
1e895f |
+ MetaRendererNativeGpuData *egl_stream_renderer_gpu_data;
|
|
|
1e895f |
GError *egl_device_error = NULL;
|
|
|
1e895f |
#endif
|
|
|
1e895f |
|
|
|
1e895f |
if (!gpu_kms)
|
|
|
1e895f |
return create_renderer_gpu_data_surfaceless (renderer_native, error);
|
|
|
1e895f |
|
|
|
1e895f |
-#ifdef HAVE_EGL_DEVICE
|
|
|
1e895f |
- /* Try to initialize the EGLDevice backend first. Whenever we use a
|
|
|
1e895f |
- * non-NVIDIA GPU, the EGLDevice enumeration function won't find a match, and
|
|
|
1e895f |
- * we'll fall back to GBM (which will always succeed as it has a software
|
|
|
1e895f |
- * rendering fallback)
|
|
|
1e895f |
- */
|
|
|
1e895f |
- renderer_gpu_data = create_renderer_gpu_data_egl_device (renderer_native,
|
|
|
1e895f |
- gpu_kms,
|
|
|
1e895f |
- &egl_device_error);
|
|
|
1e895f |
- if (renderer_gpu_data)
|
|
|
1e895f |
- return renderer_gpu_data;
|
|
|
1e895f |
-#endif
|
|
|
1e895f |
-
|
|
|
1e895f |
- renderer_gpu_data = create_renderer_gpu_data_gbm (renderer_native,
|
|
|
1e895f |
- gpu_kms,
|
|
|
1e895f |
- &gbm_error);
|
|
|
1e895f |
- if (renderer_gpu_data)
|
|
|
1e895f |
+ gbm_renderer_gpu_data = create_renderer_gpu_data_gbm (renderer_native,
|
|
|
1e895f |
+ gpu_kms,
|
|
|
1e895f |
+ &gbm_error);
|
|
|
1e895f |
+ if (gbm_renderer_gpu_data)
|
|
|
1e895f |
{
|
|
|
1e895f |
+ if (gbm_renderer_gpu_data->secondary.is_hardware_rendering)
|
|
|
1e895f |
+ return gbm_renderer_gpu_data;
|
|
|
1e895f |
+ }
|
|
|
1e895f |
+
|
|
|
1e895f |
#ifdef HAVE_EGL_DEVICE
|
|
|
1e895f |
- g_error_free (egl_device_error);
|
|
|
1e895f |
-#endif
|
|
|
1e895f |
- return renderer_gpu_data;
|
|
|
1e895f |
+ egl_stream_renderer_gpu_data =
|
|
|
1e895f |
+ create_renderer_gpu_data_egl_device (renderer_native,
|
|
|
1e895f |
+ gpu_kms,
|
|
|
1e895f |
+ &egl_device_error);
|
|
|
1e895f |
+ if (egl_stream_renderer_gpu_data)
|
|
|
1e895f |
+ {
|
|
|
1e895f |
+ g_clear_pointer (&gbm_renderer_gpu_data,
|
|
|
1e895f |
+ meta_renderer_native_gpu_data_free);
|
|
|
1e895f |
+ return egl_stream_renderer_gpu_data;
|
|
|
1e895f |
}
|
|
|
1e895f |
+#endif
|
|
|
1e895f |
+
|
|
|
1e895f |
+ if (gbm_renderer_gpu_data)
|
|
|
1e895f |
+ return gbm_renderer_gpu_data;
|
|
|
1e895f |
|
|
|
1e895f |
g_set_error (error, G_IO_ERROR,
|
|
|
1e895f |
G_IO_ERROR_FAILED,
|
|
|
1e895f |
--
|
|
|
1e895f |
2.35.1
|
|
|
1e895f |
|