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

@ -24,7 +24,13 @@
#include "backends/meta-backend-private.h"
#include "backends/meta-monitor-config-manager.h"
static float supported_scales_test[] = {
static float supported_scales_test_logical[] = {
1.0,
1.5,
2.0
};
static float supported_scales_test_physical[] = {
1.0,
2.0
};
@ -415,12 +421,22 @@ meta_monitor_manager_test_calculate_monitor_mode_scale (MetaMonitorManager *mana
}
static void
meta_monitor_manager_test_get_supported_scales (MetaMonitorManager *manager,
float **scales,
int *n_scales)
meta_monitor_manager_test_get_supported_scales (MetaMonitorManager *manager,
MetaLogicalMonitorLayoutMode layout_mode,
float **scales,
int *n_scales)
{
*scales = supported_scales_test;
*n_scales = G_N_ELEMENTS (supported_scales_test);
switch (layout_mode)
{
case META_LOGICAL_MONITOR_LAYOUT_MODE_LOGICAL:
*scales = supported_scales_test_logical;
*n_scales = G_N_ELEMENTS (supported_scales_test_logical);
break;
case META_LOGICAL_MONITOR_LAYOUT_MODE_PHYSICAL:
*scales = supported_scales_test_physical;
*n_scales = G_N_ELEMENTS (supported_scales_test_physical);
break;
}
}
static gboolean

View File

@ -51,7 +51,7 @@ typedef struct _MonitorTestCaseMonitor
typedef struct _MonitorTestCaseLogicalMonitor
{
MetaRectangle layout;
int scale;
float scale;
MetaMonitorTransform transform;
gboolean is_primary;
gboolean is_presentation;
@ -141,9 +141,9 @@ check_monitor_configuration (MetaMonitorConfigStore *config_store,
g_assert (meta_rectangle_equal (&logical_monitor_config->layout,
&config_expect->logical_monitors[i].layout));
g_assert_cmpint (logical_monitor_config->scale,
==,
config_expect->logical_monitors[i].scale);
g_assert_cmpfloat (logical_monitor_config->scale,
==,
config_expect->logical_monitors[i].scale);
g_assert_cmpint (logical_monitor_config->transform,
==,
config_expect->logical_monitors[i].transform);

View File

@ -437,9 +437,9 @@ check_logical_monitor (MonitorTestCase *test_case,
g_assert_cmpint (logical_monitor->rect.height,
==,
test_logical_monitor->layout.height);
g_assert_cmpint (logical_monitor->scale,
==,
test_logical_monitor->scale);
g_assert_cmpfloat (logical_monitor->scale,
==,
test_logical_monitor->scale);
g_assert_cmpuint (logical_monitor->transform,
==,
test_logical_monitor->transform);