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
This commit is contained in:
parent
55719afcbf
commit
9186b6d6b0
@ -64,9 +64,6 @@ struct _MetaCrtc
|
||||
|
||||
MetaCrtcConfig *config;
|
||||
|
||||
/* Used when changing configuration */
|
||||
gboolean is_dirty;
|
||||
|
||||
gpointer driver_private;
|
||||
GDestroyNotify driver_notify;
|
||||
};
|
||||
|
@ -506,14 +506,20 @@ apply_crtc_assignments (MetaMonitorManager *manager,
|
||||
MetaOutputInfo **outputs,
|
||||
unsigned int n_outputs)
|
||||
{
|
||||
g_autoptr (GList) to_configure_outputs = NULL;
|
||||
g_autoptr (GList) to_configure_crtcs = NULL;
|
||||
GList *l;
|
||||
unsigned i;
|
||||
|
||||
to_configure_outputs = g_list_copy (meta_gpu_get_outputs (get_gpu (manager)));
|
||||
to_configure_crtcs = g_list_copy (meta_gpu_get_crtcs (get_gpu (manager)));
|
||||
|
||||
for (i = 0; i < n_crtcs; i++)
|
||||
{
|
||||
MetaCrtcInfo *crtc_info = crtcs[i];
|
||||
MetaCrtc *crtc = crtc_info->crtc;
|
||||
crtc->is_dirty = TRUE;
|
||||
|
||||
to_configure_crtcs = g_list_remove (to_configure_crtcs, crtc);
|
||||
|
||||
if (crtc_info->mode == NULL)
|
||||
{
|
||||
@ -533,7 +539,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);
|
||||
}
|
||||
}
|
||||
@ -549,30 +556,18 @@ apply_crtc_assignments (MetaMonitorManager *manager,
|
||||
}
|
||||
|
||||
/* Disable CRTCs not mentioned in the list */
|
||||
for (l = meta_gpu_get_crtcs (get_gpu (manager)); l; l = l->next)
|
||||
for (l = to_configure_crtcs; l; l = l->next)
|
||||
{
|
||||
MetaCrtc *crtc = l->data;
|
||||
|
||||
if (crtc->is_dirty)
|
||||
{
|
||||
crtc->is_dirty = FALSE;
|
||||
continue;
|
||||
}
|
||||
|
||||
meta_crtc_unset_config (crtc);
|
||||
}
|
||||
|
||||
/* Disable outputs not mentioned in the list */
|
||||
for (l = meta_gpu_get_outputs (get_gpu (manager)); 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;
|
||||
}
|
||||
|
@ -89,9 +89,6 @@ struct _MetaOutput
|
||||
int backlight_min;
|
||||
int backlight_max;
|
||||
|
||||
/* Used when changing configuration */
|
||||
gboolean is_dirty;
|
||||
|
||||
gboolean is_primary;
|
||||
gboolean is_presentation;
|
||||
|
||||
|
@ -302,7 +302,6 @@ meta_create_kms_crtc (MetaGpuKms *gpu_kms,
|
||||
"id", meta_kms_crtc_get_id (kms_crtc),
|
||||
"gpu", gpu,
|
||||
NULL);
|
||||
crtc->is_dirty = FALSE;
|
||||
crtc->all_transforms = ALL_TRANSFORMS_MASK;
|
||||
|
||||
crtc_kms = g_new0 (MetaCrtcKms, 1);
|
||||
|
@ -176,16 +176,32 @@ apply_crtc_assignments (MetaMonitorManager *manager,
|
||||
unsigned int n_outputs)
|
||||
{
|
||||
MetaBackend *backend = meta_monitor_manager_get_backend (manager);
|
||||
g_autoptr (GList) to_configure_outputs = NULL;
|
||||
g_autoptr (GList) to_configure_crtcs = NULL;
|
||||
unsigned i;
|
||||
GList *gpus;
|
||||
GList *l;
|
||||
|
||||
gpus = meta_backend_get_gpus (backend);
|
||||
for (l = gpus; l; l = l->next)
|
||||
{
|
||||
MetaGpu *gpu = l->data;
|
||||
GList *crtcs;
|
||||
GList *outputs;
|
||||
|
||||
outputs = g_list_copy (meta_gpu_get_outputs (gpu));
|
||||
to_configure_outputs = g_list_concat (to_configure_outputs, outputs);
|
||||
|
||||
crtcs = g_list_copy (meta_gpu_get_crtcs (gpu));
|
||||
to_configure_crtcs = g_list_concat (to_configure_crtcs, crtcs);
|
||||
}
|
||||
|
||||
for (i = 0; i < n_crtcs; i++)
|
||||
{
|
||||
MetaCrtcInfo *crtc_info = crtcs[i];
|
||||
MetaCrtc *crtc = crtc_info->crtc;
|
||||
|
||||
crtc->is_dirty = TRUE;
|
||||
to_configure_crtcs = g_list_remove (to_configure_crtcs, crtc);
|
||||
|
||||
if (crtc_info->mode == NULL)
|
||||
{
|
||||
@ -204,31 +220,19 @@ apply_crtc_assignments (MetaMonitorManager *manager,
|
||||
{
|
||||
MetaOutput *output = g_ptr_array_index (crtc_info->outputs, j);
|
||||
|
||||
output->is_dirty = TRUE;
|
||||
to_configure_outputs = g_list_remove (to_configure_outputs,
|
||||
output);
|
||||
meta_output_assign_crtc (output, crtc);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Disable CRTCs not mentioned in the list (they have is_dirty == FALSE,
|
||||
because they weren't seen in the first loop) */
|
||||
gpus = meta_backend_get_gpus (backend);
|
||||
for (l = gpus; l; l = l->next)
|
||||
|
||||
/* Disable CRTCs yet to be configured. */
|
||||
for (l = to_configure_crtcs; l; l = l->next)
|
||||
{
|
||||
MetaGpu *gpu = l->data;
|
||||
GList *k;
|
||||
MetaCrtc *crtc = l->data;
|
||||
|
||||
for (k = meta_gpu_get_crtcs (gpu); k; k = k->next)
|
||||
{
|
||||
MetaCrtc *crtc = k->data;
|
||||
|
||||
if (crtc->is_dirty)
|
||||
{
|
||||
crtc->is_dirty = FALSE;
|
||||
continue;
|
||||
}
|
||||
|
||||
meta_crtc_unset_config (crtc);
|
||||
}
|
||||
meta_crtc_unset_config (crtc);
|
||||
}
|
||||
|
||||
for (i = 0; i < n_outputs; i++)
|
||||
@ -241,25 +245,13 @@ apply_crtc_assignments (MetaMonitorManager *manager,
|
||||
output->is_underscanning = output_info->is_underscanning;
|
||||
}
|
||||
|
||||
/* Disable outputs not mentioned in the list */
|
||||
for (l = gpus; l; l = l->next)
|
||||
/* Disable outputs yet to be configured. */
|
||||
for (l = to_configure_outputs; l; l = l->next)
|
||||
{
|
||||
MetaGpu *gpu = l->data;
|
||||
GList *k;
|
||||
MetaOutput *output = l->data;
|
||||
|
||||
for (k = meta_gpu_get_outputs (gpu); k; k = k->next)
|
||||
{
|
||||
MetaOutput *output = k->data;
|
||||
|
||||
if (output->is_dirty)
|
||||
{
|
||||
output->is_dirty = FALSE;
|
||||
continue;
|
||||
}
|
||||
|
||||
meta_output_unassign_crtc (output);
|
||||
output->is_primary = FALSE;
|
||||
}
|
||||
meta_output_unassign_crtc (output);
|
||||
output->is_primary = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -280,7 +280,6 @@ meta_create_xrandr_crtc (MetaGpuXrandr *gpu_xrandr,
|
||||
};
|
||||
}
|
||||
|
||||
crtc->is_dirty = FALSE;
|
||||
crtc->all_transforms =
|
||||
meta_monitor_transform_from_xrandr_all (xrandr_crtc->rotations);
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -123,14 +123,20 @@ apply_crtc_assignments (MetaMonitorManager *manager,
|
||||
MetaBackend *backend = meta_monitor_manager_get_backend (manager);
|
||||
MetaBackendTest *backend_test = META_BACKEND_TEST (backend);
|
||||
MetaGpu *gpu = meta_backend_test_get_gpu (backend_test);
|
||||
g_autoptr (GList) to_configure_outputs = NULL;
|
||||
g_autoptr (GList) to_configure_crtcs = NULL;
|
||||
GList *l;
|
||||
unsigned int i;
|
||||
|
||||
to_configure_outputs = g_list_copy (meta_gpu_get_outputs (gpu));
|
||||
to_configure_crtcs = g_list_copy (meta_gpu_get_crtcs (gpu));
|
||||
|
||||
for (i = 0; i < n_crtcs; i++)
|
||||
{
|
||||
MetaCrtcInfo *crtc_info = crtcs[i];
|
||||
MetaCrtc *crtc = crtc_info->crtc;
|
||||
crtc->is_dirty = TRUE;
|
||||
|
||||
to_configure_crtcs = g_list_remove (to_configure_crtcs, crtc);
|
||||
|
||||
if (crtc_info->mode == NULL)
|
||||
{
|
||||
@ -150,7 +156,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);
|
||||
}
|
||||
}
|
||||
@ -167,30 +174,18 @@ 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_configure_crtcs; l; l = l->next)
|
||||
{
|
||||
MetaCrtc *crtc = l->data;
|
||||
|
||||
if (crtc->is_dirty)
|
||||
{
|
||||
crtc->is_dirty = FALSE;
|
||||
continue;
|
||||
}
|
||||
|
||||
meta_crtc_unset_config (crtc);
|
||||
}
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user