summaryrefslogtreecommitdiff
path: root/src/backends/x11/meta-monitor-manager-xrandr.c
diff options
context:
space:
mode:
authorJonas Ã…dahl <jadahl@gmail.com>2020-02-25 16:54:20 +0100
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>2020-06-10 18:54:50 +0000
commit9186b6d6b099cf5ef5319bd3a82799751e1cc3de (patch)
treed988d8e9e4a791b7ba7a9a14becce9a337c88ed0 /src/backends/x11/meta-monitor-manager-xrandr.c
parent55719afcbf23461443f6f15e20729209aaf5e6e6 (diff)
downloadmutter-9186b6d6b099cf5ef5319bd3a82799751e1cc3de.tar.gz
monitor-manager: Remove is_dirty from MetaCrtc and MetaOutput
It was used during configuration to ensure that we always dealt with every output and CRTC. Do this without polluting the MetaOutput and MetaCrtc structs with intermediate variables not used by the corresponding types themself. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1287
Diffstat (limited to 'src/backends/x11/meta-monitor-manager-xrandr.c')
-rw-r--r--src/backends/x11/meta-monitor-manager-xrandr.c28
1 files changed, 11 insertions, 17 deletions
diff --git a/src/backends/x11/meta-monitor-manager-xrandr.c b/src/backends/x11/meta-monitor-manager-xrandr.c
index 8e074604a..d06f7daff 100644
--- a/src/backends/x11/meta-monitor-manager-xrandr.c
+++ b/src/backends/x11/meta-monitor-manager-xrandr.c
@@ -368,10 +368,15 @@ apply_crtc_assignments (MetaMonitorManager *manager,
{
MetaMonitorManagerXrandr *manager_xrandr = META_MONITOR_MANAGER_XRANDR (manager);
MetaGpu *gpu = meta_monitor_manager_xrandr_get_gpu (manager_xrandr);
+ g_autoptr (GList) to_configure_outputs = NULL;
+ g_autoptr (GList) to_disable_crtcs = NULL;
unsigned i;
GList *l;
int width, height, width_mm, height_mm;
+ to_configure_outputs = g_list_copy (meta_gpu_get_outputs (gpu));
+ to_disable_crtcs = g_list_copy (meta_gpu_get_crtcs (gpu));
+
XGrabServer (manager_xrandr->xdisplay);
/* First compute the new size of the screen (framebuffer) */
@@ -380,11 +385,12 @@ apply_crtc_assignments (MetaMonitorManager *manager,
{
MetaCrtcInfo *crtc_info = crtcs[i];
MetaCrtc *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, (int) roundf (crtc_info->layout.origin.x +
crtc_info->layout.size.width));
height = MAX (height, (int) roundf (crtc_info->layout.origin.y +
@@ -427,17 +433,10 @@ apply_crtc_assignments (MetaMonitorManager *manager,
}
}
- /* Disable CRTCs not mentioned in the list */
- for (l = meta_gpu_get_crtcs (gpu); l; l = l->next)
+ for (l = to_disable_crtcs; l; l = l->next)
{
MetaCrtc *crtc = l->data;
- if (crtc->is_dirty)
- {
- crtc->is_dirty = FALSE;
- continue;
- }
-
if (!crtc->config)
continue;
@@ -488,7 +487,8 @@ apply_crtc_assignments (MetaMonitorManager *manager,
output = ((MetaOutput**)crtc_info->outputs->pdata)[j];
- output->is_dirty = TRUE;
+ to_configure_outputs = g_list_remove (to_configure_outputs,
+ output);
meta_output_assign_crtc (output, crtc);
output_ids[j] = meta_output_get_id (output);
@@ -536,16 +536,10 @@ apply_crtc_assignments (MetaMonitorManager *manager,
}
/* Disable outputs not mentioned in the list */
- for (l = meta_gpu_get_outputs (gpu); l; l = l->next)
+ for (l = to_configure_outputs; l; l = l->next)
{
MetaOutput *output = l->data;
- if (output->is_dirty)
- {
- output->is_dirty = FALSE;
- continue;
- }
-
meta_output_unassign_crtc (output);
output->is_primary = FALSE;
}