[gnome-flashback] monitor-manager: remove is_dirty from GfCrtc and GfOutput



commit 182123bae81b8fbbbde95eebac232863915722f2
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Tue Jul 7 20:51:43 2020 +0300

    monitor-manager: remove is_dirty from GfCrtc and GfOutput
    
    Based on mutter commit:
    https://gitlab.gnome.org/GNOME/mutter/-/commit/9186b6d6b099cf5ef531

 backends/gf-crtc-private.h           |  3 ---
 backends/gf-crtc-xrandr.c            |  1 -
 backends/gf-monitor-manager-xrandr.c | 31 +++++++++++++------------------
 backends/gf-output-private.h         |  3 ---
 4 files changed, 13 insertions(+), 25 deletions(-)
---
diff --git a/backends/gf-crtc-private.h b/backends/gf-crtc-private.h
index d0df0b2..9ccceea 100644
--- a/backends/gf-crtc-private.h
+++ b/backends/gf-crtc-private.h
@@ -51,9 +51,6 @@ struct _GfCrtc
 
   GfCrtcConfig   *config;
 
-  /* Used when changing configuration */
-  gboolean        is_dirty;
-
   gpointer        driver_private;
   GDestroyNotify  driver_notify;
 };
diff --git a/backends/gf-crtc-xrandr.c b/backends/gf-crtc-xrandr.c
index fefb014..0a89f26 100644
--- a/backends/gf-crtc-xrandr.c
+++ b/backends/gf-crtc-xrandr.c
@@ -152,7 +152,6 @@ gf_create_xrandr_crtc (GfGpuXrandr        *gpu_xrandr,
   crtc->driver_private = crtc_xrandr;
   crtc->driver_notify = (GDestroyNotify) gf_crtc_destroy_notify;
 
-  crtc->is_dirty = FALSE;
   crtc->all_transforms = gf_monitor_transform_from_xrandr_all (xrandr_crtc->rotations);
 
   modes = gf_gpu_get_modes (gpu);
diff --git a/backends/gf-monitor-manager-xrandr.c b/backends/gf-monitor-manager-xrandr.c
index 83fd72c..e139a84 100644
--- a/backends/gf-monitor-manager-xrandr.c
+++ b/backends/gf-monitor-manager-xrandr.c
@@ -379,6 +379,8 @@ apply_crtc_assignments (GfMonitorManager  *manager,
 {
   GfMonitorManagerXrandr *xrandr;
   GfGpu *gpu;
+  GList *to_configure_outputs;
+  GList *to_disable_crtcs;
   gint width, height, width_mm, height_mm;
   guint i;
   GList *l;
@@ -386,6 +388,9 @@ apply_crtc_assignments (GfMonitorManager  *manager,
   xrandr = GF_MONITOR_MANAGER_XRANDR (manager);
   gpu = get_gpu (xrandr);
 
+  to_configure_outputs = g_list_copy (gf_gpu_get_outputs (gpu));
+  to_disable_crtcs = g_list_copy (gf_gpu_get_crtcs (gpu));
+
   XGrabServer (xrandr->xdisplay);
 
   /* First compute the new size of the screen (framebuffer) */
@@ -395,11 +400,11 @@ apply_crtc_assignments (GfMonitorManager  *manager,
       GfCrtcInfo *crtc_info = crtcs[i];
       GfCrtc *crtc = crtc_info->crtc;
 
-      crtc->is_dirty = TRUE;
-
       if (crtc_info->mode == NULL)
         continue;
 
+      to_disable_crtcs = g_list_remove (to_disable_crtcs, crtc);
+
       width = MAX (width, crtc_info->layout.x + crtc_info->layout.width);
       height = MAX (height, crtc_info->layout.y + crtc_info->layout.height);
     }
@@ -438,17 +443,10 @@ apply_crtc_assignments (GfMonitorManager  *manager,
         }
     }
 
-  /* Disable CRTCs not mentioned in the list */
-  for (l = gf_gpu_get_crtcs (gpu); l; l = l->next)
+  for (l = to_disable_crtcs; l; l = l->next)
     {
       GfCrtc *crtc = l->data;
 
-      if (crtc->is_dirty)
-        {
-          crtc->is_dirty = FALSE;
-          continue;
-        }
-
       if (!crtc->config)
         continue;
 
@@ -499,7 +497,7 @@ apply_crtc_assignments (GfMonitorManager  *manager,
 
               output = ((GfOutput**) crtc_info->outputs->pdata)[j];
 
-              output->is_dirty = TRUE;
+              to_configure_outputs = g_list_remove (to_configure_outputs, output);
               gf_output_assign_crtc (output, crtc);
 
               output_ids[j] = output->winsys_id;
@@ -549,22 +547,19 @@ apply_crtc_assignments (GfMonitorManager  *manager,
     }
 
   /* Disable outputs not mentioned in the list */
-  for (l = gf_gpu_get_outputs (gpu); l; l = l->next)
+  for (l = to_configure_outputs; l; l = l->next)
     {
       GfOutput *output = l->data;
 
-      if (output->is_dirty)
-        {
-          output->is_dirty = FALSE;
-          continue;
-        }
-
       gf_output_unassign_crtc (output);
       output->is_primary = FALSE;
     }
 
   XUngrabServer (xrandr->xdisplay);
   XFlush (xrandr->xdisplay);
+
+  g_clear_pointer (&to_configure_outputs, g_list_free);
+  g_clear_pointer (&to_disable_crtcs, g_list_free);
 }
 
 static GQuark
diff --git a/backends/gf-output-private.h b/backends/gf-output-private.h
index 36d5788..6565843 100644
--- a/backends/gf-output-private.h
+++ b/backends/gf-output-private.h
@@ -83,9 +83,6 @@ struct _GfOutput
   gint                 backlight_min;
   gint                 backlight_max;
 
-  /* Used when changing configuration */
-  gboolean             is_dirty;
-
   /* The low-level bits used to build the high-level info in GfLogicalMonitor */
   gboolean             is_primary;
   gboolean             is_presentation;


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