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