[mutter/wip/rstrode/rhel-8.0.0: 12/30] renderer/native: fall back to CPU copy mode if GPU blit fails



commit 669f4c0a004a4e75300d1edf93bf97f0b6192b53
Author: Ray Strode <rstrode redhat com>
Date:   Wed Jan 16 16:01:27 2019 -0500

    renderer/native: fall back to CPU copy mode if GPU blit fails
    
    In multi-gpu setups, we currently try to blit the rendered output
    from the primary GPU to the GPU handling secondary monitors.
    
    This technique only works in cases where both cards use open source
    drivers.
    
    The code tries to detect if the technique will work up front by
    seeing GBM initializes okay. In the event, blits are determined
    unavailable, the code falls back to copying the rendered
    output through host memory.
    
    The determination on whether or not blits is available hinges on
    whether or not GBM initializes successfully.
    
    Unfortunately, these days GBM will initialize successfully even
    when blits aren't available, since it falls back to using software
    renderering.
    
    This commit addresses the problem by waiting until the blit fails,
    and forcing CPU copies from that point forward.

 src/backends/native/meta-renderer-native.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
---
diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c
index a19fcef2a..b3fdaf647 100644
--- a/src/backends/native/meta-renderer-native.c
+++ b/src/backends/native/meta-renderer-native.c
@@ -1747,7 +1747,19 @@ copy_shared_framebuffer_gpu (CoglOnscreen                        *onscreen,
                                                   &error))
     {
       g_warning ("Failed to blit shared framebuffer: %s", error->message);
-      g_error_free (error);
+      g_clear_error (&error);
+
+      renderer_gpu_data->secondary.copy_mode = META_SHARED_FRAMEBUFFER_COPY_MODE_CPU;
+
+      if (!init_secondary_gpu_state_cpu_copy_mode (renderer_native, onscreen,
+                                                   renderer_gpu_data,
+                                                   secondary_gpu_state->gpu_kms,
+                                                   &error))
+        {
+          g_warning ("Failed to fall back to CPU copy mode: %s", error->message);
+          g_error_free (error);
+        }
+
       return;
     }
 


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