[gnome-flashback] monitor: attach to backend instead of GPU



commit 8f36e23998b9a1fb3c7fbcef0d330afcd736408d
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Sat Aug 13 13:28:30 2022 +0300

    monitor: attach to backend instead of GPU
    
    Based on mutter commit:
    https://gitlab.gnome.org/GNOME/mutter/-/commit/6aef4b39708cc391c6e3

 backends/gf-monitor-manager.c        |  4 ++--
 backends/gf-monitor-normal-private.h |  4 ++--
 backends/gf-monitor-normal.c         |  8 +++++---
 backends/gf-monitor-private.h        |  2 +-
 backends/gf-monitor-tiled-private.h  |  3 +--
 backends/gf-monitor-tiled.c          |  9 +++++----
 backends/gf-monitor.c                | 39 +++++++++++++++---------------------
 7 files changed, 32 insertions(+), 37 deletions(-)
---
diff --git a/backends/gf-monitor-manager.c b/backends/gf-monitor-manager.c
index 4e9d63c..5b5c087 100644
--- a/backends/gf-monitor-manager.c
+++ b/backends/gf-monitor-manager.c
@@ -1243,7 +1243,7 @@ rebuild_monitors (GfMonitorManager *manager)
                 {
                   GfMonitorTiled *monitor_tiled;
 
-                  monitor_tiled = gf_monitor_tiled_new (gpu, manager, output);
+                  monitor_tiled = gf_monitor_tiled_new (manager, output);
                   manager->monitors = g_list_append (manager->monitors, monitor_tiled);
                 }
             }
@@ -1251,7 +1251,7 @@ rebuild_monitors (GfMonitorManager *manager)
             {
               GfMonitorNormal *monitor_normal;
 
-              monitor_normal = gf_monitor_normal_new (gpu, output);
+              monitor_normal = gf_monitor_normal_new (manager, output);
               manager->monitors = g_list_append (manager->monitors, monitor_normal);
             }
         }
diff --git a/backends/gf-monitor-normal-private.h b/backends/gf-monitor-normal-private.h
index e0be600..0cec695 100644
--- a/backends/gf-monitor-normal-private.h
+++ b/backends/gf-monitor-normal-private.h
@@ -30,8 +30,8 @@ G_BEGIN_DECLS
 G_DECLARE_FINAL_TYPE (GfMonitorNormal, gf_monitor_normal,
                       GF, MONITOR_NORMAL, GfMonitor)
 
-GfMonitorNormal *gf_monitor_normal_new (GfGpu    *gpu,
-                                        GfOutput *output);
+GfMonitorNormal *gf_monitor_normal_new (GfMonitorManager *monitor_manager,
+                                        GfOutput         *output);
 
 G_END_DECLS
 
diff --git a/backends/gf-monitor-normal.c b/backends/gf-monitor-normal.c
index 12fdaa0..b84d151 100644
--- a/backends/gf-monitor-normal.c
+++ b/backends/gf-monitor-normal.c
@@ -185,14 +185,16 @@ gf_monitor_normal_init (GfMonitorNormal *normal)
 }
 
 GfMonitorNormal *
-gf_monitor_normal_new (GfGpu    *gpu,
-                       GfOutput *output)
+gf_monitor_normal_new (GfMonitorManager *monitor_manager,
+                       GfOutput         *output)
 {
+  GfBackend *backend;
   GfMonitorNormal *normal;
   GfMonitor *monitor;
 
+  backend = gf_monitor_manager_get_backend (monitor_manager);
   normal = g_object_new (GF_TYPE_MONITOR_NORMAL,
-                         "gpu", gpu,
+                         "backend", backend,
                          NULL);
 
   monitor = GF_MONITOR (normal);
diff --git a/backends/gf-monitor-private.h b/backends/gf-monitor-private.h
index 39c6cc6..6a10ec9 100644
--- a/backends/gf-monitor-private.h
+++ b/backends/gf-monitor-private.h
@@ -92,7 +92,7 @@ struct _GfMonitorClass
                                           gint               *height);
 };
 
-GfGpu              *gf_monitor_get_gpu                    (GfMonitor                  *monitor);
+GfBackend          *gf_monitor_get_backend                (GfMonitor                  *self);
 
 void                gf_monitor_make_display_name          (GfMonitor                  *monitor);
 
diff --git a/backends/gf-monitor-tiled-private.h b/backends/gf-monitor-tiled-private.h
index 58a2ed0..b211ac6 100644
--- a/backends/gf-monitor-tiled-private.h
+++ b/backends/gf-monitor-tiled-private.h
@@ -31,8 +31,7 @@ G_BEGIN_DECLS
 G_DECLARE_FINAL_TYPE (GfMonitorTiled, gf_monitor_tiled,
                       GF, MONITOR_TILED, GfMonitor)
 
-GfMonitorTiled *gf_monitor_tiled_new               (GfGpu            *gpu,
-                                                    GfMonitorManager *monitor_manager,
+GfMonitorTiled *gf_monitor_tiled_new               (GfMonitorManager *monitor_manager,
                                                     GfOutput         *output);
 
 uint32_t        gf_monitor_tiled_get_tile_group_id (GfMonitorTiled   *monitor_tiled);
diff --git a/backends/gf-monitor-tiled.c b/backends/gf-monitor-tiled.c
index a5fdb7c..30ef6f0 100644
--- a/backends/gf-monitor-tiled.c
+++ b/backends/gf-monitor-tiled.c
@@ -751,18 +751,19 @@ gf_monitor_tiled_init (GfMonitorTiled *tiled)
 }
 
 GfMonitorTiled *
