From 6aef4b39708cc391c6e3afb9c1211cc5f6227bc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Tue, 26 Jan 2021 14:49:25 +0100 Subject: [PATCH] monitor: Attach to backend instead of GPU Prepare for the future when a monitor isn't necessarily attached to a mode setting device, which is practically what MetaGpu represents. Part-of: --- src/backends/meta-monitor-manager.c | 4 ++-- src/backends/meta-monitor.c | 20 +++++++++---------- src/backends/meta-monitor.h | 8 +++----- .../meta-screen-cast-monitor-stream.c | 3 +-- .../native/meta-cursor-renderer-native.c | 3 ++- 5 files changed, 17 insertions(+), 21 deletions(-) diff --git a/src/backends/meta-monitor-manager.c b/src/backends/meta-monitor-manager.c index 0fbdf5661..620b60d0a 100644 --- a/src/backends/meta-monitor-manager.c +++ b/src/backends/meta-monitor-manager.c @@ -2872,7 +2872,7 @@ rebuild_monitors (MetaMonitorManager *manager) { MetaMonitorTiled *monitor_tiled; - monitor_tiled = meta_monitor_tiled_new (gpu, manager, output); + monitor_tiled = meta_monitor_tiled_new (manager, output); manager->monitors = g_list_append (manager->monitors, monitor_tiled); } @@ -2881,7 +2881,7 @@ rebuild_monitors (MetaMonitorManager *manager) { MetaMonitorNormal *monitor_normal; - monitor_normal = meta_monitor_normal_new (gpu, manager, output); + monitor_normal = meta_monitor_normal_new (manager, output); manager->monitors = g_list_append (manager->monitors, monitor_normal); } diff --git a/src/backends/meta-monitor.c b/src/backends/meta-monitor.c index 0be7994ad..8f147b70c 100644 --- a/src/backends/meta-monitor.c +++ b/src/backends/meta-monitor.c @@ -55,7 +55,7 @@ typedef struct _MetaMonitorModeTiled typedef struct _MetaMonitorPrivate { - MetaGpu *gpu; + MetaBackend *backend; GList *outputs; GList *modes; @@ -288,12 +288,12 @@ meta_monitor_make_display_name (MetaMonitor *monitor, } } -MetaGpu * -meta_monitor_get_gpu (MetaMonitor *monitor) +MetaBackend * +meta_monitor_get_backend (MetaMonitor *monitor) { MetaMonitorPrivate *priv = meta_monitor_get_instance_private (monitor); - return priv->gpu; + return priv->backend; } GList * @@ -660,8 +660,7 @@ meta_monitor_normal_generate_modes (MetaMonitorNormal *monitor_normal) } MetaMonitorNormal * -meta_monitor_normal_new (MetaGpu *gpu, - MetaMonitorManager *monitor_manager, +meta_monitor_normal_new (MetaMonitorManager *monitor_manager, MetaOutput *output) { MetaMonitorNormal *monitor_normal; @@ -672,7 +671,7 @@ meta_monitor_normal_new (MetaGpu *gpu, monitor = META_MONITOR (monitor_normal); monitor_priv = meta_monitor_get_instance_private (monitor); - monitor_priv->gpu = gpu; + monitor_priv->backend = meta_monitor_manager_get_backend (monitor_manager); monitor_priv->outputs = g_list_append (NULL, g_object_ref (output)); meta_output_set_monitor (output, monitor); @@ -1348,8 +1347,7 @@ meta_monitor_tiled_generate_modes (MetaMonitorTiled *monitor_tiled) } MetaMonitorTiled * -meta_monitor_tiled_new (MetaGpu *gpu, - MetaMonitorManager *monitor_manager, +meta_monitor_tiled_new (MetaMonitorManager *monitor_manager, MetaOutput *output) { const MetaOutputInfo *output_info = meta_output_get_info (output); @@ -1361,13 +1359,13 @@ meta_monitor_tiled_new (MetaGpu *gpu, monitor = META_MONITOR (monitor_tiled); monitor_priv = meta_monitor_get_instance_private (monitor); - monitor_priv->gpu = gpu; + monitor_priv->backend = meta_monitor_manager_get_backend (monitor_manager); monitor_tiled->tile_group_id = output_info->tile_info.group_id; monitor_priv->winsys_id = meta_output_get_id (output); monitor_tiled->origin_output = output; - add_tiled_monitor_outputs (gpu, monitor_tiled); + add_tiled_monitor_outputs (meta_output_get_gpu (output), monitor_tiled); monitor_tiled->main_output = find_untiled_output (monitor_tiled); diff --git a/src/backends/meta-monitor.h b/src/backends/meta-monitor.h index c158b7c94..eceb645c2 100644 --- a/src/backends/meta-monitor.h +++ b/src/backends/meta-monitor.h @@ -95,17 +95,15 @@ G_DECLARE_FINAL_TYPE (MetaMonitorTiled, meta_monitor_tiled, META, MONITOR_TILED, MetaMonitor) -MetaMonitorTiled * meta_monitor_tiled_new (MetaGpu *gpu, - MetaMonitorManager *monitor_manager, +MetaMonitorTiled * meta_monitor_tiled_new (MetaMonitorManager *monitor_manager, MetaOutput *output); -MetaMonitorNormal * meta_monitor_normal_new (MetaGpu *gpu, - MetaMonitorManager *monitor_manager, +MetaMonitorNormal * meta_monitor_normal_new (MetaMonitorManager *monitor_manager, MetaOutput *output); MetaMonitorSpec * meta_monitor_get_spec (MetaMonitor *monitor); -MetaGpu * meta_monitor_get_gpu (MetaMonitor *monitor); +MetaBackend * meta_monitor_get_backend (MetaMonitor *monitor); META_EXPORT_TEST gboolean meta_monitor_is_active (MetaMonitor *monitor); diff --git a/src/backends/meta-screen-cast-monitor-stream.c b/src/backends/meta-screen-cast-monitor-stream.c index 9c138611c..d3ad20b3c 100644 --- a/src/backends/meta-screen-cast-monitor-stream.c +++ b/src/backends/meta-screen-cast-monitor-stream.c @@ -113,8 +113,7 @@ meta_screen_cast_monitor_stream_new (MetaScreenCastSession *session, MetaScreenCastFlag flags, GError **error) { - MetaGpu *gpu = meta_monitor_get_gpu (monitor); - MetaBackend *backend = meta_gpu_get_backend (gpu); + MetaBackend *backend = meta_monitor_get_backend (monitor); MetaMonitorManager *monitor_manager = meta_backend_get_monitor_manager (backend); MetaScreenCastMonitorStream *monitor_stream; diff --git a/src/backends/native/meta-cursor-renderer-native.c b/src/backends/native/meta-cursor-renderer-native.c index bb436b2c0..3d83e6e47 100644 --- a/src/backends/native/meta-cursor-renderer-native.c +++ b/src/backends/native/meta-cursor-renderer-native.c @@ -985,9 +985,10 @@ calculate_cursor_sprite_gpus (MetaCursorRenderer *renderer, for (l_mon = monitors; l_mon; l_mon = l_mon->next) { MetaMonitor *monitor = l_mon->data; + MetaOutput *output = meta_monitor_get_main_output (monitor); MetaGpu *gpu; - gpu = meta_monitor_get_gpu (monitor); + gpu = meta_output_get_gpu (output); if (!g_list_find (gpus, gpu)) gpus = g_list_prepend (gpus, gpu); }