From 3c6d688c8777dcc16fcc9c005c53fb11e3ef1f37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Tue, 13 Dec 2016 22:08:17 +0800 Subject: [PATCH] logical-monitor: Don't mirror refresh rate Let the callers figure out how to associate a logical monitor with a refresh rate, instead of exposing an arbitrary one. https://bugzilla.gnome.org/show_bug.cgi?id=777732 --- src/backends/meta-logical-monitor.c | 1 - src/backends/meta-logical-monitor.h | 1 - src/wayland/meta-wayland-outputs.c | 11 ++++++++--- src/wayland/meta-wayland-outputs.h | 1 + 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/backends/meta-logical-monitor.c b/src/backends/meta-logical-monitor.c index 96588c42c..21bb3d8d1 100644 --- a/src/backends/meta-logical-monitor.c +++ b/src/backends/meta-logical-monitor.c @@ -43,7 +43,6 @@ meta_logical_monitor_new (MetaMonitor *monitor, main_output = meta_monitor_get_main_output (monitor); logical_monitor->number = number; - logical_monitor->refresh_rate = main_output->crtc->current_mode->refresh_rate; logical_monitor->winsys_id = main_output->winsys_id; logical_monitor->scale = main_output->scale; logical_monitor->in_fullscreen = -1; diff --git a/src/backends/meta-logical-monitor.h b/src/backends/meta-logical-monitor.h index bce082245..34a134d15 100644 --- a/src/backends/meta-logical-monitor.h +++ b/src/backends/meta-logical-monitor.h @@ -37,7 +37,6 @@ struct _MetaLogicalMonitor int number; MetaRectangle rect; /* for tiled monitors these are calculated, from untiled just copied */ - float refresh_rate; gboolean is_primary; gboolean is_presentation; /* XXX: not yet used */ gboolean in_fullscreen; diff --git a/src/wayland/meta-wayland-outputs.c b/src/wayland/meta-wayland-outputs.c index 66bc108e1..5489b7bc4 100644 --- a/src/wayland/meta-wayland-outputs.c +++ b/src/wayland/meta-wayland-outputs.c @@ -77,12 +77,16 @@ send_output_events (struct wl_resource *resource, MetaLogicalMonitor *old_logical_monitor; guint old_mode_flags; gint old_scale; + float old_refresh_rate; + float refresh_rate; old_logical_monitor = wayland_output->logical_monitor; old_mode_flags = wayland_output->mode_flags; old_scale = wayland_output->scale; + old_refresh_rate = wayland_output->refresh_rate; output = pick_main_output (logical_monitor); + refresh_rate = output->crtc->current_mode->refresh_rate; gboolean need_done = FALSE; @@ -114,14 +118,14 @@ send_output_events (struct wl_resource *resource, if (need_all_events || old_logical_monitor->rect.width != logical_monitor->rect.width || old_logical_monitor->rect.height != logical_monitor->rect.height || - old_logical_monitor->refresh_rate != logical_monitor->refresh_rate || + old_refresh_rate != refresh_rate || old_mode_flags != mode_flags) { wl_output_send_mode (resource, mode_flags, logical_monitor->rect.width, logical_monitor->rect.height, - (int32_t) (logical_monitor->refresh_rate * 1000)); + (int32_t) (refresh_rate * 1000)); need_done = TRUE; } @@ -161,7 +165,7 @@ bind_output (struct wl_client *client, logical_monitor, output->name, logical_monitor->rect.x, logical_monitor->rect.y, logical_monitor->rect.width, logical_monitor->rect.height, - logical_monitor->refresh_rate); + wayland_output->refresh_rate); send_output_events (resource, wayland_output, logical_monitor, TRUE); } @@ -188,6 +192,7 @@ meta_wayland_output_set_logical_monitor (MetaWaylandOutput *wayland_output, if (output->crtc->current_mode == output->preferred_mode) wayland_output->mode_flags |= WL_OUTPUT_MODE_PREFERRED; wayland_output->scale = output->scale; + wayland_output->refresh_rate = output->crtc->current_mode->refresh_rate; } static void diff --git a/src/wayland/meta-wayland-outputs.h b/src/wayland/meta-wayland-outputs.h index d5b779b64..f9f096aba 100644 --- a/src/wayland/meta-wayland-outputs.h +++ b/src/wayland/meta-wayland-outputs.h @@ -39,6 +39,7 @@ struct _MetaWaylandOutput struct wl_global *global; MetaLogicalMonitor *logical_monitor; guint mode_flags; + float refresh_rate; gint scale; GList *resources;