monitor-manager: Rename *Info structs to *Assignment
MetaCrtcInfo and MetaOutputInfo did not represent information about MetaCrtc and MetaOutput, but the result of the monitor configuration assignment algorithm, thus rename it to MetaCrtcAssignment and MetaOutputAssignment. The purpose for this is to be able to introduce a struct that actually carries information about the CRTCs and outputs, as retrieved from the backend implementations. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1287
This commit is contained in:
parent
f71316c850
commit
b69111d8e6
15 changed files with 278 additions and 257 deletions
|
@ -44,8 +44,9 @@ typedef struct _MetaGpu MetaGpu;
|
||||||
typedef struct _MetaCrtc MetaCrtc;
|
typedef struct _MetaCrtc MetaCrtc;
|
||||||
typedef struct _MetaOutput MetaOutput;
|
typedef struct _MetaOutput MetaOutput;
|
||||||
typedef struct _MetaCrtcMode MetaCrtcMode;
|
typedef struct _MetaCrtcMode MetaCrtcMode;
|
||||||
typedef struct _MetaCrtcInfo MetaCrtcInfo;
|
typedef struct _MetaCrtcAssignment MetaCrtcAssignment;
|
||||||
typedef struct _MetaOutputInfo MetaOutputInfo;
|
typedef struct _MetaOutputAssignment MetaOutputAssignment;
|
||||||
|
|
||||||
typedef struct _MetaTileInfo MetaTileInfo;
|
typedef struct _MetaTileInfo MetaTileInfo;
|
||||||
|
|
||||||
typedef struct _MetaRenderer MetaRenderer;
|
typedef struct _MetaRenderer MetaRenderer;
|
||||||
|
|
|
@ -52,10 +52,10 @@ G_DEFINE_TYPE (MetaMonitorsConfig, meta_monitors_config,
|
||||||
G_TYPE_OBJECT)
|
G_TYPE_OBJECT)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_crtc_info_free (MetaCrtcInfo *info);
|
meta_crtc_assignment_free (MetaCrtcAssignment *assignment);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_output_info_free (MetaOutputInfo *info);
|
meta_output_assignment_free (MetaOutputAssignment *assignment);
|
||||||
|
|
||||||
MetaMonitorConfigManager *
|
MetaMonitorConfigManager *
|
||||||
meta_monitor_config_manager_new (MetaMonitorManager *monitor_manager)
|
meta_monitor_config_manager_new (MetaMonitorManager *monitor_manager)
|
||||||
|
@ -96,15 +96,16 @@ is_crtc_reserved (MetaCrtc *crtc,
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
is_crtc_assigned (MetaCrtc *crtc,
|
is_crtc_assigned (MetaCrtc *crtc,
|
||||||
GPtrArray *crtc_infos)
|
GPtrArray *crtc_assignments)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
for (i = 0; i < crtc_infos->len; i++)
|
for (i = 0; i < crtc_assignments->len; i++)
|
||||||
{
|
{
|
||||||
MetaCrtcInfo *assigned_crtc_info = g_ptr_array_index (crtc_infos, i);
|
MetaCrtcAssignment *assigned_crtc_assignment =
|
||||||
|
g_ptr_array_index (crtc_assignments, i);
|
||||||
|
|
||||||
if (assigned_crtc_info->crtc == crtc)
|
if (assigned_crtc_assignment->crtc == crtc)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,14 +114,14 @@ is_crtc_assigned (MetaCrtc *crtc,
|
||||||
|
|
||||||
static MetaCrtc *
|
static MetaCrtc *
|
||||||
find_unassigned_crtc (MetaOutput *output,
|
find_unassigned_crtc (MetaOutput *output,
|
||||||
GPtrArray *crtc_infos,
|
GPtrArray *crtc_assignments,
|
||||||
GArray *reserved_crtcs)
|
GArray *reserved_crtcs)
|
||||||
{
|
{
|
||||||
MetaCrtc *crtc;
|
MetaCrtc *crtc;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
crtc = meta_output_get_assigned_crtc (output);
|
crtc = meta_output_get_assigned_crtc (output);
|
||||||
if (crtc && !is_crtc_assigned (crtc, crtc_infos))
|
if (crtc && !is_crtc_assigned (crtc, crtc_assignments))
|
||||||
return crtc;
|
return crtc;
|
||||||
|
|
||||||
/* then try to assign a CRTC that wasn't used */
|
/* then try to assign a CRTC that wasn't used */
|
||||||
|
@ -128,7 +129,7 @@ find_unassigned_crtc (MetaOutput *output,
|
||||||
{
|
{
|
||||||
crtc = output->possible_crtcs[i];
|
crtc = output->possible_crtcs[i];
|
||||||
|
|
||||||
if (is_crtc_assigned (crtc, crtc_infos))
|
if (is_crtc_assigned (crtc, crtc_assignments))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (is_crtc_reserved (crtc, reserved_crtcs))
|
if (is_crtc_reserved (crtc, reserved_crtcs))
|
||||||
|
@ -142,7 +143,7 @@ find_unassigned_crtc (MetaOutput *output,
|
||||||
{
|
{
|
||||||
crtc = output->possible_crtcs[i];
|
crtc = output->possible_crtcs[i];
|
||||||
|
|
||||||
if (is_crtc_assigned (crtc, crtc_infos))
|
if (is_crtc_assigned (crtc, crtc_assignments))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
return crtc;
|
return crtc;
|
||||||
|
@ -157,8 +158,8 @@ typedef struct
|
||||||
MetaMonitorsConfig *config;
|
MetaMonitorsConfig *config;
|
||||||
MetaLogicalMonitorConfig *logical_monitor_config;
|
MetaLogicalMonitorConfig *logical_monitor_config;
|
||||||
MetaMonitorConfig *monitor_config;
|
MetaMonitorConfig *monitor_config;
|
||||||
GPtrArray *crtc_infos;
|
GPtrArray *crtc_assignments;
|
||||||
GPtrArray *output_infos;
|
GPtrArray *output_assignments;
|
||||||
GArray *reserved_crtcs;
|
GArray *reserved_crtcs;
|
||||||
} MonitorAssignmentData;
|
} MonitorAssignmentData;
|
||||||
|
|
||||||
|
@ -181,15 +182,17 @@ assign_monitor_crtc (MetaMonitor *monitor,
|
||||||
float width, height;
|
float width, height;
|
||||||
MetaCrtcMode *crtc_mode;
|
MetaCrtcMode *crtc_mode;
|
||||||
graphene_rect_t crtc_layout;
|
graphene_rect_t crtc_layout;
|
||||||
MetaCrtcInfo *crtc_info;
|
MetaCrtcAssignment *crtc_assignment;
|
||||||
MetaOutputInfo *output_info;
|
MetaOutputAssignment *output_assignment;
|
||||||
MetaMonitorConfig *first_monitor_config;
|
MetaMonitorConfig *first_monitor_config;
|
||||||
gboolean assign_output_as_primary;
|
gboolean assign_output_as_primary;
|
||||||
gboolean assign_output_as_presentation;
|
gboolean assign_output_as_presentation;
|
||||||
|
|
||||||
output = monitor_crtc_mode->output;
|
output = monitor_crtc_mode->output;
|
||||||
|
|
||||||
crtc = find_unassigned_crtc (output, data->crtc_infos, data->reserved_crtcs);
|
crtc = find_unassigned_crtc (output,
|
||||||
|
data->crtc_assignments,
|
||||||
|
data->reserved_crtcs);
|
||||||
|
|
||||||
if (!crtc)
|
if (!crtc)
|
||||||
{
|
{
|
||||||
|
@ -244,15 +247,15 @@ assign_monitor_crtc (MetaMonitor *monitor,
|
||||||
width,
|
width,
|
||||||
height);
|
height);
|
||||||
|
|
||||||
crtc_info = g_slice_new0 (MetaCrtcInfo);
|
crtc_assignment = g_slice_new0 (MetaCrtcAssignment);
|
||||||
*crtc_info = (MetaCrtcInfo) {
|
*crtc_assignment = (MetaCrtcAssignment) {
|
||||||
.crtc = crtc,
|
.crtc = crtc,
|
||||||
.mode = crtc_mode,
|
.mode = crtc_mode,
|
||||||
.layout = crtc_layout,
|
.layout = crtc_layout,
|
||||||
.transform = crtc_hw_transform,
|
.transform = crtc_hw_transform,
|
||||||
.outputs = g_ptr_array_new ()
|
.outputs = g_ptr_array_new ()
|
||||||
};
|
};
|
||||||
g_ptr_array_add (crtc_info->outputs, output);
|
g_ptr_array_add (crtc_assignment->outputs, output);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Only one output can be marked as primary (due to Xrandr limitation),
|
* Only one output can be marked as primary (due to Xrandr limitation),
|
||||||
|
@ -272,16 +275,16 @@ assign_monitor_crtc (MetaMonitor *monitor,
|
||||||
else
|
else
|
||||||
assign_output_as_presentation = FALSE;
|
assign_output_as_presentation = FALSE;
|
||||||
|
|
||||||
output_info = g_slice_new0 (MetaOutputInfo);
|
output_assignment = g_slice_new0 (MetaOutputAssignment);
|
||||||
*output_info = (MetaOutputInfo) {
|
*output_assignment = (MetaOutputAssignment) {
|
||||||
.output = output,
|
.output = output,
|
||||||
.is_primary = assign_output_as_primary,
|
.is_primary = assign_output_as_primary,
|
||||||
.is_presentation = assign_output_as_presentation,
|
.is_presentation = assign_output_as_presentation,
|
||||||
.is_underscanning = data->monitor_config->enable_underscanning
|
.is_underscanning = data->monitor_config->enable_underscanning
|
||||||
};
|
};
|
||||||
|
|
||||||
g_ptr_array_add (data->crtc_infos, crtc_info);
|
g_ptr_array_add (data->crtc_assignments, crtc_assignment);
|
||||||
g_ptr_array_add (data->output_infos, output_info);
|
g_ptr_array_add (data->output_assignments, output_assignment);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -291,8 +294,8 @@ assign_monitor_crtcs (MetaMonitorManager *manager,
|
||||||
MetaMonitorsConfig *config,
|
MetaMonitorsConfig *config,
|
||||||
MetaLogicalMonitorConfig *logical_monitor_config,
|
MetaLogicalMonitorConfig *logical_monitor_config,
|
||||||
MetaMonitorConfig *monitor_config,
|
MetaMonitorConfig *monitor_config,
|
||||||
GPtrArray *crtc_infos,
|
GPtrArray *crtc_assignments,
|
||||||
GPtrArray *output_infos,
|
GPtrArray *output_assignments,
|
||||||
GArray *reserved_crtcs,
|
GArray *reserved_crtcs,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
|
@ -327,8 +330,8 @@ assign_monitor_crtcs (MetaMonitorManager *manager,
|
||||||
.config = config,
|
.config = config,
|
||||||
.logical_monitor_config = logical_monitor_config,
|
.logical_monitor_config = logical_monitor_config,
|
||||||
.monitor_config = monitor_config,
|
.monitor_config = monitor_config,
|
||||||
.crtc_infos = crtc_infos,
|
.crtc_assignments = crtc_assignments,
|
||||||
.output_infos = output_infos,
|
.output_assignments = output_assignments,
|
||||||
.reserved_crtcs = reserved_crtcs
|
.reserved_crtcs = reserved_crtcs
|
||||||
};
|
};
|
||||||
if (!meta_monitor_mode_foreach_crtc (monitor, monitor_mode,
|
if (!meta_monitor_mode_foreach_crtc (monitor, monitor_mode,
|
||||||
|
@ -344,8 +347,8 @@ static gboolean
|
||||||
assign_logical_monitor_crtcs (MetaMonitorManager *manager,
|
assign_logical_monitor_crtcs (MetaMonitorManager *manager,
|
||||||
MetaMonitorsConfig *config,
|
MetaMonitorsConfig *config,
|
||||||
MetaLogicalMonitorConfig *logical_monitor_config,
|
MetaLogicalMonitorConfig *logical_monitor_config,
|
||||||
GPtrArray *crtc_infos,
|
GPtrArray *crtc_assignments,
|
||||||
GPtrArray *output_infos,
|
GPtrArray *output_assignments,
|
||||||
GArray *reserved_crtcs,
|
GArray *reserved_crtcs,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
|
@ -359,7 +362,7 @@ assign_logical_monitor_crtcs (MetaMonitorManager *manager,
|
||||||
config,
|
config,
|
||||||
logical_monitor_config,
|
logical_monitor_config,
|
||||||
monitor_config,
|
monitor_config,
|
||||||
crtc_infos, output_infos,
|
crtc_assignments, output_assignments,
|
||||||
reserved_crtcs, error))
|
reserved_crtcs, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -370,19 +373,19 @@ assign_logical_monitor_crtcs (MetaMonitorManager *manager,
|
||||||
gboolean
|
gboolean
|
||||||
meta_monitor_config_manager_assign (MetaMonitorManager *manager,
|
meta_monitor_config_manager_assign (MetaMonitorManager *manager,
|
||||||
MetaMonitorsConfig *config,
|
MetaMonitorsConfig *config,
|
||||||
GPtrArray **out_crtc_infos,
|
GPtrArray **out_crtc_assignments,
|
||||||
GPtrArray **out_output_infos,
|
GPtrArray **out_output_assignments,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
GPtrArray *crtc_infos;
|
GPtrArray *crtc_assignments;
|
||||||
GPtrArray *output_infos;
|
GPtrArray *output_assignments;
|
||||||
GArray *reserved_crtcs;
|
GArray *reserved_crtcs;
|
||||||
GList *l;
|
GList *l;
|
||||||
|
|
||||||
crtc_infos =
|
crtc_assignments =
|
||||||
g_ptr_array_new_with_free_func ((GDestroyNotify) meta_crtc_info_free);
|
g_ptr_array_new_with_free_func ((GDestroyNotify) meta_crtc_assignment_free);
|
||||||
output_infos =
|
output_assignments =
|
||||||
g_ptr_array_new_with_free_func ((GDestroyNotify) meta_output_info_free);
|
g_ptr_array_new_with_free_func ((GDestroyNotify) meta_output_assignment_free);
|
||||||
reserved_crtcs = g_array_new (FALSE, FALSE, sizeof (uint64_t));
|
reserved_crtcs = g_array_new (FALSE, FALSE, sizeof (uint64_t));
|
||||||
|
|
||||||
for (l = config->logical_monitor_configs; l; l = l->next)
|
for (l = config->logical_monitor_configs; l; l = l->next)
|
||||||
|
@ -421,11 +424,11 @@ meta_monitor_config_manager_assign (MetaMonitorManager *manager,
|
||||||
|
|
||||||
if (!assign_logical_monitor_crtcs (manager,
|
if (!assign_logical_monitor_crtcs (manager,
|
||||||
config, logical_monitor_config,
|
config, logical_monitor_config,
|
||||||
crtc_infos, output_infos,
|
crtc_assignments, output_assignments,
|
||||||
reserved_crtcs, error))
|
reserved_crtcs, error))
|
||||||
{
|
{
|
||||||
g_ptr_array_free (crtc_infos, TRUE);
|
g_ptr_array_free (crtc_assignments, TRUE);
|
||||||
g_ptr_array_free (output_infos, TRUE);
|
g_ptr_array_free (output_assignments, TRUE);
|
||||||
g_array_free (reserved_crtcs, TRUE);
|
g_array_free (reserved_crtcs, TRUE);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -433,8 +436,8 @@ meta_monitor_config_manager_assign (MetaMonitorManager *manager,
|
||||||
|
|
||||||
g_array_free (reserved_crtcs, TRUE);
|
g_array_free (reserved_crtcs, TRUE);
|
||||||
|
|
||||||
*out_crtc_infos = crtc_infos;
|
*out_crtc_assignments = crtc_assignments;
|
||||||
*out_output_infos = output_infos;
|
*out_output_assignments = output_assignments;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -1563,16 +1566,16 @@ meta_monitors_config_class_init (MetaMonitorsConfigClass *klass)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_crtc_info_free (MetaCrtcInfo *info)
|
meta_crtc_assignment_free (MetaCrtcAssignment *assignment)
|
||||||
{
|
{
|
||||||
g_ptr_array_free (info->outputs, TRUE);
|
g_ptr_array_free (assignment->outputs, TRUE);
|
||||||
g_slice_free (MetaCrtcInfo, info);
|
g_slice_free (MetaCrtcAssignment, assignment);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_output_info_free (MetaOutputInfo *info)
|
meta_output_assignment_free (MetaOutputAssignment *assignment)
|
||||||
{
|
{
|
||||||
g_slice_free (MetaOutputInfo, info);
|
g_slice_free (MetaOutputAssignment, assignment);
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
|
|
|
@ -87,8 +87,8 @@ MetaMonitorConfigStore * meta_monitor_config_manager_get_store (MetaMonitorConfi
|
||||||
META_EXPORT_TEST
|
META_EXPORT_TEST
|
||||||
gboolean meta_monitor_config_manager_assign (MetaMonitorManager *manager,
|
gboolean meta_monitor_config_manager_assign (MetaMonitorManager *manager,
|
||||||
MetaMonitorsConfig *config,
|
MetaMonitorsConfig *config,
|
||||||
GPtrArray **crtc_infos,
|
GPtrArray **crtc_assignments,
|
||||||
GPtrArray **output_infos,
|
GPtrArray **output_assignments,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
META_EXPORT_TEST
|
META_EXPORT_TEST
|
||||||
|
|
|
@ -498,11 +498,11 @@ meta_monitor_manager_dummy_ensure_initial_config (MetaMonitorManager *manager)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
apply_crtc_assignments (MetaMonitorManager *manager,
|
apply_crtc_assignments (MetaMonitorManager *manager,
|
||||||
MetaCrtcInfo **crtcs,
|
MetaCrtcAssignment **crtcs,
|
||||||
unsigned int n_crtcs,
|
unsigned int n_crtcs,
|
||||||
MetaOutputInfo **outputs,
|
MetaOutputAssignment **outputs,
|
||||||
unsigned int n_outputs)
|
unsigned int n_outputs)
|
||||||
{
|
{
|
||||||
g_autoptr (GList) to_configure_outputs = NULL;
|
g_autoptr (GList) to_configure_outputs = NULL;
|
||||||
g_autoptr (GList) to_configure_crtcs = NULL;
|
g_autoptr (GList) to_configure_crtcs = NULL;
|
||||||
|
@ -513,12 +513,12 @@ apply_crtc_assignments (MetaMonitorManager *manager,
|
||||||
|
|
||||||
for (i = 0; i < n_crtcs; i++)
|
for (i = 0; i < n_crtcs; i++)
|
||||||
{
|
{
|
||||||
MetaCrtcInfo *crtc_info = crtcs[i];
|
MetaCrtcAssignment *crtc_assignment = crtcs[i];
|
||||||
MetaCrtc *crtc = crtc_info->crtc;
|
MetaCrtc *crtc = crtc_assignment->crtc;
|
||||||
|
|
||||||
to_configure_crtcs = g_list_remove (to_configure_crtcs, crtc);
|
to_configure_crtcs = g_list_remove (to_configure_crtcs, crtc);
|
||||||
|
|
||||||
if (crtc_info->mode == NULL)
|
if (crtc_assignment->mode == NULL)
|
||||||
{
|
{
|
||||||
meta_crtc_unset_config (crtc);
|
meta_crtc_unset_config (crtc);
|
||||||
}
|
}
|
||||||
|
@ -527,22 +527,24 @@ apply_crtc_assignments (MetaMonitorManager *manager,
|
||||||
unsigned int j;
|
unsigned int j;
|
||||||
|
|
||||||
meta_crtc_set_config (crtc,
|
meta_crtc_set_config (crtc,
|
||||||
&crtc_info->layout,
|
&crtc_assignment->layout,
|
||||||
crtc_info->mode,
|
crtc_assignment->mode,
|
||||||
crtc_info->transform);
|
crtc_assignment->transform);
|
||||||
|
|
||||||
for (j = 0; j < crtc_info->outputs->len; j++)
|
for (j = 0; j < crtc_assignment->outputs->len; j++)
|
||||||
{
|
{
|
||||||
MetaOutput *output;
|
MetaOutput *output;
|
||||||
MetaOutputInfo *output_info;
|
MetaOutputAssignment *output_assignment;
|
||||||
|
|
||||||
output = ((MetaOutput**)crtc_info->outputs->pdata)[j];
|
output = ((MetaOutput**) crtc_assignment->outputs->pdata)[j];
|
||||||
|
|
||||||
to_configure_outputs = g_list_remove (to_configure_outputs,
|
to_configure_outputs = g_list_remove (to_configure_outputs,
|
||||||
output);
|
output);
|
||||||
|
|
||||||
output_info = meta_find_output_info (outputs, n_outputs, output);
|
output_assignment = meta_find_output_assignment (outputs,
|
||||||
meta_output_assign_crtc (output, crtc, output_info);
|
n_outputs,
|
||||||
|
output);
|
||||||
|
meta_output_assign_crtc (output, crtc, output_assignment);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -590,8 +592,8 @@ meta_monitor_manager_dummy_apply_monitors_config (MetaMonitorManager *manag
|
||||||
MetaMonitorsConfigMethod method,
|
MetaMonitorsConfigMethod method,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
GPtrArray *crtc_infos;
|
GPtrArray *crtc_assignments;
|
||||||
GPtrArray *output_infos;
|
GPtrArray *output_assignments;
|
||||||
|
|
||||||
if (!config)
|
if (!config)
|
||||||
{
|
{
|
||||||
|
@ -603,25 +605,26 @@ meta_monitor_manager_dummy_apply_monitors_config (MetaMonitorManager *manag
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!meta_monitor_config_manager_assign (manager, config,
|
if (!meta_monitor_config_manager_assign (manager, config,
|
||||||
&crtc_infos, &output_infos,
|
&crtc_assignments,
|
||||||
|
&output_assignments,
|
||||||
error))
|
error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (method == META_MONITORS_CONFIG_METHOD_VERIFY)
|
if (method == META_MONITORS_CONFIG_METHOD_VERIFY)
|
||||||
{
|
{
|
||||||
g_ptr_array_free (crtc_infos, TRUE);
|
g_ptr_array_free (crtc_assignments, TRUE);
|
||||||
g_ptr_array_free (output_infos, TRUE);
|
g_ptr_array_free (output_assignments, TRUE);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
apply_crtc_assignments (manager,
|
apply_crtc_assignments (manager,
|
||||||
(MetaCrtcInfo **) crtc_infos->pdata,
|
(MetaCrtcAssignment **) crtc_assignments->pdata,
|
||||||
crtc_infos->len,
|
crtc_assignments->len,
|
||||||
(MetaOutputInfo **) output_infos->pdata,
|
(MetaOutputAssignment **) output_assignments->pdata,
|
||||||
output_infos->len);
|
output_assignments->len);
|
||||||
|
|
||||||
g_ptr_array_free (crtc_infos, TRUE);
|
g_ptr_array_free (crtc_assignments, TRUE);
|
||||||
g_ptr_array_free (output_infos, TRUE);
|
g_ptr_array_free (output_assignments, TRUE);
|
||||||
|
|
||||||
update_screen_size (manager, config);
|
update_screen_size (manager, config);
|
||||||
meta_monitor_manager_rebuild (manager, config);
|
meta_monitor_manager_rebuild (manager, config);
|
||||||
|
|
|
@ -63,12 +63,12 @@ typedef enum _MetaLogicalMonitorLayoutMode
|
||||||
} MetaLogicalMonitorLayoutMode;
|
} MetaLogicalMonitorLayoutMode;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* MetaCrtcInfo:
|
* MetaCrtcAssignment:
|
||||||
*
|
*
|
||||||
* A representation of a CRTC configuration, generated by
|
* A representation of a CRTC configuration, generated by
|
||||||
* MetaMonitorConfigManager.
|
* MetaMonitorConfigManager.
|
||||||
*/
|
*/
|
||||||
struct _MetaCrtcInfo
|
struct _MetaCrtcAssignment
|
||||||
{
|
{
|
||||||
MetaCrtc *crtc;
|
MetaCrtc *crtc;
|
||||||
MetaCrtcMode *mode;
|
MetaCrtcMode *mode;
|
||||||
|
@ -78,12 +78,12 @@ struct _MetaCrtcInfo
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* MetaOutputInfo:
|
* MetaOutputAssignment:
|
||||||
*
|
*
|
||||||
* A representation of a connector configuration, generated by
|
* A representation of a connector configuration, generated by
|
||||||
* MetaMonitorConfigManager.
|
* MetaMonitorConfigManager.
|
||||||
*/
|
*/
|
||||||
struct _MetaOutputInfo
|
struct _MetaOutputAssignment
|
||||||
{
|
{
|
||||||
MetaOutput *output;
|
MetaOutput *output;
|
||||||
gboolean is_primary;
|
gboolean is_primary;
|
||||||
|
@ -387,19 +387,19 @@ gboolean meta_monitor_has_aspect_as_size (MetaMonitor *monitor);
|
||||||
char * meta_monitor_manager_get_vendor_name (MetaMonitorManager *manager,
|
char * meta_monitor_manager_get_vendor_name (MetaMonitorManager *manager,
|
||||||
const char *vendor);
|
const char *vendor);
|
||||||
|
|
||||||
static inline MetaOutputInfo *
|
static inline MetaOutputAssignment *
|
||||||
meta_find_output_info (MetaOutputInfo **outputs,
|
meta_find_output_assignment (MetaOutputAssignment **outputs,
|
||||||
unsigned int n_outputs,
|
unsigned int n_outputs,
|
||||||
MetaOutput *output)
|
MetaOutput *output)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
for (i = 0; i < n_outputs; i++)
|
for (i = 0; i < n_outputs; i++)
|
||||||
{
|
{
|
||||||
MetaOutputInfo *output_info = outputs[i];
|
MetaOutputAssignment *output_assignment = outputs[i];
|
||||||
|
|
||||||
if (output == output_info->output)
|
if (output == output_assignment->output)
|
||||||
return output_info;
|
return output_assignment;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -116,9 +116,9 @@ meta_output_get_backlight (MetaOutput *output)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_output_assign_crtc (MetaOutput *output,
|
meta_output_assign_crtc (MetaOutput *output,
|
||||||
MetaCrtc *crtc,
|
MetaCrtc *crtc,
|
||||||
const MetaOutputInfo *output_info)
|
const MetaOutputAssignment *output_assignment)
|
||||||
{
|
{
|
||||||
MetaOutputPrivate *priv = meta_output_get_instance_private (output);
|
MetaOutputPrivate *priv = meta_output_get_instance_private (output);
|
||||||
|
|
||||||
|
@ -126,9 +126,9 @@ meta_output_assign_crtc (MetaOutput *output,
|
||||||
|
|
||||||
g_set_object (&priv->crtc, crtc);
|
g_set_object (&priv->crtc, crtc);
|
||||||
|
|
||||||
priv->is_primary = output_info->is_primary;
|
priv->is_primary = output_assignment->is_primary;
|
||||||
priv->is_presentation = output_info->is_presentation;
|
priv->is_presentation = output_assignment->is_presentation;
|
||||||
priv->is_underscanning = output_info->is_underscanning;
|
priv->is_underscanning = output_assignment->is_underscanning;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -130,9 +130,9 @@ void meta_output_set_backlight (MetaOutput *output,
|
||||||
int meta_output_get_backlight (MetaOutput *output);
|
int meta_output_get_backlight (MetaOutput *output);
|
||||||
|
|
||||||
META_EXPORT_TEST
|
META_EXPORT_TEST
|
||||||
void meta_output_assign_crtc (MetaOutput *output,
|
void meta_output_assign_crtc (MetaOutput *output,
|
||||||
MetaCrtc *crtc,
|
MetaCrtc *crtc,
|
||||||
const MetaOutputInfo *output_info);
|
const MetaOutputAssignment *output_assignment);
|
||||||
|
|
||||||
META_EXPORT_TEST
|
META_EXPORT_TEST
|
||||||
void meta_output_unassign_crtc (MetaOutput *output);
|
void meta_output_unassign_crtc (MetaOutput *output);
|
||||||
|
|
|
@ -169,11 +169,11 @@ meta_monitor_manager_kms_ensure_initial_config (MetaMonitorManager *manager)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
apply_crtc_assignments (MetaMonitorManager *manager,
|
apply_crtc_assignments (MetaMonitorManager *manager,
|
||||||
MetaCrtcInfo **crtcs,
|
MetaCrtcAssignment **crtcs,
|
||||||
unsigned int n_crtcs,
|
unsigned int n_crtcs,
|
||||||
MetaOutputInfo **outputs,
|
MetaOutputAssignment **outputs,
|
||||||
unsigned int n_outputs)
|
unsigned int n_outputs)
|
||||||
{
|
{
|
||||||
MetaBackend *backend = meta_monitor_manager_get_backend (manager);
|
MetaBackend *backend = meta_monitor_manager_get_backend (manager);
|
||||||
g_autoptr (GList) to_configure_outputs = NULL;
|
g_autoptr (GList) to_configure_outputs = NULL;
|
||||||
|
@ -198,12 +198,12 @@ apply_crtc_assignments (MetaMonitorManager *manager,
|
||||||
|
|
||||||
for (i = 0; i < n_crtcs; i++)
|
for (i = 0; i < n_crtcs; i++)
|
||||||
{
|
{
|
||||||
MetaCrtcInfo *crtc_info = crtcs[i];
|
MetaCrtcAssignment *crtc_assignment = crtcs[i];
|
||||||
MetaCrtc *crtc = crtc_info->crtc;
|
MetaCrtc *crtc = crtc_assignment->crtc;
|
||||||
|
|
||||||
to_configure_crtcs = g_list_remove (to_configure_crtcs, crtc);
|
to_configure_crtcs = g_list_remove (to_configure_crtcs, crtc);
|
||||||
|
|
||||||
if (crtc_info->mode == NULL)
|
if (crtc_assignment->mode == NULL)
|
||||||
{
|
{
|
||||||
meta_crtc_unset_config (crtc);
|
meta_crtc_unset_config (crtc);
|
||||||
}
|
}
|
||||||
|
@ -212,20 +212,23 @@ apply_crtc_assignments (MetaMonitorManager *manager,
|
||||||
unsigned int j;
|
unsigned int j;
|
||||||
|
|
||||||
meta_crtc_set_config (crtc,
|
meta_crtc_set_config (crtc,
|
||||||
&crtc_info->layout,
|
&crtc_assignment->layout,
|
||||||
crtc_info->mode,
|
crtc_assignment->mode,
|
||||||
crtc_info->transform);
|
crtc_assignment->transform);
|
||||||
|
|
||||||
for (j = 0; j < crtc_info->outputs->len; j++)
|
for (j = 0; j < crtc_assignment->outputs->len; j++)
|
||||||
{
|
{
|
||||||
MetaOutput *output = g_ptr_array_index (crtc_info->outputs, j);
|
MetaOutput *output = g_ptr_array_index (crtc_assignment->outputs,
|
||||||
MetaOutputInfo *output_info;
|
j);
|
||||||
|
MetaOutputAssignment *output_assignment;
|
||||||
|
|
||||||
to_configure_outputs = g_list_remove (to_configure_outputs,
|
to_configure_outputs = g_list_remove (to_configure_outputs,
|
||||||
output);
|
output);
|
||||||
|
|
||||||
output_info = meta_find_output_info (outputs, n_outputs, output);
|
output_assignment = meta_find_output_assignment (outputs,
|
||||||
meta_output_assign_crtc (output, crtc, output_info);
|
n_outputs,
|
||||||
|
output);
|
||||||
|
meta_output_assign_crtc (output, crtc, output_assignment);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -273,8 +276,8 @@ meta_monitor_manager_kms_apply_monitors_config (MetaMonitorManager *manager
|
||||||
MetaMonitorsConfigMethod method,
|
MetaMonitorsConfigMethod method,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
GPtrArray *crtc_infos;
|
GPtrArray *crtc_assignments;
|
||||||
GPtrArray *output_infos;
|
GPtrArray *output_assignments;
|
||||||
|
|
||||||
if (!config)
|
if (!config)
|
||||||
{
|
{
|
||||||
|
@ -285,25 +288,26 @@ meta_monitor_manager_kms_apply_monitors_config (MetaMonitorManager *manager
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!meta_monitor_config_manager_assign (manager, config,
|
if (!meta_monitor_config_manager_assign (manager, config,
|
||||||
&crtc_infos, &output_infos,
|
&crtc_assignments,
|
||||||
|
&output_assignments,
|
||||||
error))
|
error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (method == META_MONITORS_CONFIG_METHOD_VERIFY)
|
if (method == META_MONITORS_CONFIG_METHOD_VERIFY)
|
||||||
{
|
{
|
||||||
g_ptr_array_free (crtc_infos, TRUE);
|
g_ptr_array_free (crtc_assignments, TRUE);
|
||||||
g_ptr_array_free (output_infos, TRUE);
|
g_ptr_array_free (output_assignments, TRUE);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
apply_crtc_assignments (manager,
|
apply_crtc_assignments (manager,
|
||||||
(MetaCrtcInfo **) crtc_infos->pdata,
|
(MetaCrtcAssignment **) crtc_assignments->pdata,
|
||||||
crtc_infos->len,
|
crtc_assignments->len,
|
||||||
(MetaOutputInfo **) output_infos->pdata,
|
(MetaOutputAssignment **) output_assignments->pdata,
|
||||||
output_infos->len);
|
output_assignments->len);
|
||||||
|
|
||||||
g_ptr_array_free (crtc_infos, TRUE);
|
g_ptr_array_free (crtc_assignments, TRUE);
|
||||||
g_ptr_array_free (output_infos, TRUE);
|
g_ptr_array_free (output_assignments, TRUE);
|
||||||
|
|
||||||
update_screen_size (manager, config);
|
update_screen_size (manager, config);
|
||||||
meta_monitor_manager_rebuild (manager, config);
|
meta_monitor_manager_rebuild (manager, config);
|
||||||
|
|
|
@ -363,23 +363,23 @@ meta_create_kms_output (MetaGpuKms *gpu_kms,
|
||||||
|
|
||||||
if (meta_crtc_get_id (crtc) == connector_state->current_crtc_id)
|
if (meta_crtc_get_id (crtc) == connector_state->current_crtc_id)
|
||||||
{
|
{
|
||||||
MetaOutputInfo output_info;
|
MetaOutputAssignment output_assignment;
|
||||||
|
|
||||||
if (old_output)
|
if (old_output)
|
||||||
{
|
{
|
||||||
output_info = (MetaOutputInfo) {
|
output_assignment = (MetaOutputAssignment) {
|
||||||
.is_primary = meta_output_is_primary (old_output),
|
.is_primary = meta_output_is_primary (old_output),
|
||||||
.is_presentation = meta_output_is_presentation (old_output),
|
.is_presentation = meta_output_is_presentation (old_output),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
output_info = (MetaOutputInfo) {
|
output_assignment = (MetaOutputAssignment) {
|
||||||
.is_primary = FALSE,
|
.is_primary = FALSE,
|
||||||
.is_presentation = FALSE,
|
.is_presentation = FALSE,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
meta_output_assign_crtc (output, crtc, &output_info);
|
meta_output_assign_crtc (output, crtc, &output_assignment);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -183,27 +183,27 @@ meta_monitor_transform_from_xrandr_all (Rotation rotation)
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
meta_crtc_xrandr_is_assignment_changed (MetaCrtc *crtc,
|
meta_crtc_xrandr_is_assignment_changed (MetaCrtc *crtc,
|
||||||
MetaCrtcInfo *crtc_info)
|
MetaCrtcAssignment *crtc_assignment)
|
||||||
{
|
{
|
||||||
MetaCrtcXrandr *crtc_xrandr = crtc->driver_private;
|
MetaCrtcXrandr *crtc_xrandr = crtc->driver_private;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
if (crtc_xrandr->current_mode != crtc_info->mode)
|
if (crtc_xrandr->current_mode != crtc_assignment->mode)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
if (crtc_xrandr->rect.x != (int) roundf (crtc_info->layout.origin.x))
|
if (crtc_xrandr->rect.x != (int) roundf (crtc_assignment->layout.origin.x))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
if (crtc_xrandr->rect.y != (int) roundf (crtc_info->layout.origin.y))
|
if (crtc_xrandr->rect.y != (int) roundf (crtc_assignment->layout.origin.y))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
if (crtc_xrandr->transform != crtc_info->transform)
|
if (crtc_xrandr->transform != crtc_assignment->transform)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
for (i = 0; i < crtc_info->outputs->len; i++)
|
for (i = 0; i < crtc_assignment->outputs->len; i++)
|
||||||
{
|
{
|
||||||
MetaOutput *output = ((MetaOutput**) crtc_info->outputs->pdata)[i];
|
MetaOutput *output = ((MetaOutput**) crtc_assignment->outputs->pdata)[i];
|
||||||
MetaCrtc *assigned_crtc;
|
MetaCrtc *assigned_crtc;
|
||||||
|
|
||||||
assigned_crtc = meta_output_get_assigned_crtc (output);
|
assigned_crtc = meta_output_get_assigned_crtc (output);
|
||||||
|
|
|
@ -39,8 +39,8 @@ gboolean meta_crtc_xrandr_set_config (MetaCrtc *crtc,
|
||||||
int n_outputs,
|
int n_outputs,
|
||||||
xcb_timestamp_t *out_timestamp);
|
xcb_timestamp_t *out_timestamp);
|
||||||
|
|
||||||
gboolean meta_crtc_xrandr_is_assignment_changed (MetaCrtc *crtc,
|
gboolean meta_crtc_xrandr_is_assignment_changed (MetaCrtc *crtc,
|
||||||
MetaCrtcInfo *crtc_info);
|
MetaCrtcAssignment *crtc_assignment);
|
||||||
|
|
||||||
MetaCrtcMode * meta_crtc_xrandr_get_current_mode (MetaCrtc *crtc);
|
MetaCrtcMode * meta_crtc_xrandr_get_current_mode (MetaCrtc *crtc);
|
||||||
|
|
||||||
|
|
|
@ -241,52 +241,52 @@ xrandr_set_crtc_config (MetaMonitorManagerXrandr *manager_xrandr,
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
is_crtc_assignment_changed (MetaCrtc *crtc,
|
is_crtc_assignment_changed (MetaCrtc *crtc,
|
||||||
MetaCrtcInfo **crtc_infos,
|
MetaCrtcAssignment **crtc_assignments,
|
||||||
unsigned int n_crtc_infos)
|
unsigned int n_crtc_assignments)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
for (i = 0; i < n_crtc_infos; i++)
|
for (i = 0; i < n_crtc_assignments; i++)
|
||||||
{
|
{
|
||||||
MetaCrtcInfo *crtc_info = crtc_infos[i];
|
MetaCrtcAssignment *crtc_assignment = crtc_assignments[i];
|
||||||
|
|
||||||
if (crtc_info->crtc != crtc)
|
if (crtc_assignment->crtc != crtc)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
return meta_crtc_xrandr_is_assignment_changed (crtc, crtc_info);
|
return meta_crtc_xrandr_is_assignment_changed (crtc, crtc_assignment);
|
||||||
}
|
}
|
||||||
|
|
||||||
return !!meta_crtc_xrandr_get_current_mode (crtc);
|
return !!meta_crtc_xrandr_get_current_mode (crtc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
is_output_assignment_changed (MetaOutput *output,
|
is_output_assignment_changed (MetaOutput *output,
|
||||||
MetaCrtcInfo **crtc_infos,
|
MetaCrtcAssignment **crtc_assignments,
|
||||||
unsigned int n_crtc_infos,
|
unsigned int n_crtc_assignments,
|
||||||
MetaOutputInfo **output_infos,
|
MetaOutputAssignment **output_assignments,
|
||||||
unsigned int n_output_infos)
|
unsigned int n_output_assignments)
|
||||||
{
|
{
|
||||||
MetaCrtc *assigned_crtc;
|
MetaCrtc *assigned_crtc;
|
||||||
gboolean output_is_found = FALSE;
|
gboolean output_is_found = FALSE;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
for (i = 0; i < n_output_infos; i++)
|
for (i = 0; i < n_output_assignments; i++)
|
||||||
{
|
{
|
||||||
MetaOutputInfo *output_info = output_infos[i];
|
MetaOutputAssignment *output_assignment = output_assignments[i];
|
||||||
|
|
||||||
if (output_info->output != output)
|
if (output_assignment->output != output)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (meta_output_is_primary (output) != output_info->is_primary)
|
if (meta_output_is_primary (output) != output_assignment->is_primary)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
if (meta_output_is_presentation (output) !=
|
if (meta_output_is_presentation (output) !=
|
||||||
output_info->is_presentation)
|
output_assignment->is_presentation)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
if (meta_output_is_underscanning (output) !=
|
if (meta_output_is_underscanning (output) !=
|
||||||
output_info->is_underscanning)
|
output_assignment->is_underscanning)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
output_is_found = TRUE;
|
output_is_found = TRUE;
|
||||||
|
@ -297,18 +297,18 @@ is_output_assignment_changed (MetaOutput *output,
|
||||||
if (!output_is_found)
|
if (!output_is_found)
|
||||||
return assigned_crtc != NULL;
|
return assigned_crtc != NULL;
|
||||||
|
|
||||||
for (i = 0; i < n_crtc_infos; i++)
|
for (i = 0; i < n_crtc_assignments; i++)
|
||||||
{
|
{
|
||||||
MetaCrtcInfo *crtc_info = crtc_infos[i];
|
MetaCrtcAssignment *crtc_assignment = crtc_assignments[i];
|
||||||
unsigned int j;
|
unsigned int j;
|
||||||
|
|
||||||
for (j = 0; j < crtc_info->outputs->len; j++)
|
for (j = 0; j < crtc_assignment->outputs->len; j++)
|
||||||
{
|
{
|
||||||
MetaOutput *crtc_info_output =
|
MetaOutput *crtc_assignment_output =
|
||||||
((MetaOutput**) crtc_info->outputs->pdata)[j];
|
((MetaOutput**) crtc_assignment->outputs->pdata)[j];
|
||||||
|
|
||||||
if (crtc_info_output == output &&
|
if (crtc_assignment_output == output &&
|
||||||
crtc_info->crtc == assigned_crtc)
|
crtc_assignment->crtc == assigned_crtc)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -326,11 +326,11 @@ meta_monitor_manager_xrandr_get_gpu (MetaMonitorManagerXrandr *manager_xrandr)
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
is_assignments_changed (MetaMonitorManager *manager,
|
is_assignments_changed (MetaMonitorManager *manager,
|
||||||
MetaCrtcInfo **crtc_infos,
|
MetaCrtcAssignment **crtc_assignments,
|
||||||
unsigned int n_crtc_infos,
|
unsigned int n_crtc_assignments,
|
||||||
MetaOutputInfo **output_infos,
|
MetaOutputAssignment **output_assignments,
|
||||||
unsigned int n_output_infos)
|
unsigned int n_output_assignments)
|
||||||
{
|
{
|
||||||
MetaMonitorManagerXrandr *manager_xrandr =
|
MetaMonitorManagerXrandr *manager_xrandr =
|
||||||
META_MONITOR_MANAGER_XRANDR (manager);
|
META_MONITOR_MANAGER_XRANDR (manager);
|
||||||
|
@ -341,7 +341,7 @@ is_assignments_changed (MetaMonitorManager *manager,
|
||||||
{
|
{
|
||||||
MetaCrtc *crtc = l->data;
|
MetaCrtc *crtc = l->data;
|
||||||
|
|
||||||
if (is_crtc_assignment_changed (crtc, crtc_infos, n_crtc_infos))
|
if (is_crtc_assignment_changed (crtc, crtc_assignments, n_crtc_assignments))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -350,10 +350,10 @@ is_assignments_changed (MetaMonitorManager *manager,
|
||||||
MetaOutput *output = l->data;
|
MetaOutput *output = l->data;
|
||||||
|
|
||||||
if (is_output_assignment_changed (output,
|
if (is_output_assignment_changed (output,
|
||||||
crtc_infos,
|
crtc_assignments,
|
||||||
n_crtc_infos,
|
n_crtc_assignments,
|
||||||
output_infos,
|
output_assignments,
|
||||||
n_output_infos))
|
n_output_assignments))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -361,12 +361,12 @@ is_assignments_changed (MetaMonitorManager *manager,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
apply_crtc_assignments (MetaMonitorManager *manager,
|
apply_crtc_assignments (MetaMonitorManager *manager,
|
||||||
gboolean save_timestamp,
|
gboolean save_timestamp,
|
||||||
MetaCrtcInfo **crtcs,
|
MetaCrtcAssignment **crtcs,
|
||||||
unsigned int n_crtcs,
|
unsigned int n_crtcs,
|
||||||
MetaOutputInfo **outputs,
|
MetaOutputAssignment **outputs,
|
||||||
unsigned int n_outputs)
|
unsigned int n_outputs)
|
||||||
{
|
{
|
||||||
MetaMonitorManagerXrandr *manager_xrandr = META_MONITOR_MANAGER_XRANDR (manager);
|
MetaMonitorManagerXrandr *manager_xrandr = META_MONITOR_MANAGER_XRANDR (manager);
|
||||||
MetaGpu *gpu = meta_monitor_manager_xrandr_get_gpu (manager_xrandr);
|
MetaGpu *gpu = meta_monitor_manager_xrandr_get_gpu (manager_xrandr);
|
||||||
|
@ -385,18 +385,18 @@ apply_crtc_assignments (MetaMonitorManager *manager,
|
||||||
width = 0; height = 0;
|
width = 0; height = 0;
|
||||||
for (i = 0; i < n_crtcs; i++)
|
for (i = 0; i < n_crtcs; i++)
|
||||||
{
|
{
|
||||||
MetaCrtcInfo *crtc_info = crtcs[i];
|
MetaCrtcAssignment *crtc_assignment = crtcs[i];
|
||||||
MetaCrtc *crtc = crtc_info->crtc;
|
MetaCrtc *crtc = crtc_assignment->crtc;
|
||||||
|
|
||||||
if (crtc_info->mode == NULL)
|
if (crtc_assignment->mode == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
to_disable_crtcs = g_list_remove (to_disable_crtcs, crtc);
|
to_disable_crtcs = g_list_remove (to_disable_crtcs, crtc);
|
||||||
|
|
||||||
width = MAX (width, (int) roundf (crtc_info->layout.origin.x +
|
width = MAX (width, (int) roundf (crtc_assignment->layout.origin.x +
|
||||||
crtc_info->layout.size.width));
|
crtc_assignment->layout.size.width));
|
||||||
height = MAX (height, (int) roundf (crtc_info->layout.origin.y +
|
height = MAX (height, (int) roundf (crtc_assignment->layout.origin.y +
|
||||||
crtc_info->layout.size.height));
|
crtc_assignment->layout.size.height));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Second disable all newly disabled CRTCs, or CRTCs that in the previous
|
/* Second disable all newly disabled CRTCs, or CRTCs that in the previous
|
||||||
|
@ -406,8 +406,8 @@ apply_crtc_assignments (MetaMonitorManager *manager,
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < n_crtcs; i++)
|
for (i = 0; i < n_crtcs; i++)
|
||||||
{
|
{
|
||||||
MetaCrtcInfo *crtc_info = crtcs[i];
|
MetaCrtcAssignment *crtc_assignment = crtcs[i];
|
||||||
MetaCrtc *crtc = crtc_info->crtc;
|
MetaCrtc *crtc = crtc_assignment->crtc;
|
||||||
MetaCrtcConfig *crtc_config;
|
MetaCrtcConfig *crtc_config;
|
||||||
int x2, y2;
|
int x2, y2;
|
||||||
|
|
||||||
|
@ -420,7 +420,7 @@ apply_crtc_assignments (MetaMonitorManager *manager,
|
||||||
y2 = (int) roundf (crtc_config->layout.origin.y +
|
y2 = (int) roundf (crtc_config->layout.origin.y +
|
||||||
crtc_config->layout.size.height);
|
crtc_config->layout.size.height);
|
||||||
|
|
||||||
if (!crtc_info->mode || x2 > width || y2 > height)
|
if (!crtc_assignment->mode || x2 > width || y2 > height)
|
||||||
{
|
{
|
||||||
xrandr_set_crtc_config (manager_xrandr,
|
xrandr_set_crtc_config (manager_xrandr,
|
||||||
crtc,
|
crtc,
|
||||||
|
@ -468,45 +468,52 @@ apply_crtc_assignments (MetaMonitorManager *manager,
|
||||||
|
|
||||||
for (i = 0; i < n_crtcs; i++)
|
for (i = 0; i < n_crtcs; i++)
|
||||||
{
|
{
|
||||||
MetaCrtcInfo *crtc_info = crtcs[i];
|
MetaCrtcAssignment *crtc_assignment = crtcs[i];
|
||||||
MetaCrtc *crtc = crtc_info->crtc;
|
MetaCrtc *crtc = crtc_assignment->crtc;
|
||||||
|
|
||||||
if (crtc_info->mode != NULL)
|
if (crtc_assignment->mode != NULL)
|
||||||
{
|
{
|
||||||
MetaCrtcMode *mode;
|
MetaCrtcMode *mode;
|
||||||
g_autofree xcb_randr_output_t *output_ids = NULL;
|
g_autofree xcb_randr_output_t *output_ids = NULL;
|
||||||
unsigned int j, n_output_ids;
|
unsigned int j, n_output_ids;
|
||||||
|
xcb_randr_crtc_t crtc_id;
|
||||||
|
int x, y;
|
||||||
xcb_randr_rotation_t rotation;
|
xcb_randr_rotation_t rotation;
|
||||||
|
|
||||||
mode = crtc_info->mode;
|
mode = crtc_assignment->mode;
|
||||||
|
|
||||||
n_output_ids = crtc_info->outputs->len;
|
n_output_ids = crtc_assignment->outputs->len;
|
||||||
output_ids = g_new (xcb_randr_output_t, n_output_ids);
|
output_ids = g_new (xcb_randr_output_t, n_output_ids);
|
||||||
|
|
||||||
for (j = 0; j < n_output_ids; j++)
|
for (j = 0; j < n_output_ids; j++)
|
||||||
{
|
{
|
||||||
MetaOutput *output;
|
MetaOutput *output;
|
||||||
MetaOutputInfo *output_info;
|
MetaOutputAssignment *output_assignment;
|
||||||
|
|
||||||
output = ((MetaOutput**)crtc_info->outputs->pdata)[j];
|
output = ((MetaOutput**)crtc_assignment->outputs->pdata)[j];
|
||||||
|
|
||||||
to_configure_outputs = g_list_remove (to_configure_outputs,
|
to_configure_outputs = g_list_remove (to_configure_outputs,
|
||||||
output);
|
output);
|
||||||
|
|
||||||
output_info = meta_find_output_info (outputs, n_outputs, output);
|
output_assignment = meta_find_output_assignment (outputs,
|
||||||
meta_output_assign_crtc (output, crtc, output_info);
|
n_outputs,
|
||||||
|
output);
|
||||||
|
meta_output_assign_crtc (output, crtc, output_assignment);
|
||||||
|
|
||||||
output_ids[j] = meta_output_get_id (output);
|
output_ids[j] = meta_output_get_id (output);
|
||||||
}
|
}
|
||||||
|
|
||||||
rotation = meta_monitor_transform_to_xrandr (crtc_info->transform);
|
crtc_id = (xcb_randr_crtc_t) meta_crtc_get_id (crtc);
|
||||||
|
x = (int) roundf (crtc_assignment->layout.origin.x);
|
||||||
|
y = (int) roundf (crtc_assignment->layout.origin.y);
|
||||||
|
rotation =
|
||||||
|
meta_monitor_transform_to_xrandr (crtc_assignment->transform);
|
||||||
if (!xrandr_set_crtc_config (manager_xrandr,
|
if (!xrandr_set_crtc_config (manager_xrandr,
|
||||||
crtc,
|
crtc,
|
||||||
save_timestamp,
|
save_timestamp,
|
||||||
(xcb_randr_crtc_t) meta_crtc_get_id (crtc),
|
crtc_id,
|
||||||
XCB_CURRENT_TIME,
|
XCB_CURRENT_TIME,
|
||||||
(int) roundf (crtc_info->layout.origin.x),
|
x, y,
|
||||||
(int) roundf (crtc_info->layout.origin.y),
|
|
||||||
(xcb_randr_mode_t) mode->mode_id,
|
(xcb_randr_mode_t) mode->mode_id,
|
||||||
rotation,
|
rotation,
|
||||||
output_ids, n_output_ids))
|
output_ids, n_output_ids))
|
||||||
|
@ -515,23 +522,23 @@ apply_crtc_assignments (MetaMonitorManager *manager,
|
||||||
(unsigned) meta_crtc_get_id (crtc),
|
(unsigned) meta_crtc_get_id (crtc),
|
||||||
(unsigned) mode->mode_id,
|
(unsigned) mode->mode_id,
|
||||||
mode->width, mode->height, (float)mode->refresh_rate,
|
mode->width, mode->height, (float)mode->refresh_rate,
|
||||||
(int) roundf (crtc_info->layout.origin.x),
|
(int) roundf (crtc_assignment->layout.origin.x),
|
||||||
(int) roundf (crtc_info->layout.origin.y),
|
(int) roundf (crtc_assignment->layout.origin.y),
|
||||||
crtc_info->transform);
|
crtc_assignment->transform);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
meta_crtc_set_config (crtc,
|
meta_crtc_set_config (crtc,
|
||||||
&crtc_info->layout,
|
&crtc_assignment->layout,
|
||||||
mode,
|
mode,
|
||||||
crtc_info->transform);
|
crtc_assignment->transform);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < n_outputs; i++)
|
for (i = 0; i < n_outputs; i++)
|
||||||
{
|
{
|
||||||
MetaOutputInfo *output_info = outputs[i];
|
MetaOutputAssignment *output_assignment = outputs[i];
|
||||||
MetaOutput *output = output_info->output;
|
MetaOutput *output = output_assignment->output;
|
||||||
|
|
||||||
meta_output_xrandr_apply_mode (output);
|
meta_output_xrandr_apply_mode (output);
|
||||||
}
|
}
|
||||||
|
@ -581,8 +588,8 @@ meta_monitor_manager_xrandr_apply_monitors_config (MetaMonitorManager *mana
|
||||||
MetaMonitorsConfigMethod method,
|
MetaMonitorsConfigMethod method,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
GPtrArray *crtc_infos;
|
GPtrArray *crtc_assignments;
|
||||||
GPtrArray *output_infos;
|
GPtrArray *output_assignments;
|
||||||
|
|
||||||
if (!config)
|
if (!config)
|
||||||
{
|
{
|
||||||
|
@ -591,7 +598,8 @@ meta_monitor_manager_xrandr_apply_monitors_config (MetaMonitorManager *mana
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!meta_monitor_config_manager_assign (manager, config,
|
if (!meta_monitor_config_manager_assign (manager, config,
|
||||||
&crtc_infos, &output_infos,
|
&crtc_assignments,
|
||||||
|
&output_assignments,
|
||||||
error))
|
error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
@ -606,17 +614,17 @@ meta_monitor_manager_xrandr_apply_monitors_config (MetaMonitorManager *mana
|
||||||
* just update the logical state.
|
* just update the logical state.
|
||||||
*/
|
*/
|
||||||
if (is_assignments_changed (manager,
|
if (is_assignments_changed (manager,
|
||||||
(MetaCrtcInfo **) crtc_infos->pdata,
|
(MetaCrtcAssignment **) crtc_assignments->pdata,
|
||||||
crtc_infos->len,
|
crtc_assignments->len,
|
||||||
(MetaOutputInfo **) output_infos->pdata,
|
(MetaOutputAssignment **) output_assignments->pdata,
|
||||||
output_infos->len))
|
output_assignments->len))
|
||||||
{
|
{
|
||||||
apply_crtc_assignments (manager,
|
apply_crtc_assignments (manager,
|
||||||
TRUE,
|
TRUE,
|
||||||
(MetaCrtcInfo **) crtc_infos->pdata,
|
(MetaCrtcAssignment **) crtc_assignments->pdata,
|
||||||
crtc_infos->len,
|
crtc_assignments->len,
|
||||||
(MetaOutputInfo **) output_infos->pdata,
|
(MetaOutputAssignment **) output_assignments->pdata,
|
||||||
output_infos->len);
|
output_assignments->len);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -624,8 +632,8 @@ meta_monitor_manager_xrandr_apply_monitors_config (MetaMonitorManager *mana
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g_ptr_array_free (crtc_infos, TRUE);
|
g_ptr_array_free (crtc_assignments, TRUE);
|
||||||
g_ptr_array_free (output_infos, TRUE);
|
g_ptr_array_free (output_assignments, TRUE);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -823,14 +823,14 @@ meta_create_xrandr_output (MetaGpuXrandr *gpu_xrandr,
|
||||||
|
|
||||||
if (assigned_crtc)
|
if (assigned_crtc)
|
||||||
{
|
{
|
||||||
MetaOutputInfo output_info;
|
MetaOutputAssignment output_assignment;
|
||||||
|
|
||||||
output_info = (MetaOutputInfo) {
|
output_assignment = (MetaOutputAssignment) {
|
||||||
.is_primary = (XID) meta_output_get_id (output) == primary_output,
|
.is_primary = (XID) meta_output_get_id (output) == primary_output,
|
||||||
.is_presentation = output_get_presentation_xrandr (output),
|
.is_presentation = output_get_presentation_xrandr (output),
|
||||||
.is_underscanning = output_get_underscanning_xrandr (output),
|
.is_underscanning = output_get_underscanning_xrandr (output),
|
||||||
};
|
};
|
||||||
meta_output_assign_crtc (output, assigned_crtc, &output_info);
|
meta_output_assign_crtc (output, assigned_crtc, &output_assignment);
|
||||||
}
|
}
|
||||||
|
|
||||||
output->n_possible_clones = xrandr_output->nclone;
|
output->n_possible_clones = xrandr_output->nclone;
|
||||||
|
|
|
@ -114,11 +114,11 @@ meta_monitor_manager_test_ensure_initial_config (MetaMonitorManager *manager)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
apply_crtc_assignments (MetaMonitorManager *manager,
|
apply_crtc_assignments (MetaMonitorManager *manager,
|
||||||
MetaCrtcInfo **crtcs,
|
MetaCrtcAssignment **crtcs,
|
||||||
unsigned int n_crtcs,
|
unsigned int n_crtcs,
|
||||||
MetaOutputInfo **outputs,
|
MetaOutputAssignment **outputs,
|
||||||
unsigned int n_outputs)
|
unsigned int n_outputs)
|
||||||
{
|
{
|
||||||
MetaBackend *backend = meta_monitor_manager_get_backend (manager);
|
MetaBackend *backend = meta_monitor_manager_get_backend (manager);
|
||||||
MetaBackendTest *backend_test = META_BACKEND_TEST (backend);
|
MetaBackendTest *backend_test = META_BACKEND_TEST (backend);
|
||||||
|
@ -132,12 +132,12 @@ apply_crtc_assignments (MetaMonitorManager *manager,
|
||||||
|
|
||||||
for (i = 0; i < n_crtcs; i++)
|
for (i = 0; i < n_crtcs; i++)
|
||||||
{
|
{
|
||||||
MetaCrtcInfo *crtc_info = crtcs[i];
|
MetaCrtcAssignment *crtc_assignment = crtcs[i];
|
||||||
MetaCrtc *crtc = crtc_info->crtc;
|
MetaCrtc *crtc = crtc_assignment->crtc;
|
||||||
|
|
||||||
to_configure_crtcs = g_list_remove (to_configure_crtcs, crtc);
|
to_configure_crtcs = g_list_remove (to_configure_crtcs, crtc);
|
||||||
|
|
||||||
if (crtc_info->mode == NULL)
|
if (crtc_assignment->mode == NULL)
|
||||||
{
|
{
|
||||||
meta_crtc_unset_config (crtc);
|
meta_crtc_unset_config (crtc);
|
||||||
}
|
}
|
||||||
|
@ -146,22 +146,24 @@ apply_crtc_assignments (MetaMonitorManager *manager,
|
||||||
unsigned int j;
|
unsigned int j;
|
||||||
|
|
||||||
meta_crtc_set_config (crtc,
|
meta_crtc_set_config (crtc,
|
||||||
&crtc_info->layout,
|
&crtc_assignment->layout,
|
||||||
crtc_info->mode,
|
crtc_assignment->mode,
|
||||||
crtc_info->transform);
|
crtc_assignment->transform);
|
||||||
|
|
||||||
for (j = 0; j < crtc_info->outputs->len; j++)
|
for (j = 0; j < crtc_assignment->outputs->len; j++)
|
||||||
{
|
{
|
||||||
MetaOutput *output;
|
MetaOutput *output;
|
||||||
MetaOutputInfo *output_info;
|
MetaOutputAssignment *output_assignment;
|
||||||
|
|
||||||
output = ((MetaOutput**)crtc_info->outputs->pdata)[j];
|
output = ((MetaOutput**) crtc_assignment->outputs->pdata)[j];
|
||||||
|
|
||||||
to_configure_outputs = g_list_remove (to_configure_outputs,
|
to_configure_outputs = g_list_remove (to_configure_outputs,
|
||||||
output);
|
output);
|
||||||
|
|
||||||
output_info = meta_find_output_info (outputs, n_outputs, output);
|
output_assignment = meta_find_output_assignment (outputs,
|
||||||
meta_output_assign_crtc (output, crtc, output_info);
|
n_outputs,
|
||||||
|
output);
|
||||||
|
meta_output_assign_crtc (output, crtc, output_assignment);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -209,8 +211,8 @@ meta_monitor_manager_test_apply_monitors_config (MetaMonitorManager *manage
|
||||||
MetaMonitorsConfigMethod method,
|
MetaMonitorsConfigMethod method,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
GPtrArray *crtc_infos;
|
GPtrArray *crtc_assignments;
|
||||||
GPtrArray *output_infos;
|
GPtrArray *output_assignments;
|
||||||
|
|
||||||
if (!config)
|
if (!config)
|
||||||
{
|
{
|
||||||
|
@ -226,26 +228,26 @@ meta_monitor_manager_test_apply_monitors_config (MetaMonitorManager *manage
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!meta_monitor_config_manager_assign (manager, config,
|
if (!meta_monitor_config_manager_assign (manager, config,
|
||||||
&crtc_infos,
|
&crtc_assignments,
|
||||||
&output_infos,
|
&output_assignments,
|
||||||
error))
|
error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (method == META_MONITORS_CONFIG_METHOD_VERIFY)
|
if (method == META_MONITORS_CONFIG_METHOD_VERIFY)
|
||||||
{
|
{
|
||||||
g_ptr_array_free (crtc_infos, TRUE);
|
g_ptr_array_free (crtc_assignments, TRUE);
|
||||||
g_ptr_array_free (output_infos, TRUE);
|
g_ptr_array_free (output_assignments, TRUE);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
apply_crtc_assignments (manager,
|
apply_crtc_assignments (manager,
|
||||||
(MetaCrtcInfo **) crtc_infos->pdata,
|
(MetaCrtcAssignment **) crtc_assignments->pdata,
|
||||||
crtc_infos->len,
|
crtc_assignments->len,
|
||||||
(MetaOutputInfo **) output_infos->pdata,
|
(MetaOutputAssignment **) output_assignments->pdata,
|
||||||
output_infos->len);
|
output_assignments->len);
|
||||||
|
|
||||||
g_ptr_array_free (crtc_infos, TRUE);
|
g_ptr_array_free (crtc_assignments, TRUE);
|
||||||
g_ptr_array_free (output_infos, TRUE);
|
g_ptr_array_free (output_assignments, TRUE);
|
||||||
|
|
||||||
update_screen_size (manager, config);
|
update_screen_size (manager, config);
|
||||||
|
|
||||||
|
|
|
@ -656,12 +656,12 @@ create_monitor_test_setup (MonitorTestCaseSetup *setup,
|
||||||
|
|
||||||
if (crtc)
|
if (crtc)
|
||||||
{
|
{
|
||||||
MetaOutputInfo output_info;
|
MetaOutputAssignment output_assignment;
|
||||||
|
|
||||||
output_info = (MetaOutputInfo) {
|
output_assignment = (MetaOutputAssignment) {
|
||||||
.is_underscanning = setup->outputs[i].is_underscanning,
|
.is_underscanning = setup->outputs[i].is_underscanning,
|
||||||
};
|
};
|
||||||
meta_output_assign_crtc (output, crtc, &output_info);
|
meta_output_assign_crtc (output, crtc, &output_assignment);
|
||||||
}
|
}
|
||||||
|
|
||||||
output->name = (is_laptop_panel ? g_strdup_printf ("eDP-%d",
|
output->name = (is_laptop_panel ? g_strdup_printf ("eDP-%d",
|
||||||
|
|
Loading…
Reference in a new issue