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
This commit is contained in:
Rui Matos 2015-04-21 17:49:55 +02:00
parent bbb83d4cd0
commit 1141929bc5
5 changed files with 9 additions and 4 deletions

View File

@ -190,6 +190,7 @@ struct _MetaMonitorMode
int width;
int height;
float refresh_rate;
guint32 flags;
gpointer driver_private;
GDestroyNotify driver_notify;

View File

@ -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,

View File

@ -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;

View File

@ -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);
}

View File

@ -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 @@
<arg name="serial" direction="out" type="u" />
<arg name="crtcs" direction="out" type="a(uxiiiiiuaua{sv})" />
<arg name="outputs" direction="out" type="a(uxiausauaua{sv})" />
<arg name="modes" direction="out" type="a(uxuud)" />
<arg name="modes" direction="out" type="a(uxuudu)" />
<arg name="max_screen_width" direction="out" type="i" />
<arg name="max_screen_height" direction="out" type="i" />
</method>