monitor-manager: Add support for refresh rate modes
The refresh rate mode is exposed in the DisplayConfig D-Bus interface and is made persistent through monitors.xml. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1154>
This commit is contained in:
@ -3254,6 +3254,100 @@ meta_test_monitor_underscanning_config (void)
|
||||
check_monitor_test_clients_state ();
|
||||
}
|
||||
|
||||
static void
|
||||
meta_test_monitor_refresh_rate_mode_config (void)
|
||||
{
|
||||
MonitorTestCase test_case = {
|
||||
.setup = {
|
||||
.modes = {
|
||||
{
|
||||
.width = 1024,
|
||||
.height = 768,
|
||||
.refresh_rate = 60.0,
|
||||
.refresh_rate_mode = META_CRTC_REFRESH_RATE_MODE_VARIABLE,
|
||||
}
|
||||
},
|
||||
.n_modes = 1,
|
||||
.outputs = {
|
||||
{
|
||||
.crtc = 0,
|
||||
.modes = { 0 },
|
||||
.n_modes = 1,
|
||||
.preferred_mode = 0,
|
||||
.possible_crtcs = { 0 },
|
||||
.n_possible_crtcs = 1,
|
||||
.width_mm = 222,
|
||||
.height_mm = 125,
|
||||
}
|
||||
},
|
||||
.n_outputs = 1,
|
||||
.crtcs = {
|
||||
{
|
||||
.current_mode = 0
|
||||
}
|
||||
},
|
||||
.n_crtcs = 1
|
||||
},
|
||||
|
||||
.expect = {
|
||||
.monitors = {
|
||||
{
|
||||
.outputs = { 0 },
|
||||
.n_outputs = 1,
|
||||
.modes = {
|
||||
{
|
||||
.width = 1024,
|
||||
.height = 768,
|
||||
.refresh_rate = 60.0,
|
||||
.refresh_rate_mode = META_CRTC_REFRESH_RATE_MODE_VARIABLE,
|
||||
.crtc_modes = {
|
||||
{
|
||||
.output = 0,
|
||||
.crtc_mode = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
.n_modes = 1,
|
||||
.current_mode = 0,
|
||||
.width_mm = 222,
|
||||
.height_mm = 125,
|
||||
}
|
||||
},
|
||||
.n_monitors = 1,
|
||||
.logical_monitors = {
|
||||
{
|
||||
.monitors = { 0 },
|
||||
.n_monitors = 1,
|
||||
.layout = { .x = 0, .y = 0, .width = 1024, .height = 768 },
|
||||
.scale = 1
|
||||
}
|
||||
},
|
||||
.n_logical_monitors = 1,
|
||||
.primary_logical_monitor = 0,
|
||||
.n_outputs = 1,
|
||||
.crtcs = {
|
||||
{
|
||||
.current_mode = 0,
|
||||
}
|
||||
},
|
||||
.n_crtcs = 1,
|
||||
.screen_width = 1024,
|
||||
.screen_height = 768
|
||||
}
|
||||
};
|
||||
MetaMonitorTestSetup *test_setup;
|
||||
|
||||
test_setup = meta_create_monitor_test_setup (test_backend,
|
||||
&test_case.setup,
|
||||
MONITOR_TEST_FLAG_NO_STORED);
|
||||
emulate_hotplug (test_setup);
|
||||
META_TEST_LOG_CALL ("Checking monitor configuration",
|
||||
meta_check_monitor_configuration (test_context,
|
||||
&test_case.expect));
|
||||
check_monitor_test_clients_state ();
|
||||
}
|
||||
|
||||
static void
|
||||
meta_test_monitor_max_bpc_config (void)
|
||||
{
|
||||
@ -5933,6 +6027,203 @@ meta_test_monitor_custom_underscanning_config (void)
|
||||
check_monitor_test_clients_state ();
|
||||
}
|
||||
|
||||
static void
|
||||
meta_test_monitor_custom_refresh_rate_mode_fixed_config (void)
|
||||
{
|
||||
MonitorTestCase test_case = {
|
||||
.setup = {
|
||||
.modes = {
|
||||
{
|
||||
.width = 1024,
|
||||
.height = 768,
|
||||
.refresh_rate = 60.000495910644531,
|
||||
.refresh_rate_mode = META_CRTC_REFRESH_RATE_MODE_FIXED,
|
||||
}
|
||||
},
|
||||
.n_modes = 1,
|
||||
.outputs = {
|
||||
{
|
||||
.crtc = 0,
|
||||
.modes = { 0 },
|
||||
.n_modes = 1,
|
||||
.preferred_mode = 0,
|
||||
.possible_crtcs = { 0 },
|
||||
.n_possible_crtcs = 1,
|
||||
.width_mm = 222,
|
||||
.height_mm = 125,
|
||||
.serial = "0x123456",
|
||||
},
|
||||
},
|
||||
.n_outputs = 1,
|
||||
.crtcs = {
|
||||
{
|
||||
.current_mode = 0
|
||||
},
|
||||
},
|
||||
.n_crtcs = 1
|
||||
},
|
||||
|
||||
.expect = {
|
||||
.monitors = {
|
||||
{
|
||||
.outputs = { 0 },
|
||||
.n_outputs = 1,
|
||||
.modes = {
|
||||
{
|
||||
.width = 1024,
|
||||
.height = 768,
|
||||
.refresh_rate = 60.000495910644531,
|
||||
.refresh_rate_mode = META_CRTC_REFRESH_RATE_MODE_FIXED,
|
||||
.crtc_modes = {
|
||||
{
|
||||
.output = 0,
|
||||
.crtc_mode = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
.n_modes = 1,
|
||||
.current_mode = 0,
|
||||
.width_mm = 222,
|
||||
.height_mm = 125,
|
||||
}
|
||||
},
|
||||
.n_monitors = 1,
|
||||
.logical_monitors = {
|
||||
{
|
||||
.monitors = { 0 },
|
||||
.n_monitors = 1,
|
||||
.layout = { .x = 0, .y = 0, .width = 1024, .height = 768 },
|
||||
.scale = 1
|
||||
}
|
||||
},
|
||||
.n_logical_monitors = 1,
|
||||
.primary_logical_monitor = 0,
|
||||
.n_outputs = 1,
|
||||
.crtcs = {
|
||||
{
|
||||
.current_mode = 0,
|
||||
}
|
||||
},
|
||||
.n_crtcs = 1,
|
||||
.n_tiled_monitors = 0,
|
||||
.screen_width = 1024,
|
||||
.screen_height = 768
|
||||
}
|
||||
};
|
||||
MetaMonitorTestSetup *test_setup;
|
||||
|
||||
test_setup = meta_create_monitor_test_setup (test_backend,
|
||||
&test_case.setup,
|
||||
MONITOR_TEST_FLAG_NONE);
|
||||
meta_set_custom_monitor_config (test_context, "refresh-rate-mode-fixed.xml");
|
||||
emulate_hotplug (test_setup);
|
||||
|
||||
META_TEST_LOG_CALL ("Checking monitor configuration",
|
||||
meta_check_monitor_configuration (test_context,
|
||||
&test_case.expect));
|
||||
check_monitor_test_clients_state ();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
meta_test_monitor_custom_refresh_rate_mode_variable_config (void)
|
||||
{
|
||||
MonitorTestCase test_case = {
|
||||
.setup = {
|
||||
.modes = {
|
||||
{
|
||||
.width = 1024,
|
||||
.height = 768,
|
||||
.refresh_rate = 60.000495910644531,
|
||||
.refresh_rate_mode = META_CRTC_REFRESH_RATE_MODE_VARIABLE,
|
||||
}
|
||||
},
|
||||
.n_modes = 1,
|
||||
.outputs = {
|
||||
{
|
||||
.crtc = 0,
|
||||
.modes = { 0 },
|
||||
.n_modes = 1,
|
||||
.preferred_mode = 0,
|
||||
.possible_crtcs = { 0 },
|
||||
.n_possible_crtcs = 1,
|
||||
.width_mm = 222,
|
||||
.height_mm = 125,
|
||||
.serial = "0x123456",
|
||||
},
|
||||
},
|
||||
.n_outputs = 1,
|
||||
.crtcs = {
|
||||
{
|
||||
.current_mode = 0
|
||||
},
|
||||
},
|
||||
.n_crtcs = 1
|
||||
},
|
||||
|
||||
.expect = {
|
||||
.monitors = {
|
||||
{
|
||||
.outputs = { 0 },
|
||||
.n_outputs = 1,
|
||||
.modes = {
|
||||
{
|
||||
.width = 1024,
|
||||
.height = 768,
|
||||
.refresh_rate = 60.000495910644531,
|
||||
.refresh_rate_mode = META_CRTC_REFRESH_RATE_MODE_VARIABLE,
|
||||
.crtc_modes = {
|
||||
{
|
||||
.output = 0,
|
||||
.crtc_mode = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
.n_modes = 1,
|
||||
.current_mode = 0,
|
||||
.width_mm = 222,
|
||||
.height_mm = 125,
|
||||
}
|
||||
},
|
||||
.n_monitors = 1,
|
||||
.logical_monitors = {
|
||||
{
|
||||
.monitors = { 0 },
|
||||
.n_monitors = 1,
|
||||
.layout = { .x = 0, .y = 0, .width = 1024, .height = 768 },
|
||||
.scale = 1
|
||||
}
|
||||
},
|
||||
.n_logical_monitors = 1,
|
||||
.primary_logical_monitor = 0,
|
||||
.n_outputs = 1,
|
||||
.crtcs = {
|
||||
{
|
||||
.current_mode = 0,
|
||||
}
|
||||
},
|
||||
.n_crtcs = 1,
|
||||
.n_tiled_monitors = 0,
|
||||
.screen_width = 1024,
|
||||
.screen_height = 768
|
||||
}
|
||||
};
|
||||
MetaMonitorTestSetup *test_setup;
|
||||
|
||||
test_setup = meta_create_monitor_test_setup (test_backend,
|
||||
&test_case.setup,
|
||||
MONITOR_TEST_FLAG_NONE);
|
||||
meta_set_custom_monitor_config (test_context, "refresh-rate-mode-variable.xml");
|
||||
emulate_hotplug (test_setup);
|
||||
|
||||
META_TEST_LOG_CALL ("Checking monitor configuration",
|
||||
meta_check_monitor_configuration (test_context,
|
||||
&test_case.expect));
|
||||
check_monitor_test_clients_state ();
|
||||
}
|
||||
|
||||
static void
|
||||
meta_test_monitor_custom_scale_config (void)
|
||||
{
|
||||
@ -9718,6 +10009,8 @@ init_monitor_tests (void)
|
||||
meta_test_monitor_no_outputs);
|
||||
add_monitor_test ("/backends/monitor/underscanning-config",
|
||||
meta_test_monitor_underscanning_config);
|
||||
add_monitor_test ("/backends/monitor/refresh-rate-mode-config",
|
||||
meta_test_monitor_refresh_rate_mode_config);
|
||||
add_monitor_test ("/backends/monitor/max-bpc-config",
|
||||
meta_test_monitor_max_bpc_config);
|
||||
add_monitor_test ("/backends/monitor/rgb-range-config",
|
||||
@ -9754,6 +10047,10 @@ init_monitor_tests (void)
|
||||
meta_test_monitor_custom_primary_config);
|
||||
add_monitor_test ("/backends/monitor/custom/underscanning-config",
|
||||
meta_test_monitor_custom_underscanning_config);
|
||||
add_monitor_test ("/backends/monitor/custom/refresh-rate-mode-fixed-config",
|
||||
meta_test_monitor_custom_refresh_rate_mode_fixed_config);
|
||||
add_monitor_test ("/backends/monitor/custom/refresh-rate-mode-variable-config",
|
||||
meta_test_monitor_custom_refresh_rate_mode_variable_config);
|
||||
add_monitor_test ("/backends/monitor/custom/scale-config",
|
||||
meta_test_monitor_custom_scale_config);
|
||||
add_monitor_test ("/backends/monitor/custom/fractional-scale-config",
|
||||
|
Reference in New Issue
Block a user