[mutter] renderer/native: Debug for primary copy mode



commit a95644dbdc9c9488362cf6698592f4dfb40e309a
Author: Pekka Paalanen <pekka paalanen collabora com>
Date:   Fri Jul 5 14:09:31 2019 +0300

    renderer/native: Debug for primary copy mode
    
    COPY_MODE_PRIMARY has two paths, automatically chosen. For debugging purposes,
    e.g. why is my DisplayLink screen slowing down the whole desktop, it will be
    useful to know which copy path is taken. Debug prints are added to both when
    the primary GPU copy succeeds the first time and when it fails the first time.
    
    This is not the full truth, because theoretically the success/failure could
    change every frame, but we don't want to spam the logs (even in debug mode)
    every frame. In practise, it should be rare for the success or failure to ever
    change. Hence, saying what happened on the first time is enough. This does
    indicate if it ever changes even once, too, so we know if that unexpected thing
    happens.
    
    The debug prints are per secondary GPU since there could be several.
    
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/615

 src/backends/native/meta-renderer-native.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
---
diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c
index d2aba0ce9..46dba6775 100644
--- a/src/backends/native/meta-renderer-native.c
+++ b/src/backends/native/meta-renderer-native.c
@@ -169,6 +169,9 @@ typedef struct _MetaOnscreenNativeSecondaryGpuState
   } cpu;
 
   int pending_flips;
+
+  gboolean noted_primary_gpu_copy_ok;
+  gboolean noted_primary_gpu_copy_failed;
 } MetaOnscreenNativeSecondaryGpuState;
 
 typedef struct _MetaOnscreenNative
@@ -2097,10 +2100,23 @@ update_secondary_gpu_state_pre_swap_buffers (CoglOnscreen *onscreen)
           if (!copy_shared_framebuffer_primary_gpu (onscreen,
                                                     secondary_gpu_state))
             {
+              if (!secondary_gpu_state->noted_primary_gpu_copy_failed)
+                {
+                  g_debug ("Using primary GPU to copy for %s failed once.",
+                           meta_gpu_kms_get_file_path (secondary_gpu_state->gpu_kms));
+                  secondary_gpu_state->noted_primary_gpu_copy_failed = TRUE;
+                }
+
               copy_shared_framebuffer_cpu (onscreen,
                                            secondary_gpu_state,
                                            renderer_gpu_data);
             }
+          else if (!secondary_gpu_state->noted_primary_gpu_copy_ok)
+            {
+              g_debug ("Using primary GPU to copy for %s succeeded once.",
+                       meta_gpu_kms_get_file_path (secondary_gpu_state->gpu_kms));
+              secondary_gpu_state->noted_primary_gpu_copy_ok = TRUE;
+            }
           break;
         }
     }


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