From 1141929bc5a90c6cbdf92881d6296812c283d788 Mon Sep 17 00:00:00 2001 From: Rui Matos Date: Tue, 21 Apr 2015 17:49:55 +0200 Subject: [PATCH] backends: Add flags to MetaMonitorMode And export them in the DBus API since they're useful for gnome-control-center. https://bugzilla.gnome.org/show_bug.cgi?id=763832 --- src/backends/meta-monitor-manager-private.h | 1 + src/backends/meta-monitor-manager.c | 7 ++++--- src/backends/native/meta-monitor-manager-kms.c | 1 + src/backends/x11/meta-monitor-manager-xrandr.c | 1 + src/org.gnome.Mutter.DisplayConfig.xml | 3 ++- 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/backends/meta-monitor-manager-private.h b/src/backends/meta-monitor-manager-private.h index 7cda017d8..58d232a98 100644 --- a/src/backends/meta-monitor-manager-private.h +++ b/src/backends/meta-monitor-manager-private.h @@ -190,6 +190,7 @@ struct _MetaMonitorMode int width; int height; float refresh_rate; + guint32 flags; gpointer driver_private; GDestroyNotify driver_notify; diff --git a/src/backends/meta-monitor-manager.c b/src/backends/meta-monitor-manager.c index 93588e36c..e00d3cedd 100644 --- a/src/backends/meta-monitor-manager.c +++ b/src/backends/meta-monitor-manager.c @@ -590,7 +590,7 @@ meta_monitor_manager_handle_get_resources (MetaDBusDisplayConfig *skeleton, g_variant_builder_init (&crtc_builder, G_VARIANT_TYPE ("a(uxiiiiiuaua{sv})")); g_variant_builder_init (&output_builder, G_VARIANT_TYPE ("a(uxiausauaua{sv})")); - g_variant_builder_init (&mode_builder, G_VARIANT_TYPE ("a(uxuud)")); + g_variant_builder_init (&mode_builder, G_VARIANT_TYPE ("a(uxuudu)")); for (i = 0; i < manager->n_crtcs; i++) { @@ -714,12 +714,13 @@ meta_monitor_manager_handle_get_resources (MetaDBusDisplayConfig *skeleton, { MetaMonitorMode *mode = &manager->modes[i]; - g_variant_builder_add (&mode_builder, "(uxuud)", + g_variant_builder_add (&mode_builder, "(uxuudu)", i, /* ID */ (gint64)mode->mode_id, (guint32)mode->width, (guint32)mode->height, - (double)mode->refresh_rate); + (double)mode->refresh_rate, + (guint32)mode->flags); } meta_dbus_display_config_complete_get_resources (skeleton, diff --git a/src/backends/native/meta-monitor-manager-kms.c b/src/backends/native/meta-monitor-manager-kms.c index e1a6f5fc1..a28ef7907 100644 --- a/src/backends/native/meta-monitor-manager-kms.c +++ b/src/backends/native/meta-monitor-manager-kms.c @@ -632,6 +632,7 @@ meta_monitor_manager_kms_read_current (MetaMonitorManager *manager) meta_mode->name = g_strndup (mode->name, DRM_DISPLAY_MODE_LEN); meta_mode->width = mode->hdisplay; meta_mode->height = mode->vdisplay; + meta_mode->flags = mode->flags; /* Calculate refresh rate in milliHz first for extra precision. */ meta_mode->refresh_rate = (mode->clock * 1000000LL) / mode->htotal; diff --git a/src/backends/x11/meta-monitor-manager-xrandr.c b/src/backends/x11/meta-monitor-manager-xrandr.c index 47fe891c4..b0a77dadb 100644 --- a/src/backends/x11/meta-monitor-manager-xrandr.c +++ b/src/backends/x11/meta-monitor-manager-xrandr.c @@ -788,6 +788,7 @@ meta_monitor_manager_xrandr_read_current (MetaMonitorManager *manager) mode->height = xmode->height; mode->refresh_rate = (xmode->dotClock / ((float)xmode->hTotal * xmode->vTotal)); + mode->flags = xmode->modeFlags; mode->name = get_xmode_name (xmode); } diff --git a/src/org.gnome.Mutter.DisplayConfig.xml b/src/org.gnome.Mutter.DisplayConfig.xml index 06449c36a..16ef01ec4 100644 --- a/src/org.gnome.Mutter.DisplayConfig.xml +++ b/src/org.gnome.Mutter.DisplayConfig.xml @@ -115,6 +115,7 @@ * x winsys_id: the low-level ID of this mode * u width, height: the resolution * d frequency: refresh rate + * u flags: mode flags as defined in xf86drmMode.h and randr.h Output and modes are read-only objects (except for output properties), they can change only in accordance to HW changes (such as hotplugging @@ -133,7 +134,7 @@ - +