Blame SOURCES/0001-gpu-xrandr-Move-dpms-state-and-screen-size-updating-.patch

f73620
From 7ce6f10f6966ec6e66549a6878ae333d0fe1e84c Mon Sep 17 00:00:00 2001
f73620
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
f73620
Date: Wed, 3 Oct 2018 10:50:07 +0200
f73620
Subject: [PATCH 1/2] gpu/xrandr: Move dpms state and screen size updating into
f73620
 helpers
f73620
f73620
To be used by no-Xrandr fallback path.
f73620
---
f73620
 src/backends/x11/meta-gpu-xrandr.c | 70 ++++++++++++++++++++----------
f73620
 1 file changed, 46 insertions(+), 24 deletions(-)
f73620
f73620
diff --git a/src/backends/x11/meta-gpu-xrandr.c b/src/backends/x11/meta-gpu-xrandr.c
f73620
index add80c0d2d..a4e187a49a 100644
f73620
--- a/src/backends/x11/meta-gpu-xrandr.c
f73620
+++ b/src/backends/x11/meta-gpu-xrandr.c
f73620
@@ -91,31 +91,15 @@ meta_gpu_xrandr_poll_hardware (MetaGpu *gpu)
f73620
   gpu_xrandr->need_hardware_poll = TRUE;
f73620
 }
f73620
 
f73620
-static gboolean
f73620
-meta_gpu_xrandr_read_current (MetaGpu  *gpu,
f73620
-                              GError  **error)
f73620
+static void
f73620
+update_dpms_state (MetaMonitorManagerXrandr *monitor_manager_xrandr)
f73620
 {
f73620
-  MetaGpuXrandr *gpu_xrandr = META_GPU_XRANDR (gpu);
f73620
-  MetaMonitorManager *monitor_manager = meta_gpu_get_monitor_manager (gpu);
f73620
-  MetaMonitorManagerXrandr *monitor_manager_xrandr =
f73620
-    META_MONITOR_MANAGER_XRANDR (monitor_manager);
f73620
+  MetaMonitorManager *monitor_manager =
f73620
+    META_MONITOR_MANAGER (monitor_manager_xrandr);
f73620
   Display *xdisplay =
f73620
     meta_monitor_manager_xrandr_get_xdisplay (monitor_manager_xrandr);
f73620
-  XRRScreenResources *resources;
f73620
-  RROutput primary_output;
f73620
-  unsigned int i, j;
f73620
-  GList *l;
f73620
-  int min_width, min_height;
f73620
-  Screen *screen;
f73620
   BOOL dpms_capable, dpms_enabled;
f73620
   CARD16 dpms_state;
f73620
-  GList *outputs = NULL;
f73620
-  GList *modes = NULL;
f73620
-  GList *crtcs = NULL;
f73620
-
f73620
-  if (gpu_xrandr->resources)
f73620
-    XRRFreeScreenResources (gpu_xrandr->resources);
f73620
-  gpu_xrandr->resources = NULL;
f73620
 
f73620
   dpms_capable = DPMSCapable (xdisplay);
f73620
 
f73620
@@ -146,6 +130,47 @@ meta_gpu_xrandr_read_current (MetaGpu  *gpu,
f73620
     {
f73620
       monitor_manager->power_save_mode = META_POWER_SAVE_UNSUPPORTED;
f73620
     }
f73620
+}
f73620
+
f73620
+static void
f73620
+update_screen_size (MetaMonitorManagerXrandr *monitor_manager_xrandr)
f73620
+{
f73620
+  MetaMonitorManager *monitor_manager =
f73620
+    META_MONITOR_MANAGER (monitor_manager_xrandr);
f73620
+  Display *xdisplay =
f73620
+    meta_monitor_manager_xrandr_get_xdisplay (monitor_manager_xrandr);
f73620
+  Screen *screen;
f73620
+
f73620
+  screen = ScreenOfDisplay (xdisplay, DefaultScreen (xdisplay));
f73620
+
f73620
+  monitor_manager->screen_width = WidthOfScreen (screen);
f73620
+  monitor_manager->screen_height = HeightOfScreen (screen);
f73620
+}
f73620
+
f73620
+static gboolean
f73620
+meta_gpu_xrandr_read_current (MetaGpu  *gpu,
f73620
+                              GError  **error)
f73620
+{
f73620
+  MetaGpuXrandr *gpu_xrandr = META_GPU_XRANDR (gpu);
f73620
+  MetaMonitorManager *monitor_manager = meta_gpu_get_monitor_manager (gpu);
f73620
+  MetaMonitorManagerXrandr *monitor_manager_xrandr =
f73620
+    META_MONITOR_MANAGER_XRANDR (monitor_manager);
f73620
+  Display *xdisplay =
f73620
+    meta_monitor_manager_xrandr_get_xdisplay (monitor_manager_xrandr);
f73620
+  XRRScreenResources *resources;
f73620
+  RROutput primary_output;
f73620
+  unsigned int i, j;
f73620
+  GList *l;
f73620
+  int min_width, min_height;
f73620
+  GList *outputs = NULL;
f73620
+  GList *modes = NULL;
f73620
+  GList *crtcs = NULL;
f73620
+
f73620
+  if (gpu_xrandr->resources)
f73620
+    XRRFreeScreenResources (gpu_xrandr->resources);
f73620
+  gpu_xrandr->resources = NULL;
f73620
+
f73620
+  update_dpms_state (monitor_manager_xrandr);
f73620
 
f73620
   XRRGetScreenSizeRange (xdisplay, DefaultRootWindow (xdisplay),
f73620
                          &min_width,
f73620
@@ -153,10 +178,7 @@ meta_gpu_xrandr_read_current (MetaGpu  *gpu,
f73620
                          &gpu_xrandr->max_screen_width,
f73620
                          &gpu_xrandr->max_screen_height);
f73620
 
f73620
-  screen = ScreenOfDisplay (xdisplay, DefaultScreen (xdisplay));
f73620
-  /* This is updated because we called XRRUpdateConfiguration. */
f73620
-  monitor_manager->screen_width = WidthOfScreen (screen);
f73620
-  monitor_manager->screen_height = HeightOfScreen (screen);
f73620
+  update_screen_size (monitor_manager_xrandr);
f73620
 
f73620
   if (gpu_xrandr->need_hardware_poll)
f73620
     {
f73620
-- 
f73620
2.17.1
f73620