1
0
Fork 0

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

View file

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

View file

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

View file

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

View file

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