2016-12-05 05:38:43 -05:00
|
|
|
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (C) 2016 Red Hat, Inc.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 2 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include "tests/meta-monitor-manager-test.h"
|
|
|
|
|
2017-02-15 03:06:46 -05:00
|
|
|
#include "backends/meta-backend-private.h"
|
2017-03-28 00:35:19 -04:00
|
|
|
#include "backends/meta-crtc.h"
|
2017-07-10 06:19:32 -04:00
|
|
|
#include "backends/meta-gpu.h"
|
2017-01-09 01:31:18 -05:00
|
|
|
#include "backends/meta-monitor-config-manager.h"
|
2017-03-24 05:35:51 -04:00
|
|
|
#include "backends/meta-output.h"
|
2019-01-11 09:35:42 -05:00
|
|
|
#include "tests/meta-backend-test.h"
|
2022-01-28 10:28:32 -05:00
|
|
|
#include "tests/meta-monitor-test-utils.h"
|
2017-01-09 01:31:18 -05:00
|
|
|
|
2020-02-26 13:47:44 -05:00
|
|
|
G_DEFINE_TYPE (MetaCrtcTest, meta_crtc_test, META_TYPE_CRTC)
|
2020-02-26 10:47:03 -05:00
|
|
|
G_DEFINE_TYPE (MetaOutputTest, meta_output_test, META_TYPE_OUTPUT)
|
|
|
|
|
2016-12-05 05:38:43 -05:00
|
|
|
struct _MetaMonitorManagerTest
|
|
|
|
{
|
|
|
|
MetaMonitorManager parent;
|
2016-12-05 08:28:22 -05:00
|
|
|
|
2017-03-21 05:22:56 -04:00
|
|
|
gboolean handles_transforms;
|
2017-01-09 22:50:44 -05:00
|
|
|
|
2016-12-13 07:11:48 -05:00
|
|
|
int tiled_monitor_count;
|
|
|
|
|
2016-12-05 08:28:22 -05:00
|
|
|
MetaMonitorTestSetup *test_setup;
|
2016-12-05 05:38:43 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
G_DEFINE_TYPE (MetaMonitorManagerTest, meta_monitor_manager_test,
|
|
|
|
META_TYPE_MONITOR_MANAGER)
|
|
|
|
|
2022-01-28 10:28:32 -05:00
|
|
|
static MetaCreateTestSetupFunc initial_setup_func;
|
|
|
|
|
|
|
|
static MonitorTestCaseSetup default_test_case_setup = {
|
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 800,
|
|
|
|
.height = 600,
|
|
|
|
.refresh_rate = 60.0
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.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,
|
|
|
|
};
|
|
|
|
|
|
|
|
static MetaMonitorTestSetup *
|
|
|
|
create_default_test_setup (MetaBackend *backend)
|
|
|
|
{
|
|
|
|
return meta_create_monitor_test_setup (backend,
|
|
|
|
&default_test_case_setup,
|
|
|
|
MONITOR_TEST_FLAG_NO_STORED);
|
|
|
|
}
|
2016-12-05 08:28:22 -05:00
|
|
|
|
|
|
|
void
|
2022-01-28 10:28:32 -05:00
|
|
|
meta_init_monitor_test_setup (MetaCreateTestSetupFunc func)
|
2016-12-05 08:28:22 -05:00
|
|
|
{
|
2020-02-25 04:18:22 -05:00
|
|
|
initial_setup_func = func;
|
2016-12-05 08:28:22 -05:00
|
|
|
}
|
|
|
|
|
2016-12-07 04:39:53 -05:00
|
|
|
void
|
|
|
|
meta_monitor_manager_test_emulate_hotplug (MetaMonitorManagerTest *manager_test,
|
|
|
|
MetaMonitorTestSetup *test_setup)
|
|
|
|
{
|
|
|
|
MetaMonitorManager *manager = META_MONITOR_MANAGER (manager_test);
|
|
|
|
MetaMonitorTestSetup *old_test_setup;
|
|
|
|
|
|
|
|
old_test_setup = manager_test->test_setup;
|
|
|
|
manager_test->test_setup = test_setup;
|
|
|
|
|
2021-01-25 15:10:53 -05:00
|
|
|
meta_monitor_manager_reload (manager);
|
2016-12-07 04:39:53 -05:00
|
|
|
|
|
|
|
g_free (old_test_setup);
|
|
|
|
}
|
|
|
|
|
2017-03-21 05:22:56 -04:00
|
|
|
void
|
|
|
|
meta_monitor_manager_test_set_handles_transforms (MetaMonitorManagerTest *manager_test,
|
|
|
|
gboolean handles_transforms)
|
|
|
|
{
|
|
|
|
g_assert (handles_transforms || meta_is_stage_views_enabled());
|
|
|
|
|
|
|
|
manager_test->handles_transforms = handles_transforms;
|
|
|
|
}
|
|
|
|
|
2016-12-13 07:11:48 -05:00
|
|
|
int
|
|
|
|
meta_monitor_manager_test_get_tiled_monitor_count (MetaMonitorManagerTest *manager_test)
|
|
|
|
{
|
|
|
|
return manager_test->tiled_monitor_count;
|
|
|
|
}
|
|
|
|
|
2019-01-11 09:35:42 -05:00
|
|
|
void
|
2016-12-05 05:38:43 -05:00
|
|
|
meta_monitor_manager_test_read_current (MetaMonitorManager *manager)
|
|
|
|
{
|
2016-12-05 08:28:22 -05:00
|
|
|
MetaMonitorManagerTest *manager_test = META_MONITOR_MANAGER_TEST (manager);
|
2019-01-11 09:35:42 -05:00
|
|
|
MetaBackend *backend = meta_monitor_manager_get_backend (manager);
|
|
|
|
MetaBackendTest *backend_test = META_BACKEND_TEST (backend);
|
|
|
|
MetaGpu *gpu = meta_backend_test_get_gpu (backend_test);
|
2016-12-05 05:38:43 -05:00
|
|
|
|
2016-12-05 08:28:22 -05:00
|
|
|
g_assert (manager_test->test_setup);
|
2016-12-05 05:38:43 -05:00
|
|
|
|
2019-01-11 09:35:42 -05:00
|
|
|
meta_gpu_take_modes (gpu, manager_test->test_setup->modes);
|
|
|
|
meta_gpu_take_crtcs (gpu, manager_test->test_setup->crtcs);
|
|
|
|
meta_gpu_take_outputs (gpu, manager_test->test_setup->outputs);
|
2016-12-05 05:38:43 -05:00
|
|
|
}
|
|
|
|
|
2017-01-06 00:27:21 -05:00
|
|
|
static void
|
|
|
|
meta_monitor_manager_test_ensure_initial_config (MetaMonitorManager *manager)
|
|
|
|
{
|
2017-01-09 01:31:18 -05:00
|
|
|
MetaMonitorsConfig *config;
|
|
|
|
|
|
|
|
config = meta_monitor_manager_ensure_configured (manager);
|
2017-01-06 00:27:21 -05:00
|
|
|
|
2017-03-24 03:36:12 -04:00
|
|
|
if (meta_is_stage_views_enabled ())
|
2017-04-21 06:01:15 -04:00
|
|
|
{
|
|
|
|
meta_monitor_manager_update_logical_state (manager, config);
|
|
|
|
}
|
2017-01-09 01:31:18 -05:00
|
|
|
else
|
2017-04-21 06:01:15 -04:00
|
|
|
{
|
2017-09-11 02:10:26 -04:00
|
|
|
meta_monitor_manager_update_logical_state_derived (manager, NULL);
|
2017-04-21 06:01:15 -04:00
|
|
|
}
|
2017-01-06 00:27:21 -05:00
|
|
|
}
|
|
|
|
|
2016-12-05 05:38:43 -05:00
|
|
|
static void
|
2020-02-25 14:30:46 -05:00
|
|
|
apply_crtc_assignments (MetaMonitorManager *manager,
|
|
|
|
MetaCrtcAssignment **crtcs,
|
|
|
|
unsigned int n_crtcs,
|
|
|
|
MetaOutputAssignment **outputs,
|
|
|
|
unsigned int n_outputs)
|
2016-12-05 05:38:43 -05:00
|
|
|
{
|
2019-01-11 09:35:42 -05:00
|
|
|
MetaBackend *backend = meta_monitor_manager_get_backend (manager);
|
|
|
|
MetaBackendTest *backend_test = META_BACKEND_TEST (backend);
|
|
|
|
MetaGpu *gpu = meta_backend_test_get_gpu (backend_test);
|
2020-02-25 10:54:20 -05:00
|
|
|
g_autoptr (GList) to_configure_outputs = NULL;
|
|
|
|
g_autoptr (GList) to_configure_crtcs = NULL;
|
2016-12-05 05:38:43 -05:00
|
|
|
unsigned int i;
|
|
|
|
|
2020-02-25 10:54:20 -05:00
|
|
|
to_configure_outputs = g_list_copy (meta_gpu_get_outputs (gpu));
|
|
|
|
to_configure_crtcs = g_list_copy (meta_gpu_get_crtcs (gpu));
|
|
|
|
|
2016-12-05 05:38:43 -05:00
|
|
|
for (i = 0; i < n_crtcs; i++)
|
|
|
|
{
|
2020-02-25 14:30:46 -05:00
|
|
|
MetaCrtcAssignment *crtc_assignment = crtcs[i];
|
|
|
|
MetaCrtc *crtc = crtc_assignment->crtc;
|
2020-02-25 10:54:20 -05:00
|
|
|
|
|
|
|
to_configure_crtcs = g_list_remove (to_configure_crtcs, crtc);
|
2016-12-05 05:38:43 -05:00
|
|
|
|
2020-02-25 14:30:46 -05:00
|
|
|
if (crtc_assignment->mode == NULL)
|
2016-12-05 05:38:43 -05:00
|
|
|
{
|
2020-01-14 16:34:44 -05:00
|
|
|
meta_crtc_unset_config (crtc);
|
2016-12-05 05:38:43 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
unsigned int j;
|
|
|
|
|
2020-01-14 16:34:44 -05:00
|
|
|
meta_crtc_set_config (crtc,
|
2020-02-25 14:30:46 -05:00
|
|
|
&crtc_assignment->layout,
|
|
|
|
crtc_assignment->mode,
|
|
|
|
crtc_assignment->transform);
|
2016-12-05 05:38:43 -05:00
|
|
|
|
2020-02-25 14:30:46 -05:00
|
|
|
for (j = 0; j < crtc_assignment->outputs->len; j++)
|
2016-12-05 05:38:43 -05:00
|
|
|
{
|
2020-02-25 12:37:21 -05:00
|
|
|
MetaOutput *output;
|
2020-02-25 14:30:46 -05:00
|
|
|
MetaOutputAssignment *output_assignment;
|
2020-02-25 12:37:21 -05:00
|
|
|
|
2020-02-25 14:30:46 -05:00
|
|
|
output = ((MetaOutput**) crtc_assignment->outputs->pdata)[j];
|
2016-12-05 05:38:43 -05:00
|
|
|
|
2020-02-25 10:54:20 -05:00
|
|
|
to_configure_outputs = g_list_remove (to_configure_outputs,
|
|
|
|
output);
|
2020-02-25 12:37:21 -05:00
|
|
|
|
2020-02-25 14:30:46 -05:00
|
|
|
output_assignment = meta_find_output_assignment (outputs,
|
|
|
|
n_outputs,
|
|
|
|
output);
|
|
|
|
meta_output_assign_crtc (output, crtc, output_assignment);
|
2016-12-05 05:38:43 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-25 12:37:21 -05:00
|
|
|
g_list_foreach (to_configure_crtcs,
|
|
|
|
(GFunc) meta_crtc_unset_config,
|
|
|
|
NULL);
|
|
|
|
g_list_foreach (to_configure_outputs,
|
|
|
|
(GFunc) meta_output_unassign_crtc,
|
|
|
|
NULL);
|
2017-01-09 01:31:18 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
update_screen_size (MetaMonitorManager *manager,
|
|
|
|
MetaMonitorsConfig *config)
|
|
|
|
{
|
|
|
|
GList *l;
|
|
|
|
int screen_width = 0;
|
|
|
|
int screen_height = 0;
|
|
|
|
|
|
|
|
for (l = config->logical_monitor_configs; l; l = l->next)
|
|
|
|
{
|
|
|
|
MetaLogicalMonitorConfig *logical_monitor_config = l->data;
|
|
|
|
int right_edge;
|
|
|
|
int bottom_edge;
|
|
|
|
|
|
|
|
right_edge = (logical_monitor_config->layout.width +
|
|
|
|
logical_monitor_config->layout.x);
|
|
|
|
if (right_edge > screen_width)
|
|
|
|
screen_width = right_edge;
|
|
|
|
|
|
|
|
bottom_edge = (logical_monitor_config->layout.height +
|
|
|
|
logical_monitor_config->layout.y);
|
|
|
|
if (bottom_edge > screen_height)
|
|
|
|
screen_height = bottom_edge;
|
|
|
|
}
|
2016-12-05 05:38:43 -05:00
|
|
|
|
|
|
|
manager->screen_width = screen_width;
|
|
|
|
manager->screen_height = screen_height;
|
2017-01-09 01:31:18 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2017-02-14 06:54:04 -05:00
|
|
|
meta_monitor_manager_test_apply_monitors_config (MetaMonitorManager *manager,
|
|
|
|
MetaMonitorsConfig *config,
|
|
|
|
MetaMonitorsConfigMethod method,
|
|
|
|
GError **error)
|
2017-01-09 01:31:18 -05:00
|
|
|
{
|
2020-02-25 14:30:46 -05:00
|
|
|
GPtrArray *crtc_assignments;
|
|
|
|
GPtrArray *output_assignments;
|
2017-01-09 01:31:18 -05:00
|
|
|
|
2017-01-20 01:50:11 -05:00
|
|
|
if (!config)
|
|
|
|
{
|
2017-04-12 02:15:33 -04:00
|
|
|
manager->screen_width = META_MONITOR_MANAGER_MIN_SCREEN_WIDTH;
|
|
|
|
manager->screen_height = META_MONITOR_MANAGER_MIN_SCREEN_HEIGHT;
|
2017-01-20 01:50:11 -05:00
|
|
|
|
2017-03-21 05:16:04 -04:00
|
|
|
if (meta_is_stage_views_enabled ())
|
2017-09-11 02:10:26 -04:00
|
|
|
meta_monitor_manager_rebuild (manager, NULL);
|
2017-03-21 05:16:04 -04:00
|
|
|
else
|
2017-09-11 02:10:26 -04:00
|
|
|
meta_monitor_manager_rebuild_derived (manager, config);
|
2017-01-20 01:50:11 -05:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2017-01-09 01:31:18 -05:00
|
|
|
if (!meta_monitor_config_manager_assign (manager, config,
|
2020-02-25 14:30:46 -05:00
|
|
|
&crtc_assignments,
|
|
|
|
&output_assignments,
|
2017-01-09 01:31:18 -05:00
|
|
|
error))
|
|
|
|
return FALSE;
|
|
|
|
|
2017-02-14 06:54:04 -05:00
|
|
|
if (method == META_MONITORS_CONFIG_METHOD_VERIFY)
|
|
|
|
{
|
2020-02-25 14:30:46 -05:00
|
|
|
g_ptr_array_free (crtc_assignments, TRUE);
|
|
|
|
g_ptr_array_free (output_assignments, TRUE);
|
2017-02-14 06:54:04 -05:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2017-01-09 01:31:18 -05:00
|
|
|
apply_crtc_assignments (manager,
|
2020-02-25 14:30:46 -05:00
|
|
|
(MetaCrtcAssignment **) crtc_assignments->pdata,
|
|
|
|
crtc_assignments->len,
|
|
|
|
(MetaOutputAssignment **) output_assignments->pdata,
|
|
|
|
output_assignments->len);
|
2017-01-09 01:31:18 -05:00
|
|
|
|
2020-02-25 14:30:46 -05:00
|
|
|
g_ptr_array_free (crtc_assignments, TRUE);
|
|
|
|
g_ptr_array_free (output_assignments, TRUE);
|
2017-01-09 01:31:18 -05:00
|
|
|
|
|
|
|
update_screen_size (manager, config);
|
2017-03-21 05:16:04 -04:00
|
|
|
|
|
|
|
if (meta_is_stage_views_enabled ())
|
2017-09-11 02:10:26 -04:00
|
|
|
meta_monitor_manager_rebuild (manager, config);
|
2017-03-21 05:16:04 -04:00
|
|
|
else
|
2017-09-11 02:10:26 -04:00
|
|
|
meta_monitor_manager_rebuild_derived (manager, config);
|
2016-12-05 05:38:43 -05:00
|
|
|
|
2017-01-09 01:31:18 -05:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2016-12-13 07:11:48 -05:00
|
|
|
static void
|
|
|
|
meta_monitor_manager_test_tiled_monitor_added (MetaMonitorManager *manager,
|
|
|
|
MetaMonitor *monitor)
|
|
|
|
{
|
|
|
|
MetaMonitorManagerTest *manager_test = META_MONITOR_MANAGER_TEST (manager);
|
|
|
|
|
|
|
|
manager_test->tiled_monitor_count++;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
meta_monitor_manager_test_tiled_monitor_removed (MetaMonitorManager *manager,
|
|
|
|
MetaMonitor *monitor)
|
|
|
|
{
|
|
|
|
MetaMonitorManagerTest *manager_test = META_MONITOR_MANAGER_TEST (manager);
|
|
|
|
|
|
|
|
manager_test->tiled_monitor_count--;
|
|
|
|
}
|
|
|
|
|
2017-03-08 03:05:00 -05:00
|
|
|
static gboolean
|
|
|
|
meta_monitor_manager_test_is_transform_handled (MetaMonitorManager *manager,
|
|
|
|
MetaCrtc *crtc,
|
|
|
|
MetaMonitorTransform transform)
|
|
|
|
{
|
2017-03-21 05:22:56 -04:00
|
|
|
MetaMonitorManagerTest *manager_test = META_MONITOR_MANAGER_TEST (manager);
|
|
|
|
|
|
|
|
return manager_test->handles_transforms;
|
2017-03-08 03:05:00 -05:00
|
|
|
}
|
|
|
|
|
2017-05-25 04:12:51 -04:00
|
|
|
static float
|
2017-06-10 10:10:57 -04:00
|
|
|
meta_monitor_manager_test_calculate_monitor_mode_scale (MetaMonitorManager *manager,
|
|
|
|
MetaLogicalMonitorLayoutMode layout_mode,
|
|
|
|
MetaMonitor *monitor,
|
|
|
|
MetaMonitorMode *monitor_mode)
|
2017-01-20 02:07:12 -05:00
|
|
|
{
|
|
|
|
MetaOutput *output;
|
|
|
|
MetaOutputTest *output_test;
|
|
|
|
|
|
|
|
output = meta_monitor_get_main_output (monitor);
|
2020-02-26 10:47:03 -05:00
|
|
|
output_test = META_OUTPUT_TEST (output);
|
2017-01-20 02:07:12 -05:00
|
|
|
|
2017-08-18 02:27:42 -04:00
|
|
|
if (output_test)
|
|
|
|
return output_test->scale;
|
|
|
|
else
|
|
|
|
return 1;
|
2017-01-20 02:07:12 -05:00
|
|
|
}
|
|
|
|
|
2017-06-05 03:59:47 -04:00
|
|
|
static float *
|
2019-03-08 13:03:57 -05:00
|
|
|
meta_monitor_manager_test_calculate_supported_scales (MetaMonitorManager *manager,
|
|
|
|
MetaLogicalMonitorLayoutMode layout_mode,
|
|
|
|
MetaMonitor *monitor,
|
|
|
|
MetaMonitorMode *monitor_mode,
|
|
|
|
int *n_supported_scales)
|
2017-01-26 04:14:32 -05:00
|
|
|
{
|
2017-06-05 03:59:47 -04:00
|
|
|
MetaMonitorScalesConstraint constraints =
|
|
|
|
META_MONITOR_SCALES_CONSTRAINT_NONE;
|
|
|
|
|
2017-05-25 05:20:59 -04:00
|
|
|
switch (layout_mode)
|
|
|
|
{
|
|
|
|
case META_LOGICAL_MONITOR_LAYOUT_MODE_LOGICAL:
|
|
|
|
break;
|
|
|
|
case META_LOGICAL_MONITOR_LAYOUT_MODE_PHYSICAL:
|
2017-06-05 03:59:47 -04:00
|
|
|
constraints |= META_MONITOR_SCALES_CONSTRAINT_NO_FRAC;
|
2017-05-25 05:20:59 -04:00
|
|
|
break;
|
|
|
|
}
|
2017-06-05 03:59:47 -04:00
|
|
|
|
|
|
|
return meta_monitor_calculate_supported_scales (monitor, monitor_mode,
|
|
|
|
constraints,
|
|
|
|
n_supported_scales);
|
2017-01-26 04:14:32 -05:00
|
|
|
}
|
|
|
|
|
2017-02-24 05:10:52 -05:00
|
|
|
static gboolean
|
|
|
|
is_monitor_framebuffer_scaled (void)
|
|
|
|
{
|
|
|
|
MetaBackend *backend = meta_get_backend ();
|
2017-04-21 04:40:51 -04:00
|
|
|
MetaSettings *settings = meta_backend_get_settings (backend);
|
2017-02-24 05:10:52 -05:00
|
|
|
|
2017-04-21 04:40:51 -04:00
|
|
|
return meta_settings_is_experimental_feature_enabled (
|
|
|
|
settings,
|
2017-02-24 05:10:52 -05:00
|
|
|
META_EXPERIMENTAL_FEATURE_SCALE_MONITOR_FRAMEBUFFER);
|
|
|
|
}
|
|
|
|
|
2017-02-07 03:01:40 -05:00
|
|
|
static MetaMonitorManagerCapability
|
|
|
|
meta_monitor_manager_test_get_capabilities (MetaMonitorManager *manager)
|
|
|
|
{
|
2017-02-24 05:10:52 -05:00
|
|
|
MetaMonitorManagerCapability capabilities =
|
|
|
|
META_MONITOR_MANAGER_CAPABILITY_NONE;
|
|
|
|
|
|
|
|
if (is_monitor_framebuffer_scaled ())
|
|
|
|
capabilities |= META_MONITOR_MANAGER_CAPABILITY_LAYOUT_MODE;
|
|
|
|
|
|
|
|
return capabilities;
|
2017-02-07 03:01:40 -05:00
|
|
|
}
|
|
|
|
|
2017-02-15 03:06:46 -05:00
|
|
|
static gboolean
|
|
|
|
meta_monitor_manager_test_get_max_screen_size (MetaMonitorManager *manager,
|
|
|
|
int *max_width,
|
|
|
|
int *max_height)
|
|
|
|
{
|
|
|
|
if (meta_is_stage_views_enabled ())
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
*max_width = 65535;
|
|
|
|
*max_height = 65535;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2017-02-24 05:10:52 -05:00
|
|
|
static MetaLogicalMonitorLayoutMode
|
|
|
|
meta_monitor_manager_test_get_default_layout_mode (MetaMonitorManager *manager)
|
|
|
|
{
|
|
|
|
if (!meta_is_stage_views_enabled ())
|
|
|
|
return META_LOGICAL_MONITOR_LAYOUT_MODE_PHYSICAL;
|
|
|
|
|
|
|
|
if (is_monitor_framebuffer_scaled ())
|
|
|
|
return META_LOGICAL_MONITOR_LAYOUT_MODE_LOGICAL;
|
|
|
|
else
|
|
|
|
return META_LOGICAL_MONITOR_LAYOUT_MODE_PHYSICAL;
|
|
|
|
}
|
|
|
|
|
2016-12-07 04:39:53 -05:00
|
|
|
static void
|
2022-01-28 10:28:32 -05:00
|
|
|
meta_monitor_manager_test_constructed (GObject *object)
|
2016-12-07 04:39:53 -05:00
|
|
|
{
|
|
|
|
MetaMonitorManagerTest *manager_test = META_MONITOR_MANAGER_TEST (object);
|
2022-01-28 10:28:32 -05:00
|
|
|
MetaMonitorManager *manager = META_MONITOR_MANAGER (manager_test);
|
|
|
|
MetaBackend *backend = meta_monitor_manager_get_backend (manager);
|
2016-12-07 04:39:53 -05:00
|
|
|
|
2022-01-28 10:28:32 -05:00
|
|
|
if (initial_setup_func)
|
|
|
|
manager_test->test_setup = initial_setup_func (backend);
|
|
|
|
else
|
|
|
|
manager_test->test_setup = create_default_test_setup (backend);
|
2021-03-02 12:52:52 -05:00
|
|
|
|
2022-01-28 10:28:32 -05:00
|
|
|
G_OBJECT_CLASS (meta_monitor_manager_test_parent_class)->constructed (object);
|
2021-03-02 12:52:52 -05:00
|
|
|
}
|
|
|
|
|
2016-12-05 05:38:43 -05:00
|
|
|
static void
|
2022-01-28 10:28:32 -05:00
|
|
|
meta_monitor_manager_test_dispose (GObject *object)
|
2016-12-05 05:38:43 -05:00
|
|
|
{
|
2020-02-25 04:18:22 -05:00
|
|
|
MetaMonitorManagerTest *manager_test = META_MONITOR_MANAGER_TEST (object);
|
2016-12-05 08:28:22 -05:00
|
|
|
|
2022-01-28 10:28:32 -05:00
|
|
|
g_clear_pointer (&manager_test->test_setup, g_free);
|
2020-02-25 04:18:22 -05:00
|
|
|
|
2022-01-28 10:28:32 -05:00
|
|
|
G_OBJECT_CLASS (meta_monitor_manager_test_parent_class)->dispose (object);
|
2020-02-25 04:18:22 -05:00
|
|
|
}
|
2017-03-21 05:22:56 -04:00
|
|
|
|
2020-02-25 04:18:22 -05:00
|
|
|
static void
|
|
|
|
meta_monitor_manager_test_init (MetaMonitorManagerTest *manager_test)
|
|
|
|
{
|
|
|
|
manager_test->handles_transforms = TRUE;
|
2016-12-05 05:38:43 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
meta_monitor_manager_test_class_init (MetaMonitorManagerTestClass *klass)
|
|
|
|
{
|
2016-12-07 04:39:53 -05:00
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
2016-12-05 05:38:43 -05:00
|
|
|
MetaMonitorManagerClass *manager_class = META_MONITOR_MANAGER_CLASS (klass);
|
|
|
|
|
2020-02-25 04:18:22 -05:00
|
|
|
object_class->constructed = meta_monitor_manager_test_constructed;
|
2022-01-28 10:28:32 -05:00
|
|
|
object_class->dispose = meta_monitor_manager_test_dispose;
|
2016-12-07 04:39:53 -05:00
|
|
|
|
2017-01-06 00:27:21 -05:00
|
|
|
manager_class->ensure_initial_config = meta_monitor_manager_test_ensure_initial_config;
|
2017-01-09 01:31:18 -05:00
|
|
|
manager_class->apply_monitors_config = meta_monitor_manager_test_apply_monitors_config;
|
2016-12-13 07:11:48 -05:00
|
|
|
manager_class->tiled_monitor_added = meta_monitor_manager_test_tiled_monitor_added;
|
|
|
|
manager_class->tiled_monitor_removed = meta_monitor_manager_test_tiled_monitor_removed;
|
2017-03-08 03:05:00 -05:00
|
|
|
manager_class->is_transform_handled = meta_monitor_manager_test_is_transform_handled;
|
2017-01-20 02:07:12 -05:00
|
|
|
manager_class->calculate_monitor_mode_scale = meta_monitor_manager_test_calculate_monitor_mode_scale;
|
2017-06-05 03:59:47 -04:00
|
|
|
manager_class->calculate_supported_scales = meta_monitor_manager_test_calculate_supported_scales;
|
2017-02-07 03:01:40 -05:00
|
|
|
manager_class->get_capabilities = meta_monitor_manager_test_get_capabilities;
|
2017-02-15 03:06:46 -05:00
|
|
|
manager_class->get_max_screen_size = meta_monitor_manager_test_get_max_screen_size;
|
2017-02-24 05:10:52 -05:00
|
|
|
manager_class->get_default_layout_mode = meta_monitor_manager_test_get_default_layout_mode;
|
2016-12-05 05:38:43 -05:00
|
|
|
}
|
2020-02-26 10:47:03 -05:00
|
|
|
|
|
|
|
static void
|
|
|
|
meta_output_test_init (MetaOutputTest *output_test)
|
|
|
|
{
|
|
|
|
output_test->scale = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
meta_output_test_class_init (MetaOutputTestClass *klass)
|
|
|
|
{
|
|
|
|
}
|
2020-02-26 13:47:44 -05:00
|
|
|
|
|
|
|
static void
|
|
|
|
meta_crtc_test_init (MetaCrtcTest *crtc_test)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
meta_crtc_test_class_init (MetaCrtcTestClass *klass)
|
|
|
|
{
|
|
|
|
}
|