Add support for rudimentary fractional scaling

When the logical layout mode is used, allow configuring the scaling to
be non-integer. Supported scales are so far hard coded to include at
most 1, 1.5 and 2, and scales that doesn't result in non-fractional
logical monitor sizes are discarded.

Wayland outputs are set to have scale ceil(actual_scale) meaning well
behaving Wayland clients will provide buffers with buffer scale 2, thus
being scaled down to the fractional scale.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
This commit is contained in:
Jonas Ådahl
2017-05-25 17:20:59 +08:00
parent b64c69e4bc
commit 10b0351a59
12 changed files with 126 additions and 59 deletions

View File

@@ -52,7 +52,13 @@
#define ALL_TRANSFORMS_MASK ((1 << ALL_TRANSFORMS) - 1)
#define SYNC_TOLERANCE 0.01 /* 1 percent */
static float supported_scales_kms[] = {
static float supported_scales_kms_logical[] = {
1.0,
1.5,
2.0
};
static float supported_scales_kms_physical[] = {
1.0,
2.0
};
@@ -1847,12 +1853,22 @@ meta_monitor_manager_kms_calculate_monitor_mode_scale (MetaMonitorManager *manag
}
static void
meta_monitor_manager_kms_get_supported_scales (MetaMonitorManager *manager,
float **scales,
int *n_scales)
meta_monitor_manager_kms_get_supported_scales (MetaMonitorManager *manager,
MetaLogicalMonitorLayoutMode layout_mode,
float **scales,
int *n_scales)
{
*scales = supported_scales_kms;
*n_scales = G_N_ELEMENTS (supported_scales_kms);
switch (layout_mode)
{
case META_LOGICAL_MONITOR_LAYOUT_MODE_LOGICAL:
*scales = supported_scales_kms_logical;
*n_scales = G_N_ELEMENTS (supported_scales_kms_logical);
break;
case META_LOGICAL_MONITOR_LAYOUT_MODE_PHYSICAL:
*scales = supported_scales_kms_physical;
*n_scales = G_N_ELEMENTS (supported_scales_kms_physical);
break;
}
}
static MetaMonitorManagerCapability