-gf_monitor_tiled_new (GfGpu            *gpu,
-                      GfMonitorManager *monitor_manager,
+gf_monitor_tiled_new (GfMonitorManager *monitor_manager,
                       GfOutput         *output)
 {
   const GfOutputInfo *output_info;
+  GfBackend *backend;
   GfMonitorTiled *tiled;
   GfMonitor *monitor;
 
   output_info = gf_output_get_info (output);
 
+  backend = gf_monitor_manager_get_backend (monitor_manager);
   tiled = g_object_new (GF_TYPE_MONITOR_TILED,
-                        "gpu", gpu,
+                        "backend", backend,
                         NULL);
 
   monitor = GF_MONITOR (tiled);
@@ -773,7 +774,7 @@ gf_monitor_tiled_new (GfGpu            *gpu,
   gf_monitor_set_winsys_id (monitor, gf_output_get_id (output));
 
   tiled->origin_output = output;
-  add_tiled_monitor_outputs (gpu, tiled);
+  add_tiled_monitor_outputs (gf_output_get_gpu (output), tiled);
 
   tiled->main_output = find_untiled_output (tiled);
 
diff --git a/backends/gf-monitor.c b/backends/gf-monitor.c
index 0f8f0d5..459ad1b 100644
--- a/backends/gf-monitor.c
+++ b/backends/gf-monitor.c
@@ -54,7 +54,7 @@
 
 typedef struct
 {
-  GfGpu            *gpu;
+  GfBackend        *backend;
 
   GList            *outputs;
   GList            *modes;
@@ -85,7 +85,7 @@ enum
 {
   PROP_0,
 
-  PROP_GPU,
+  PROP_BACKEND,
 
   LAST_PROP
 };
@@ -426,8 +426,8 @@ gf_monitor_get_property (GObject    *object,
 
   switch (property_id)
     {
-      case PROP_GPU:
-        g_value_set_object (value, priv->gpu);
+      case PROP_BACKEND:
+        g_value_set_object (value, priv->backend);
         break;
 
       default:
@@ -450,8 +450,8 @@ gf_monitor_set_property (GObject      *object,
 
   switch (property_id)
     {
-      case PROP_GPU:
-        priv->gpu = g_value_get_object (value);
+      case PROP_BACKEND:
+        priv->backend = g_value_get_object (value);
         break;
 
       default:
@@ -463,11 +463,11 @@ gf_monitor_set_property (GObject      *object,
 static void
 gf_monitor_install_properties (GObjectClass *object_class)
 {
-  monitor_properties[PROP_GPU] =
-    g_param_spec_object ("gpu",
-                         "GfGpu",
-                         "GfGpu",
-                         GF_TYPE_GPU,
+  monitor_properties[PROP_BACKEND] =
+    g_param_spec_object ("backend",
+                         "GfBackend",
+                         "GfBackend",
+                         GF_TYPE_BACKEND,
                          G_PARAM_READWRITE |
                          G_PARAM_STATIC_STRINGS |
                          G_PARAM_CONSTRUCT_ONLY);
@@ -501,27 +501,25 @@ gf_monitor_init (GfMonitor *monitor)
   priv->mode_ids = g_hash_table_new (g_str_hash, g_str_equal);
 }
 
-GfGpu *
-gf_monitor_get_gpu (GfMonitor *monitor)
+GfBackend *
+gf_monitor_get_backend (GfMonitor *monitor)
 {
   GfMonitorPrivate *priv;
 
   priv = gf_monitor_get_instance_private (monitor);
 
-  return priv->gpu;
+  return priv->backend;
 }
 
 void
 gf_monitor_make_display_name (GfMonitor *monitor)
 {
   GfMonitorPrivate *priv;
-  GfBackend *backend;
   GfMonitorManager *manager;
 
   priv = gf_monitor_get_instance_private (monitor);
 
-  backend = gf_gpu_get_backend (priv->gpu);
-  manager = gf_backend_get_monitor_manager (backend);
+  manager = gf_backend_get_monitor_manager (priv->backend);
 
   g_free (priv->display_name);
   priv->display_name = make_display_name (monitor, manager);
@@ -1061,16 +1059,11 @@ gf_monitor_calculate_mode_scale (GfMonitor                 *monitor,
                                  GfMonitorScalesConstraint  constraints)
 {
   GfMonitorPrivate *priv;
-  GfMonitorManager *monitor_manager;
-  GfBackend *backend;
   GfSettings *settings;
   gint global_scaling_factor;
 
   priv = gf_monitor_get_instance_private (monitor);
-  backend = gf_gpu_get_backend (priv->gpu);
-  monitor_manager = gf_backend_get_monitor_manager (backend);
-  backend = gf_monitor_manager_get_backend (monitor_manager);
-  settings = gf_backend_get_settings (backend);
+  settings = gf_backend_get_settings (priv->backend);
 
   if (gf_settings_get_global_scaling_factor (settings, &global_scaling_factor))
     return global_scaling_factor;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]