[mutter] backends/native: Don't use software renderer for GPU copy



commit b76bf200923cbc2556a63439529f24e97f587bf3
Author: Emilio Pozuelo Monfort <emilio pozuelo collabora co uk>
Date:   Tue Oct 23 10:09:22 2018 +0200

    backends/native: Don't use software renderer for GPU copy
    
    If the GPU copy path would use a software renderer, fall back to the CPU
    copy path. The CPU copy path is possibly faster and avoids screen
    corruption issues that were observed on an Intel Haswell desktop. The
    corruption was likely due to texturing from an unfinished rendering or
    memory caching issues.
    
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/325

 src/backends/native/meta-renderer-native.c | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)
---
diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c
index 2c60c7c59..3b293f202 100644
--- a/src/backends/native/meta-renderer-native.c
+++ b/src/backends/native/meta-renderer-native.c
@@ -3364,7 +3364,6 @@ init_secondary_gpu_data_gpu (MetaRendererNativeGpuData *renderer_gpu_data,
   EGLContext egl_context;
   const char **missing_gl_extensions;
   const char *renderer_str;
-  gboolean is_hardware;
 
   if (!create_secondary_egl_config (egl, renderer_gpu_data->mode, egl_display,
                                     &egl_config, error))
@@ -3391,9 +3390,19 @@ init_secondary_gpu_data_gpu (MetaRendererNativeGpuData *renderer_gpu_data,
   if (g_str_has_prefix (renderer_str, "llvmpipe") ||
       g_str_has_prefix (renderer_str, "softpipe") ||
       g_str_has_prefix (renderer_str, "swrast"))
-    is_hardware = FALSE;
-  else
-    is_hardware = TRUE;
+    {
+      meta_egl_make_current (egl,
+                             egl_display,
+                             EGL_NO_SURFACE,
+                             EGL_NO_SURFACE,
+                             EGL_NO_CONTEXT,
+                             NULL);
+      meta_egl_destroy_context (egl, egl_display, egl_context, NULL);
+      g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+                   "Do not want to use software renderer (%s), falling back to CPU copy path",
+                   renderer_str);
+      return FALSE;
+    }
 
   if (!meta_gles3_has_extensions (renderer_native->gles3,
                                   &missing_gl_extensions,
@@ -3411,7 +3420,7 @@ init_secondary_gpu_data_gpu (MetaRendererNativeGpuData *renderer_gpu_data,
       g_free (missing_gl_extensions);
     }
 
-  renderer_gpu_data->secondary.is_hardware_rendering = is_hardware;
+  renderer_gpu_data->secondary.is_hardware_rendering = TRUE;
   renderer_gpu_data->secondary.egl_context = egl_context;
   renderer_gpu_data->secondary.egl_config = egl_config;
   renderer_gpu_data->secondary.copy_mode = META_SHARED_FRAMEBUFFER_COPY_MODE_GPU;


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