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: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1698>
This commit is contained in:
Jonas Ådahl 2021-01-26 14:49:25 +01:00 committed by Marge Bot
parent 19c4667d6a
commit 6aef4b3970
5 changed files with 17 additions and 21 deletions

View File

@ -2872,7 +2872,7 @@ rebuild_monitors (MetaMonitorManager *manager)
{ {
MetaMonitorTiled *monitor_tiled; 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, manager->monitors = g_list_append (manager->monitors,
monitor_tiled); monitor_tiled);
} }
@ -2881,7 +2881,7 @@ rebuild_monitors (MetaMonitorManager *manager)
{ {
MetaMonitorNormal *monitor_normal; 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, manager->monitors = g_list_append (manager->monitors,
monitor_normal); monitor_normal);
} }

View File

@ -55,7 +55,7 @@ typedef struct _MetaMonitorModeTiled
typedef struct _MetaMonitorPrivate typedef struct _MetaMonitorPrivate
{ {
MetaGpu *gpu; MetaBackend *backend;
GList *outputs; GList *outputs;
GList *modes; GList *modes;
@ -288,12 +288,12 @@ meta_monitor_make_display_name (MetaMonitor *monitor,
} }
} }
MetaGpu * MetaBackend *
meta_monitor_get_gpu (MetaMonitor *monitor) meta_monitor_get_backend (MetaMonitor *monitor)
{ {
MetaMonitorPrivate *priv = meta_monitor_get_instance_private (monitor); MetaMonitorPrivate *priv = meta_monitor_get_instance_private (monitor);
return priv->gpu; return priv->backend;
} }
GList * GList *
@ -660,8 +660,7 @@ meta_monitor_normal_generate_modes (MetaMonitorNormal *monitor_normal)
} }
MetaMonitorNormal * MetaMonitorNormal *
meta_monitor_normal_new (MetaGpu *gpu, meta_monitor_normal_new (MetaMonitorManager *monitor_manager,
MetaMonitorManager *monitor_manager,
MetaOutput *output) MetaOutput *output)
{ {
MetaMonitorNormal *monitor_normal; MetaMonitorNormal *monitor_normal;
@ -672,7 +671,7 @@ meta_monitor_normal_new (MetaGpu *gpu,
monitor = META_MONITOR (monitor_normal); monitor = META_MONITOR (monitor_normal);
monitor_priv = meta_monitor_get_instance_private (monitor); 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)); monitor_priv->outputs = g_list_append (NULL, g_object_ref (output));
meta_output_set_monitor (output, monitor); meta_output_set_monitor (output, monitor);
@ -1348,8 +1347,7 @@ meta_monitor_tiled_generate_modes (MetaMonitorTiled *monitor_tiled)
} }
MetaMonitorTiled * MetaMonitorTiled *
meta_monitor_tiled_new (MetaGpu *gpu, meta_monitor_tiled_new (MetaMonitorManager *monitor_manager,
MetaMonitorManager *monitor_manager,
MetaOutput *output) MetaOutput *output)
{ {
const MetaOutputInfo *output_info = meta_output_get_info (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 = META_MONITOR (monitor_tiled);
monitor_priv = meta_monitor_get_instance_private (monitor); 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_tiled->tile_group_id = output_info->tile_info.group_id;
monitor_priv->winsys_id = meta_output_get_id (output); monitor_priv->winsys_id = meta_output_get_id (output);
monitor_tiled->origin_output = 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); monitor_tiled->main_output = find_untiled_output (monitor_tiled);

View File

@ -95,17 +95,15 @@ G_DECLARE_FINAL_TYPE (MetaMonitorTiled, meta_monitor_tiled,
META, MONITOR_TILED, META, MONITOR_TILED,
MetaMonitor) MetaMonitor)
MetaMonitorTiled * meta_monitor_tiled_new (MetaGpu *gpu, MetaMonitorTiled * meta_monitor_tiled_new (MetaMonitorManager *monitor_manager,
MetaMonitorManager *monitor_manager,
MetaOutput *output); MetaOutput *output);
MetaMonitorNormal * meta_monitor_normal_new (MetaGpu *gpu, MetaMonitorNormal * meta_monitor_normal_new (MetaMonitorManager *monitor_manager,
MetaMonitorManager *monitor_manager,
MetaOutput *output); MetaOutput *output);
MetaMonitorSpec * meta_monitor_get_spec (MetaMonitor *monitor); MetaMonitorSpec * meta_monitor_get_spec (MetaMonitor *monitor);
MetaGpu * meta_monitor_get_gpu (MetaMonitor *monitor); MetaBackend * meta_monitor_get_backend (MetaMonitor *monitor);
META_EXPORT_TEST META_EXPORT_TEST
gboolean meta_monitor_is_active (MetaMonitor *monitor); gboolean meta_monitor_is_active (MetaMonitor *monitor);

View File

@ -113,8 +113,7 @@ meta_screen_cast_monitor_stream_new (MetaScreenCastSession *session,
MetaScreenCastFlag flags, MetaScreenCastFlag flags,
GError **error) GError **error)
{ {
MetaGpu *gpu = meta_monitor_get_gpu (monitor); MetaBackend *backend = meta_monitor_get_backend (monitor);
MetaBackend *backend = meta_gpu_get_backend (gpu);
MetaMonitorManager *monitor_manager = MetaMonitorManager *monitor_manager =
meta_backend_get_monitor_manager (backend); meta_backend_get_monitor_manager (backend);
MetaScreenCastMonitorStream *monitor_stream; MetaScreenCastMonitorStream *monitor_stream;

View File

@ -985,9 +985,10 @@ calculate_cursor_sprite_gpus (MetaCursorRenderer *renderer,
for (l_mon = monitors; l_mon; l_mon = l_mon->next) for (l_mon = monitors; l_mon; l_mon = l_mon->next)
{ {
MetaMonitor *monitor = l_mon->data; MetaMonitor *monitor = l_mon->data;
MetaOutput *output = meta_monitor_get_main_output (monitor);
MetaGpu *gpu; MetaGpu *gpu;
gpu = meta_monitor_get_gpu (monitor); gpu = meta_output_get_gpu (output);
if (!g_list_find (gpus, gpu)) if (!g_list_find (gpus, gpu))
gpus = g_list_prepend (gpus, gpu); gpus = g_list_prepend (gpus, gpu);
} }