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
This commit is contained in:
Pekka Paalanen 2019-07-05 14:09:31 +03:00 committed by Jonas Ådahl
parent 720f363241
commit a95644dbdc

View File

@ -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;
}
}