Commit bab8a8a8 authored by Marco Trevisan's avatar Marco Trevisan 🎺

crtc: save CRT controller scale

In some backends (X11) the scaling could be applied natively at crtc level,
so we need to save it at this level.
parent 9b64e2d2
......@@ -60,6 +60,7 @@ struct _MetaCrtc
MetaCrtcMode *current_mode;
MetaMonitorTransform transform;
unsigned int all_transforms;
float scale;
MetaLogicalMonitor *logical_monitor;
......
......@@ -152,6 +152,7 @@ find_unassigned_crtc (MetaOutput *output,
typedef struct
{
MetaMonitorManager *monitor_manager;
MetaMonitorsConfig *config;
MetaLogicalMonitorConfig *logical_monitor_config;
MetaMonitorConfig *monitor_config;
GPtrArray *crtc_infos;
......@@ -177,6 +178,7 @@ assign_monitor_crtc (MetaMonitor *monitor,
MetaMonitorConfig *first_monitor_config;
gboolean assign_output_as_primary;
gboolean assign_output_as_presentation;
float scale;
output = monitor_crtc_mode->output;
......@@ -199,6 +201,18 @@ assign_monitor_crtc (MetaMonitor *monitor,
crtc_transform))
crtc_transform = META_MONITOR_TRANSFORM_NORMAL;
scale = data->logical_monitor_config->scale;
if (!meta_monitor_manager_is_scale_supported (data->monitor_manager,
data->config->layout_mode,
monitor, mode, scale))
{
scale = roundf (scale);
if (!meta_monitor_manager_is_scale_supported (data->monitor_manager,
data->config->layout_mode,
monitor, mode, scale))
scale = 1.0f;
}
meta_monitor_calculate_crtc_pos (monitor, mode, output, crtc_transform,
&crtc_x, &crtc_y);
......@@ -208,6 +222,7 @@ assign_monitor_crtc (MetaMonitor *monitor,
.mode = monitor_crtc_mode->crtc_mode,
.x = crtc_x,
.y = crtc_y,
.scale = scale,
.transform = crtc_transform,
.outputs = g_ptr_array_new ()
};
......@@ -259,6 +274,7 @@ assign_monitor_crtc (MetaMonitor *monitor,
static gboolean
assign_monitor_crtcs (MetaMonitorManager *manager,
MetaMonitorsConfig *config,
MetaLogicalMonitorConfig *logical_monitor_config,
MetaMonitorConfig *monitor_config,
GPtrArray *crtc_infos,
......@@ -294,6 +310,7 @@ assign_monitor_crtcs (MetaMonitorManager *manager,
data = (MonitorAssignmentData) {
.monitor_manager = manager,
.config = config,
.logical_monitor_config = logical_monitor_config,
.monitor_config = monitor_config,
.crtc_infos = crtc_infos,
......@@ -311,6 +328,7 @@ assign_monitor_crtcs (MetaMonitorManager *manager,
static gboolean
assign_logical_monitor_crtcs (MetaMonitorManager *manager,
MetaMonitorsConfig *config,
MetaLogicalMonitorConfig *logical_monitor_config,
GPtrArray *crtc_infos,
GPtrArray *output_infos,
......@@ -324,6 +342,7 @@ assign_logical_monitor_crtcs (MetaMonitorManager *manager,
MetaMonitorConfig *monitor_config = l->data;
if (!assign_monitor_crtcs (manager,
config,
logical_monitor_config,
monitor_config,
crtc_infos, output_infos,
......@@ -382,7 +401,7 @@ meta_monitor_config_manager_assign (MetaMonitorManager *manager,
{
MetaLogicalMonitorConfig *logical_monitor_config = l->data;
if (!assign_logical_monitor_crtcs (manager, logical_monitor_config,
if (!assign_logical_monitor_crtcs (manager, config, logical_monitor_config,
crtc_infos, output_infos,
reserved_crtcs, error))
{
......
......@@ -75,6 +75,7 @@ struct _MetaCrtcInfo
MetaCrtcMode *mode;
int x;
int y;
float scale;
MetaMonitorTransform transform;
GPtrArray *outputs;
};
......
......@@ -349,10 +349,17 @@ meta_monitor_manager_rebuild_logical_monitors_derived (MetaMonitorManager *manag
if (use_global_scale)
scale = global_scale;
else if (config)
scale = derive_scale_from_config (manager, config, &layout);
else
scale = calculate_monitor_scale (manager, monitor);
{
MetaOutput *output = meta_monitor_get_main_output (monitor);
MetaCrtc *crtc = meta_output_get_assigned_crtc (output);
if (crtc)
scale = crtc->scale;
else if (config)
scale = derive_scale_from_config (manager, config, &layout);
else
scale = calculate_monitor_scale (manager, monitor);
}
g_assert (scale > 0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment