1
0
Fork 0

kms: Add some debug logging for added planes/connectors/CRTCs

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3926>
This commit is contained in:
Jonas Ådahl 2024-08-06 21:11:54 +02:00 committed by Marge Bot
parent 45bf41bf94
commit fd598e1868
5 changed files with 56 additions and 13 deletions

View file

@ -1577,6 +1577,12 @@ meta_kms_connector_new (MetaKmsImplDevice *impl_device,
connector->type_id = drm_connector->connector_type_id;
connector->name = make_connector_name (drm_connector);
meta_topic (META_DEBUG_KMS,
"Adding connector %s (%u, %s)",
connector->name,
connector->id,
meta_kms_impl_device_get_path (impl_device));
init_properties (connector, impl_device, drm_connector);
meta_kms_connector_read_state (connector, impl_device,

View file

@ -509,6 +509,11 @@ meta_kms_crtc_new (MetaKmsImplDevice *impl_device,
crtc->id = drm_crtc->crtc_id;
crtc->idx = idx;
meta_topic (META_DEBUG_KMS,
"Adding CRTC %u (%s)",
crtc->id,
meta_kms_impl_device_get_path (impl_device));
init_properties (crtc, impl_device, drm_crtc);
meta_kms_crtc_read_state (crtc, impl_device, drm_crtc, drm_props);

View file

@ -535,17 +535,7 @@ add_plane_property (MetaKmsImplDevice *impl_device,
static const char *
get_plane_type_string (MetaKmsPlane *plane)
{
switch (meta_kms_plane_get_plane_type (plane))
{
case META_KMS_PLANE_TYPE_PRIMARY:
return "primary";
case META_KMS_PLANE_TYPE_CURSOR:
return "cursor";
case META_KMS_PLANE_TYPE_OVERLAY:
return "overlay";
}
g_assert_not_reached ();
return meta_kms_plane_type_to_string (meta_kms_plane_get_plane_type (plane));
}
static gboolean

View file

@ -28,6 +28,7 @@
#include "backends/native/meta-kms-impl-device-atomic.h"
#include "backends/native/meta-kms-device-private.h"
#include "backends/native/meta-kms-update-private.h"
#include "common/meta-drm-format-helpers.h"
typedef struct _MetaKmsPlanePropTable
{
@ -312,15 +313,23 @@ update_formats (MetaKmsPlane *plane,
in_formats = &plane->prop_table.props[META_KMS_PLANE_PROP_IN_FORMATS];
blob_id = in_formats->value;
if (blob_id == 0)
return;
{
meta_topic (META_DEBUG_KMS, " Plane has no advertised formats");
return;
}
fd = meta_kms_impl_device_get_fd (impl_device);
blob = drmModeGetPropertyBlob (fd, blob_id);
if (!blob)
return;
{
g_warning ("Failed to rertieve IN_FORMATS property blob: %s",
g_strerror (errno));
return;
}
if (blob->length < sizeof (struct drm_format_modifier_blob))
{
g_warning ("IN_FORMATS property blob size invalid");
drmModeFreePropertyBlob (blob);
return;
}
@ -334,6 +343,16 @@ update_formats (MetaKmsPlane *plane,
{
GArray *modifiers = g_array_new (FALSE, FALSE, sizeof (uint64_t));
if (meta_is_topic_enabled (META_DEBUG_KMS))
{
MetaDrmFormatBuf tmp;
meta_topic (META_DEBUG_KMS,
" Adding format %s (0x%x)",
meta_drm_format_to_string (&tmp, formats[fmt_i]),
formats[fmt_i]);
}
for (mod_i = 0; mod_i < blob_fmt->count_modifiers; mod_i++)
{
struct drm_format_modifier *drm_modifier = &drm_modifiers[mod_i];
@ -649,6 +668,11 @@ meta_kms_plane_new (MetaKmsPlaneType type,
plane->possible_crtcs = drm_plane->possible_crtcs;
plane->device = meta_kms_impl_device_get_device (impl_device);
meta_topic (META_DEBUG_KMS,
"Adding %s plane %u (%s)",
meta_kms_plane_type_to_string (type),
plane->id,
meta_kms_impl_device_get_path (impl_device));
init_properties (plane, impl_device, drm_plane, drm_plane_props);
meta_kms_plane_read_state (plane, impl_device, drm_plane, drm_plane_props);
@ -715,3 +739,19 @@ meta_kms_plane_class_init (MetaKmsPlaneClass *klass)
object_class->finalize = meta_kms_plane_finalize;
}
const char *
meta_kms_plane_type_to_string (MetaKmsPlaneType plane_type)
{
switch (plane_type)
{
case META_KMS_PLANE_TYPE_PRIMARY:
return "primary";
case META_KMS_PLANE_TYPE_CURSOR:
return "cursor";
case META_KMS_PLANE_TYPE_OVERLAY:
return "overlay";
}
g_assert_not_reached ();
}

View file

@ -76,3 +76,5 @@ gboolean meta_kms_plane_is_usable_with (MetaKmsPlane *plane,
void meta_kms_plane_update_set_rotation (MetaKmsPlane *plane,
MetaKmsPlaneAssignment *plane_assignment,
MtkMonitorTransform transform);
const char * meta_kms_plane_type_to_string (MetaKmsPlaneType plane_type);