backends/native: Add some KMS debug logging
Using the g_debug() macro. Set G_DEBUG_MESSAGES to "mutter" to activate log. https://gitlab.gnome.org/GNOME/mutter/issues/548 https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
This commit is contained in:
parent
6aa1026600
commit
22a91f23ad
@ -154,9 +154,17 @@ meta_crtc_kms_set_mode (MetaCrtc *crtc,
|
||||
connectors = generate_crtc_connector_list (gpu, crtc);
|
||||
|
||||
if (connectors)
|
||||
mode = crtc->current_mode->driver_private;
|
||||
{
|
||||
mode = crtc->current_mode->driver_private;
|
||||
|
||||
g_debug ("Setting CRTC (%ld) mode to %s", crtc->crtc_id, mode->name);
|
||||
}
|
||||
else
|
||||
mode = NULL;
|
||||
{
|
||||
mode = NULL;
|
||||
|
||||
g_debug ("Unsetting CRTC (%ld) mode", crtc->crtc_id);
|
||||
}
|
||||
|
||||
meta_kms_update_mode_set (kms_update,
|
||||
meta_crtc_kms_get_kms_crtc (crtc),
|
||||
|
@ -383,6 +383,68 @@ meta_monitor_manager_kms_get_crtc_gamma (MetaMonitorManager *manager,
|
||||
drmModeFreeCrtc (kms_crtc);
|
||||
}
|
||||
|
||||
static char *
|
||||
generate_gamma_ramp_string (size_t size,
|
||||
unsigned short *red,
|
||||
unsigned short *green,
|
||||
unsigned short *blue)
|
||||
{
|
||||
GString *string;
|
||||
int color;
|
||||
|
||||
string = g_string_new ("[");
|
||||
for (color = 0; color < 3; color++)
|
||||
{
|
||||
unsigned short **color_ptr;
|
||||
char color_char;
|
||||
size_t i;
|
||||
|
||||
switch (color)
|
||||
{
|
||||
case 0:
|
||||
color_ptr = &red;
|
||||
color_char = 'r';
|
||||
break;
|
||||
case 1:
|
||||
color_ptr = &green;
|
||||
color_char = 'g';
|
||||
break;
|
||||
case 2:
|
||||
color_ptr = &blue;
|
||||
color_char = 'b';
|
||||
break;
|
||||
}
|
||||
|
||||
g_string_append_printf (string, " %c: ", color_char);
|
||||
for (i = 0; i < MIN (4, size); i++)
|
||||
{
|
||||
int j;
|
||||
|
||||
if (size > 4)
|
||||
{
|
||||
if (i == 2)
|
||||
g_string_append (string, ",...");
|
||||
|
||||
if (i >= 2)
|
||||
j = i + (size - 4);
|
||||
else
|
||||
j = i;
|
||||
}
|
||||
else
|
||||
{
|
||||
j = i;
|
||||
}
|
||||
g_string_append_printf (string, "%s%hu",
|
||||
j == 0 ? "" : ",",
|
||||
(*color_ptr)[i]);
|
||||
}
|
||||
}
|
||||
|
||||
g_string_append (string, " ]");
|
||||
|
||||
return g_string_free (string, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_monitor_manager_kms_set_crtc_gamma (MetaMonitorManager *manager,
|
||||
MetaCrtc *crtc,
|
||||
@ -393,8 +455,18 @@ meta_monitor_manager_kms_set_crtc_gamma (MetaMonitorManager *manager,
|
||||
{
|
||||
MetaGpu *gpu = meta_crtc_get_gpu (crtc);
|
||||
int kms_fd = meta_gpu_kms_get_fd (META_GPU_KMS (gpu));
|
||||
g_autofree char *gamma_ramp_string = NULL;
|
||||
int ret;
|
||||
|
||||
drmModeCrtcSetGamma (kms_fd, crtc->crtc_id, size, red, green, blue);
|
||||
gamma_ramp_string = generate_gamma_ramp_string (size, red, green, blue);
|
||||
g_debug ("Setting CRTC (%ld) gamma to %s", crtc->crtc_id, gamma_ramp_string);
|
||||
|
||||
ret = drmModeCrtcSetGamma (kms_fd, crtc->crtc_id, size, red, green, blue);
|
||||
if (ret != 0)
|
||||
{
|
||||
g_warning ("Failed to set CRTC (%ld) Gamma: %s",
|
||||
crtc->crtc_id, g_strerror (-ret));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -69,6 +69,11 @@ meta_output_kms_set_underscan (MetaOutput *output,
|
||||
crtc = meta_output_get_assigned_crtc (output);
|
||||
hborder = MIN (128, (uint64_t) round (crtc->current_mode->width * 0.05));
|
||||
vborder = MIN (128, (uint64_t) round (crtc->current_mode->height * 0.05));
|
||||
|
||||
g_debug ("Setting underscan of connector %s to %lu x %lu",
|
||||
meta_kms_connector_get_name (output_kms->kms_connector),
|
||||
hborder, vborder);
|
||||
|
||||
meta_kms_connector_set_underscanning (output_kms->kms_connector,
|
||||
kms_update,
|
||||
hborder,
|
||||
@ -76,6 +81,9 @@ meta_output_kms_set_underscan (MetaOutput *output,
|
||||
}
|
||||
else
|
||||
{
|
||||
g_debug ("Unsetting underscan of connector %s",
|
||||
meta_kms_connector_get_name (output_kms->kms_connector));
|
||||
|
||||
meta_kms_connector_unset_underscanning (output_kms->kms_connector,
|
||||
kms_update);
|
||||
}
|
||||
@ -96,6 +104,10 @@ meta_output_kms_set_power_save_mode (MetaOutput *output,
|
||||
{
|
||||
MetaOutputKms *output_kms = output->driver_private;
|
||||
|
||||
g_debug ("Setting DPMS state of connector %s to %lu",
|
||||
meta_kms_connector_get_name (output_kms->kms_connector),
|
||||
dpms_state);
|
||||
|
||||
meta_kms_connector_update_set_dpms_state (output_kms->kms_connector,
|
||||
kms_update,
|
||||
dpms_state);
|
||||
|
Loading…
Reference in New Issue
Block a user