backends/native: Add various cogl traces

Trace the time spent finishing a frame, posting KMS updates and some
other things.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/757
This commit is contained in:
Jonas Ådahl 2019-08-27 13:11:07 +03:00 committed by Georges Basile Stavracas Neto
parent 4ab483d991
commit ab1107973b
4 changed files with 39 additions and 0 deletions

View File

@ -43,6 +43,7 @@
#include "cogl-onscreen-template-private.h"
#include "cogl-egl.h"
#include "cogl-private.h"
#include "cogl-trace.h"
#include "winsys/cogl-winsys-egl-private.h"
#include "winsys/cogl-winsys-private.h"
@ -753,6 +754,9 @@ _cogl_winsys_onscreen_swap_buffers_with_damage (CoglOnscreen *onscreen,
CoglRendererEGL *egl_renderer = renderer->winsys;
CoglOnscreenEGL *egl_onscreen = onscreen->winsys;
COGL_TRACE_BEGIN_SCOPED (CoglOnscreenEGLSwapBuffersWithDamage,
"Onscreen (eglSwapBuffers)");
/* The specification for EGL (at least in 1.4) says that the surface
needs to be bound to the current context for the swap to work
although it may change in future. Mesa explicitly checks for this

View File

@ -59,6 +59,7 @@
#include "backends/native/meta-monitor-manager-kms.h"
#include "backends/native/meta-renderer-native.h"
#include "backends/native/meta-stage-native.h"
#include "cogl/cogl-trace.h"
#include "core/meta-border.h"
#include "meta/main.h"
@ -799,6 +800,9 @@ meta_backend_native_pause (MetaBackendNative *native)
MetaMonitorManagerKms *monitor_manager_kms =
META_MONITOR_MANAGER_KMS (monitor_manager);
COGL_TRACE_BEGIN_SCOPED (MetaBackendNativePause,
"Backend (pause)");
meta_device_manager_native_release_devices ();
clutter_stage_freeze_updates (stage);
@ -818,6 +822,9 @@ void meta_backend_native_resume (MetaBackendNative *native)
MetaInputSettings *input_settings;
MetaIdleMonitor *idle_monitor;
COGL_TRACE_BEGIN_SCOPED (MetaBackendNativeResume,
"Backend (resume)");
meta_monitor_manager_kms_resume (monitor_manager_kms);
connect_udev_device_added_handler (native);

View File

@ -27,6 +27,7 @@
#include "backends/native/meta-kms-impl-simple.h"
#include "backends/native/meta-kms-update-private.h"
#include "backends/native/meta-udev.h"
#include "cogl/cogl-trace.h"
/**
* SECTION:kms
@ -205,6 +206,9 @@ meta_kms_post_update_sync (MetaKms *kms,
{
meta_kms_update_seal (update);
COGL_TRACE_BEGIN_SCOPED (MetaKmsPostUpdateSync,
"KMS (post update)");
return meta_kms_run_impl_task_sync (kms,
meta_kms_update_process_in_impl,
update,
@ -441,6 +445,9 @@ meta_kms_update_states_in_impl (MetaKms *kms)
{
GList *l;
COGL_TRACE_BEGIN_SCOPED (MetaKmsUpdateStates,
"KMS (update states)");
meta_assert_in_kms_impl (kms);
for (l = kms->devices; l; l = l->next)

View File

@ -1666,6 +1666,9 @@ meta_onscreen_native_set_crtc_modes (CoglOnscreen *onscreen,
MetaLogicalMonitor *logical_monitor;
SetCrtcModeData data;
COGL_TRACE_BEGIN_SCOPED (MetaOnscreenNativeSetCrtcModes,
"Onscreen (set CRTC modes)");
logical_monitor = meta_renderer_view_get_logical_monitor (view);
data = (SetCrtcModeData) {
.renderer_gpu_data = renderer_gpu_data,
@ -1709,6 +1712,9 @@ meta_onscreen_native_flip_crtcs (CoglOnscreen *onscreen,
MetaPowerSave power_save_mode;
MetaLogicalMonitor *logical_monitor;
COGL_TRACE_BEGIN_SCOPED (MetaOnscreenNativeFlipCrtcs,
"Onscreen (flip CRTCs)");
power_save_mode = meta_monitor_manager_get_power_save_mode (monitor_manager);
if (power_save_mode == META_POWER_SAVE_ON)
{
@ -2086,6 +2092,9 @@ update_secondary_gpu_state_pre_swap_buffers (CoglOnscreen *onscreen)
GHashTableIter iter;
MetaOnscreenNativeSecondaryGpuState *secondary_gpu_state;
COGL_TRACE_BEGIN_SCOPED (MetaRendererNativeGpuStatePreSwapBuffers,
"Onscreen (secondary gpu pre-swap-buffers)");
g_hash_table_iter_init (&iter, onscreen_native->secondary_gpu_states);
while (g_hash_table_iter_next (&iter,
NULL,
@ -2135,6 +2144,9 @@ update_secondary_gpu_state_post_swap_buffers (CoglOnscreen *onscreen,
GHashTableIter iter;
MetaOnscreenNativeSecondaryGpuState *secondary_gpu_state;
COGL_TRACE_BEGIN_SCOPED (MetaRendererNativeGpuStatePostSwapBuffers,
"Onscreen (secondary gpu post-swap-buffers)");
g_hash_table_iter_init (&iter, onscreen_native->secondary_gpu_states);
while (g_hash_table_iter_next (&iter,
NULL,
@ -2186,13 +2198,19 @@ meta_onscreen_native_swap_buffers_with_damage (CoglOnscreen *onscreen,
g_autoptr (GError) error = NULL;
MetaDrmBufferGbm *buffer_gbm;
COGL_TRACE_BEGIN_SCOPED (MetaRendererNativeSwapBuffers,
"Onscreen (swap-buffers)");
kms_update = meta_kms_ensure_pending_update (kms);
/*
* Wait for the flip callback before continuing, as we might have started the
* animation earlier due to the animation being driven by some other monitor.
*/
COGL_TRACE_BEGIN (MetaRendererNativeSwapBuffersWait,
"Onscreen (waiting for page flips");
wait_for_pending_flips (onscreen);
COGL_TRACE_END (MetaRendererNativeSwapBuffersWait);
frame_info = g_queue_peek_tail (&onscreen->pending_frame_infos);
frame_info->global_frame_counter = renderer_native->frame_counter;
@ -2257,11 +2275,14 @@ meta_onscreen_native_swap_buffers_with_damage (CoglOnscreen *onscreen,
if (egl_context_changed)
_cogl_winsys_egl_ensure_current (cogl_display);
COGL_TRACE_BEGIN (MetaRendererNativePostKmsUpdate,
"Onscreen (post pending update");
if (!meta_kms_post_pending_update_sync (kms, &error))
{
if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED))
g_warning ("Failed to post KMS update: %s", error->message);
}
COGL_TRACE_END (MetaRendererNativePostKmsUpdate);
}
static gboolean