onscreen/native: Change some g_debug() meta_topic()

g_debug() is inconvenient to use; change to meta_topic() with the 'kms'
topic. This makes it possible to enable valuable debug output at
runtime.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1931>
This commit is contained in:
Jonas Ådahl 2021-07-15 09:00:45 +02:00
parent d057762cdb
commit a2937a47bb

View File

@ -34,6 +34,7 @@
#include "backends/meta-egl-ext.h" #include "backends/meta-egl-ext.h"
#include "backends/native/meta-cogl-utils.h" #include "backends/native/meta-cogl-utils.h"
#include "backends/native/meta-crtc-kms.h" #include "backends/native/meta-crtc-kms.h"
#include "backends/native/meta-device-pool.h"
#include "backends/native/meta-drm-buffer-dumb.h" #include "backends/native/meta-drm-buffer-dumb.h"
#include "backends/native/meta-drm-buffer-gbm.h" #include "backends/native/meta-drm-buffer-gbm.h"
#include "backends/native/meta-drm-buffer-import.h" #include "backends/native/meta-drm-buffer-import.h"
@ -577,8 +578,10 @@ import_shared_framebuffer (CoglOnscreen *onscreen,
&error); &error);
if (!buffer_import) if (!buffer_import)
{ {
g_debug ("Zero-copy disabled for %s, meta_drm_buffer_import_new failed: %s", meta_topic (META_DEBUG_KMS,
meta_gpu_kms_get_file_path (secondary_gpu_state->gpu_kms), "Zero-copy disabled for %s, "
"meta_drm_buffer_import_new failed: %s",
meta_device_file_get_path (device_file),
error->message); error->message);
g_warn_if_fail (secondary_gpu_state->import_status == g_warn_if_fail (secondary_gpu_state->import_status ==
@ -618,8 +621,9 @@ import_shared_framebuffer (CoglOnscreen *onscreen,
*/ */
secondary_gpu_release_dumb (secondary_gpu_state); secondary_gpu_release_dumb (secondary_gpu_state);
g_debug ("Using zero-copy for %s succeeded once.", meta_topic (META_DEBUG_KMS,
meta_gpu_kms_get_file_path (secondary_gpu_state->gpu_kms)); "Using zero-copy for %s succeeded once.",
meta_device_file_get_path (device_file));
} }
secondary_gpu_state->import_status = secondary_gpu_state->import_status =
@ -766,7 +770,8 @@ copy_shared_framebuffer_primary_gpu (CoglOnscreen *onscre
dmabuf_fd = meta_drm_buffer_dumb_ensure_dmabuf_fd (buffer_dumb, &error); dmabuf_fd = meta_drm_buffer_dumb_ensure_dmabuf_fd (buffer_dumb, &error);
if (!dmabuf_fd) if (!dmabuf_fd)
{ {
g_debug ("Failed to create DMA buffer: %s", error->message); meta_topic (META_DEBUG_KMS,
"Failed to create DMA buffer: %s", error->message);
return FALSE; return FALSE;
} }
@ -782,8 +787,9 @@ copy_shared_framebuffer_primary_gpu (CoglOnscreen *onscre
if (error) if (error)
{ {
g_debug ("%s: Failed to blit DMA buffer image: %s", meta_topic (META_DEBUG_KMS,
G_STRFUNC, error->message); "Failed to create DMA buffer for blitting: %s",
error->message);
return FALSE; return FALSE;
} }
@ -874,8 +880,10 @@ update_secondary_gpu_state_pre_swap_buffers (CoglOnscreen *onscreen)
if (secondary_gpu_state) if (secondary_gpu_state)
{ {
MetaRendererNativeGpuData *renderer_gpu_data; MetaRendererNativeGpuData *renderer_gpu_data;
MetaDeviceFile *device_file;
renderer_gpu_data = secondary_gpu_state->renderer_gpu_data; renderer_gpu_data = secondary_gpu_state->renderer_gpu_data;
device_file = renderer_gpu_data->device_file;
switch (renderer_gpu_data->secondary.copy_mode) switch (renderer_gpu_data->secondary.copy_mode)
{ {
case META_SHARED_FRAMEBUFFER_COPY_MODE_SECONDARY_GPU: case META_SHARED_FRAMEBUFFER_COPY_MODE_SECONDARY_GPU:
@ -894,8 +902,9 @@ update_secondary_gpu_state_pre_swap_buffers (CoglOnscreen *onscreen)
{ {
if (!secondary_gpu_state->noted_primary_gpu_copy_failed) if (!secondary_gpu_state->noted_primary_gpu_copy_failed)
{ {
g_debug ("Using primary GPU to copy for %s failed once.", meta_topic (META_DEBUG_KMS,
meta_gpu_kms_get_file_path (secondary_gpu_state->gpu_kms)); "Using primary GPU to copy for %s failed once.",
meta_device_file_get_path (device_file));
secondary_gpu_state->noted_primary_gpu_copy_failed = TRUE; secondary_gpu_state->noted_primary_gpu_copy_failed = TRUE;
} }
@ -905,8 +914,9 @@ update_secondary_gpu_state_pre_swap_buffers (CoglOnscreen *onscreen)
} }
else if (!secondary_gpu_state->noted_primary_gpu_copy_ok) else if (!secondary_gpu_state->noted_primary_gpu_copy_ok)
{ {
g_debug ("Using primary GPU to copy for %s succeeded once.", meta_topic (META_DEBUG_KMS,
meta_gpu_kms_get_file_path (secondary_gpu_state->gpu_kms)); "Using primary GPU to copy for %s succeeded once.",
meta_device_file_get_path (device_file));
secondary_gpu_state->noted_primary_gpu_copy_ok = TRUE; secondary_gpu_state->noted_primary_gpu_copy_ok = TRUE;
} }
break; break;
@ -1035,7 +1045,8 @@ meta_onscreen_native_swap_buffers_with_damage (CoglOnscreen *onscreen,
&error); &error);
if (!buffer_gbm) if (!buffer_gbm)
{ {
g_warning ("meta_drm_buffer_gbm_new_lock_front failed: %s", g_warning ("Failed to lock front buffer on %s: %s",
meta_device_file_get_path (render_device_file),
error->message); error->message);
return; return;
} }
@ -1944,8 +1955,9 @@ init_secondary_gpu_state_cpu_copy_mode (MetaRendererNative *renderer_nat
gpu_kms = META_GPU_KMS (meta_crtc_get_gpu (onscreen_native->crtc)); gpu_kms = META_GPU_KMS (meta_crtc_get_gpu (onscreen_native->crtc));
device_file = renderer_gpu_data->device_file; device_file = renderer_gpu_data->device_file;
g_debug ("Secondary GPU %s using DRM format '%s' (0x%x) for a %dx%d output.", meta_topic (META_DEBUG_KMS,
meta_gpu_kms_get_file_path (gpu_kms), "Secondary GPU %s using DRM format '%s' (0x%x) for a %dx%d output.",
meta_device_file_get_path (device_file),
meta_drm_format_to_string (&tmp, drm_format), meta_drm_format_to_string (&tmp, drm_format),
drm_format, drm_format,
width, height); width, height);