2016-12-05 05:40:44 -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/monitor-unit-tests.h"
|
|
|
|
|
|
|
|
#include "backends/meta-backend-private.h"
|
2016-12-12 21:37:11 -05:00
|
|
|
#include "backends/meta-logical-monitor.h"
|
2016-12-12 21:58:41 -05:00
|
|
|
#include "backends/meta-monitor.h"
|
2016-12-05 08:28:22 -05:00
|
|
|
#include "tests/meta-monitor-manager-test.h"
|
2017-01-12 22:41:05 -05:00
|
|
|
#include "tests/monitor-test-utils.h"
|
2016-12-05 08:28:22 -05:00
|
|
|
|
|
|
|
#define ALL_TRANSFORMS ((1 << (META_MONITOR_TRANSFORM_FLIPPED_270 + 1)) - 1)
|
|
|
|
|
2016-12-07 00:54:32 -05:00
|
|
|
#define MAX_N_MODES 10
|
|
|
|
#define MAX_N_OUTPUTS 10
|
|
|
|
#define MAX_N_CRTCS 10
|
2016-12-12 21:58:41 -05:00
|
|
|
#define MAX_N_MONITORS 10
|
2016-12-07 00:54:32 -05:00
|
|
|
#define MAX_N_LOGICAL_MONITORS 10
|
|
|
|
|
2016-12-12 22:45:43 -05:00
|
|
|
/*
|
|
|
|
* The following structures are used to define test cases.
|
|
|
|
*
|
|
|
|
* Each test case consists of a test case setup and a test case expectaction.
|
|
|
|
* and a expected result, consisting
|
|
|
|
* of an array of monitors, logical monitors and a screen size.
|
|
|
|
*
|
|
|
|
* TEST CASE SETUP:
|
|
|
|
*
|
|
|
|
* A test case setup consists of an array of modes, an array of outputs and an
|
|
|
|
* array of CRTCs.
|
|
|
|
*
|
|
|
|
* A mode has a width and height in pixels, and a refresh rate in updates per
|
|
|
|
* second.
|
|
|
|
*
|
|
|
|
* An output has an array of available modes, and a preferred mode. Modes are
|
|
|
|
* defined as indices into the modes array of the test case setup.
|
|
|
|
*
|
|
|
|
* It also has CRTc and an array of possible CRTCs. Crtcs are defined as indices
|
|
|
|
* into the CRTC array. The CRTC value -1 means no CRTC.
|
|
|
|
*
|
|
|
|
* It also has various meta data, such as physical dimension, tile info and
|
|
|
|
* scale.
|
|
|
|
*
|
|
|
|
* A CRTC only has a current mode. A mode is defined as an index into the modes
|
|
|
|
* array.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* TEST CASE EXPECTS:
|
|
|
|
*
|
|
|
|
* A test case expects consists of an array of monitors, an array of logical
|
|
|
|
* monitors, a output and crtc count, and a screen width.
|
|
|
|
*
|
|
|
|
* A monitor represents a physical monitor (such as an external monitor, or a
|
|
|
|
* laptop panel etc). A monitor consists of an array of outputs, defined by
|
2017-01-05 23:43:22 -05:00
|
|
|
* indices into the setup output array, an array of monitor modes, and the
|
|
|
|
* current mode, defined by an index into the monitor modes array, and the
|
|
|
|
* physical dimensions.
|
2016-12-12 22:45:43 -05:00
|
|
|
*
|
|
|
|
* A logical monitor represents a region of the total screen area. It contains
|
|
|
|
* the expected layout and a scale.
|
|
|
|
*/
|
|
|
|
|
2017-01-12 23:32:12 -05:00
|
|
|
typedef enum _MonitorTestFlag
|
|
|
|
{
|
|
|
|
MONITOR_TEST_FLAG_NONE,
|
|
|
|
MONITOR_TEST_FLAG_NO_STORED
|
|
|
|
} MonitorTestFlag;
|
|
|
|
|
2016-12-07 00:54:32 -05:00
|
|
|
typedef struct _MonitorTestCaseMode
|
|
|
|
{
|
|
|
|
int width;
|
|
|
|
int height;
|
|
|
|
float refresh_rate;
|
2017-06-14 02:42:48 -04:00
|
|
|
MetaCrtcModeFlag flags;
|
2016-12-07 00:54:32 -05:00
|
|
|
} MonitorTestCaseMode;
|
|
|
|
|
|
|
|
typedef struct _MonitorTestCaseOutput
|
|
|
|
{
|
|
|
|
int crtc;
|
|
|
|
int modes[MAX_N_MODES];
|
|
|
|
int n_modes;
|
|
|
|
int preferred_mode;
|
|
|
|
int possible_crtcs[MAX_N_CRTCS];
|
|
|
|
int n_possible_crtcs;
|
|
|
|
int width_mm;
|
|
|
|
int height_mm;
|
2016-12-07 04:42:06 -05:00
|
|
|
MetaTileInfo tile_info;
|
2017-05-25 05:22:14 -04:00
|
|
|
float scale;
|
2017-01-09 22:50:44 -05:00
|
|
|
gboolean is_laptop_panel;
|
2017-01-16 22:34:23 -05:00
|
|
|
gboolean is_underscanning;
|
2016-12-07 00:54:32 -05:00
|
|
|
} MonitorTestCaseOutput;
|
|
|
|
|
|
|
|
typedef struct _MonitorTestCaseCrtc
|
|
|
|
{
|
|
|
|
int current_mode;
|
|
|
|
} MonitorTestCaseCrtc;
|
|
|
|
|
|
|
|
typedef struct _MonitorTestCaseSetup
|
|
|
|
{
|
|
|
|
MonitorTestCaseMode modes[MAX_N_MODES];
|
|
|
|
int n_modes;
|
|
|
|
|
|
|
|
MonitorTestCaseOutput outputs[MAX_N_OUTPUTS];
|
|
|
|
int n_outputs;
|
|
|
|
|
|
|
|
MonitorTestCaseCrtc crtcs[MAX_N_CRTCS];
|
|
|
|
int n_crtcs;
|
|
|
|
} MonitorTestCaseSetup;
|
|
|
|
|
2016-12-14 04:23:44 -05:00
|
|
|
typedef struct _MonitorTestCaseMonitorCrtcMode
|
|
|
|
{
|
|
|
|
int output;
|
|
|
|
int crtc_mode;
|
|
|
|
} MetaTestCaseMonitorCrtcMode;
|
|
|
|
|
|
|
|
typedef struct _MonitorTestCaseMonitorMode
|
|
|
|
{
|
|
|
|
int width;
|
|
|
|
int height;
|
2017-06-14 02:08:43 -04:00
|
|
|
float refresh_rate;
|
2017-06-14 02:42:48 -04:00
|
|
|
MetaCrtcModeFlag flags;
|
2016-12-14 04:23:44 -05:00
|
|
|
MetaTestCaseMonitorCrtcMode crtc_modes[MAX_N_CRTCS];
|
|
|
|
} MetaMonitorTestCaseMonitorMode;
|
|
|
|
|
2016-12-12 21:58:41 -05:00
|
|
|
typedef struct _MonitorTestCaseMonitor
|
|
|
|
{
|
|
|
|
long outputs[MAX_N_OUTPUTS];
|
|
|
|
int n_outputs;
|
2016-12-14 04:23:44 -05:00
|
|
|
MetaMonitorTestCaseMonitorMode modes[MAX_N_MODES];
|
|
|
|
int n_modes;
|
2017-01-05 23:43:22 -05:00
|
|
|
int current_mode;
|
2016-12-12 21:58:41 -05:00
|
|
|
int width_mm;
|
|
|
|
int height_mm;
|
2017-01-16 22:34:23 -05:00
|
|
|
gboolean is_underscanning;
|
2016-12-12 21:58:41 -05:00
|
|
|
} MonitorTestCaseMonitor;
|
|
|
|
|
2016-12-07 01:18:28 -05:00
|
|
|
typedef struct _MonitorTestCaseLogicalMonitor
|
|
|
|
{
|
|
|
|
MetaRectangle layout;
|
2017-05-25 05:22:14 -04:00
|
|
|
float scale;
|
2017-01-19 01:09:55 -05:00
|
|
|
int monitors[MAX_N_MONITORS];
|
|
|
|
int n_monitors;
|
2017-03-21 02:28:25 -04:00
|
|
|
MetaMonitorTransform transform;
|
2016-12-07 01:18:28 -05:00
|
|
|
} MonitorTestCaseLogicalMonitor;
|
|
|
|
|
2017-01-18 05:01:47 -05:00
|
|
|
typedef struct _MonitorTestCaseCrtcExpect
|
|
|
|
{
|
2017-03-21 02:28:25 -04:00
|
|
|
MetaMonitorTransform transform;
|
2017-01-18 05:01:47 -05:00
|
|
|
int current_mode;
|
2017-03-17 05:21:10 -04:00
|
|
|
int x;
|
|
|
|
int y;
|
2017-01-18 05:01:47 -05:00
|
|
|
} MonitorTestCaseCrtcExpect;
|
|
|
|
|
2016-12-07 01:18:28 -05:00
|
|
|
typedef struct _MonitorTestCaseExpect
|
|
|
|
{
|
2016-12-12 21:58:41 -05:00
|
|
|
MonitorTestCaseMonitor monitors[MAX_N_MONITORS];
|
|
|
|
int n_monitors;
|
2016-12-07 01:18:28 -05:00
|
|
|
MonitorTestCaseLogicalMonitor logical_monitors[MAX_N_LOGICAL_MONITORS];
|
|
|
|
int n_logical_monitors;
|
2017-01-16 00:09:21 -05:00
|
|
|
int primary_logical_monitor;
|
2016-12-07 01:18:28 -05:00
|
|
|
int n_outputs;
|
2017-01-18 05:01:47 -05:00
|
|
|
MonitorTestCaseCrtcExpect crtcs[MAX_N_CRTCS];
|
2016-12-07 01:18:28 -05:00
|
|
|
int n_crtcs;
|
2016-12-13 07:11:48 -05:00
|
|
|
int n_tiled_monitors;
|
2016-12-07 01:18:28 -05:00
|
|
|
int screen_width;
|
|
|
|
int screen_height;
|
|
|
|
} MonitorTestCaseExpect;
|
|
|
|
|
2016-12-07 00:54:32 -05:00
|
|
|
typedef struct _MonitorTestCase
|
|
|
|
{
|
|
|
|
MonitorTestCaseSetup setup;
|
2016-12-07 01:18:28 -05:00
|
|
|
MonitorTestCaseExpect expect;
|
2016-12-07 00:54:32 -05:00
|
|
|
} MonitorTestCase;
|
|
|
|
|
|
|
|
static MonitorTestCase initial_test_case = {
|
|
|
|
.setup = {
|
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 1024,
|
|
|
|
.height = 768,
|
|
|
|
.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
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.crtc = 1,
|
|
|
|
.modes = { 0 },
|
|
|
|
.n_modes = 1,
|
|
|
|
.preferred_mode = 0,
|
|
|
|
.possible_crtcs = { 1 },
|
|
|
|
.n_possible_crtcs = 1,
|
2016-12-12 21:58:41 -05:00
|
|
|
.width_mm = 220,
|
|
|
|
.height_mm = 124
|
2016-12-07 00:54:32 -05:00
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_outputs = 2,
|
|
|
|
.crtcs = {
|
|
|
|
{
|
|
|
|
.current_mode = 0
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.current_mode = 0
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_crtcs = 2
|
2016-12-07 01:18:28 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
.expect = {
|
2016-12-12 21:58:41 -05:00
|
|
|
.monitors = {
|
|
|
|
{
|
|
|
|
.outputs = { 0 },
|
|
|
|
.n_outputs = 1,
|
2016-12-14 04:23:44 -05:00
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 1024,
|
|
|
|
.height = 768,
|
2017-06-14 02:08:43 -04:00
|
|
|
.refresh_rate = 60.0,
|
2016-12-14 04:23:44 -05:00
|
|
|
.crtc_modes = {
|
|
|
|
{
|
|
|
|
.output = 0,
|
|
|
|
.crtc_mode = 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_modes = 1,
|
2017-01-05 23:43:22 -05:00
|
|
|
.current_mode = 0,
|
2016-12-12 21:58:41 -05:00
|
|
|
.width_mm = 222,
|
|
|
|
.height_mm = 125
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.outputs = { 1 },
|
|
|
|
.n_outputs = 1,
|
2016-12-14 04:23:44 -05:00
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 1024,
|
|
|
|
.height = 768,
|
2017-06-14 02:08:43 -04:00
|
|
|
.refresh_rate = 60.0,
|
2016-12-14 04:23:44 -05:00
|
|
|
.crtc_modes = {
|
|
|
|
{
|
|
|
|
.output = 1,
|
|
|
|
.crtc_mode = 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_modes = 1,
|
2017-01-05 23:43:22 -05:00
|
|
|
.current_mode = 0,
|
2016-12-12 21:58:41 -05:00
|
|
|
.width_mm = 220,
|
|
|
|
.height_mm = 124
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_monitors = 2,
|
2016-12-07 01:18:28 -05:00
|
|
|
.logical_monitors = {
|
|
|
|
{
|
2017-01-19 01:09:55 -05:00
|
|
|
.monitors = { 0 },
|
|
|
|
.n_monitors = 1,
|
2016-12-07 01:18:28 -05:00
|
|
|
.layout = { .x = 0, .y = 0, .width = 1024, .height = 768 },
|
|
|
|
.scale = 1
|
|
|
|
},
|
|
|
|
{
|
2017-01-19 01:09:55 -05:00
|
|
|
.monitors = { 1 },
|
|
|
|
.n_monitors = 1,
|
2016-12-07 01:18:28 -05:00
|
|
|
.layout = { .x = 1024, .y = 0, .width = 1024, .height = 768 },
|
|
|
|
.scale = 1
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_logical_monitors = 2,
|
2017-01-16 00:09:21 -05:00
|
|
|
.primary_logical_monitor = 0,
|
2016-12-07 01:18:28 -05:00
|
|
|
.n_outputs = 2,
|
2017-01-18 05:01:47 -05:00
|
|
|
.crtcs = {
|
|
|
|
{
|
|
|
|
.current_mode = 0,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.current_mode = 0,
|
|
|
|
}
|
|
|
|
},
|
2016-12-07 01:18:28 -05:00
|
|
|
.n_crtcs = 2,
|
|
|
|
.screen_width = 1024 * 2,
|
|
|
|
.screen_height = 768
|
2016-12-07 00:54:32 -05:00
|
|
|
}
|
|
|
|
};
|
2016-12-05 05:40:44 -05:00
|
|
|
|
2016-12-12 21:58:41 -05:00
|
|
|
static MetaOutput *
|
|
|
|
output_from_winsys_id (MetaMonitorManager *monitor_manager,
|
|
|
|
long winsys_id)
|
|
|
|
{
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
for (i = 0; i < monitor_manager->n_outputs; i++)
|
|
|
|
{
|
|
|
|
MetaOutput *output = &monitor_manager->outputs[i];
|
|
|
|
|
|
|
|
if (output->winsys_id == winsys_id)
|
|
|
|
return output;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2016-12-14 04:23:44 -05:00
|
|
|
typedef struct _CheckMonitorModeData
|
|
|
|
{
|
|
|
|
MetaMonitorManager *monitor_manager;
|
|
|
|
MetaTestCaseMonitorCrtcMode *expect_crtc_mode_iter;
|
|
|
|
} CheckMonitorModeData;
|
|
|
|
|
2016-12-20 10:23:27 -05:00
|
|
|
static gboolean
|
2016-12-14 04:23:44 -05:00
|
|
|
check_monitor_mode (MetaMonitor *monitor,
|
|
|
|
MetaMonitorMode *mode,
|
|
|
|
MetaMonitorCrtcMode *monitor_crtc_mode,
|
2016-12-20 10:23:27 -05:00
|
|
|
gpointer user_data,
|
|
|
|
GError **error)
|
2016-12-14 04:23:44 -05:00
|
|
|
{
|
|
|
|
CheckMonitorModeData *data = user_data;
|
|
|
|
MetaMonitorManager *monitor_manager = data->monitor_manager;
|
|
|
|
MetaOutput *output;
|
|
|
|
MetaCrtcMode *crtc_mode;
|
2017-03-06 00:13:07 -05:00
|
|
|
int expect_crtc_mode_index;
|
2016-12-14 04:23:44 -05:00
|
|
|
|
|
|
|
output = output_from_winsys_id (monitor_manager,
|
|
|
|
data->expect_crtc_mode_iter->output);
|
2017-03-06 00:13:07 -05:00
|
|
|
expect_crtc_mode_index = data->expect_crtc_mode_iter->crtc_mode;
|
|
|
|
if (expect_crtc_mode_index == -1)
|
|
|
|
crtc_mode = NULL;
|
|
|
|
else
|
|
|
|
crtc_mode = &monitor_manager->modes[expect_crtc_mode_index];
|
2016-12-14 04:23:44 -05:00
|
|
|
|
|
|
|
g_assert (monitor_crtc_mode->output == output);
|
|
|
|
g_assert (monitor_crtc_mode->crtc_mode == crtc_mode);
|
|
|
|
|
2017-06-14 02:08:43 -04:00
|
|
|
|
|
|
|
if (crtc_mode)
|
|
|
|
{
|
|
|
|
float refresh_rate;
|
2017-06-14 02:42:48 -04:00
|
|
|
MetaCrtcModeFlag flags;
|
2017-06-14 02:08:43 -04:00
|
|
|
|
|
|
|
refresh_rate = meta_monitor_mode_get_refresh_rate (mode);
|
2017-06-14 02:42:48 -04:00
|
|
|
flags = meta_monitor_mode_get_flags (mode);
|
2017-06-14 02:08:43 -04:00
|
|
|
|
|
|
|
g_assert_cmpfloat (refresh_rate, ==, crtc_mode->refresh_rate);
|
2017-06-14 02:42:48 -04:00
|
|
|
g_assert_cmpint (flags, ==, crtc_mode->flags);
|
2017-06-14 02:08:43 -04:00
|
|
|
}
|
|
|
|
|
2017-01-18 04:35:01 -05:00
|
|
|
data->expect_crtc_mode_iter++;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
check_current_monitor_mode (MetaMonitor *monitor,
|
|
|
|
MetaMonitorMode *mode,
|
|
|
|
MetaMonitorCrtcMode *monitor_crtc_mode,
|
|
|
|
gpointer user_data,
|
|
|
|
GError **error)
|
|
|
|
{
|
|
|
|
CheckMonitorModeData *data = user_data;
|
|
|
|
MetaMonitorManager *monitor_manager = data->monitor_manager;
|
|
|
|
MetaOutput *output;
|
|
|
|
|
|
|
|
output = output_from_winsys_id (monitor_manager,
|
|
|
|
data->expect_crtc_mode_iter->output);
|
|
|
|
|
2017-03-06 00:13:07 -05:00
|
|
|
if (data->expect_crtc_mode_iter->crtc_mode == -1)
|
|
|
|
{
|
|
|
|
g_assert_null (output->crtc);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
MetaLogicalMonitor *logical_monitor;
|
|
|
|
|
|
|
|
g_assert_nonnull (output->crtc);
|
|
|
|
g_assert (monitor_crtc_mode->crtc_mode == output->crtc->current_mode);
|
|
|
|
|
|
|
|
logical_monitor = output->crtc->logical_monitor;
|
|
|
|
g_assert_nonnull (logical_monitor);
|
|
|
|
}
|
|
|
|
|
2017-01-18 04:35:01 -05:00
|
|
|
|
2016-12-14 04:23:44 -05:00
|
|
|
data->expect_crtc_mode_iter++;
|
2016-12-20 10:23:27 -05:00
|
|
|
|
|
|
|
return TRUE;
|
2016-12-14 04:23:44 -05:00
|
|
|
}
|
|
|
|
|
2017-01-19 00:22:26 -05:00
|
|
|
static MetaLogicalMonitor *
|
|
|
|
logical_monitor_from_layout (MetaMonitorManager *monitor_manager,
|
|
|
|
MetaRectangle *layout)
|
|
|
|
{
|
|
|
|
GList *l;
|
|
|
|
|
|
|
|
for (l = monitor_manager->logical_monitors; l; l = l->next)
|
|
|
|
{
|
|
|
|
MetaLogicalMonitor *logical_monitor = l->data;
|
|
|
|
|
|
|
|
if (meta_rectangle_equal (layout, &logical_monitor->rect))
|
|
|
|
return logical_monitor;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
check_logical_monitor (MonitorTestCase *test_case,
|
|
|
|
MetaMonitorManager *monitor_manager,
|
|
|
|
MonitorTestCaseLogicalMonitor *test_logical_monitor)
|
|
|
|
{
|
|
|
|
MetaLogicalMonitor *logical_monitor;
|
|
|
|
MetaOutput *primary_output;
|
|
|
|
GList *monitors;
|
|
|
|
GList *l;
|
2017-01-19 01:09:55 -05:00
|
|
|
int i;
|
2017-01-19 00:22:26 -05:00
|
|
|
|
|
|
|
logical_monitor = logical_monitor_from_layout (monitor_manager,
|
|
|
|
&test_logical_monitor->layout);
|
|
|
|
g_assert_nonnull (logical_monitor);
|
|
|
|
|
|
|
|
g_assert_cmpint (logical_monitor->rect.x,
|
|
|
|
==,
|
|
|
|
test_logical_monitor->layout.x);
|
|
|
|
g_assert_cmpint (logical_monitor->rect.y,
|
|
|
|
==,
|
|
|
|
test_logical_monitor->layout.y);
|
|
|
|
g_assert_cmpint (logical_monitor->rect.width,
|
|
|
|
==,
|
|
|
|
test_logical_monitor->layout.width);
|
|
|
|
g_assert_cmpint (logical_monitor->rect.height,
|
|
|
|
==,
|
|
|
|
test_logical_monitor->layout.height);
|
2017-05-25 05:20:59 -04:00
|
|
|
g_assert_cmpfloat (logical_monitor->scale,
|
|
|
|
==,
|
|
|
|
test_logical_monitor->scale);
|
2017-03-21 02:28:25 -04:00
|
|
|
g_assert_cmpuint (logical_monitor->transform,
|
|
|
|
==,
|
|
|
|
test_logical_monitor->transform);
|
2017-01-19 00:22:26 -05:00
|
|
|
|
|
|
|
if (logical_monitor == monitor_manager->primary_logical_monitor)
|
|
|
|
g_assert (meta_logical_monitor_is_primary (logical_monitor));
|
|
|
|
|
|
|
|
primary_output = NULL;
|
|
|
|
monitors = meta_logical_monitor_get_monitors (logical_monitor);
|
2017-01-19 01:09:55 -05:00
|
|
|
g_assert_cmpint ((int) g_list_length (monitors),
|
|
|
|
==,
|
|
|
|
test_logical_monitor->n_monitors);
|
|
|
|
|
|
|
|
for (i = 0; i < test_logical_monitor->n_monitors; i++)
|
|
|
|
{
|
|
|
|
MetaMonitor *monitor =
|
|
|
|
g_list_nth (monitor_manager->monitors,
|
|
|
|
test_logical_monitor->monitors[i])->data;
|
|
|
|
|
|
|
|
g_assert_nonnull (g_list_find (monitors, monitor));
|
|
|
|
}
|
|
|
|
|
2017-01-19 00:22:26 -05:00
|
|
|
for (l = monitors; l; l = l->next)
|
|
|
|
{
|
|
|
|
MetaMonitor *monitor = l->data;
|
|
|
|
GList *outputs;
|
|
|
|
GList *l_output;
|
|
|
|
|
|
|
|
outputs = meta_monitor_get_outputs (monitor);
|
|
|
|
for (l_output = outputs; l_output; l_output = l_output->next)
|
|
|
|
{
|
|
|
|
MetaOutput *output = l_output->data;
|
|
|
|
|
|
|
|
if (output->is_primary)
|
|
|
|
{
|
|
|
|
g_assert_null (primary_output);
|
|
|
|
primary_output = output;
|
|
|
|
}
|
|
|
|
|
2017-03-06 00:13:07 -05:00
|
|
|
g_assert (!output->crtc ||
|
|
|
|
output->crtc->logical_monitor == logical_monitor);
|
2017-01-19 00:22:26 -05:00
|
|
|
g_assert_cmpint (logical_monitor->is_presentation,
|
|
|
|
==,
|
|
|
|
output->is_presentation);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (logical_monitor == monitor_manager->primary_logical_monitor)
|
|
|
|
g_assert_nonnull (primary_output);
|
|
|
|
}
|
|
|
|
|
2017-03-17 05:21:10 -04:00
|
|
|
static void
|
|
|
|
get_compensated_crtc_position (MetaCrtc *crtc,
|
|
|
|
int *x,
|
|
|
|
int *y)
|
|
|
|
{
|
|
|
|
MetaLogicalMonitor *logical_monitor;
|
|
|
|
MetaBackend *backend = meta_get_backend ();
|
|
|
|
MetaRenderer *renderer = meta_backend_get_renderer (backend);
|
|
|
|
GList *views;
|
|
|
|
GList *l;
|
|
|
|
|
|
|
|
logical_monitor = crtc->logical_monitor;
|
|
|
|
g_assert_nonnull (logical_monitor);
|
|
|
|
|
|
|
|
views = meta_renderer_get_views (renderer);
|
|
|
|
for (l = views; l; l = l->next)
|
|
|
|
{
|
|
|
|
MetaRendererView *view = l->data;
|
|
|
|
MetaRectangle view_layout;
|
|
|
|
|
|
|
|
clutter_stage_view_get_layout (CLUTTER_STAGE_VIEW (view),
|
|
|
|
&view_layout);
|
|
|
|
|
|
|
|
if (meta_rectangle_equal (&view_layout,
|
|
|
|
&logical_monitor->rect))
|
|
|
|
{
|
|
|
|
*x = crtc->rect.x - view_layout.x;
|
|
|
|
*y = crtc->rect.y - view_layout.y;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
*x = crtc->rect.x;
|
|
|
|
*y = crtc->rect.y;
|
|
|
|
}
|
|
|
|
|
2016-12-05 05:40:44 -05:00
|
|
|
static void
|
2016-12-07 01:18:28 -05:00
|
|
|
check_monitor_configuration (MonitorTestCase *test_case)
|
2016-12-05 05:40:44 -05:00
|
|
|
{
|
|
|
|
MetaBackend *backend = meta_get_backend ();
|
|
|
|
MetaMonitorManager *monitor_manager =
|
|
|
|
meta_backend_get_monitor_manager (backend);
|
2016-12-13 07:11:48 -05:00
|
|
|
MetaMonitorManagerTest *monitor_manager_test =
|
|
|
|
META_MONITOR_MANAGER_TEST (monitor_manager);
|
|
|
|
int tiled_monitor_count;
|
2016-12-12 21:58:41 -05:00
|
|
|
GList *monitors;
|
2016-12-07 01:18:28 -05:00
|
|
|
int n_logical_monitors;
|
|
|
|
GList *l;
|
|
|
|
int i;
|
|
|
|
|
2017-01-12 00:40:31 -05:00
|
|
|
g_assert_cmpint (monitor_manager->screen_width,
|
|
|
|
==,
|
|
|
|
test_case->expect.screen_width);
|
|
|
|
g_assert_cmpint (monitor_manager->screen_height,
|
|
|
|
==,
|
|
|
|
test_case->expect.screen_height);
|
|
|
|
g_assert_cmpint ((int) monitor_manager->n_outputs,
|
|
|
|
==,
|
|
|
|
test_case->expect.n_outputs);
|
|
|
|
g_assert_cmpint ((int) monitor_manager->n_crtcs,
|
|
|
|
==,
|
|
|
|
test_case->expect.n_crtcs);
|
2016-12-05 05:40:44 -05:00
|
|
|
|
2016-12-13 07:11:48 -05:00
|
|
|
tiled_monitor_count =
|
|
|
|
meta_monitor_manager_test_get_tiled_monitor_count (monitor_manager_test);
|
2017-01-12 00:40:31 -05:00
|
|
|
g_assert_cmpint (tiled_monitor_count,
|
|
|
|
==,
|
|
|
|
test_case->expect.n_tiled_monitors);
|
2016-12-13 07:11:48 -05:00
|
|
|
|
2016-12-12 21:58:41 -05:00
|
|
|
monitors = meta_monitor_manager_get_monitors (monitor_manager);
|
2017-01-12 00:40:31 -05:00
|
|
|
g_assert_cmpint ((int) g_list_length (monitors),
|
|
|
|
==,
|
|
|
|
test_case->expect.n_monitors);
|
2016-12-12 21:58:41 -05:00
|
|
|
for (l = monitors, i = 0; l; l = l->next, i++)
|
|
|
|
{
|
|
|
|
MetaMonitor *monitor = l->data;
|
|
|
|
GList *outputs;
|
|
|
|
GList *l_output;
|
|
|
|
int j;
|
|
|
|
int width_mm, height_mm;
|
2016-12-14 04:23:44 -05:00
|
|
|
GList *modes;
|
|
|
|
GList *l_mode;
|
2017-01-05 23:43:22 -05:00
|
|
|
MetaMonitorMode *current_mode;
|
|
|
|
int expected_current_mode_index;
|
|
|
|
MetaMonitorMode *expected_current_mode;
|
2016-12-12 21:58:41 -05:00
|
|
|
|
|
|
|
outputs = meta_monitor_get_outputs (monitor);
|
|
|
|
|
2017-01-12 00:40:31 -05:00
|
|
|
g_assert_cmpint ((int) g_list_length (outputs),
|
|
|
|
==,
|
|
|
|
test_case->expect.monitors[i].n_outputs);
|
2016-12-12 21:58:41 -05:00
|
|
|
|
|
|
|
for (l_output = outputs, j = 0; l_output; l_output = l_output->next, j++)
|
|
|
|
{
|
|
|
|
MetaOutput *output = l_output->data;
|
|
|
|
long winsys_id = test_case->expect.monitors[i].outputs[j];
|
|
|
|
|
|
|
|
g_assert (output == output_from_winsys_id (monitor_manager,
|
|
|
|
winsys_id));
|
2017-01-16 22:34:23 -05:00
|
|
|
g_assert_cmpint (test_case->expect.monitors[i].is_underscanning,
|
|
|
|
==,
|
|
|
|
output->is_underscanning);
|
2016-12-12 21:58:41 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
meta_monitor_get_physical_dimensions (monitor, &width_mm, &height_mm);
|
2017-01-12 00:40:31 -05:00
|
|
|
g_assert_cmpint (width_mm,
|
|
|
|
==,
|
|
|
|
test_case->expect.monitors[i].width_mm);
|
|
|
|
g_assert_cmpint (height_mm,
|
|
|
|
==,
|
|
|
|
test_case->expect.monitors[i].height_mm);
|
2016-12-14 04:23:44 -05:00
|
|
|
|
|
|
|
modes = meta_monitor_get_modes (monitor);
|
2017-06-22 03:06:23 -04:00
|
|
|
g_assert_cmpint (g_list_length (modes),
|
|
|
|
==,
|
|
|
|
test_case->expect.monitors[i].n_modes);
|
|
|
|
|
2016-12-14 04:23:44 -05:00
|
|
|
for (l_mode = modes, j = 0; l_mode; l_mode = l_mode->next, j++)
|
|
|
|
{
|
|
|
|
MetaMonitorMode *mode = l_mode->data;
|
|
|
|
int width;
|
|
|
|
int height;
|
2017-06-14 02:08:43 -04:00
|
|
|
float refresh_rate;
|
2017-06-14 02:42:48 -04:00
|
|
|
MetaCrtcModeFlag flags;
|
2016-12-14 04:23:44 -05:00
|
|
|
CheckMonitorModeData data;
|
|
|
|
|
|
|
|
meta_monitor_mode_get_resolution (mode, &width, &height);
|
2017-06-14 02:08:43 -04:00
|
|
|
refresh_rate = meta_monitor_mode_get_refresh_rate (mode);
|
2017-06-14 02:42:48 -04:00
|
|
|
flags = meta_monitor_mode_get_flags (mode);
|
2016-12-14 04:23:44 -05:00
|
|
|
|
2017-01-12 00:40:31 -05:00
|
|
|
g_assert_cmpint (width,
|
|
|
|
==,
|
|
|
|
test_case->expect.monitors[i].modes[j].width);
|
|
|
|
g_assert_cmpint (height,
|
|
|
|
==,
|
|
|
|
test_case->expect.monitors[i].modes[j].height);
|
2017-06-14 02:08:43 -04:00
|
|
|
g_assert_cmpfloat (refresh_rate,
|
|
|
|
==,
|
|
|
|
test_case->expect.monitors[i].modes[j].refresh_rate);
|
2017-06-14 02:42:48 -04:00
|
|
|
g_assert_cmpint (flags,
|
|
|
|
==,
|
|
|
|
test_case->expect.monitors[i].modes[j].flags);
|
2016-12-14 04:23:44 -05:00
|
|
|
|
|
|
|
data = (CheckMonitorModeData) {
|
|
|
|
.monitor_manager = monitor_manager,
|
|
|
|
.expect_crtc_mode_iter =
|
|
|
|
test_case->expect.monitors[i].modes[j].crtc_modes
|
|
|
|
};
|
|
|
|
meta_monitor_mode_foreach_crtc (monitor, mode,
|
|
|
|
check_monitor_mode,
|
2016-12-20 10:23:27 -05:00
|
|
|
&data,
|
|
|
|
NULL);
|
2016-12-14 04:23:44 -05:00
|
|
|
}
|
2017-01-05 23:43:22 -05:00
|
|
|
|
|
|
|
current_mode = meta_monitor_get_current_mode (monitor);
|
|
|
|
expected_current_mode_index = test_case->expect.monitors[i].current_mode;
|
|
|
|
if (expected_current_mode_index == -1)
|
|
|
|
expected_current_mode = NULL;
|
|
|
|
else
|
|
|
|
expected_current_mode = g_list_nth (modes,
|
|
|
|
expected_current_mode_index)->data;
|
|
|
|
|
|
|
|
g_assert (current_mode == expected_current_mode);
|
2017-05-01 00:07:44 -04:00
|
|
|
if (current_mode)
|
|
|
|
g_assert (meta_monitor_is_active (monitor));
|
|
|
|
else
|
|
|
|
g_assert (!meta_monitor_is_active (monitor));
|
2017-01-05 23:43:22 -05:00
|
|
|
|
2017-01-18 04:35:01 -05:00
|
|
|
if (current_mode)
|
|
|
|
{
|
|
|
|
CheckMonitorModeData data;
|
|
|
|
|
|
|
|
data = (CheckMonitorModeData) {
|
|
|
|
.monitor_manager = monitor_manager,
|
|
|
|
.expect_crtc_mode_iter =
|
|
|
|
test_case->expect.monitors[i].modes[expected_current_mode_index].crtc_modes
|
|
|
|
};
|
|
|
|
meta_monitor_mode_foreach_crtc (monitor, expected_current_mode,
|
|
|
|
check_current_monitor_mode,
|
|
|
|
&data,
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
|
2017-01-05 23:43:22 -05:00
|
|
|
meta_monitor_derive_current_mode (monitor);
|
|
|
|
g_assert (current_mode == meta_monitor_get_current_mode (monitor));
|
2016-12-12 21:58:41 -05:00
|
|
|
}
|
|
|
|
|
2016-12-05 05:40:44 -05:00
|
|
|
n_logical_monitors =
|
|
|
|
meta_monitor_manager_get_num_logical_monitors (monitor_manager);
|
2017-01-12 00:40:31 -05:00
|
|
|
g_assert_cmpint (n_logical_monitors,
|
|
|
|
==,
|
|
|
|
test_case->expect.n_logical_monitors);
|
2016-12-05 05:40:44 -05:00
|
|
|
|
2017-01-16 00:09:21 -05:00
|
|
|
/*
|
|
|
|
* Check that we have a primary logical monitor (except for headless),
|
|
|
|
* and that the main output of the first monitor is the only output
|
|
|
|
* that is marked as primary (further below). Note: outputs being primary or
|
|
|
|
* not only matters on X11.
|
|
|
|
*/
|
|
|
|
if (test_case->expect.primary_logical_monitor == -1)
|
|
|
|
{
|
|
|
|
g_assert_null (monitor_manager->primary_logical_monitor);
|
|
|
|
g_assert_null (monitor_manager->logical_monitors);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-01-19 00:22:26 -05:00
|
|
|
MonitorTestCaseLogicalMonitor *test_logical_monitor =
|
|
|
|
&test_case->expect.logical_monitors[test_case->expect.primary_logical_monitor];
|
|
|
|
MetaLogicalMonitor *logical_monitor;
|
|
|
|
|
|
|
|
logical_monitor =
|
|
|
|
logical_monitor_from_layout (monitor_manager,
|
|
|
|
&test_logical_monitor->layout);
|
|
|
|
g_assert (logical_monitor == monitor_manager->primary_logical_monitor);
|
2017-01-16 00:09:21 -05:00
|
|
|
}
|
|
|
|
|
2017-01-19 00:22:26 -05:00
|
|
|
for (i = 0; i < test_case->expect.n_logical_monitors; i++)
|
2016-12-05 05:40:44 -05:00
|
|
|
{
|
2016-12-07 01:18:28 -05:00
|
|
|
MonitorTestCaseLogicalMonitor *test_logical_monitor =
|
|
|
|
&test_case->expect.logical_monitors[i];
|
2017-01-16 00:09:21 -05:00
|
|
|
|
2017-01-19 00:22:26 -05:00
|
|
|
check_logical_monitor (test_case, monitor_manager, test_logical_monitor);
|
2016-12-05 05:40:44 -05:00
|
|
|
}
|
2017-01-12 00:40:31 -05:00
|
|
|
g_assert_cmpint (n_logical_monitors, ==, i);
|
2017-01-18 05:01:47 -05:00
|
|
|
|
|
|
|
for (i = 0; i < test_case->expect.n_crtcs; i++)
|
|
|
|
{
|
|
|
|
if (test_case->expect.crtcs[i].current_mode == -1)
|
|
|
|
{
|
|
|
|
g_assert_null (monitor_manager->crtcs[i].current_mode);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
MetaCrtc *crtc = &monitor_manager->crtcs[i];
|
2017-03-21 05:16:04 -04:00
|
|
|
MetaLogicalMonitor *logical_monitor = crtc->logical_monitor;
|
2017-01-18 05:01:47 -05:00
|
|
|
MetaCrtcMode *expected_current_mode =
|
|
|
|
&monitor_manager->modes[test_case->expect.crtcs[i].current_mode];
|
2017-03-17 05:21:10 -04:00
|
|
|
int crtc_x, crtc_y;
|
2017-01-18 05:01:47 -05:00
|
|
|
|
|
|
|
g_assert (crtc->current_mode == expected_current_mode);
|
2017-03-17 05:21:10 -04:00
|
|
|
|
2017-03-21 02:28:25 -04:00
|
|
|
g_assert_cmpuint (crtc->transform,
|
|
|
|
==,
|
|
|
|
test_case->expect.crtcs[i].transform);
|
|
|
|
|
2017-03-21 05:16:04 -04:00
|
|
|
if (meta_is_stage_views_enabled ())
|
|
|
|
{
|
|
|
|
get_compensated_crtc_position (crtc, &crtc_x, &crtc_y);
|
|
|
|
|
|
|
|
g_assert_cmpint (crtc_x, ==, test_case->expect.crtcs[i].x);
|
|
|
|
g_assert_cmpint (crtc_y, ==, test_case->expect.crtcs[i].y);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int expect_crtc_x;
|
|
|
|
int expect_crtc_y;
|
|
|
|
|
|
|
|
g_assert_cmpuint (logical_monitor->transform,
|
|
|
|
==,
|
|
|
|
crtc->transform);
|
|
|
|
|
|
|
|
expect_crtc_x = (test_case->expect.crtcs[i].x +
|
|
|
|
logical_monitor->rect.x);
|
|
|
|
expect_crtc_y = (test_case->expect.crtcs[i].y +
|
|
|
|
logical_monitor->rect.y);
|
2017-03-17 05:21:10 -04:00
|
|
|
|
2017-03-21 05:16:04 -04:00
|
|
|
g_assert_cmpint (crtc->rect.x, ==, expect_crtc_x);
|
|
|
|
g_assert_cmpint (crtc->rect.y, ==, expect_crtc_y);
|
|
|
|
}
|
2017-01-18 05:01:47 -05:00
|
|
|
}
|
|
|
|
}
|
2016-12-05 05:40:44 -05:00
|
|
|
}
|
|
|
|
|
2017-01-20 02:07:12 -05:00
|
|
|
static void
|
|
|
|
meta_output_test_destroy_notify (MetaOutput *output)
|
|
|
|
{
|
|
|
|
g_clear_pointer (&output->driver_private, g_free);
|
|
|
|
}
|
|
|
|
|
2016-12-07 00:54:32 -05:00
|
|
|
static MetaMonitorTestSetup *
|
2017-01-12 23:32:12 -05:00
|
|
|
create_monitor_test_setup (MonitorTestCase *test_case,
|
|
|
|
MonitorTestFlag flags)
|
2016-12-05 08:28:22 -05:00
|
|
|
{
|
|
|
|
MetaMonitorTestSetup *test_setup;
|
|
|
|
int i;
|
2017-01-09 22:50:44 -05:00
|
|
|
int n_laptop_panels = 0;
|
|
|
|
int n_normal_panels = 0;
|
2017-01-12 23:32:12 -05:00
|
|
|
gboolean hotplug_mode_update;
|
|
|
|
|
|
|
|
if (flags & MONITOR_TEST_FLAG_NO_STORED)
|
|
|
|
hotplug_mode_update = TRUE;
|
|
|
|
else
|
|
|
|
hotplug_mode_update = FALSE;
|
2016-12-05 08:28:22 -05:00
|
|
|
|
|
|
|
test_setup = g_new0 (MetaMonitorTestSetup, 1);
|
|
|
|
|
2016-12-07 00:54:32 -05:00
|
|
|
test_setup->n_modes = test_case->setup.n_modes;
|
2016-12-09 02:49:54 -05:00
|
|
|
test_setup->modes = g_new0 (MetaCrtcMode, test_setup->n_modes);
|
2016-12-07 00:54:32 -05:00
|
|
|
for (i = 0; i < test_setup->n_modes; i++)
|
|
|
|
{
|
2016-12-09 02:49:54 -05:00
|
|
|
test_setup->modes[i] = (MetaCrtcMode) {
|
2016-12-07 00:54:32 -05:00
|
|
|
.mode_id = i,
|
|
|
|
.width = test_case->setup.modes[i].width,
|
|
|
|
.height = test_case->setup.modes[i].height,
|
2017-06-14 02:42:48 -04:00
|
|
|
.refresh_rate = test_case->setup.modes[i].refresh_rate,
|
|
|
|
.flags = test_case->setup.modes[i].flags,
|
2016-12-07 00:54:32 -05:00
|
|
|
};
|
|
|
|
}
|
2016-12-05 08:28:22 -05:00
|
|
|
|
2016-12-07 00:54:32 -05:00
|
|
|
test_setup->n_crtcs = test_case->setup.n_crtcs;
|
2016-12-07 23:15:28 -05:00
|
|
|
test_setup->crtcs = g_new0 (MetaCrtc, test_setup->n_crtcs);
|
2016-12-07 00:54:32 -05:00
|
|
|
for (i = 0; i < test_setup->n_crtcs; i++)
|
|
|
|
{
|
|
|
|
int current_mode_index;
|
2016-12-09 02:49:54 -05:00
|
|
|
MetaCrtcMode *current_mode;
|
2016-12-05 08:28:22 -05:00
|
|
|
|
2016-12-07 00:54:32 -05:00
|
|
|
current_mode_index = test_case->setup.crtcs[i].current_mode;
|
|
|
|
if (current_mode_index == -1)
|
|
|
|
current_mode = NULL;
|
|
|
|
else
|
|
|
|
current_mode = &test_setup->modes[current_mode_index];
|
2016-12-05 08:28:22 -05:00
|
|
|
|
2016-12-07 23:15:28 -05:00
|
|
|
test_setup->crtcs[i] = (MetaCrtc) {
|
2016-12-07 00:54:32 -05:00
|
|
|
.crtc_id = i + 1,
|
|
|
|
.current_mode = current_mode,
|
|
|
|
.transform = META_MONITOR_TRANSFORM_NORMAL,
|
|
|
|
.all_transforms = ALL_TRANSFORMS
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
test_setup->n_outputs = test_case->setup.n_outputs;
|
|
|
|
test_setup->outputs = g_new0 (MetaOutput, test_setup->n_outputs);
|
|
|
|
for (i = 0; i < test_setup->n_outputs; i++)
|
2016-12-05 08:28:22 -05:00
|
|
|
{
|
2017-01-20 02:07:12 -05:00
|
|
|
MetaOutputTest *output_test;
|
2016-12-07 00:54:32 -05:00
|
|
|
int crtc_index;
|
2016-12-07 23:15:28 -05:00
|
|
|
MetaCrtc *crtc;
|
2016-12-07 00:54:32 -05:00
|
|
|
int preferred_mode_index;
|
2016-12-09 02:49:54 -05:00
|
|
|
MetaCrtcMode *preferred_mode;
|
|
|
|
MetaCrtcMode **modes;
|
2016-12-07 00:54:32 -05:00
|
|
|
int n_modes;
|
|
|
|
int j;
|
2016-12-07 23:15:28 -05:00
|
|
|
MetaCrtc **possible_crtcs;
|
2016-12-07 00:54:32 -05:00
|
|
|
int n_possible_crtcs;
|
2016-12-07 04:42:30 -05:00
|
|
|
int scale;
|
2017-01-09 22:50:44 -05:00
|
|
|
gboolean is_laptop_panel;
|
2016-12-07 00:54:32 -05:00
|
|
|
|
|
|
|
crtc_index = test_case->setup.outputs[i].crtc;
|
|
|
|
if (crtc_index == -1)
|
|
|
|
crtc = NULL;
|
|
|
|
else
|
|
|
|
crtc = &test_setup->crtcs[crtc_index];
|
|
|
|
|
|
|
|
preferred_mode_index = test_case->setup.outputs[i].preferred_mode;
|
|
|
|
if (preferred_mode_index == -1)
|
|
|
|
preferred_mode = NULL;
|
|
|
|
else
|
|
|
|
preferred_mode = &test_setup->modes[preferred_mode_index];
|
|
|
|
|
|
|
|
n_modes = test_case->setup.outputs[i].n_modes;
|
2016-12-09 02:49:54 -05:00
|
|
|
modes = g_new0 (MetaCrtcMode *, n_modes);
|
2016-12-07 00:54:32 -05:00
|
|
|
for (j = 0; j < n_modes; j++)
|
|
|
|
{
|
|
|
|
int mode_index;
|
|
|
|
|
|
|
|
mode_index = test_case->setup.outputs[i].modes[j];
|
|
|
|
modes[j] = &test_setup->modes[mode_index];
|
|
|
|
}
|
|
|
|
|
|
|
|
n_possible_crtcs = test_case->setup.outputs[i].n_possible_crtcs;
|
2016-12-07 23:15:28 -05:00
|
|
|
possible_crtcs = g_new0 (MetaCrtc *, n_possible_crtcs);
|
2016-12-07 00:54:32 -05:00
|
|
|
for (j = 0; j < n_possible_crtcs; j++)
|
|
|
|
{
|
|
|
|
int possible_crtc_index;
|
|
|
|
|
|
|
|
possible_crtc_index = test_case->setup.outputs[i].possible_crtcs[j];
|
|
|
|
possible_crtcs[j] = &test_setup->crtcs[possible_crtc_index];
|
|
|
|
}
|
|
|
|
|
2017-01-20 02:07:12 -05:00
|
|
|
output_test = g_new0 (MetaOutputTest, 1);
|
|
|
|
|
2016-12-07 04:42:30 -05:00
|
|
|
scale = test_case->setup.outputs[i].scale;
|
|
|
|
if (scale < 1)
|
|
|
|
scale = 1;
|
|
|
|
|
2017-01-20 02:07:12 -05:00
|
|
|
*output_test = (MetaOutputTest) {
|
|
|
|
.scale = scale
|
|
|
|
};
|
|
|
|
|
2017-01-09 22:50:44 -05:00
|
|
|
is_laptop_panel = test_case->setup.outputs[i].is_laptop_panel;
|
|
|
|
|
2016-12-07 00:54:32 -05:00
|
|
|
test_setup->outputs[i] = (MetaOutput) {
|
|
|
|
.crtc = crtc,
|
2016-12-12 21:58:41 -05:00
|
|
|
.winsys_id = i,
|
2017-01-09 22:50:44 -05:00
|
|
|
.name = (is_laptop_panel ? g_strdup_printf ("eDP-%d",
|
|
|
|
++n_laptop_panels)
|
|
|
|
: g_strdup_printf ("DP-%d",
|
|
|
|
++n_normal_panels)),
|
2017-01-12 03:20:04 -05:00
|
|
|
.vendor = g_strdup ("MetaProduct's Inc."),
|
|
|
|
.product = g_strdup ("MetaMonitor"),
|
|
|
|
.serial = g_strdup ("0x123456"),
|
2016-12-07 00:54:32 -05:00
|
|
|
.suggested_x = -1,
|
|
|
|
.suggested_y = -1,
|
2017-01-12 23:32:12 -05:00
|
|
|
.hotplug_mode_update = hotplug_mode_update,
|
2016-12-07 00:54:32 -05:00
|
|
|
.width_mm = test_case->setup.outputs[i].width_mm,
|
|
|
|
.height_mm = test_case->setup.outputs[i].height_mm,
|
|
|
|
.subpixel_order = COGL_SUBPIXEL_ORDER_UNKNOWN,
|
|
|
|
.preferred_mode = preferred_mode,
|
|
|
|
.n_modes = n_modes,
|
|
|
|
.modes = modes,
|
|
|
|
.n_possible_crtcs = n_possible_crtcs,
|
|
|
|
.possible_crtcs = possible_crtcs,
|
|
|
|
.n_possible_clones = 0,
|
|
|
|
.possible_clones = NULL,
|
|
|
|
.backlight = -1,
|
2017-01-09 22:50:44 -05:00
|
|
|
.connector_type = (is_laptop_panel ? META_CONNECTOR_TYPE_eDP
|
|
|
|
: META_CONNECTOR_TYPE_DisplayPort),
|
2016-12-07 04:42:06 -05:00
|
|
|
.tile_info = test_case->setup.outputs[i].tile_info,
|
2017-01-20 02:07:12 -05:00
|
|
|
.is_underscanning = test_case->setup.outputs[i].is_underscanning,
|
|
|
|
.driver_private = output_test,
|
|
|
|
.driver_notify = (GDestroyNotify) meta_output_test_destroy_notify
|
2016-12-07 00:54:32 -05:00
|
|
|
};
|
2016-12-05 08:28:22 -05:00
|
|
|
}
|
|
|
|
|
2016-12-07 00:54:32 -05:00
|
|
|
return test_setup;
|
2016-12-05 08:28:22 -05:00
|
|
|
}
|
|
|
|
|
2016-12-07 01:18:28 -05:00
|
|
|
static void
|
|
|
|
meta_test_monitor_initial_linear_config (void)
|
|
|
|
{
|
|
|
|
check_monitor_configuration (&initial_test_case);
|
|
|
|
}
|
|
|
|
|
2016-12-07 02:15:25 -05:00
|
|
|
static void
|
|
|
|
emulate_hotplug (MetaMonitorTestSetup *test_setup)
|
|
|
|
{
|
|
|
|
MetaBackend *backend = meta_get_backend ();
|
|
|
|
MetaMonitorManager *monitor_manager =
|
|
|
|
meta_backend_get_monitor_manager (backend);
|
|
|
|
MetaMonitorManagerTest *monitor_manager_test =
|
|
|
|
META_MONITOR_MANAGER_TEST (monitor_manager);
|
|
|
|
|
|
|
|
meta_monitor_manager_test_emulate_hotplug (monitor_manager_test, test_setup);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
meta_test_monitor_one_disconnected_linear_config (void)
|
|
|
|
{
|
|
|
|
MonitorTestCase test_case = initial_test_case;
|
|
|
|
MetaMonitorTestSetup *test_setup;
|
|
|
|
|
|
|
|
test_case.setup.n_outputs = 1;
|
|
|
|
|
|
|
|
test_case.expect = (MonitorTestCaseExpect) {
|
2016-12-12 21:58:41 -05:00
|
|
|
.monitors = {
|
|
|
|
{
|
|
|
|
.outputs = { 0 },
|
|
|
|
.n_outputs = 1,
|
2016-12-14 04:23:44 -05:00
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 1024,
|
|
|
|
.height = 768,
|
2017-06-14 02:08:43 -04:00
|
|
|
.refresh_rate = 60.0,
|
2016-12-14 04:23:44 -05:00
|
|
|
.crtc_modes = {
|
|
|
|
{
|
|
|
|
.output = 0,
|
|
|
|
.crtc_mode = 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_modes = 1,
|
2017-01-05 23:43:22 -05:00
|
|
|
.current_mode = 0,
|
2016-12-12 21:58:41 -05:00
|
|
|
.width_mm = 222,
|
|
|
|
.height_mm = 125
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_monitors = 1,
|
2016-12-07 02:15:25 -05:00
|
|
|
.logical_monitors = {
|
|
|
|
{
|
2017-01-19 01:09:55 -05:00
|
|
|
.monitors = { 0 },
|
|
|
|
.n_monitors = 1,
|
2016-12-07 02:15:25 -05:00
|
|
|
.layout = { .x = 0, .y = 0, .width = 1024, .height = 768 },
|
|
|
|
.scale = 1
|
|
|
|
},
|
|
|
|
},
|
|
|
|
.n_logical_monitors = 1,
|
2017-01-16 00:09:21 -05:00
|
|
|
.primary_logical_monitor = 0,
|
2016-12-07 02:15:25 -05:00
|
|
|
.n_outputs = 1,
|
2017-01-18 05:01:47 -05:00
|
|
|
.crtcs = {
|
|
|
|
{
|
|
|
|
.current_mode = 0,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.current_mode = -1,
|
|
|
|
}
|
|
|
|
},
|
2016-12-07 02:15:25 -05:00
|
|
|
.n_crtcs = 2,
|
|
|
|
.screen_width = 1024,
|
|
|
|
.screen_height = 768
|
|
|
|
};
|
|
|
|
|
2017-01-12 23:32:12 -05:00
|
|
|
test_setup = create_monitor_test_setup (&test_case,
|
|
|
|
MONITOR_TEST_FLAG_NO_STORED);
|
2016-12-07 02:15:25 -05:00
|
|
|
emulate_hotplug (test_setup);
|
|
|
|
check_monitor_configuration (&test_case);
|
|
|
|
}
|
|
|
|
|
2016-12-07 02:16:12 -05:00
|
|
|
static void
|
|
|
|
meta_test_monitor_one_off_linear_config (void)
|
|
|
|
{
|
|
|
|
MonitorTestCase test_case;
|
|
|
|
MetaMonitorTestSetup *test_setup;
|
|
|
|
MonitorTestCaseOutput outputs[] = {
|
|
|
|
{
|
|
|
|
.crtc = 0,
|
|
|
|
.modes = { 0 },
|
|
|
|
.n_modes = 1,
|
|
|
|
.preferred_mode = 0,
|
|
|
|
.possible_crtcs = { 0 },
|
|
|
|
.n_possible_crtcs = 1,
|
|
|
|
.width_mm = 222,
|
|
|
|
.height_mm = 125
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.crtc = -1,
|
|
|
|
.modes = { 0 },
|
|
|
|
.n_modes = 1,
|
|
|
|
.preferred_mode = 0,
|
|
|
|
.possible_crtcs = { 1 },
|
|
|
|
.n_possible_crtcs = 1,
|
2016-12-12 21:58:41 -05:00
|
|
|
.width_mm = 224,
|
|
|
|
.height_mm = 126
|
2016-12-07 02:16:12 -05:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
test_case = initial_test_case;
|
|
|
|
|
|
|
|
memcpy (&test_case.setup.outputs, &outputs, sizeof (outputs));
|
|
|
|
test_case.setup.n_outputs = G_N_ELEMENTS (outputs);
|
|
|
|
|
|
|
|
test_case.setup.crtcs[1].current_mode = -1;
|
|
|
|
|
|
|
|
test_case.expect = (MonitorTestCaseExpect) {
|
2016-12-12 21:58:41 -05:00
|
|
|
.monitors = {
|
|
|
|
{
|
|
|
|
.outputs = { 0 },
|
|
|
|
.n_outputs = 1,
|
2016-12-14 04:23:44 -05:00
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 1024,
|
|
|
|
.height = 768,
|
2017-06-14 02:08:43 -04:00
|
|
|
.refresh_rate = 60.0,
|
2016-12-14 04:23:44 -05:00
|
|
|
.crtc_modes = {
|
|
|
|
{
|
|
|
|
.output = 0,
|
|
|
|
.crtc_mode = 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_modes = 1,
|
2017-01-05 23:43:22 -05:00
|
|
|
.current_mode = 0,
|
2016-12-12 21:58:41 -05:00
|
|
|
.width_mm = 222,
|
|
|
|
.height_mm = 125
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.outputs = { 1 },
|
|
|
|
.n_outputs = 1,
|
2016-12-14 04:23:44 -05:00
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 1024,
|
|
|
|
.height = 768,
|
2017-06-14 02:08:43 -04:00
|
|
|
.refresh_rate = 60.0,
|
2016-12-14 04:23:44 -05:00
|
|
|
.crtc_modes = {
|
|
|
|
{
|
|
|
|
.output = 1,
|
|
|
|
.crtc_mode = 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_modes = 1,
|
2017-01-05 23:43:22 -05:00
|
|
|
.current_mode = 0,
|
2016-12-12 21:58:41 -05:00
|
|
|
.width_mm = 224,
|
|
|
|
.height_mm = 126
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_monitors = 2,
|
2016-12-07 02:16:12 -05:00
|
|
|
.logical_monitors = {
|
|
|
|
{
|
2017-01-19 01:09:55 -05:00
|
|
|
.monitors = { 0 },
|
|
|
|
.n_monitors = 1,
|
2016-12-07 02:16:12 -05:00
|
|
|
.layout = { .x = 0, .y = 0, .width = 1024, .height = 768 },
|
|
|
|
.scale = 1
|
|
|
|
},
|
|
|
|
{
|
2017-01-19 01:09:55 -05:00
|
|
|
.monitors = { 1 },
|
|
|
|
.n_monitors = 1,
|
2016-12-07 02:16:12 -05:00
|
|
|
.layout = { .x = 1024, .y = 0, .width = 1024, .height = 768 },
|
|
|
|
.scale = 1
|
|
|
|
},
|
|
|
|
},
|
|
|
|
.n_logical_monitors = 2,
|
2017-01-16 00:09:21 -05:00
|
|
|
.primary_logical_monitor = 0,
|
2016-12-07 02:16:12 -05:00
|
|
|
.n_outputs = 2,
|
2017-01-18 05:01:47 -05:00
|
|
|
.crtcs = {
|
|
|
|
{
|
|
|
|
.current_mode = 0,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.current_mode = 0,
|
|
|
|
}
|
|
|
|
},
|
2016-12-07 02:16:12 -05:00
|
|
|
.n_crtcs = 2,
|
|
|
|
.screen_width = 1024 * 2,
|
|
|
|
.screen_height = 768
|
|
|
|
};
|
|
|
|
|
2017-01-12 23:32:12 -05:00
|
|
|
test_setup = create_monitor_test_setup (&test_case,
|
|
|
|
MONITOR_TEST_FLAG_NO_STORED);
|
2016-12-07 02:16:12 -05:00
|
|
|
emulate_hotplug (test_setup);
|
|
|
|
check_monitor_configuration (&test_case);
|
|
|
|
}
|
|
|
|
|
2016-12-07 02:33:45 -05:00
|
|
|
static void
|
|
|
|
meta_test_monitor_preferred_linear_config (void)
|
|
|
|
{
|
|
|
|
MonitorTestCase test_case = {
|
|
|
|
.setup = {
|
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 800,
|
|
|
|
.height = 600,
|
|
|
|
.refresh_rate = 60.0
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.width = 1024,
|
|
|
|
.height = 768,
|
|
|
|
.refresh_rate = 60.0
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.width = 1280,
|
|
|
|
.height = 720,
|
|
|
|
.refresh_rate = 60.0
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_modes = 3,
|
|
|
|
.outputs = {
|
|
|
|
{
|
|
|
|
.crtc = -1,
|
|
|
|
.modes = { 0, 1, 2 },
|
|
|
|
.n_modes = 3,
|
|
|
|
.preferred_mode = 1,
|
|
|
|
.possible_crtcs = { 0 },
|
|
|
|
.n_possible_crtcs = 1,
|
|
|
|
.width_mm = 222,
|
|
|
|
.height_mm = 125
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_outputs = 1,
|
|
|
|
.crtcs = {
|
|
|
|
{
|
|
|
|
.current_mode = -1
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_crtcs = 1
|
|
|
|
},
|
|
|
|
|
|
|
|
.expect = {
|
2016-12-12 21:58:41 -05:00
|
|
|
.monitors = {
|
|
|
|
{
|
|
|
|
.outputs = { 0 },
|
|
|
|
.n_outputs = 1,
|
2016-12-14 04:23:44 -05:00
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 800,
|
|
|
|
.height = 600,
|
2017-06-14 02:08:43 -04:00
|
|
|
.refresh_rate = 60.0,
|
2016-12-14 04:23:44 -05:00
|
|
|
.crtc_modes = {
|
|
|
|
{
|
|
|
|
.output = 0,
|
|
|
|
.crtc_mode = 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.width = 1024,
|
|
|
|
.height = 768,
|
2017-06-14 02:08:43 -04:00
|
|
|
.refresh_rate = 60.0,
|
2016-12-14 04:23:44 -05:00
|
|
|
.crtc_modes = {
|
|
|
|
{
|
|
|
|
.output = 0,
|
|
|
|
.crtc_mode = 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.width = 1280,
|
|
|
|
.height = 720,
|
2017-06-14 02:08:43 -04:00
|
|
|
.refresh_rate = 60.0,
|
2016-12-14 04:23:44 -05:00
|
|
|
.crtc_modes = {
|
|
|
|
{
|
|
|
|
.output = 0,
|
|
|
|
.crtc_mode = 2
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_modes = 3,
|
2017-01-05 23:43:22 -05:00
|
|
|
.current_mode = 1,
|
2016-12-12 21:58:41 -05:00
|
|
|
.width_mm = 222,
|
|
|
|
.height_mm = 125
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_monitors = 1,
|
2016-12-07 02:33:45 -05:00
|
|
|
.logical_monitors = {
|
|
|
|
{
|
2017-01-19 01:09:55 -05:00
|
|
|
.monitors = { 0 },
|
|
|
|
.n_monitors = 1,
|
2016-12-07 02:33:45 -05:00
|
|
|
.layout = { .x = 0, .y = 0, .width = 1024, .height = 768 },
|
|
|
|
.scale = 1
|
|
|
|
},
|
|
|
|
},
|
|
|
|
.n_logical_monitors = 1,
|
2017-01-16 00:09:21 -05:00
|
|
|
.primary_logical_monitor = 0,
|
2016-12-07 02:33:45 -05:00
|
|
|
.n_outputs = 1,
|
2017-01-18 05:01:47 -05:00
|
|
|
.crtcs = {
|
|
|
|
{
|
|
|
|
.current_mode = 1,
|
|
|
|
}
|
|
|
|
},
|
2016-12-07 02:33:45 -05:00
|
|
|
.n_crtcs = 1,
|
|
|
|
.screen_width = 1024,
|
|
|
|
.screen_height = 768,
|
|
|
|
}
|
|
|
|
};
|
|
|
|
MetaMonitorTestSetup *test_setup;
|
|
|
|
|
2017-01-12 23:32:12 -05:00
|
|
|
test_setup = create_monitor_test_setup (&test_case,
|
|
|
|
MONITOR_TEST_FLAG_NO_STORED);
|
2016-12-07 02:33:45 -05:00
|
|
|
emulate_hotplug (test_setup);
|
|
|
|
check_monitor_configuration (&test_case);
|
|
|
|
}
|
|
|
|
|
2016-12-07 04:42:06 -05:00
|
|
|
static void
|
|
|
|
meta_test_monitor_tiled_linear_config (void)
|
|
|
|
{
|
|
|
|
MonitorTestCase test_case = {
|
|
|
|
.setup = {
|
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 400,
|
|
|
|
.height = 600,
|
|
|
|
.refresh_rate = 60.0
|
|
|
|
},
|
|
|
|
},
|
|
|
|
.n_modes = 1,
|
|
|
|
.outputs = {
|
|
|
|
{
|
|
|
|
.crtc = -1,
|
|
|
|
.modes = { 0 },
|
|
|
|
.n_modes = 1,
|
|
|
|
.preferred_mode = 0,
|
|
|
|
.possible_crtcs = { 0 },
|
|
|
|
.n_possible_crtcs = 1,
|
|
|
|
.width_mm = 222,
|
|
|
|
.height_mm = 125,
|
|
|
|
.tile_info = {
|
|
|
|
.group_id = 1,
|
|
|
|
.max_h_tiles = 2,
|
|
|
|
.max_v_tiles = 1,
|
|
|
|
.loc_h_tile = 0,
|
|
|
|
.loc_v_tile = 0,
|
|
|
|
.tile_w = 400,
|
|
|
|
.tile_h = 600
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.crtc = -1,
|
|
|
|
.modes = { 0 },
|
|
|
|
.n_modes = 1,
|
|
|
|
.preferred_mode = 0,
|
|
|
|
.possible_crtcs = { 1 },
|
|
|
|
.n_possible_crtcs = 1,
|
|
|
|
.width_mm = 222,
|
|
|
|
.height_mm = 125,
|
|
|
|
.tile_info = {
|
|
|
|
.group_id = 1,
|
|
|
|
.max_h_tiles = 2,
|
|
|
|
.max_v_tiles = 1,
|
|
|
|
.loc_h_tile = 1,
|
|
|
|
.loc_v_tile = 0,
|
|
|
|
.tile_w = 400,
|
|
|
|
.tile_h = 600
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_outputs = 2,
|
|
|
|
.crtcs = {
|
|
|
|
{
|
|
|
|
.current_mode = -1
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.current_mode = -1
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_crtcs = 2
|
|
|
|
},
|
|
|
|
|
|
|
|
.expect = {
|
2016-12-12 21:58:41 -05:00
|
|
|
.monitors = {
|
|
|
|
{
|
|
|
|
.outputs = { 0, 1 },
|
|
|
|
.n_outputs = 2,
|
2016-12-14 04:23:44 -05:00
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 800,
|
|
|
|
.height = 600,
|
2017-06-14 02:08:43 -04:00
|
|
|
.refresh_rate = 60.0,
|
2016-12-14 04:23:44 -05:00
|
|
|
.crtc_modes = {
|
|
|
|
{
|
|
|
|
.output = 0,
|
|
|
|
.crtc_mode = 0
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.output = 1,
|
2017-01-18 04:35:01 -05:00
|
|
|
.crtc_mode = 0,
|
2016-12-14 04:23:44 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
.n_modes = 1,
|
2017-01-05 23:43:22 -05:00
|
|
|
.current_mode = 0,
|
2016-12-12 21:58:41 -05:00
|
|
|
.width_mm = 222,
|
|
|
|
.height_mm = 125,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_monitors = 1,
|
2016-12-07 04:42:06 -05:00
|
|
|
.logical_monitors = {
|
|
|
|
{
|
2017-01-19 01:09:55 -05:00
|
|
|
.monitors = { 0 },
|
|
|
|
.n_monitors = 1,
|
2016-12-07 04:42:06 -05:00
|
|
|
.layout = { .x = 0, .y = 0, .width = 800, .height = 600 },
|
|
|
|
.scale = 1
|
|
|
|
},
|
|
|
|
},
|
|
|
|
.n_logical_monitors = 1,
|
2017-01-16 00:09:21 -05:00
|
|
|
.primary_logical_monitor = 0,
|
2016-12-07 04:42:06 -05:00
|
|
|
.n_outputs = 2,
|
2017-01-18 05:01:47 -05:00
|
|
|
.crtcs = {
|
|
|
|
{
|
|
|
|
.current_mode = 0,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.current_mode = 0,
|
2017-03-17 05:21:10 -04:00
|
|
|
.x = 400,
|
|
|
|
.y = 0
|
2017-01-18 05:01:47 -05:00
|
|
|
}
|
|
|
|
},
|
2016-12-07 04:42:06 -05:00
|
|
|
.n_crtcs = 2,
|
2016-12-13 07:11:48 -05:00
|
|
|
.n_tiled_monitors = 1,
|
2016-12-07 04:42:06 -05:00
|
|
|
.screen_width = 800,
|
|
|
|
.screen_height = 600,
|
|
|
|
}
|
|
|
|
};
|
|
|
|
MetaMonitorTestSetup *test_setup;
|
|
|
|
|
2017-01-12 23:32:12 -05:00
|
|
|
test_setup = create_monitor_test_setup (&test_case,
|
|
|
|
MONITOR_TEST_FLAG_NO_STORED);
|
2016-12-07 04:42:06 -05:00
|
|
|
emulate_hotplug (test_setup);
|
|
|
|
check_monitor_configuration (&test_case);
|
|
|
|
}
|
|
|
|
|
2017-05-01 00:12:42 -04:00
|
|
|
static void
|
|
|
|
meta_test_monitor_tiled_non_preferred_linear_config (void)
|
|
|
|
{
|
|
|
|
MonitorTestCase test_case = {
|
|
|
|
.setup = {
|
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 640,
|
|
|
|
.height = 480,
|
|
|
|
.refresh_rate = 60.0
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.width = 800,
|
|
|
|
.height = 600,
|
|
|
|
.refresh_rate = 60.0
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.width = 512,
|
|
|
|
.height = 768,
|
|
|
|
.refresh_rate = 120.0
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.width = 1024,
|
|
|
|
.height = 768,
|
|
|
|
.refresh_rate = 60.0
|
|
|
|
},
|
|
|
|
},
|
|
|
|
.n_modes = 4,
|
|
|
|
.outputs = {
|
|
|
|
{
|
|
|
|
.crtc = -1,
|
|
|
|
.modes = { 0, 2 },
|
|
|
|
.n_modes = 2,
|
|
|
|
.preferred_mode = 1,
|
|
|
|
.possible_crtcs = { 0 },
|
|
|
|
.n_possible_crtcs = 1,
|
|
|
|
.width_mm = 222,
|
|
|
|
.height_mm = 125,
|
|
|
|
.tile_info = {
|
|
|
|
.group_id = 1,
|
|
|
|
.max_h_tiles = 2,
|
|
|
|
.max_v_tiles = 1,
|
|
|
|
.loc_h_tile = 0,
|
|
|
|
.loc_v_tile = 0,
|
|
|
|
.tile_w = 512,
|
|
|
|
.tile_h = 768
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.crtc = -1,
|
|
|
|
.modes = { 1, 2, 3 },
|
|
|
|
.n_modes = 3,
|
|
|
|
.preferred_mode = 0,
|
|
|
|
.possible_crtcs = { 1 },
|
|
|
|
.n_possible_crtcs = 1,
|
|
|
|
.width_mm = 222,
|
|
|
|
.height_mm = 125,
|
|
|
|
.tile_info = {
|
|
|
|
.group_id = 1,
|
|
|
|
.max_h_tiles = 2,
|
|
|
|
.max_v_tiles = 1,
|
|
|
|
.loc_h_tile = 1,
|
|
|
|
.loc_v_tile = 0,
|
|
|
|
.tile_w = 512,
|
|
|
|
.tile_h = 768
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_outputs = 2,
|
|
|
|
.crtcs = {
|
|
|
|
{
|
|
|
|
.current_mode = -1
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.current_mode = -1
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_crtcs = 2
|
|
|
|
},
|
|
|
|
|
|
|
|
.expect = {
|
|
|
|
.monitors = {
|
|
|
|
{
|
|
|
|
.outputs = { 0, 1 },
|
|
|
|
.n_outputs = 2,
|
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 1024,
|
|
|
|
.height = 768,
|
2017-06-14 02:08:43 -04:00
|
|
|
.refresh_rate = 120.0,
|
2017-05-01 00:12:42 -04:00
|
|
|
.crtc_modes = {
|
|
|
|
{
|
|
|
|
.output = 0,
|
|
|
|
.crtc_mode = 2
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.output = 1,
|
|
|
|
.crtc_mode = 2,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.width = 800,
|
|
|
|
.height = 600,
|
2017-06-14 02:08:43 -04:00
|
|
|
.refresh_rate = 60.0,
|
2017-05-01 00:12:42 -04:00
|
|
|
.crtc_modes = {
|
|
|
|
{
|
|
|
|
.output = 0,
|
|
|
|
.crtc_mode = -1
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.output = 1,
|
|
|
|
.crtc_mode = 1,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.width = 1024,
|
|
|
|
.height = 768,
|
2017-06-14 02:08:43 -04:00
|
|
|
.refresh_rate = 60.0,
|
2017-05-01 00:12:42 -04:00
|
|
|
.crtc_modes = {
|
|
|
|
{
|
|
|
|
.output = 0,
|
|
|
|
.crtc_mode = -1
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.output = 1,
|
|
|
|
.crtc_mode = 3,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
.n_modes = 3,
|
|
|
|
.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 = 2,
|
|
|
|
.crtcs = {
|
|
|
|
{
|
|
|
|
.current_mode = 2,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.current_mode = 2,
|
|
|
|
.x = 512
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_crtcs = 2,
|
|
|
|
.n_tiled_monitors = 1,
|
|
|
|
.screen_width = 1024,
|
|
|
|
.screen_height = 768,
|
|
|
|
}
|
|
|
|
};
|
|
|
|
MetaMonitorTestSetup *test_setup;
|
|
|
|
|
|
|
|
if (!is_using_monitor_config_manager ())
|
|
|
|
{
|
|
|
|
g_test_skip ("Only the new monitor config manager handles this case.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
test_setup = create_monitor_test_setup (&test_case,
|
|
|
|
MONITOR_TEST_FLAG_NO_STORED);
|
|
|
|
emulate_hotplug (test_setup);
|
|
|
|
check_monitor_configuration (&test_case);
|
|
|
|
}
|
|
|
|
|
2016-12-07 04:42:30 -05:00
|
|
|
static void
|
|
|
|
meta_test_monitor_hidpi_linear_config (void)
|
|
|
|
{
|
|
|
|
MonitorTestCase test_case = {
|
|
|
|
.setup = {
|
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 1280,
|
|
|
|
.height = 720,
|
|
|
|
.refresh_rate = 60.0
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.width = 1024,
|
|
|
|
.height = 768,
|
|
|
|
.refresh_rate = 60.0
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_modes = 2,
|
|
|
|
.outputs = {
|
|
|
|
{
|
|
|
|
.crtc = 0,
|
|
|
|
.modes = { 0 },
|
|
|
|
.n_modes = 1,
|
|
|
|
.preferred_mode = 0,
|
|
|
|
.possible_crtcs = { 0 },
|
|
|
|
.n_possible_crtcs = 1,
|
|
|
|
/* These will result in DPI of about 216" */
|
|
|
|
.width_mm = 150,
|
|
|
|
.height_mm = 85,
|
|
|
|
.scale = 2,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.crtc = 1,
|
|
|
|
.modes = { 1 },
|
|
|
|
.n_modes = 1,
|
|
|
|
.preferred_mode = 1,
|
|
|
|
.possible_crtcs = { 1 },
|
|
|
|
.n_possible_crtcs = 1,
|
|
|
|
.width_mm = 222,
|
|
|
|
.height_mm = 125,
|
|
|
|
.scale = 1,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_outputs = 2,
|
|
|
|
.crtcs = {
|
|
|
|
{
|
|
|
|
.current_mode = -1
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.current_mode = -1
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_crtcs = 2
|
|
|
|
},
|
|
|
|
|
|
|
|
.expect = {
|
2016-12-12 21:58:41 -05:00
|
|
|
.monitors = {
|
|
|
|
{
|
|
|
|
.outputs = { 0 },
|
|
|
|
.n_outputs = 1,
|
2016-12-14 04:23:44 -05:00
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 1280,
|
|
|
|
.height = 720,
|
2017-06-14 02:08:43 -04:00
|
|
|
.refresh_rate = 60.0,
|
2016-12-14 04:23:44 -05:00
|
|
|
.crtc_modes = {
|
|
|
|
{
|
|
|
|
.output = 0,
|
|
|
|
.crtc_mode = 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
.n_modes = 1,
|
2017-01-05 23:43:22 -05:00
|
|
|
.current_mode = 0,
|
2016-12-12 21:58:41 -05:00
|
|
|
.width_mm = 150,
|
|
|
|
.height_mm = 85
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.outputs = { 1 },
|
|
|
|
.n_outputs = 1,
|
2016-12-14 04:23:44 -05:00
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 1024,
|
|
|
|
.height = 768,
|
2017-06-14 02:08:43 -04:00
|
|
|
.refresh_rate = 60.0,
|
2016-12-14 04:23:44 -05:00
|
|
|
.crtc_modes = {
|
|
|
|
{
|
|
|
|
.output = 1,
|
|
|
|
.crtc_mode = 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
.n_modes = 1,
|
2017-01-05 23:43:22 -05:00
|
|
|
.current_mode = 0,
|
2016-12-12 21:58:41 -05:00
|
|
|
.width_mm = 222,
|
|
|
|
.height_mm = 125
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_monitors = 2,
|
2016-12-07 04:42:30 -05:00
|
|
|
.logical_monitors = {
|
|
|
|
{
|
2017-01-19 01:09:55 -05:00
|
|
|
.monitors = { 0 },
|
|
|
|
.n_monitors = 1,
|
2017-02-24 05:10:52 -05:00
|
|
|
.layout = { .x = 0, .y = 0, .width = 640, .height = 360 },
|
2016-12-07 04:42:30 -05:00
|
|
|
.scale = 2
|
|
|
|
},
|
|
|
|
{
|
2017-01-19 01:09:55 -05:00
|
|
|
.monitors = { 1 },
|
|
|
|
.n_monitors = 1,
|
2017-02-24 05:10:52 -05:00
|
|
|
.layout = { .x = 640, .y = 0, .width = 1024, .height = 768 },
|
2016-12-07 04:42:30 -05:00
|
|
|
.scale = 1
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_logical_monitors = 2,
|
2017-01-16 00:09:21 -05:00
|
|
|
.primary_logical_monitor = 0,
|
2016-12-07 04:42:30 -05:00
|
|
|
.n_outputs = 2,
|
2017-01-18 05:01:47 -05:00
|
|
|
.crtcs = {
|
|
|
|
{
|
|
|
|
.current_mode = 0,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.current_mode = 1,
|
|
|
|
}
|
|
|
|
},
|
2016-12-07 04:42:30 -05:00
|
|
|
.n_crtcs = 2,
|
2017-02-24 05:10:52 -05:00
|
|
|
.screen_width = 640 + 1024,
|
2016-12-07 04:42:30 -05:00
|
|
|
.screen_height = 768
|
|
|
|
}
|
|
|
|
};
|
|
|
|
MetaMonitorTestSetup *test_setup;
|
|
|
|
|
2017-02-24 05:10:52 -05:00
|
|
|
if (!is_using_monitor_config_manager ())
|
|
|
|
{
|
|
|
|
g_test_skip ("Not using MetaMonitorConfigManager");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-03-21 05:16:04 -04:00
|
|
|
if (!meta_is_stage_views_enabled ())
|
|
|
|
{
|
|
|
|
g_test_skip ("Not using stage views");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-01-12 23:32:12 -05:00
|
|
|
test_setup = create_monitor_test_setup (&test_case,
|
|
|
|
MONITOR_TEST_FLAG_NO_STORED);
|
2016-12-07 04:42:30 -05:00
|
|
|
emulate_hotplug (test_setup);
|
|
|
|
check_monitor_configuration (&test_case);
|
|
|
|
}
|
|
|
|
|
2016-12-20 10:15:45 -05:00
|
|
|
static void
|
|
|
|
meta_test_monitor_suggested_config (void)
|
|
|
|
{
|
|
|
|
MonitorTestCase test_case = {
|
|
|
|
.setup = {
|
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 800,
|
|
|
|
.height = 600,
|
|
|
|
.refresh_rate = 60.0
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.width = 1024,
|
|
|
|
.height = 768,
|
|
|
|
.refresh_rate = 60.0
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_modes = 2,
|
|
|
|
.outputs = {
|
|
|
|
{
|
|
|
|
.crtc = 0,
|
|
|
|
.modes = { 0 },
|
|
|
|
.n_modes = 1,
|
|
|
|
.preferred_mode = 0,
|
|
|
|
.possible_crtcs = { 0 },
|
|
|
|
.n_possible_crtcs = 1,
|
|
|
|
.width_mm = 222,
|
|
|
|
.height_mm = 125
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.crtc = 1,
|
|
|
|
.modes = { 1 },
|
|
|
|
.n_modes = 1,
|
|
|
|
.preferred_mode = 1,
|
|
|
|
.possible_crtcs = { 1 },
|
|
|
|
.n_possible_crtcs = 1,
|
|
|
|
.width_mm = 220,
|
|
|
|
.height_mm = 124
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_outputs = 2,
|
|
|
|
.crtcs = {
|
|
|
|
{
|
|
|
|
.current_mode = -1
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.current_mode = -1
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_crtcs = 2
|
|
|
|
},
|
|
|
|
|
|
|
|
.expect = {
|
|
|
|
.monitors = {
|
|
|
|
{
|
|
|
|
.outputs = { 0 },
|
|
|
|
.n_outputs = 1,
|
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 800,
|
|
|
|
.height = 600,
|
2017-06-14 02:08:43 -04:00
|
|
|
.refresh_rate = 60.0,
|
2016-12-20 10:15:45 -05:00
|
|
|
.crtc_modes = {
|
|
|
|
{
|
|
|
|
.output = 0,
|
|
|
|
.crtc_mode = 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_modes = 1,
|
2017-01-05 23:43:22 -05:00
|
|
|
.current_mode = 0,
|
2016-12-20 10:15:45 -05:00
|
|
|
.width_mm = 222,
|
|
|
|
.height_mm = 125
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.outputs = { 1 },
|
|
|
|
.n_outputs = 1,
|
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 1024,
|
|
|
|
.height = 768,
|
2017-06-14 02:08:43 -04:00
|
|
|
.refresh_rate = 60.0,
|
2016-12-20 10:15:45 -05:00
|
|
|
.crtc_modes = {
|
|
|
|
{
|
|
|
|
.output = 1,
|
|
|
|
.crtc_mode = 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_modes = 1,
|
2017-01-05 23:43:22 -05:00
|
|
|
.current_mode = 0,
|
2016-12-20 10:15:45 -05:00
|
|
|
.width_mm = 220,
|
|
|
|
.height_mm = 124
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_monitors = 2,
|
|
|
|
/*
|
|
|
|
* Logical monitors expectations altered to correspond to the
|
|
|
|
* "suggested_x/y" changed further below.
|
|
|
|
*/
|
|
|
|
.logical_monitors = {
|
|
|
|
{
|
2017-01-19 01:09:55 -05:00
|
|
|
.monitors = { 0 },
|
|
|
|
.n_monitors = 1,
|
2016-12-20 10:15:45 -05:00
|
|
|
.layout = { .x = 1024, .y = 758, .width = 800, .height = 600 },
|
|
|
|
.scale = 1
|
|
|
|
},
|
|
|
|
{
|
2017-01-19 01:09:55 -05:00
|
|
|
.monitors = { 1 },
|
|
|
|
.n_monitors = 1,
|
2016-12-20 10:15:45 -05:00
|
|
|
.layout = { .x = 0, .y = 0, .width = 1024, .height = 768 },
|
|
|
|
.scale = 1
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_logical_monitors = 2,
|
2017-01-16 00:09:21 -05:00
|
|
|
.primary_logical_monitor = 1,
|
2016-12-20 10:15:45 -05:00
|
|
|
.n_outputs = 2,
|
2017-01-18 05:01:47 -05:00
|
|
|
.crtcs = {
|
|
|
|
{
|
|
|
|
.current_mode = 0,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.current_mode = 1,
|
|
|
|
}
|
|
|
|
},
|
2016-12-20 10:15:45 -05:00
|
|
|
.n_crtcs = 2,
|
|
|
|
.n_tiled_monitors = 0,
|
|
|
|
.screen_width = 1024 + 800,
|
|
|
|
.screen_height = 1358
|
|
|
|
}
|
|
|
|
};
|
|
|
|
MetaMonitorTestSetup *test_setup;
|
|
|
|
|
2017-01-12 23:32:12 -05:00
|
|
|
test_setup = create_monitor_test_setup (&test_case,
|
|
|
|
MONITOR_TEST_FLAG_NO_STORED);
|
2016-12-20 10:15:45 -05:00
|
|
|
|
|
|
|
test_setup->outputs[0].suggested_x = 1024;
|
|
|
|
test_setup->outputs[0].suggested_y = 758;
|
|
|
|
test_setup->outputs[1].suggested_x = 0;
|
|
|
|
test_setup->outputs[1].suggested_y = 0;
|
|
|
|
|
|
|
|
emulate_hotplug (test_setup);
|
|
|
|
check_monitor_configuration (&test_case);
|
|
|
|
}
|
|
|
|
|
2017-01-09 04:10:58 -05:00
|
|
|
static void
|
|
|
|
meta_test_monitor_limited_crtcs (void)
|
|
|
|
{
|
|
|
|
MonitorTestCase test_case = {
|
|
|
|
.setup = {
|
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 1024,
|
|
|
|
.height = 768,
|
|
|
|
.refresh_rate = 60.0
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_modes = 1,
|
|
|
|
.outputs = {
|
|
|
|
{
|
|
|
|
.crtc = -1,
|
|
|
|
.modes = { 0 },
|
|
|
|
.n_modes = 1,
|
|
|
|
.preferred_mode = 0,
|
|
|
|
.possible_crtcs = { 0 },
|
|
|
|
.n_possible_crtcs = 1,
|
|
|
|
.width_mm = 222,
|
|
|
|
.height_mm = 125
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.crtc = -1,
|
|
|
|
.modes = { 0 },
|
|
|
|
.n_modes = 1,
|
|
|
|
.preferred_mode = 0,
|
|
|
|
.possible_crtcs = { 0 },
|
|
|
|
.n_possible_crtcs = 1,
|
|
|
|
.width_mm = 220,
|
|
|
|
.height_mm = 124
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_outputs = 2,
|
|
|
|
.crtcs = {
|
|
|
|
{
|
|
|
|
.current_mode = 0
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_crtcs = 1
|
|
|
|
},
|
|
|
|
|
|
|
|
.expect = {
|
|
|
|
.monitors = {
|
|
|
|
{
|
|
|
|
.outputs = { 0 },
|
|
|
|
.n_outputs = 1,
|
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 1024,
|
|
|
|
.height = 768,
|
2017-06-14 02:08:43 -04:00
|
|
|
.refresh_rate = 60.0,
|
2017-01-09 04:10:58 -05:00
|
|
|
.crtc_modes = {
|
|
|
|
{
|
|
|
|
.output = 0,
|
|
|
|
.crtc_mode = 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_modes = 1,
|
|
|
|
.current_mode = 0,
|
|
|
|
.width_mm = 222,
|
|
|
|
.height_mm = 125
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.outputs = { 1 },
|
|
|
|
.n_outputs = 1,
|
|
|
|
.modes = {
|
2017-06-14 00:23:53 -04:00
|
|
|
{
|
|
|
|
.width = 1024,
|
|
|
|
.height = 768,
|
2017-06-14 02:08:43 -04:00
|
|
|
.refresh_rate = 60.0,
|
2017-06-14 00:23:53 -04:00
|
|
|
.crtc_modes = {
|
2017-01-09 04:10:58 -05:00
|
|
|
{
|
2017-06-14 00:23:53 -04:00
|
|
|
.output = 1,
|
|
|
|
.crtc_mode = 0
|
2017-01-09 04:10:58 -05:00
|
|
|
}
|
2017-06-14 00:23:53 -04:00
|
|
|
}
|
|
|
|
}
|
2017-01-09 04:10:58 -05:00
|
|
|
},
|
|
|
|
.n_modes = 1,
|
|
|
|
.current_mode = -1,
|
|
|
|
.width_mm = 220,
|
|
|
|
.height_mm = 124
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_monitors = 2,
|
|
|
|
.logical_monitors = {
|
|
|
|
{
|
2017-01-19 01:09:55 -05:00
|
|
|
.monitors = { 0 },
|
|
|
|
.n_monitors = 1,
|
2017-01-09 04:10:58 -05:00
|
|
|
.layout = { .x = 0, .y = 0, .width = 1024, .height = 768 },
|
|
|
|
.scale = 1
|
|
|
|
},
|
|
|
|
},
|
|
|
|
.n_logical_monitors = 1,
|
2017-01-16 00:09:21 -05:00
|
|
|
.primary_logical_monitor = 0,
|
2017-01-09 04:10:58 -05:00
|
|
|
.n_outputs = 2,
|
2017-01-18 05:01:47 -05:00
|
|
|
.crtcs = {
|
|
|
|
{
|
|
|
|
.current_mode = 0,
|
|
|
|
}
|
|
|
|
},
|
2017-01-09 04:10:58 -05:00
|
|
|
.n_crtcs = 1,
|
|
|
|
.n_tiled_monitors = 0,
|
|
|
|
.screen_width = 1024,
|
|
|
|
.screen_height = 768
|
|
|
|
}
|
|
|
|
};
|
|
|
|
MetaMonitorTestSetup *test_setup;
|
|
|
|
|
2017-01-12 23:32:12 -05:00
|
|
|
test_setup = create_monitor_test_setup (&test_case,
|
|
|
|
MONITOR_TEST_FLAG_NO_STORED);
|
2017-01-09 04:10:58 -05:00
|
|
|
|
|
|
|
/*
|
|
|
|
* With the config manager, we'll get a g_warning.
|
|
|
|
* With the old it's just a meta_warning().
|
|
|
|
*/
|
2017-01-12 22:41:05 -05:00
|
|
|
if (is_using_monitor_config_manager ())
|
2017-01-09 04:10:58 -05:00
|
|
|
{
|
|
|
|
g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING,
|
|
|
|
"Failed to use linear *");
|
|
|
|
}
|
|
|
|
emulate_hotplug (test_setup);
|
|
|
|
g_test_assert_expected_messages ();
|
|
|
|
|
|
|
|
check_monitor_configuration (&test_case);
|
|
|
|
}
|
|
|
|
|
2017-01-09 22:50:44 -05:00
|
|
|
static void
|
|
|
|
meta_test_monitor_lid_switch_config (void)
|
|
|
|
{
|
|
|
|
MonitorTestCase test_case = {
|
|
|
|
.setup = {
|
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 1024,
|
|
|
|
.height = 768,
|
|
|
|
.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,
|
|
|
|
.is_laptop_panel = TRUE
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.crtc = 1,
|
|
|
|
.modes = { 0 },
|
|
|
|
.n_modes = 1,
|
|
|
|
.preferred_mode = 0,
|
|
|
|
.possible_crtcs = { 1 },
|
|
|
|
.n_possible_crtcs = 1,
|
|
|
|
.width_mm = 220,
|
|
|
|
.height_mm = 124
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_outputs = 2,
|
|
|
|
.crtcs = {
|
|
|
|
{
|
|
|
|
.current_mode = 0
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.current_mode = 0
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_crtcs = 2
|
|
|
|
},
|
|
|
|
|
|
|
|
.expect = {
|
|
|
|
.monitors = {
|
|
|
|
{
|
|
|
|
.outputs = { 0 },
|
|
|
|
.n_outputs = 1,
|
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 1024,
|
|
|
|
.height = 768,
|
2017-06-14 02:08:43 -04:00
|
|
|
.refresh_rate = 60.0,
|
2017-01-09 22:50:44 -05:00
|
|
|
.crtc_modes = {
|
|
|
|
{
|
|
|
|
.output = 0,
|
|
|
|
.crtc_mode = 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_modes = 1,
|
|
|
|
.current_mode = 0,
|
|
|
|
.width_mm = 222,
|
|
|
|
.height_mm = 125
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.outputs = { 1 },
|
|
|
|
.n_outputs = 1,
|
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 1024,
|
|
|
|
.height = 768,
|
2017-06-14 02:08:43 -04:00
|
|
|
.refresh_rate = 60.0,
|
2017-01-09 22:50:44 -05:00
|
|
|
.crtc_modes = {
|
|
|
|
{
|
|
|
|
.output = 1,
|
|
|
|
.crtc_mode = 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_modes = 1,
|
|
|
|
.current_mode = 0,
|
|
|
|
.width_mm = 220,
|
|
|
|
.height_mm = 124
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_monitors = 2,
|
|
|
|
.logical_monitors = {
|
|
|
|
{
|
2017-01-19 01:09:55 -05:00
|
|
|
.monitors = { 0 },
|
|
|
|
.n_monitors = 1,
|
2017-01-09 22:50:44 -05:00
|
|
|
.layout = { .x = 0, .y = 0, .width = 1024, .height = 768 },
|
|
|
|
.scale = 1
|
|
|
|
},
|
|
|
|
{
|
2017-01-19 01:09:55 -05:00
|
|
|
.monitors = { 1 },
|
|
|
|
.n_monitors = 1,
|
2017-01-09 22:50:44 -05:00
|
|
|
.layout = { .x = 1024, .y = 0, .width = 1024, .height = 768 },
|
|
|
|
.scale = 1
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_logical_monitors = 2,
|
2017-01-16 00:09:21 -05:00
|
|
|
.primary_logical_monitor = 0,
|
2017-01-09 22:50:44 -05:00
|
|
|
.n_outputs = 2,
|
2017-01-18 05:01:47 -05:00
|
|
|
.crtcs = {
|
|
|
|
{
|
|
|
|
.current_mode = 0,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.current_mode = 0,
|
|
|
|
}
|
|
|
|
},
|
2017-01-09 22:50:44 -05:00
|
|
|
.n_crtcs = 2,
|
|
|
|
.n_tiled_monitors = 0,
|
|
|
|
.screen_width = 1024 * 2,
|
|
|
|
.screen_height = 768
|
|
|
|
}
|
|
|
|
};
|
|
|
|
MetaMonitorTestSetup *test_setup;
|
|
|
|
MetaBackend *backend = meta_get_backend ();
|
|
|
|
MetaMonitorManager *monitor_manager =
|
|
|
|
meta_backend_get_monitor_manager (backend);
|
|
|
|
MetaMonitorManagerTest *monitor_manager_test =
|
|
|
|
META_MONITOR_MANAGER_TEST (monitor_manager);
|
|
|
|
|
2017-01-12 23:32:12 -05:00
|
|
|
test_setup = create_monitor_test_setup (&test_case,
|
|
|
|
MONITOR_TEST_FLAG_NO_STORED);
|
2017-01-09 22:50:44 -05:00
|
|
|
emulate_hotplug (test_setup);
|
|
|
|
check_monitor_configuration (&test_case);
|
|
|
|
|
|
|
|
meta_monitor_manager_test_set_is_lid_closed (monitor_manager_test, TRUE);
|
|
|
|
meta_monitor_manager_lid_is_closed_changed (monitor_manager);
|
|
|
|
|
2017-01-19 01:09:55 -05:00
|
|
|
test_case.expect.logical_monitors[0] = (MonitorTestCaseLogicalMonitor) {
|
|
|
|
.monitors = { 1 },
|
|
|
|
.n_monitors = 1,
|
|
|
|
.layout = {.x = 0, .y = 0, .width = 1024, .height = 768 },
|
|
|
|
.scale = 1
|
|
|
|
};
|
2017-01-09 22:50:44 -05:00
|
|
|
test_case.expect.n_logical_monitors = 1;
|
|
|
|
test_case.expect.screen_width = 1024;
|
|
|
|
test_case.expect.monitors[0].current_mode = -1;
|
2017-01-18 05:01:47 -05:00
|
|
|
test_case.expect.crtcs[0].current_mode = -1;
|
2017-01-09 22:50:44 -05:00
|
|
|
|
|
|
|
check_monitor_configuration (&test_case);
|
|
|
|
|
|
|
|
meta_monitor_manager_test_set_is_lid_closed (monitor_manager_test, FALSE);
|
|
|
|
meta_monitor_manager_lid_is_closed_changed (monitor_manager);
|
|
|
|
|
|
|
|
test_case.expect.n_logical_monitors = 2;
|
|
|
|
test_case.expect.screen_width = 1024 * 2;
|
|
|
|
test_case.expect.monitors[0].current_mode = 0;
|
|
|
|
|
2017-01-18 05:01:47 -05:00
|
|
|
test_case.expect.crtcs[0].current_mode = 0;
|
|
|
|
test_case.expect.crtcs[1].current_mode = 0;
|
|
|
|
|
2017-01-19 01:09:55 -05:00
|
|
|
if (!is_using_monitor_config_manager ())
|
|
|
|
{
|
|
|
|
test_case.expect.logical_monitors[0] = (MonitorTestCaseLogicalMonitor) {
|
|
|
|
.monitors = { 0 },
|
|
|
|
.n_monitors = 1,
|
|
|
|
.layout = {.x = 0, .y = 0, .width = 1024, .height = 768 },
|
|
|
|
.scale = 1
|
|
|
|
};
|
|
|
|
test_case.expect.logical_monitors[1] = (MonitorTestCaseLogicalMonitor) {
|
|
|
|
.monitors = { 1 },
|
|
|
|
.n_monitors = 1,
|
|
|
|
.layout = {.x = 1024, .y = 0, .width = 1024, .height = 768 },
|
|
|
|
.scale = 1
|
|
|
|
};
|
|
|
|
test_case.expect.n_logical_monitors = 2;
|
|
|
|
test_case.expect.primary_logical_monitor = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* FIXME: The above expectation is correct, but MetaMonitorConfigManager
|
|
|
|
* doesn't support restoring previous configurations yet, so it'll
|
|
|
|
* pick keep the external monitor as primary and put it first.
|
|
|
|
*/
|
|
|
|
test_case.expect.logical_monitors[0] = (MonitorTestCaseLogicalMonitor) {
|
|
|
|
.monitors = { 1 },
|
|
|
|
.n_monitors = 1,
|
|
|
|
.layout = {.x = 0, .y = 0, .width = 1024, .height = 768 },
|
|
|
|
.scale = 1
|
|
|
|
};
|
|
|
|
test_case.expect.logical_monitors[1] = (MonitorTestCaseLogicalMonitor) {
|
|
|
|
.monitors = { 0 },
|
|
|
|
.n_monitors = 1,
|
|
|
|
.layout = {.x = 1024, .y = 0, .width = 1024, .height = 768 },
|
|
|
|
.scale = 1
|
|
|
|
};
|
|
|
|
test_case.expect.n_logical_monitors = 2;
|
|
|
|
test_case.expect.primary_logical_monitor = 0;
|
|
|
|
}
|
|
|
|
|
2017-01-09 22:50:44 -05:00
|
|
|
check_monitor_configuration (&test_case);
|
|
|
|
}
|
|
|
|
|
2017-01-10 00:18:46 -05:00
|
|
|
static void
|
|
|
|
meta_test_monitor_lid_opened_config (void)
|
|
|
|
{
|
|
|
|
MonitorTestCase test_case = {
|
|
|
|
.setup = {
|
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 1024,
|
|
|
|
.height = 768,
|
|
|
|
.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,
|
|
|
|
.is_laptop_panel = TRUE
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.crtc = 1,
|
|
|
|
.modes = { 0 },
|
|
|
|
.n_modes = 1,
|
|
|
|
.preferred_mode = 0,
|
|
|
|
.possible_crtcs = { 1 },
|
|
|
|
.n_possible_crtcs = 1,
|
|
|
|
.width_mm = 220,
|
|
|
|
.height_mm = 124
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_outputs = 2,
|
|
|
|
.crtcs = {
|
|
|
|
{
|
|
|
|
.current_mode = 0
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.current_mode = 0
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_crtcs = 2
|
|
|
|
},
|
|
|
|
|
|
|
|
.expect = {
|
|
|
|
.monitors = {
|
|
|
|
{
|
|
|
|
.outputs = { 0 },
|
|
|
|
.n_outputs = 1,
|
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 1024,
|
|
|
|
.height = 768,
|
2017-06-14 02:08:43 -04:00
|
|
|
.refresh_rate = 60.0,
|
2017-01-10 00:18:46 -05:00
|
|
|
.crtc_modes = {
|
|
|
|
{
|
|
|
|
.output = 0,
|
|
|
|
.crtc_mode = 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_modes = 1,
|
|
|
|
.current_mode = -1,
|
|
|
|
.width_mm = 222,
|
|
|
|
.height_mm = 125
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.outputs = { 1 },
|
|
|
|
.n_outputs = 1,
|
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 1024,
|
|
|
|
.height = 768,
|
2017-06-14 02:08:43 -04:00
|
|
|
.refresh_rate = 60.0,
|
2017-01-10 00:18:46 -05:00
|
|
|
.crtc_modes = {
|
|
|
|
{
|
|
|
|
.output = 1,
|
|
|
|
.crtc_mode = 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_modes = 1,
|
|
|
|
.current_mode = 0,
|
|
|
|
.width_mm = 220,
|
|
|
|
.height_mm = 124
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_monitors = 2,
|
|
|
|
.logical_monitors = {
|
|
|
|
{
|
2017-01-19 01:09:55 -05:00
|
|
|
.monitors = { 1 },
|
|
|
|
.n_monitors = 1,
|
2017-01-10 00:18:46 -05:00
|
|
|
.layout = { .x = 0, .y = 0, .width = 1024, .height = 768 },
|
|
|
|
.scale = 1
|
|
|
|
},
|
|
|
|
{
|
2017-01-19 01:09:55 -05:00
|
|
|
.monitors = { 0 },
|
|
|
|
.n_monitors = 1,
|
2017-01-10 00:18:46 -05:00
|
|
|
.layout = { .x = 1024, .y = 0, .width = 1024, .height = 768 },
|
|
|
|
.scale = 1
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_logical_monitors = 1, /* Second one checked after lid opened. */
|
2017-01-16 00:09:21 -05:00
|
|
|
.primary_logical_monitor = 0,
|
2017-01-10 00:18:46 -05:00
|
|
|
.n_outputs = 2,
|
2017-01-18 05:01:47 -05:00
|
|
|
.crtcs = {
|
|
|
|
{
|
|
|
|
.current_mode = -1,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.current_mode = 0,
|
|
|
|
}
|
|
|
|
},
|
2017-01-10 00:18:46 -05:00
|
|
|
.n_crtcs = 2,
|
|
|
|
.n_tiled_monitors = 0,
|
|
|
|
.screen_width = 1024,
|
|
|
|
.screen_height = 768
|
|
|
|
}
|
|
|
|
};
|
|
|
|
MetaMonitorTestSetup *test_setup;
|
|
|
|
MetaBackend *backend = meta_get_backend ();
|
|
|
|
MetaMonitorManager *monitor_manager =
|
|
|
|
meta_backend_get_monitor_manager (backend);
|
|
|
|
MetaMonitorManagerTest *monitor_manager_test =
|
|
|
|
META_MONITOR_MANAGER_TEST (monitor_manager);
|
|
|
|
|
2017-01-12 22:41:05 -05:00
|
|
|
if (!is_using_monitor_config_manager ())
|
2017-01-10 00:18:46 -05:00
|
|
|
{
|
|
|
|
g_test_skip ("Only the new monitor config manager handles this case.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-01-12 23:32:12 -05:00
|
|
|
test_setup = create_monitor_test_setup (&test_case,
|
|
|
|
MONITOR_TEST_FLAG_NO_STORED);
|
2017-01-10 00:18:46 -05:00
|
|
|
meta_monitor_manager_test_set_is_lid_closed (monitor_manager_test, TRUE);
|
|
|
|
|
|
|
|
emulate_hotplug (test_setup);
|
|
|
|
check_monitor_configuration (&test_case);
|
|
|
|
|
|
|
|
meta_monitor_manager_test_set_is_lid_closed (monitor_manager_test, FALSE);
|
|
|
|
meta_monitor_manager_lid_is_closed_changed (monitor_manager);
|
|
|
|
|
|
|
|
test_case.expect.n_logical_monitors = 2;
|
|
|
|
test_case.expect.screen_width = 1024 * 2;
|
|
|
|
test_case.expect.monitors[0].current_mode = 0;
|
2017-01-18 05:01:47 -05:00
|
|
|
test_case.expect.crtcs[0].current_mode = 0;
|
|
|
|
test_case.expect.crtcs[1].current_mode = 0;
|
2017-01-10 00:18:46 -05:00
|
|
|
|
|
|
|
check_monitor_configuration (&test_case);
|
|
|
|
}
|
|
|
|
|
2017-01-12 00:42:42 -05:00
|
|
|
static void
|
|
|
|
meta_test_monitor_lid_closed_no_external (void)
|
|
|
|
{
|
|
|
|
MonitorTestCase test_case = {
|
|
|
|
.setup = {
|
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 1024,
|
|
|
|
.height = 768,
|
|
|
|
.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,
|
|
|
|
.is_laptop_panel = TRUE
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_outputs = 1,
|
|
|
|
.crtcs = {
|
|
|
|
{
|
|
|
|
.current_mode = 0
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_crtcs = 1
|
|
|
|
},
|
|
|
|
|
|
|
|
.expect = {
|
|
|
|
.monitors = {
|
|
|
|
{
|
|
|
|
.outputs = { 0 },
|
|
|
|
.n_outputs = 1,
|
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 1024,
|
|
|
|
.height = 768,
|
2017-06-14 02:08:43 -04:00
|
|
|
.refresh_rate = 60.0,
|
2017-01-12 00:42:42 -05:00
|
|
|
.crtc_modes = {
|
|
|
|
{
|
|
|
|
.output = 0,
|
|
|
|
.crtc_mode = 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_modes = 1,
|
|
|
|
.current_mode = 0,
|
|
|
|
.width_mm = 222,
|
|
|
|
.height_mm = 125
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_monitors = 1,
|
|
|
|
.logical_monitors = {
|
|
|
|
{
|
2017-01-19 01:09:55 -05:00
|
|
|
.monitors = { 0 },
|
|
|
|
.n_monitors = 1,
|
2017-01-12 00:42:42 -05:00
|
|
|
.layout = { .x = 0, .y = 0, .width = 1024, .height = 768 },
|
|
|
|
.scale = 1
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_logical_monitors = 1,
|
2017-01-16 00:09:21 -05:00
|
|
|
.primary_logical_monitor = 0,
|
2017-01-12 00:42:42 -05:00
|
|
|
.n_outputs = 1,
|
2017-01-18 05:01:47 -05:00
|
|
|
.crtcs = {
|
|
|
|
{
|
|
|
|
.current_mode = 0,
|
|
|
|
},
|
|
|
|
},
|
2017-01-12 00:42:42 -05:00
|
|
|
.n_crtcs = 1,
|
|
|
|
.n_tiled_monitors = 0,
|
|
|
|
.screen_width = 1024,
|
|
|
|
.screen_height = 768
|
|
|
|
}
|
|
|
|
};
|
|
|
|
MetaMonitorTestSetup *test_setup;
|
|
|
|
MetaBackend *backend = meta_get_backend ();
|
|
|
|
MetaMonitorManager *monitor_manager =
|
|
|
|
meta_backend_get_monitor_manager (backend);
|
|
|
|
MetaMonitorManagerTest *monitor_manager_test =
|
|
|
|
META_MONITOR_MANAGER_TEST (monitor_manager);
|
|
|
|
|
2017-01-12 23:32:12 -05:00
|
|
|
test_setup = create_monitor_test_setup (&test_case,
|
|
|
|
MONITOR_TEST_FLAG_NO_STORED);
|
2017-01-12 00:42:42 -05:00
|
|
|
meta_monitor_manager_test_set_is_lid_closed (monitor_manager_test, TRUE);
|
|
|
|
|
|
|
|
emulate_hotplug (test_setup);
|
|
|
|
check_monitor_configuration (&test_case);
|
|
|
|
}
|
|
|
|
|
2017-01-12 00:51:43 -05:00
|
|
|
static void
|
|
|
|
meta_test_monitor_no_outputs (void)
|
|
|
|
{
|
|
|
|
MonitorTestCase test_case = {
|
|
|
|
.setup = {
|
|
|
|
.n_modes = 0,
|
|
|
|
.n_outputs = 0,
|
|
|
|
.n_crtcs = 0
|
|
|
|
},
|
|
|
|
|
|
|
|
.expect = {
|
|
|
|
.n_monitors = 0,
|
|
|
|
.n_logical_monitors = 0,
|
2017-01-16 00:09:21 -05:00
|
|
|
.primary_logical_monitor = -1,
|
2017-01-12 00:51:43 -05:00
|
|
|
.n_outputs = 0,
|
|
|
|
.n_crtcs = 0,
|
|
|
|
.n_tiled_monitors = 0,
|
2017-01-20 01:50:11 -05:00
|
|
|
/* The screen is made 1x1, as clutter stage used cannot be empty. */
|
|
|
|
.screen_width = 1,
|
|
|
|
.screen_height = 1
|
2017-01-12 00:51:43 -05:00
|
|
|
}
|
|
|
|
};
|
|
|
|
MetaMonitorTestSetup *test_setup;
|
|
|
|
|
2017-01-12 22:41:05 -05:00
|
|
|
if (!is_using_monitor_config_manager ())
|
2017-01-12 00:51:43 -05:00
|
|
|
{
|
|
|
|
g_test_skip ("Only the new monitor config manager handles this case.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-01-12 23:32:12 -05:00
|
|
|
test_setup = create_monitor_test_setup (&test_case,
|
|
|
|
MONITOR_TEST_FLAG_NO_STORED);
|
2017-01-12 00:51:43 -05:00
|
|
|
|
|
|
|
emulate_hotplug (test_setup);
|
|
|
|
check_monitor_configuration (&test_case);
|
|
|
|
}
|
|
|
|
|
2017-01-16 22:34:23 -05:00
|
|
|
static void
|
|
|
|
meta_test_monitor_underscanning_config (void)
|
|
|
|
{
|
|
|
|
MonitorTestCase test_case = {
|
|
|
|
.setup = {
|
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 1024,
|
|
|
|
.height = 768,
|
|
|
|
.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,
|
|
|
|
.is_underscanning = TRUE,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_outputs = 1,
|
|
|
|
.crtcs = {
|
|
|
|
{
|
|
|
|
.current_mode = 0
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_crtcs = 1
|
|
|
|
},
|
|
|
|
|
|
|
|
.expect = {
|
|
|
|
.monitors = {
|
|
|
|
{
|
|
|
|
.outputs = { 0 },
|
|
|
|
.n_outputs = 1,
|
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 1024,
|
|
|
|
.height = 768,
|
2017-06-14 02:08:43 -04:00
|
|
|
.refresh_rate = 60.0,
|
2017-01-16 22:34:23 -05:00
|
|
|
.crtc_modes = {
|
|
|
|
{
|
|
|
|
.output = 0,
|
|
|
|
.crtc_mode = 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_modes = 1,
|
|
|
|
.current_mode = 0,
|
|
|
|
.width_mm = 222,
|
|
|
|
.height_mm = 125,
|
|
|
|
.is_underscanning = TRUE,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_monitors = 1,
|
|
|
|
.logical_monitors = {
|
|
|
|
{
|
2017-01-19 01:09:55 -05:00
|
|
|
.monitors = { 0 },
|
|
|
|
.n_monitors = 1,
|
2017-01-16 22:34:23 -05:00
|
|
|
.layout = { .x = 0, .y = 0, .width = 1024, .height = 768 },
|
|
|
|
.scale = 1
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_logical_monitors = 1,
|
|
|
|
.primary_logical_monitor = 0,
|
|
|
|
.n_outputs = 1,
|
2017-01-18 05:01:47 -05:00
|
|
|
.crtcs = {
|
|
|
|
{
|
|
|
|
.current_mode = 0,
|
|
|
|
}
|
|
|
|
},
|
2017-01-16 22:34:23 -05:00
|
|
|
.n_crtcs = 1,
|
|
|
|
.screen_width = 1024,
|
|
|
|
.screen_height = 768
|
|
|
|
}
|
|
|
|
};
|
|
|
|
MetaMonitorTestSetup *test_setup;
|
|
|
|
|
|
|
|
test_setup = create_monitor_test_setup (&test_case,
|
|
|
|
MONITOR_TEST_FLAG_NO_STORED);
|
|
|
|
emulate_hotplug (test_setup);
|
|
|
|
check_monitor_configuration (&test_case);
|
|
|
|
}
|
|
|
|
|
2017-01-13 01:42:03 -05:00
|
|
|
static void
|
|
|
|
meta_test_monitor_custom_vertical_config (void)
|
|
|
|
{
|
|
|
|
MonitorTestCase test_case = {
|
|
|
|
.setup = {
|
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 1024,
|
|
|
|
.height = 768,
|
|
|
|
.refresh_rate = 60.000495910644531
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.width = 800,
|
|
|
|
.height = 600,
|
|
|
|
.refresh_rate = 60.000495910644531
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_modes = 2,
|
|
|
|
.outputs = {
|
|
|
|
{
|
|
|
|
.crtc = 0,
|
|
|
|
.modes = { 0 },
|
|
|
|
.n_modes = 1,
|
|
|
|
.preferred_mode = 0,
|
|
|
|
.possible_crtcs = { 0 },
|
|
|
|
.n_possible_crtcs = 1,
|
|
|
|
.width_mm = 222,
|
|
|
|
.height_mm = 125
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.crtc = 1,
|
|
|
|
.modes = { 1 },
|
|
|
|
.n_modes = 1,
|
|
|
|
.preferred_mode = 1,
|
|
|
|
.possible_crtcs = { 1 },
|
|
|
|
.n_possible_crtcs = 1,
|
|
|
|
.width_mm = 220,
|
|
|
|
.height_mm = 124
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_outputs = 2,
|
|
|
|
.crtcs = {
|
|
|
|
{
|
|
|
|
.current_mode = 0
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.current_mode = 0
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_crtcs = 2
|
|
|
|
},
|
|
|
|
|
|
|
|
.expect = {
|
|
|
|
.monitors = {
|
|
|
|
{
|
|
|
|
.outputs = { 0 },
|
|
|
|
.n_outputs = 1,
|
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 1024,
|
|
|
|
.height = 768,
|
2017-06-14 02:08:43 -04:00
|
|
|
.refresh_rate = 60.000495910644531,
|
2017-01-13 01:42:03 -05:00
|
|
|
.crtc_modes = {
|
|
|
|
{
|
|
|
|
.output = 0,
|
|
|
|
.crtc_mode = 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_modes = 1,
|
|
|
|
.current_mode = 0,
|
|
|
|
.width_mm = 222,
|
|
|
|
.height_mm = 125
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.outputs = { 1 },
|
|
|
|
.n_outputs = 1,
|
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 800,
|
|
|
|
.height = 600,
|
2017-06-14 02:08:43 -04:00
|
|
|
.refresh_rate = 60.000495910644531,
|
2017-01-13 01:42:03 -05:00
|
|
|
.crtc_modes = {
|
|
|
|
{
|
|
|
|
.output = 1,
|
|
|
|
.crtc_mode = 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_modes = 1,
|
|
|
|
.current_mode = 0,
|
|
|
|
.width_mm = 220,
|
|
|
|
.height_mm = 124
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_monitors = 2,
|
|
|
|
.logical_monitors = {
|
|
|
|
{
|
2017-01-19 01:09:55 -05:00
|
|
|
.monitors = { 0 },
|
|
|
|
.n_monitors = 1,
|
2017-01-13 01:42:03 -05:00
|
|
|
.layout = { .x = 0, .y = 0, .width = 1024, .height = 768 },
|
|
|
|
.scale = 1
|
|
|
|
},
|
|
|
|
{
|
2017-01-19 01:09:55 -05:00
|
|
|
.monitors = { 1 },
|
|
|
|
.n_monitors = 1,
|
2017-01-13 01:42:03 -05:00
|
|
|
.layout = { .x = 0, .y = 768, .width = 800, .height = 600 },
|
|
|
|
.scale = 1
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_logical_monitors = 2,
|
2017-01-16 00:09:21 -05:00
|
|
|
.primary_logical_monitor = 0,
|
2017-01-13 01:42:03 -05:00
|
|
|
.n_outputs = 2,
|
2017-01-18 05:01:47 -05:00
|
|
|
.crtcs = {
|
|
|
|
{
|
|
|
|
.current_mode = 0,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.current_mode = 1,
|
|
|
|
}
|
|
|
|
},
|
2017-01-13 01:42:03 -05:00
|
|
|
.n_crtcs = 2,
|
|
|
|
.n_tiled_monitors = 0,
|
|
|
|
.screen_width = 1024,
|
|
|
|
.screen_height = 768 + 600
|
|
|
|
}
|
|
|
|
};
|
|
|
|
MetaMonitorTestSetup *test_setup;
|
|
|
|
|
|
|
|
if (!is_using_monitor_config_manager ())
|
|
|
|
{
|
|
|
|
g_test_skip ("Not using MetaMonitorConfigManager");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
test_setup = create_monitor_test_setup (&test_case,
|
|
|
|
MONITOR_TEST_FLAG_NONE);
|
|
|
|
set_custom_monitor_config ("vertical.xml");
|
|
|
|
emulate_hotplug (test_setup);
|
|
|
|
|
|
|
|
check_monitor_configuration (&test_case);
|
|
|
|
}
|
|
|
|
|
2017-01-16 00:13:35 -05:00
|
|
|
static void
|
|
|
|
meta_test_monitor_custom_primary_config (void)
|
|
|
|
{
|
|
|
|
MonitorTestCase test_case = {
|
|
|
|
.setup = {
|
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 1024,
|
|
|
|
.height = 768,
|
|
|
|
.refresh_rate = 60.000495910644531
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.width = 800,
|
|
|
|
.height = 600,
|
|
|
|
.refresh_rate = 60.000495910644531
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_modes = 2,
|
|
|
|
.outputs = {
|
|
|
|
{
|
|
|
|
.crtc = 0,
|
|
|
|
.modes = { 0 },
|
|
|
|
.n_modes = 1,
|
|
|
|
.preferred_mode = 0,
|
|
|
|
.possible_crtcs = { 0 },
|
|
|
|
.n_possible_crtcs = 1,
|
|
|
|
.width_mm = 222,
|
|
|
|
.height_mm = 125
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.crtc = 1,
|
|
|
|
.modes = { 1 },
|
|
|
|
.n_modes = 1,
|
|
|
|
.preferred_mode = 1,
|
|
|
|
.possible_crtcs = { 1 },
|
|
|
|
.n_possible_crtcs = 1,
|
|
|
|
.width_mm = 220,
|
|
|
|
.height_mm = 124
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_outputs = 2,
|
|
|
|
.crtcs = {
|
|
|
|
{
|
|
|
|
.current_mode = 0
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.current_mode = 0
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_crtcs = 2
|
|
|
|
},
|
|
|
|
|
|
|
|
.expect = {
|
|
|
|
.monitors = {
|
|
|
|
{
|
|
|
|
.outputs = { 0 },
|
|
|
|
.n_outputs = 1,
|
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 1024,
|
|
|
|
.height = 768,
|
2017-06-14 02:08:43 -04:00
|
|
|
.refresh_rate = 60.000495910644531,
|
2017-01-16 00:13:35 -05:00
|
|
|
.crtc_modes = {
|
|
|
|
{
|
|
|
|
.output = 0,
|
|
|
|
.crtc_mode = 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_modes = 1,
|
|
|
|
.current_mode = 0,
|
|
|
|
.width_mm = 222,
|
|
|
|
.height_mm = 125
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.outputs = { 1 },
|
|
|
|
.n_outputs = 1,
|
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 800,
|
|
|
|
.height = 600,
|
2017-06-14 02:08:43 -04:00
|
|
|
.refresh_rate = 60.000495910644531,
|
2017-01-16 00:13:35 -05:00
|
|
|
.crtc_modes = {
|
|
|
|
{
|
|
|
|
.output = 1,
|
|
|
|
.crtc_mode = 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_modes = 1,
|
|
|
|
.current_mode = 0,
|
|
|
|
.width_mm = 220,
|
|
|
|
.height_mm = 124
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_monitors = 2,
|
|
|
|
.logical_monitors = {
|
|
|
|
{
|
2017-01-19 01:09:55 -05:00
|
|
|
.monitors = { 0 },
|
|
|
|
.n_monitors = 1,
|
2017-01-16 00:13:35 -05:00
|
|
|
.layout = { .x = 0, .y = 0, .width = 1024, .height = 768 },
|
|
|
|
.scale = 1
|
|
|
|
},
|
|
|
|
{
|
2017-01-19 01:09:55 -05:00
|
|
|
.monitors = { 1 },
|
|
|
|
.n_monitors = 1,
|
2017-01-16 00:13:35 -05:00
|
|
|
.layout = { .x = 1024, .y = 0, .width = 800, .height = 600 },
|
|
|
|
.scale = 1
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_logical_monitors = 2,
|
|
|
|
.primary_logical_monitor = 1,
|
|
|
|
.n_outputs = 2,
|
2017-01-18 05:01:47 -05:00
|
|
|
.crtcs = {
|
|
|
|
{
|
|
|
|
.current_mode = 0,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.current_mode = 1,
|
|
|
|
}
|
|
|
|
},
|
2017-01-16 00:13:35 -05:00
|
|
|
.n_crtcs = 2,
|
|
|
|
.n_tiled_monitors = 0,
|
|
|
|
.screen_width = 1024 + 800,
|
|
|
|
.screen_height = 768
|
|
|
|
}
|
|
|
|
};
|
|
|
|
MetaMonitorTestSetup *test_setup;
|
|
|
|
|
|
|
|
if (!is_using_monitor_config_manager ())
|
|
|
|
{
|
|
|
|
g_test_skip ("Not using MetaMonitorConfigManager");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
test_setup = create_monitor_test_setup (&test_case,
|
|
|
|
MONITOR_TEST_FLAG_NONE);
|
|
|
|
set_custom_monitor_config ("primary.xml");
|
|
|
|
emulate_hotplug (test_setup);
|
|
|
|
|
|
|
|
check_monitor_configuration (&test_case);
|
|
|
|
}
|
|
|
|
|
2017-01-16 22:34:23 -05:00
|
|
|
static void
|
|
|
|
meta_test_monitor_custom_underscanning_config (void)
|
|
|
|
{
|
|
|
|
MonitorTestCase test_case = {
|
|
|
|
.setup = {
|
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 1024,
|
|
|
|
.height = 768,
|
|
|
|
.refresh_rate = 60.000495910644531
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.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,
|
2017-06-14 02:08:43 -04:00
|
|
|
.refresh_rate = 60.000495910644531,
|
2017-01-16 22:34:23 -05:00
|
|
|
.crtc_modes = {
|
|
|
|
{
|
|
|
|
.output = 0,
|
|
|
|
.crtc_mode = 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_modes = 1,
|
|
|
|
.current_mode = 0,
|
|
|
|
.width_mm = 222,
|
|
|
|
.height_mm = 125,
|
|
|
|
.is_underscanning = TRUE,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_monitors = 1,
|
|
|
|
.logical_monitors = {
|
|
|
|
{
|
2017-01-19 01:09:55 -05:00
|
|
|
.monitors = { 0 },
|
|
|
|
.n_monitors = 1,
|
2017-01-16 22:34:23 -05:00
|
|
|
.layout = { .x = 0, .y = 0, .width = 1024, .height = 768 },
|
|
|
|
.scale = 1
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_logical_monitors = 1,
|
|
|
|
.primary_logical_monitor = 0,
|
|
|
|
.n_outputs = 1,
|
2017-01-18 05:01:47 -05:00
|
|
|
.crtcs = {
|
|
|
|
{
|
|
|
|
.current_mode = 0,
|
|
|
|
}
|
|
|
|
},
|
2017-01-16 22:34:23 -05:00
|
|
|
.n_crtcs = 1,
|
|
|
|
.n_tiled_monitors = 0,
|
|
|
|
.screen_width = 1024,
|
|
|
|
.screen_height = 768
|
|
|
|
}
|
|
|
|
};
|
|
|
|
MetaMonitorTestSetup *test_setup;
|
|
|
|
|
|
|
|
if (!is_using_monitor_config_manager ())
|
|
|
|
{
|
|
|
|
g_test_skip ("Not using MetaMonitorConfigManager");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
test_setup = create_monitor_test_setup (&test_case,
|
|
|
|
MONITOR_TEST_FLAG_NONE);
|
|
|
|
set_custom_monitor_config ("underscanning.xml");
|
|
|
|
emulate_hotplug (test_setup);
|
|
|
|
|
|
|
|
check_monitor_configuration (&test_case);
|
|
|
|
}
|
|
|
|
|
2017-01-19 09:46:33 -05:00
|
|
|
static void
|
|
|
|
meta_test_monitor_custom_scale_config (void)
|
|
|
|
{
|
|
|
|
MonitorTestCase test_case = {
|
|
|
|
.setup = {
|
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 1920,
|
|
|
|
.height = 1080,
|
|
|
|
.refresh_rate = 60.000495910644531
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.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 = 1920,
|
|
|
|
.height = 1080,
|
2017-06-14 02:08:43 -04:00
|
|
|
.refresh_rate = 60.000495910644531,
|
2017-01-19 09:46:33 -05:00
|
|
|
.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,
|
2017-02-24 05:10:52 -05:00
|
|
|
.layout = { .x = 0, .y = 0, .width = 960, .height = 540 },
|
2017-01-19 09:46:33 -05:00
|
|
|
.scale = 2
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_logical_monitors = 1,
|
|
|
|
.primary_logical_monitor = 0,
|
|
|
|
.n_outputs = 1,
|
|
|
|
.crtcs = {
|
|
|
|
{
|
|
|
|
.current_mode = 0,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_crtcs = 1,
|
|
|
|
.n_tiled_monitors = 0,
|
2017-02-24 05:10:52 -05:00
|
|
|
.screen_width = 960,
|
|
|
|
.screen_height = 540
|
2017-01-19 09:46:33 -05:00
|
|
|
}
|
|
|
|
};
|
|
|
|
MetaMonitorTestSetup *test_setup;
|
|
|
|
|
|
|
|
if (!is_using_monitor_config_manager ())
|
|
|
|
{
|
|
|
|
g_test_skip ("Not using MetaMonitorConfigManager");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-03-21 05:16:04 -04:00
|
|
|
if (!meta_is_stage_views_enabled ())
|
|
|
|
{
|
|
|
|
g_test_skip ("Not using stage views");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-01-19 09:46:33 -05:00
|
|
|
test_setup = create_monitor_test_setup (&test_case,
|
|
|
|
MONITOR_TEST_FLAG_NONE);
|
|
|
|
set_custom_monitor_config ("scale.xml");
|
|
|
|
emulate_hotplug (test_setup);
|
|
|
|
|
|
|
|
check_monitor_configuration (&test_case);
|
|
|
|
}
|
|
|
|
|
2017-05-25 05:22:14 -04:00
|
|
|
static void
|
|
|
|
meta_test_monitor_custom_fractional_scale_config (void)
|
|
|
|
{
|
|
|
|
MonitorTestCase test_case = {
|
|
|
|
.setup = {
|
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 1200,
|
|
|
|
.height = 900,
|
|
|
|
.refresh_rate = 60.000495910644531
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.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 = 1200,
|
|
|
|
.height = 900,
|
2017-06-14 02:08:43 -04:00
|
|
|
.refresh_rate = 60.000495910644531,
|
2017-05-25 05:22:14 -04:00
|
|
|
.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 = 800, .height = 600 },
|
|
|
|
.scale = 1.5
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_logical_monitors = 1,
|
|
|
|
.primary_logical_monitor = 0,
|
|
|
|
.n_outputs = 1,
|
|
|
|
.crtcs = {
|
|
|
|
{
|
|
|
|
.current_mode = 0,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_crtcs = 1,
|
|
|
|
.n_tiled_monitors = 0,
|
|
|
|
.screen_width = 800,
|
|
|
|
.screen_height = 600
|
|
|
|
}
|
|
|
|
};
|
|
|
|
MetaMonitorTestSetup *test_setup;
|
|
|
|
|
|
|
|
if (!is_using_monitor_config_manager ())
|
|
|
|
{
|
|
|
|
g_test_skip ("Not using MetaMonitorConfigManager");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!meta_is_stage_views_enabled ())
|
|
|
|
{
|
|
|
|
g_test_skip ("Not using stage views");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
test_setup = create_monitor_test_setup (&test_case,
|
|
|
|
MONITOR_TEST_FLAG_NONE);
|
|
|
|
set_custom_monitor_config ("fractional-scale.xml");
|
|
|
|
emulate_hotplug (test_setup);
|
|
|
|
|
|
|
|
check_monitor_configuration (&test_case);
|
|
|
|
}
|
|
|
|
|
2017-06-09 04:05:27 -04:00
|
|
|
static void
|
|
|
|
meta_test_monitor_custom_high_precision_fractional_scale_config (void)
|
|
|
|
{
|
|
|
|
MonitorTestCase test_case = {
|
|
|
|
.setup = {
|
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 1024,
|
|
|
|
.height = 768,
|
|
|
|
.refresh_rate = 60.000495910644531
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.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,
|
2017-06-14 02:08:43 -04:00
|
|
|
.refresh_rate = 60.000495910644531,
|
2017-06-09 04:05:27 -04:00
|
|
|
.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 = 744, .height = 558 },
|
|
|
|
.scale = 1024.0/744.0 /* 1.3763440847396851 */
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_logical_monitors = 1,
|
|
|
|
.primary_logical_monitor = 0,
|
|
|
|
.n_outputs = 1,
|
|
|
|
.crtcs = {
|
|
|
|
{
|
|
|
|
.current_mode = 0,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_crtcs = 1,
|
|
|
|
.n_tiled_monitors = 0,
|
|
|
|
.screen_width = 744,
|
|
|
|
.screen_height = 558
|
|
|
|
}
|
|
|
|
};
|
|
|
|
MetaMonitorTestSetup *test_setup;
|
|
|
|
|
|
|
|
if (!is_using_monitor_config_manager ())
|
|
|
|
{
|
|
|
|
g_test_skip ("Not using MetaMonitorConfigManager");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!meta_is_stage_views_enabled ())
|
|
|
|
{
|
|
|
|
g_test_skip ("Not using stage views");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
test_setup = create_monitor_test_setup (&test_case,
|
|
|
|
MONITOR_TEST_FLAG_NONE);
|
|
|
|
set_custom_monitor_config ("high-precision-fractional-scale.xml");
|
|
|
|
emulate_hotplug (test_setup);
|
|
|
|
|
|
|
|
check_monitor_configuration (&test_case);
|
|
|
|
}
|
|
|
|
|
2017-01-19 09:48:36 -05:00
|
|
|
static void
|
|
|
|
meta_test_monitor_custom_tiled_config (void)
|
|
|
|
{
|
|
|
|
MonitorTestCase test_case = {
|
|
|
|
.setup = {
|
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 400,
|
|
|
|
.height = 600,
|
|
|
|
.refresh_rate = 60.000495910644531
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_modes = 1,
|
|
|
|
.outputs = {
|
|
|
|
{
|
|
|
|
.crtc = -1,
|
|
|
|
.modes = { 0 },
|
|
|
|
.n_modes = 1,
|
|
|
|
.preferred_mode = 0,
|
|
|
|
.possible_crtcs = { 0, 1 },
|
|
|
|
.n_possible_crtcs = 2,
|
|
|
|
.width_mm = 222,
|
|
|
|
.height_mm = 125,
|
|
|
|
.tile_info = {
|
|
|
|
.group_id = 1,
|
|
|
|
.max_h_tiles = 2,
|
|
|
|
.max_v_tiles = 1,
|
|
|
|
.loc_h_tile = 0,
|
|
|
|
.loc_v_tile = 0,
|
|
|
|
.tile_w = 400,
|
|
|
|
.tile_h = 600
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.crtc = -1,
|
|
|
|
.modes = { 0 },
|
|
|
|
.n_modes = 1,
|
|
|
|
.preferred_mode = 0,
|
|
|
|
.possible_crtcs = { 0, 1 },
|
|
|
|
.n_possible_crtcs = 2,
|
|
|
|
.width_mm = 222,
|
|
|
|
.height_mm = 125,
|
|
|
|
.tile_info = {
|
|
|
|
.group_id = 1,
|
|
|
|
.max_h_tiles = 2,
|
|
|
|
.max_v_tiles = 1,
|
|
|
|
.loc_h_tile = 1,
|
|
|
|
.loc_v_tile = 0,
|
|
|
|
.tile_w = 400,
|
|
|
|
.tile_h = 600
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_outputs = 2,
|
|
|
|
.crtcs = {
|
|
|
|
{
|
|
|
|
.current_mode = 0
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.current_mode = -1
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_crtcs = 2
|
|
|
|
},
|
|
|
|
|
|
|
|
.expect = {
|
|
|
|
.monitors = {
|
|
|
|
{
|
|
|
|
.outputs = { 0, 1 },
|
|
|
|
.n_outputs = 2,
|
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 800,
|
|
|
|
.height = 600,
|
2017-06-14 02:08:43 -04:00
|
|
|
.refresh_rate = 60.000495910644531,
|
2017-01-19 09:48:36 -05:00
|
|
|
.crtc_modes = {
|
|
|
|
{
|
|
|
|
.output = 0,
|
|
|
|
.crtc_mode = 0,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.output = 1,
|
|
|
|
.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,
|
2017-02-24 05:10:52 -05:00
|
|
|
.layout = { .x = 0, .y = 0, .width = 400, .height = 300 },
|
2017-01-19 09:48:36 -05:00
|
|
|
.scale = 2
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_logical_monitors = 1,
|
|
|
|
.primary_logical_monitor = 0,
|
|
|
|
.n_outputs = 2,
|
|
|
|
.crtcs = {
|
|
|
|
{
|
|
|
|
.current_mode = 0,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.current_mode = 0,
|
2017-03-17 05:21:10 -04:00
|
|
|
.x = 400,
|
|
|
|
.y = 0
|
2017-01-19 09:48:36 -05:00
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_crtcs = 2,
|
|
|
|
.n_tiled_monitors = 1,
|
2017-02-24 05:10:52 -05:00
|
|
|
.screen_width = 400,
|
|
|
|
.screen_height = 300
|
2017-01-19 09:48:36 -05:00
|
|
|
}
|
|
|
|
};
|
|
|
|
MetaMonitorTestSetup *test_setup;
|
|
|
|
|
|
|
|
if (!is_using_monitor_config_manager ())
|
|
|
|
{
|
|
|
|
g_test_skip ("Not using MetaMonitorConfigManager");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-03-21 05:16:04 -04:00
|
|
|
if (!meta_is_stage_views_enabled ())
|
|
|
|
{
|
|
|
|
g_test_skip ("Not using stage views");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-01-19 09:48:36 -05:00
|
|
|
test_setup = create_monitor_test_setup (&test_case,
|
|
|
|
MONITOR_TEST_FLAG_NONE);
|
|
|
|
set_custom_monitor_config ("tiled.xml");
|
|
|
|
emulate_hotplug (test_setup);
|
|
|
|
|
|
|
|
check_monitor_configuration (&test_case);
|
|
|
|
}
|
|
|
|
|
2017-03-06 00:13:07 -05:00
|
|
|
static void
|
|
|
|
meta_test_monitor_custom_tiled_custom_resolution_config (void)
|
|
|
|
{
|
|
|
|
MonitorTestCase test_case = {
|
|
|
|
.setup = {
|
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 400,
|
|
|
|
.height = 600,
|
|
|
|
.refresh_rate = 60.000495910644531
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.width = 640,
|
|
|
|
.height = 480,
|
|
|
|
.refresh_rate = 60.000495910644531
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_modes = 2,
|
|
|
|
.outputs = {
|
|
|
|
{
|
|
|
|
.crtc = -1,
|
|
|
|
.modes = { 0, 1 },
|
|
|
|
.n_modes = 2,
|
|
|
|
.preferred_mode = 0,
|
|
|
|
.possible_crtcs = { 0, 1 },
|
|
|
|
.n_possible_crtcs = 2,
|
|
|
|
.width_mm = 222,
|
|
|
|
.height_mm = 125,
|
|
|
|
.tile_info = {
|
|
|
|
.group_id = 1,
|
|
|
|
.max_h_tiles = 2,
|
|
|
|
.max_v_tiles = 1,
|
|
|
|
.loc_h_tile = 0,
|
|
|
|
.loc_v_tile = 0,
|
|
|
|
.tile_w = 400,
|
|
|
|
.tile_h = 600
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.crtc = -1,
|
|
|
|
.modes = { 0, 1 },
|
|
|
|
.n_modes = 2,
|
|
|
|
.preferred_mode = 0,
|
|
|
|
.possible_crtcs = { 0, 1 },
|
|
|
|
.n_possible_crtcs = 2,
|
|
|
|
.width_mm = 222,
|
|
|
|
.height_mm = 125,
|
|
|
|
.tile_info = {
|
|
|
|
.group_id = 1,
|
|
|
|
.max_h_tiles = 2,
|
|
|
|
.max_v_tiles = 1,
|
|
|
|
.loc_h_tile = 1,
|
|
|
|
.loc_v_tile = 0,
|
|
|
|
.tile_w = 400,
|
|
|
|
.tile_h = 600
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_outputs = 2,
|
|
|
|
.crtcs = {
|
|
|
|
{
|
|
|
|
.current_mode = -1
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.current_mode = -1
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_crtcs = 2
|
|
|
|
},
|
|
|
|
|
|
|
|
.expect = {
|
|
|
|
.monitors = {
|
|
|
|
{
|
|
|
|
.outputs = { 0, 1 },
|
|
|
|
.n_outputs = 2,
|
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 800,
|
|
|
|
.height = 600,
|
2017-06-14 02:08:43 -04:00
|
|
|
.refresh_rate = 60.000495910644531,
|
2017-03-06 00:13:07 -05:00
|
|
|
.crtc_modes = {
|
|
|
|
{
|
|
|
|
.output = 0,
|
|
|
|
.crtc_mode = 0,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.output = 1,
|
|
|
|
.crtc_mode = 0,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.width = 640,
|
|
|
|
.height = 480,
|
2017-06-14 02:08:43 -04:00
|
|
|
.refresh_rate = 60.000495910644531,
|
2017-03-06 00:13:07 -05:00
|
|
|
.crtc_modes = {
|
|
|
|
{
|
|
|
|
.output = 0,
|
|
|
|
.crtc_mode = 1,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.output = 1,
|
|
|
|
.crtc_mode = -1,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_modes = 2,
|
|
|
|
.current_mode = 1,
|
|
|
|
.width_mm = 222,
|
|
|
|
.height_mm = 125,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_monitors = 1,
|
|
|
|
.logical_monitors = {
|
|
|
|
{
|
|
|
|
.monitors = { 0 },
|
|
|
|
.n_monitors = 1,
|
|
|
|
.layout = { .x = 0, .y = 0, .width = 320, .height = 240 },
|
|
|
|
.scale = 2
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_logical_monitors = 1,
|
|
|
|
.primary_logical_monitor = 0,
|
|
|
|
.n_outputs = 2,
|
|
|
|
.crtcs = {
|
|
|
|
{
|
|
|
|
.current_mode = 1,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.current_mode = -1,
|
2017-03-17 05:21:10 -04:00
|
|
|
.x = 400,
|
|
|
|
.y = 0,
|
2017-03-06 00:13:07 -05:00
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_crtcs = 2,
|
|
|
|
.n_tiled_monitors = 1,
|
|
|
|
.screen_width = 320,
|
|
|
|
.screen_height = 240
|
|
|
|
}
|
|
|
|
};
|
|
|
|
MetaMonitorTestSetup *test_setup;
|
|
|
|
|
|
|
|
if (!is_using_monitor_config_manager ())
|
|
|
|
{
|
|
|
|
g_test_skip ("Not using MetaMonitorConfigManager");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-03-21 05:16:04 -04:00
|
|
|
if (!meta_is_stage_views_enabled ())
|
|
|
|
{
|
|
|
|
g_test_skip ("Not using stage views");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-03-06 00:13:07 -05:00
|
|
|
test_setup = create_monitor_test_setup (&test_case,
|
|
|
|
MONITOR_TEST_FLAG_NONE);
|
|
|
|
set_custom_monitor_config ("tiled-custom-resolution.xml");
|
|
|
|
emulate_hotplug (test_setup);
|
|
|
|
|
|
|
|
check_monitor_configuration (&test_case);
|
|
|
|
}
|
|
|
|
|
2017-05-01 00:12:42 -04:00
|
|
|
static void
|
|
|
|
meta_test_monitor_custom_tiled_non_preferred_config (void)
|
|
|
|
{
|
|
|
|
MonitorTestCase test_case = {
|
|
|
|
.setup = {
|
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 640,
|
|
|
|
.height = 480,
|
|
|
|
.refresh_rate = 60.0
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.width = 800,
|
|
|
|
.height = 600,
|
|
|
|
.refresh_rate = 60.0
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.width = 512,
|
|
|
|
.height = 768,
|
|
|
|
.refresh_rate = 120.0
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.width = 1024,
|
|
|
|
.height = 768,
|
|
|
|
.refresh_rate = 60.0
|
|
|
|
},
|
|
|
|
},
|
|
|
|
.n_modes = 4,
|
|
|
|
.outputs = {
|
|
|
|
{
|
|
|
|
.crtc = -1,
|
|
|
|
.modes = { 0, 2 },
|
|
|
|
.n_modes = 2,
|
|
|
|
.preferred_mode = 1,
|
|
|
|
.possible_crtcs = { 0 },
|
|
|
|
.n_possible_crtcs = 1,
|
|
|
|
.width_mm = 222,
|
|
|
|
.height_mm = 125,
|
|
|
|
.tile_info = {
|
|
|
|
.group_id = 1,
|
|
|
|
.max_h_tiles = 2,
|
|
|
|
.max_v_tiles = 1,
|
|
|
|
.loc_h_tile = 0,
|
|
|
|
.loc_v_tile = 0,
|
|
|
|
.tile_w = 512,
|
|
|
|
.tile_h = 768
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.crtc = -1,
|
|
|
|
.modes = { 1, 2, 3 },
|
|
|
|
.n_modes = 3,
|
|
|
|
.preferred_mode = 0,
|
|
|
|
.possible_crtcs = { 1 },
|
|
|
|
.n_possible_crtcs = 1,
|
|
|
|
.width_mm = 222,
|
|
|
|
.height_mm = 125,
|
|
|
|
.tile_info = {
|
|
|
|
.group_id = 1,
|
|
|
|
.max_h_tiles = 2,
|
|
|
|
.max_v_tiles = 1,
|
|
|
|
.loc_h_tile = 1,
|
|
|
|
.loc_v_tile = 0,
|
|
|
|
.tile_w = 512,
|
|
|
|
.tile_h = 768
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_outputs = 2,
|
|
|
|
.crtcs = {
|
|
|
|
{
|
|
|
|
.current_mode = -1
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.current_mode = -1
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_crtcs = 2
|
|
|
|
},
|
|
|
|
|
|
|
|
.expect = {
|
|
|
|
.monitors = {
|
|
|
|
{
|
|
|
|
.outputs = { 0, 1 },
|
|
|
|
.n_outputs = 2,
|
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 1024,
|
|
|
|
.height = 768,
|
2017-06-14 02:08:43 -04:00
|
|
|
.refresh_rate = 120.0,
|
2017-05-01 00:12:42 -04:00
|
|
|
.crtc_modes = {
|
|
|
|
{
|
|
|
|
.output = 0,
|
|
|
|
.crtc_mode = 2
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.output = 1,
|
|
|
|
.crtc_mode = 2,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.width = 800,
|
|
|
|
.height = 600,
|
2017-06-14 02:08:43 -04:00
|
|
|
.refresh_rate = 60.0,
|
2017-05-01 00:12:42 -04:00
|
|
|
.crtc_modes = {
|
|
|
|
{
|
|
|
|
.output = 0,
|
|
|
|
.crtc_mode = -1
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.output = 1,
|
|
|
|
.crtc_mode = 1,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.width = 1024,
|
|
|
|
.height = 768,
|
2017-06-14 02:08:43 -04:00
|
|
|
.refresh_rate = 60.0,
|
2017-05-01 00:12:42 -04:00
|
|
|
.crtc_modes = {
|
|
|
|
{
|
|
|
|
.output = 0,
|
|
|
|
.crtc_mode = -1
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.output = 1,
|
|
|
|
.crtc_mode = 3,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
.n_modes = 3,
|
|
|
|
.current_mode = 1,
|
|
|
|
.width_mm = 222,
|
|
|
|
.height_mm = 125,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_monitors = 1,
|
|
|
|
.logical_monitors = {
|
|
|
|
{
|
|
|
|
.monitors = { 0 },
|
|
|
|
.n_monitors = 1,
|
|
|
|
.layout = { .x = 0, .y = 0, .width = 800, .height = 600 },
|
|
|
|
.scale = 1
|
|
|
|
},
|
|
|
|
},
|
|
|
|
.n_logical_monitors = 1,
|
|
|
|
.primary_logical_monitor = 0,
|
|
|
|
.n_outputs = 2,
|
|
|
|
.crtcs = {
|
|
|
|
{
|
|
|
|
.current_mode = -1,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.current_mode = 1,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_crtcs = 2,
|
|
|
|
.n_tiled_monitors = 1,
|
|
|
|
.screen_width = 800,
|
|
|
|
.screen_height = 600,
|
|
|
|
}
|
|
|
|
};
|
|
|
|
MetaMonitorTestSetup *test_setup;
|
|
|
|
|
|
|
|
if (!is_using_monitor_config_manager ())
|
|
|
|
{
|
|
|
|
g_test_skip ("Only the new monitor config manager handles this case.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
test_setup = create_monitor_test_setup (&test_case,
|
|
|
|
MONITOR_TEST_FLAG_NONE);
|
|
|
|
set_custom_monitor_config ("non-preferred-tiled-custom-resolution.xml");
|
|
|
|
emulate_hotplug (test_setup);
|
|
|
|
|
|
|
|
check_monitor_configuration (&test_case);
|
|
|
|
}
|
|
|
|
|
2017-01-19 09:55:10 -05:00
|
|
|
static void
|
|
|
|
meta_test_monitor_custom_mirrored_config (void)
|
|
|
|
{
|
|
|
|
MonitorTestCase test_case = {
|
|
|
|
.setup = {
|
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 800,
|
|
|
|
.height = 600,
|
|
|
|
.refresh_rate = 60.000495910644531
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.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
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.crtc = 1,
|
|
|
|
.modes = { 0 },
|
|
|
|
.n_modes = 1,
|
|
|
|
.preferred_mode = 0,
|
|
|
|
.possible_crtcs = { 1 },
|
|
|
|
.n_possible_crtcs = 1,
|
|
|
|
.width_mm = 220,
|
|
|
|
.height_mm = 124
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_outputs = 2,
|
|
|
|
.crtcs = {
|
|
|
|
{
|
|
|
|
.current_mode = 0
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.current_mode = 0
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_crtcs = 2
|
|
|
|
},
|
|
|
|
|
|
|
|
.expect = {
|
|
|
|
.monitors = {
|
|
|
|
{
|
|
|
|
.outputs = { 0 },
|
|
|
|
.n_outputs = 1,
|
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 800,
|
|
|
|
.height = 600,
|
2017-06-14 02:08:43 -04:00
|
|
|
.refresh_rate = 60.000495910644531,
|
2017-01-19 09:55:10 -05:00
|
|
|
.crtc_modes = {
|
|
|
|
{
|
|
|
|
.output = 0,
|
|
|
|
.crtc_mode = 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_modes = 1,
|
|
|
|
.current_mode = 0,
|
|
|
|
.width_mm = 222,
|
|
|
|
.height_mm = 125
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.outputs = { 1 },
|
|
|
|
.n_outputs = 1,
|
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 800,
|
|
|
|
.height = 600,
|
2017-06-14 02:08:43 -04:00
|
|
|
.refresh_rate = 60.000495910644531,
|
2017-01-19 09:55:10 -05:00
|
|
|
.crtc_modes = {
|
|
|
|
{
|
|
|
|
.output = 1,
|
|
|
|
.crtc_mode = 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_modes = 1,
|
|
|
|
.current_mode = 0,
|
|
|
|
.width_mm = 220,
|
|
|
|
.height_mm = 124
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_monitors = 2,
|
|
|
|
.logical_monitors = {
|
|
|
|
{
|
|
|
|
.monitors = { 0, 1 },
|
|
|
|
.n_monitors = 2,
|
|
|
|
.layout = { .x = 0, .y = 0, .width = 800, .height = 600 },
|
|
|
|
.scale = 1
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_logical_monitors = 1,
|
|
|
|
.primary_logical_monitor = 0,
|
|
|
|
.n_outputs = 2,
|
|
|
|
.crtcs = {
|
|
|
|
{
|
|
|
|
.current_mode = 0,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.current_mode = 0,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_crtcs = 2,
|
|
|
|
.n_tiled_monitors = 0,
|
|
|
|
.screen_width = 800,
|
|
|
|
.screen_height = 600
|
|
|
|
}
|
|
|
|
};
|
|
|
|
MetaMonitorTestSetup *test_setup;
|
|
|
|
|
|
|
|
if (!is_using_monitor_config_manager ())
|
|
|
|
{
|
|
|
|
g_test_skip ("Not using MetaMonitorConfigManager");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
test_setup = create_monitor_test_setup (&test_case,
|
|
|
|
MONITOR_TEST_FLAG_NONE);
|
|
|
|
set_custom_monitor_config ("mirrored.xml");
|
|
|
|
emulate_hotplug (test_setup);
|
|
|
|
|
|
|
|
check_monitor_configuration (&test_case);
|
|
|
|
}
|
|
|
|
|
2017-03-21 02:28:25 -04:00
|
|
|
static void
|
|
|
|
meta_test_monitor_custom_first_rotated_config (void)
|
|
|
|
{
|
|
|
|
MonitorTestCase test_case = {
|
|
|
|
.setup = {
|
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 1024,
|
|
|
|
.height = 768,
|
|
|
|
.refresh_rate = 60.000495910644531
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.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,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.crtc = 1,
|
|
|
|
.modes = { 0 },
|
|
|
|
.n_modes = 1,
|
|
|
|
.preferred_mode = 0,
|
|
|
|
.possible_crtcs = { 1 },
|
|
|
|
.n_possible_crtcs = 1,
|
|
|
|
.width_mm = 222,
|
|
|
|
.height_mm = 125,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_outputs = 2,
|
|
|
|
.crtcs = {
|
|
|
|
{
|
|
|
|
.current_mode = 0,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.current_mode = 0
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_crtcs = 2
|
|
|
|
},
|
|
|
|
|
|
|
|
.expect = {
|
|
|
|
.monitors = {
|
|
|
|
{
|
|
|
|
.outputs = { 0 },
|
|
|
|
.n_outputs = 1,
|
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 1024,
|
|
|
|
.height = 768,
|
2017-06-14 02:08:43 -04:00
|
|
|
.refresh_rate = 60.000495910644531,
|
2017-03-21 02:28:25 -04:00
|
|
|
.crtc_modes = {
|
|
|
|
{
|
|
|
|
.output = 0,
|
|
|
|
.crtc_mode = 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_modes = 1,
|
|
|
|
.current_mode = 0,
|
|
|
|
.width_mm = 222,
|
|
|
|
.height_mm = 125,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.outputs = { 1 },
|
|
|
|
.n_outputs = 1,
|
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 1024,
|
|
|
|
.height = 768,
|
2017-06-14 02:08:43 -04:00
|
|
|
.refresh_rate = 60.000495910644531,
|
2017-03-21 02:28:25 -04:00
|
|
|
.crtc_modes = {
|
|
|
|
{
|
|
|
|
.output = 1,
|
|
|
|
.crtc_mode = 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_modes = 1,
|
|
|
|
.current_mode = 0,
|
|
|
|
.width_mm = 222,
|
|
|
|
.height_mm = 125,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_monitors = 2,
|
|
|
|
.logical_monitors = {
|
|
|
|
{
|
|
|
|
.monitors = { 0 },
|
|
|
|
.n_monitors = 1,
|
|
|
|
.layout = { .x = 0, .y = 0, .width = 768, .height = 1024 },
|
|
|
|
.scale = 1,
|
|
|
|
.transform = META_MONITOR_TRANSFORM_270
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.monitors = { 1 },
|
|
|
|
.n_monitors = 1,
|
|
|
|
.layout = { .x = 768, .y = 0, .width = 1024, .height = 768 },
|
|
|
|
.scale = 1
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_logical_monitors = 2,
|
|
|
|
.primary_logical_monitor = 0,
|
|
|
|
.n_outputs = 2,
|
|
|
|
.crtcs = {
|
|
|
|
{
|
|
|
|
.current_mode = 0,
|
|
|
|
.transform = META_MONITOR_TRANSFORM_270
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.current_mode = 0,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_crtcs = 2,
|
|
|
|
.screen_width = 768 + 1024,
|
|
|
|
.screen_height = 1024
|
|
|
|
}
|
|
|
|
};
|
|
|
|
MetaMonitorTestSetup *test_setup;
|
|
|
|
|
|
|
|
if (!is_using_monitor_config_manager ())
|
|
|
|
{
|
|
|
|
g_test_skip ("Not using MetaMonitorConfigManager");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
test_setup = create_monitor_test_setup (&test_case,
|
|
|
|
MONITOR_TEST_FLAG_NONE);
|
|
|
|
set_custom_monitor_config ("first-rotated.xml");
|
|
|
|
emulate_hotplug (test_setup);
|
|
|
|
check_monitor_configuration (&test_case);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
meta_test_monitor_custom_second_rotated_config (void)
|
|
|
|
{
|
|
|
|
MonitorTestCase test_case = {
|
|
|
|
.setup = {
|
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 1024,
|
|
|
|
.height = 768,
|
|
|
|
.refresh_rate = 60.000495910644531
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.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,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.crtc = 1,
|
|
|
|
.modes = { 0 },
|
|
|
|
.n_modes = 1,
|
|
|
|
.preferred_mode = 0,
|
|
|
|
.possible_crtcs = { 1 },
|
|
|
|
.n_possible_crtcs = 1,
|
|
|
|
.width_mm = 222,
|
|
|
|
.height_mm = 125,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_outputs = 2,
|
|
|
|
.crtcs = {
|
|
|
|
{
|
|
|
|
.current_mode = 0
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.current_mode = 0
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_crtcs = 2
|
|
|
|
},
|
|
|
|
|
|
|
|
.expect = {
|
|
|
|
.monitors = {
|
|
|
|
{
|
|
|
|
.outputs = { 0 },
|
|
|
|
.n_outputs = 1,
|
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 1024,
|
|
|
|
.height = 768,
|
2017-06-14 02:08:43 -04:00
|
|
|
.refresh_rate = 60.000495910644531,
|
2017-03-21 02:28:25 -04:00
|
|
|
.crtc_modes = {
|
|
|
|
{
|
|
|
|
.output = 0,
|
|
|
|
.crtc_mode = 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_modes = 1,
|
|
|
|
.current_mode = 0,
|
|
|
|
.width_mm = 222,
|
|
|
|
.height_mm = 125,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.outputs = { 1 },
|
|
|
|
.n_outputs = 1,
|
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 1024,
|
|
|
|
.height = 768,
|
2017-06-14 02:08:43 -04:00
|
|
|
.refresh_rate = 60.000495910644531,
|
2017-03-21 02:28:25 -04:00
|
|
|
.crtc_modes = {
|
|
|
|
{
|
|
|
|
.output = 1,
|
|
|
|
.crtc_mode = 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_modes = 1,
|
|
|
|
.current_mode = 0,
|
|
|
|
.width_mm = 222,
|
|
|
|
.height_mm = 125,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_monitors = 2,
|
|
|
|
.logical_monitors = {
|
|
|
|
{
|
|
|
|
.monitors = { 0 },
|
|
|
|
.n_monitors = 1,
|
|
|
|
.layout = { .x = 0, .y = 256, .width = 1024, .height = 768 },
|
|
|
|
.scale = 1
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.monitors = { 1 },
|
|
|
|
.n_monitors = 1,
|
|
|
|
.layout = { .x = 1024, .y = 0, .width = 768, .height = 1024 },
|
|
|
|
.scale = 1,
|
|
|
|
.transform = META_MONITOR_TRANSFORM_90
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_logical_monitors = 2,
|
|
|
|
.primary_logical_monitor = 0,
|
|
|
|
.n_outputs = 2,
|
|
|
|
.crtcs = {
|
|
|
|
{
|
|
|
|
.current_mode = 0,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.current_mode = 0,
|
|
|
|
.transform = META_MONITOR_TRANSFORM_90
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_crtcs = 2,
|
|
|
|
.screen_width = 768 + 1024,
|
|
|
|
.screen_height = 1024
|
|
|
|
}
|
|
|
|
};
|
|
|
|
MetaMonitorTestSetup *test_setup;
|
|
|
|
|
|
|
|
if (!is_using_monitor_config_manager ())
|
|
|
|
{
|
|
|
|
g_test_skip ("Not using MetaMonitorConfigManager");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
test_setup = create_monitor_test_setup (&test_case,
|
|
|
|
MONITOR_TEST_FLAG_NONE);
|
|
|
|
set_custom_monitor_config ("second-rotated.xml");
|
|
|
|
emulate_hotplug (test_setup);
|
|
|
|
check_monitor_configuration (&test_case);
|
|
|
|
}
|
|
|
|
|
2017-03-21 03:38:56 -04:00
|
|
|
static void
|
|
|
|
meta_test_monitor_custom_second_rotated_tiled_config (void)
|
|
|
|
{
|
|
|
|
MonitorTestCase test_case = {
|
|
|
|
.setup = {
|
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 1024,
|
|
|
|
.height = 768,
|
|
|
|
.refresh_rate = 60.000495910644531
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.width = 400,
|
|
|
|
.height = 600,
|
|
|
|
.refresh_rate = 60.000495910644531
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_modes = 2,
|
|
|
|
.outputs = {
|
|
|
|
{
|
|
|
|
.crtc = 0,
|
|
|
|
.modes = { 0 },
|
|
|
|
.n_modes = 1,
|
|
|
|
.preferred_mode = 0,
|
|
|
|
.possible_crtcs = { 0 },
|
|
|
|
.n_possible_crtcs = 1,
|
|
|
|
.width_mm = 222,
|
|
|
|
.height_mm = 125,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.crtc = -1,
|
|
|
|
.modes = { 1 },
|
|
|
|
.n_modes = 1,
|
|
|
|
.preferred_mode = 1,
|
|
|
|
.possible_crtcs = { 1, 2 },
|
|
|
|
.n_possible_crtcs = 2,
|
|
|
|
.width_mm = 222,
|
|
|
|
.height_mm = 125,
|
|
|
|
.tile_info = {
|
|
|
|
.group_id = 1,
|
|
|
|
.max_h_tiles = 2,
|
|
|
|
.max_v_tiles = 1,
|
|
|
|
.loc_h_tile = 0,
|
|
|
|
.loc_v_tile = 0,
|
|
|
|
.tile_w = 400,
|
|
|
|
.tile_h = 600
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.crtc = -1,
|
|
|
|
.modes = { 1 },
|
|
|
|
.n_modes = 1,
|
|
|
|
.preferred_mode = 1,
|
|
|
|
.possible_crtcs = { 1, 2 },
|
|
|
|
.n_possible_crtcs = 2,
|
|
|
|
.width_mm = 222,
|
|
|
|
.height_mm = 125,
|
|
|
|
.tile_info = {
|
|
|
|
.group_id = 1,
|
|
|
|
.max_h_tiles = 2,
|
|
|
|
.max_v_tiles = 1,
|
|
|
|
.loc_h_tile = 1,
|
|
|
|
.loc_v_tile = 0,
|
|
|
|
.tile_w = 400,
|
|
|
|
.tile_h = 600
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_outputs = 3,
|
|
|
|
.crtcs = {
|
|
|
|
{
|
|
|
|
.current_mode = -1
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.current_mode = -1
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.current_mode = -1
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_crtcs = 3
|
|
|
|
},
|
|
|
|
|
|
|
|
.expect = {
|
|
|
|
.monitors = {
|
|
|
|
{
|
|
|
|
.outputs = { 0 },
|
|
|
|
.n_outputs = 1,
|
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 1024,
|
|
|
|
.height = 768,
|
2017-06-14 02:08:43 -04:00
|
|
|
.refresh_rate = 60.000495910644531,
|
2017-03-21 03:38:56 -04:00
|
|
|
.crtc_modes = {
|
|
|
|
{
|
|
|
|
.output = 0,
|
|
|
|
.crtc_mode = 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_modes = 1,
|
|
|
|
.current_mode = 0,
|
|
|
|
.width_mm = 222,
|
|
|
|
.height_mm = 125,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.outputs = { 1, 2 },
|
|
|
|
.n_outputs = 2,
|
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 800,
|
|
|
|
.height = 600,
|
2017-06-14 02:08:43 -04:00
|
|
|
.refresh_rate = 60.000495910644531,
|
2017-03-21 03:38:56 -04:00
|
|
|
.crtc_modes = {
|
|
|
|
{
|
|
|
|
.output = 1,
|
|
|
|
.crtc_mode = 1,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.output = 2,
|
|
|
|
.crtc_mode = 1,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_modes = 1,
|
|
|
|
.current_mode = 0,
|
|
|
|
.width_mm = 222,
|
|
|
|
.height_mm = 125,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_monitors = 2,
|
|
|
|
.logical_monitors = {
|
|
|
|
{
|
|
|
|
.monitors = { 0 },
|
|
|
|
.n_monitors = 1,
|
|
|
|
.layout = { .x = 0, .y = 256, .width = 1024, .height = 768 },
|
|
|
|
.scale = 1
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.monitors = { 1 },
|
|
|
|
.n_monitors = 1,
|
|
|
|
.layout = { .x = 1024, .y = 0, .width = 600, .height = 800 },
|
|
|
|
.scale = 1,
|
|
|
|
.transform = META_MONITOR_TRANSFORM_90
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_logical_monitors = 2,
|
|
|
|
.primary_logical_monitor = 0,
|
|
|
|
.n_outputs = 3,
|
|
|
|
.crtcs = {
|
|
|
|
{
|
|
|
|
.current_mode = 0,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.current_mode = 1,
|
|
|
|
.transform = META_MONITOR_TRANSFORM_90,
|
|
|
|
.x = 0,
|
|
|
|
.y = 400,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.current_mode = 1,
|
|
|
|
.transform = META_MONITOR_TRANSFORM_90
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_crtcs = 3,
|
|
|
|
.n_tiled_monitors = 1,
|
|
|
|
.screen_width = 1024 + 600,
|
|
|
|
.screen_height = 1024
|
|
|
|
}
|
|
|
|
};
|
|
|
|
MetaMonitorTestSetup *test_setup;
|
2017-03-21 05:28:45 -04:00
|
|
|
MetaBackend *backend = meta_get_backend ();
|
|
|
|
MetaMonitorManager *monitor_manager =
|
|
|
|
meta_backend_get_monitor_manager (backend);
|
|
|
|
MetaMonitorManagerTest *monitor_manager_test =
|
|
|
|
META_MONITOR_MANAGER_TEST (monitor_manager);
|
2017-03-21 03:38:56 -04:00
|
|
|
|
|
|
|
if (!is_using_monitor_config_manager ())
|
|
|
|
{
|
|
|
|
g_test_skip ("Not using MetaMonitorConfigManager");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-03-21 05:28:45 -04:00
|
|
|
meta_monitor_manager_test_set_handles_transforms (monitor_manager_test,
|
|
|
|
TRUE);
|
|
|
|
|
2017-03-21 03:38:56 -04:00
|
|
|
test_setup = create_monitor_test_setup (&test_case,
|
|
|
|
MONITOR_TEST_FLAG_NONE);
|
|
|
|
set_custom_monitor_config ("second-rotated-tiled.xml");
|
|
|
|
emulate_hotplug (test_setup);
|
|
|
|
check_monitor_configuration (&test_case);
|
|
|
|
}
|
|
|
|
|
2017-03-21 05:28:45 -04:00
|
|
|
static void
|
|
|
|
meta_test_monitor_custom_second_rotated_nonnative_config (void)
|
|
|
|
{
|
|
|
|
MonitorTestCase test_case = {
|
|
|
|
.setup = {
|
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 1024,
|
|
|
|
.height = 768,
|
|
|
|
.refresh_rate = 60.000495910644531
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.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,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.crtc = 1,
|
|
|
|
.modes = { 0 },
|
|
|
|
.n_modes = 1,
|
|
|
|
.preferred_mode = 0,
|
|
|
|
.possible_crtcs = { 1 },
|
|
|
|
.n_possible_crtcs = 1,
|
|
|
|
.width_mm = 222,
|
|
|
|
.height_mm = 125,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_outputs = 2,
|
|
|
|
.crtcs = {
|
|
|
|
{
|
|
|
|
.current_mode = 0
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.current_mode = 0
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_crtcs = 2
|
|
|
|
},
|
|
|
|
|
|
|
|
.expect = {
|
|
|
|
.monitors = {
|
|
|
|
{
|
|
|
|
.outputs = { 0 },
|
|
|
|
.n_outputs = 1,
|
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 1024,
|
|
|
|
.height = 768,
|
2017-06-14 02:08:43 -04:00
|
|
|
.refresh_rate = 60.000495910644531,
|
2017-03-21 05:28:45 -04:00
|
|
|
.crtc_modes = {
|
|
|
|
{
|
|
|
|
.output = 0,
|
|
|
|
.crtc_mode = 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_modes = 1,
|
|
|
|
.current_mode = 0,
|
|
|
|
.width_mm = 222,
|
|
|
|
.height_mm = 125,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.outputs = { 1 },
|
|
|
|
.n_outputs = 1,
|
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 1024,
|
|
|
|
.height = 768,
|
2017-06-14 02:08:43 -04:00
|
|
|
.refresh_rate = 60.000495910644531,
|
2017-03-21 05:28:45 -04:00
|
|
|
.crtc_modes = {
|
|
|
|
{
|
|
|
|
.output = 1,
|
|
|
|
.crtc_mode = 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_modes = 1,
|
|
|
|
.current_mode = 0,
|
|
|
|
.width_mm = 222,
|
|
|
|
.height_mm = 125,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_monitors = 2,
|
|
|
|
.logical_monitors = {
|
|
|
|
{
|
|
|
|
.monitors = { 0 },
|
|
|
|
.n_monitors = 1,
|
|
|
|
.layout = { .x = 0, .y = 256, .width = 1024, .height = 768 },
|
|
|
|
.scale = 1
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.monitors = { 1 },
|
|
|
|
.n_monitors = 1,
|
|
|
|
.layout = { .x = 1024, .y = 0, .width = 768, .height = 1024 },
|
|
|
|
.scale = 1,
|
|
|
|
.transform = META_MONITOR_TRANSFORM_90
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_logical_monitors = 2,
|
|
|
|
.primary_logical_monitor = 0,
|
|
|
|
.n_outputs = 2,
|
|
|
|
.crtcs = {
|
|
|
|
{
|
|
|
|
.current_mode = 0,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.current_mode = 0,
|
|
|
|
.transform = META_MONITOR_TRANSFORM_NORMAL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_crtcs = 2,
|
|
|
|
.screen_width = 768 + 1024,
|
|
|
|
.screen_height = 1024
|
|
|
|
}
|
|
|
|
};
|
|
|
|
MetaMonitorTestSetup *test_setup;
|
|
|
|
MetaBackend *backend = meta_get_backend ();
|
|
|
|
MetaMonitorManager *monitor_manager =
|
|
|
|
meta_backend_get_monitor_manager (backend);
|
|
|
|
MetaMonitorManagerTest *monitor_manager_test =
|
|
|
|
META_MONITOR_MANAGER_TEST (monitor_manager);
|
|
|
|
|
|
|
|
if (!is_using_monitor_config_manager ())
|
|
|
|
{
|
|
|
|
g_test_skip ("Not using MetaMonitorConfigManager");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!meta_is_stage_views_enabled ())
|
|
|
|
{
|
|
|
|
g_test_skip ("Not using stage views");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
meta_monitor_manager_test_set_handles_transforms (monitor_manager_test,
|
|
|
|
FALSE);
|
|
|
|
|
|
|
|
test_setup = create_monitor_test_setup (&test_case,
|
|
|
|
MONITOR_TEST_FLAG_NONE);
|
|
|
|
set_custom_monitor_config ("second-rotated.xml");
|
|
|
|
emulate_hotplug (test_setup);
|
|
|
|
check_monitor_configuration (&test_case);
|
|
|
|
}
|
|
|
|
|
2017-06-14 02:42:48 -04:00
|
|
|
static void
|
|
|
|
meta_test_monitor_custom_interlaced_config (void)
|
|
|
|
{
|
|
|
|
MonitorTestCase test_case = {
|
|
|
|
.setup = {
|
|
|
|
.modes = {
|
|
|
|
{
|
|
|
|
.width = 1024,
|
|
|
|
.height = 768,
|
|
|
|
.refresh_rate = 60.000495910644531
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.width = 1024,
|
|
|
|
.height = 768,
|
|
|
|
.refresh_rate = 60.000495910644531,
|
|
|
|
.flags = META_CRTC_MODE_FLAG_INTERLACE,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_modes = 2,
|
|
|
|
.outputs = {
|
|
|
|
{
|
|
|
|
.crtc = 0,
|
|
|
|
.modes = { 0, 1 },
|
|
|
|
.n_modes = 2,
|
|
|
|
.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.000495910644531,
|
|
|
|
.flags = META_CRTC_MODE_FLAG_NONE,
|
|
|
|
.crtc_modes = {
|
|
|
|
{
|
|
|
|
.output = 0,
|
|
|
|
.crtc_mode = 0,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.width = 1024,
|
|
|
|
.height = 768,
|
|
|
|
.refresh_rate = 60.000495910644531,
|
|
|
|
.flags = META_CRTC_MODE_FLAG_INTERLACE,
|
|
|
|
.crtc_modes = {
|
|
|
|
{
|
|
|
|
.output = 0,
|
|
|
|
.crtc_mode = 1,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_modes = 2,
|
|
|
|
.current_mode = 1,
|
|
|
|
.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 = 1,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.n_crtcs = 1,
|
|
|
|
.n_tiled_monitors = 0,
|
|
|
|
.screen_width = 1024,
|
|
|
|
.screen_height = 768
|
|
|
|
}
|
|
|
|
};
|
|
|
|
MetaMonitorTestSetup *test_setup;
|
|
|
|
|
|
|
|
if (!is_using_monitor_config_manager ())
|
|
|
|
{
|
|
|
|
g_test_skip ("Not using MetaMonitorConfigManager");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
test_setup = create_monitor_test_setup (&test_case,
|
|
|
|
MONITOR_TEST_FLAG_NONE);
|
|
|
|
set_custom_monitor_config ("interlaced.xml");
|
|
|
|
emulate_hotplug (test_setup);
|
|
|
|
|
|
|
|
check_monitor_configuration (&test_case);
|
|
|
|
}
|
|
|
|
|
2016-12-05 05:40:44 -05:00
|
|
|
void
|
|
|
|
init_monitor_tests (void)
|
|
|
|
{
|
2016-12-07 00:54:32 -05:00
|
|
|
MetaMonitorTestSetup *initial_test_setup;
|
|
|
|
|
2017-01-12 23:32:12 -05:00
|
|
|
initial_test_setup = create_monitor_test_setup (&initial_test_case,
|
|
|
|
MONITOR_TEST_FLAG_NO_STORED);
|
2016-12-07 00:54:32 -05:00
|
|
|
meta_monitor_manager_test_init_test_setup (initial_test_setup);
|
2016-12-05 08:28:22 -05:00
|
|
|
|
2016-12-07 01:18:28 -05:00
|
|
|
g_test_add_func ("/backends/monitor/initial-linear-config",
|
|
|
|
meta_test_monitor_initial_linear_config);
|
2016-12-07 02:15:25 -05:00
|
|
|
g_test_add_func ("/backends/monitor/one-disconnected-linear-config",
|
|
|
|
meta_test_monitor_one_disconnected_linear_config);
|
2016-12-07 02:16:12 -05:00
|
|
|
g_test_add_func ("/backends/monitor/one-off-linear-config",
|
|
|
|
meta_test_monitor_one_off_linear_config);
|
2016-12-07 02:33:45 -05:00
|
|
|
g_test_add_func ("/backends/monitor/preferred-linear-config",
|
|
|
|
meta_test_monitor_preferred_linear_config);
|
2016-12-07 04:42:06 -05:00
|
|
|
g_test_add_func ("/backends/monitor/tiled-linear-config",
|
|
|
|
meta_test_monitor_tiled_linear_config);
|
2017-05-01 00:12:42 -04:00
|
|
|
g_test_add_func ("/backends/monitor/tiled-non-preferred-linear-config",
|
|
|
|
meta_test_monitor_tiled_non_preferred_linear_config);
|
2016-12-07 04:42:30 -05:00
|
|
|
g_test_add_func ("/backends/monitor/hidpi-linear-config",
|
|
|
|
meta_test_monitor_hidpi_linear_config);
|
2016-12-20 10:15:45 -05:00
|
|
|
g_test_add_func ("/backends/monitor/suggested-config",
|
|
|
|
meta_test_monitor_suggested_config);
|
2017-01-09 04:10:58 -05:00
|
|
|
g_test_add_func ("/backends/monitor/limited-crtcs",
|
|
|
|
meta_test_monitor_limited_crtcs);
|
2017-01-09 22:50:44 -05:00
|
|
|
g_test_add_func ("/backends/monitor/lid-switch-config",
|
|
|
|
meta_test_monitor_lid_switch_config);
|
2017-01-10 00:18:46 -05:00
|
|
|
g_test_add_func ("/backends/monitor/lid-opened-config",
|
|
|
|
meta_test_monitor_lid_opened_config);
|
2017-01-12 00:42:42 -05:00
|
|
|
g_test_add_func ("/backends/monitor/lid-closed-no-external",
|
|
|
|
meta_test_monitor_lid_closed_no_external);
|
2017-01-12 00:51:43 -05:00
|
|
|
g_test_add_func ("/backends/monitor/no-outputs",
|
|
|
|
meta_test_monitor_no_outputs);
|
2017-01-16 22:34:23 -05:00
|
|
|
g_test_add_func ("/backends/monitor/underscanning-config",
|
|
|
|
meta_test_monitor_underscanning_config);
|
2017-01-13 01:42:03 -05:00
|
|
|
|
|
|
|
g_test_add_func ("/backends/monitor/custom/vertical-config",
|
|
|
|
meta_test_monitor_custom_vertical_config);
|
2017-01-16 00:13:35 -05:00
|
|
|
g_test_add_func ("/backends/monitor/custom/primary-config",
|
|
|
|
meta_test_monitor_custom_primary_config);
|
2017-01-16 22:34:23 -05:00
|
|
|
g_test_add_func ("/backends/monitor/custom/underscanning-config",
|
|
|
|
meta_test_monitor_custom_underscanning_config);
|
2017-01-19 09:46:33 -05:00
|
|
|
g_test_add_func ("/backends/monitor/custom/scale-config",
|
|
|
|
meta_test_monitor_custom_scale_config);
|
2017-05-25 05:22:14 -04:00
|
|
|
g_test_add_func ("/backends/monitor/custom/fractional-scale-config",
|
|
|
|
meta_test_monitor_custom_fractional_scale_config);
|
2017-06-09 04:05:27 -04:00
|
|
|
g_test_add_func ("/backends/monitor/custom/high-precision-fractional-scale-config",
|
|
|
|
meta_test_monitor_custom_high_precision_fractional_scale_config);
|
2017-01-19 09:48:36 -05:00
|
|
|
g_test_add_func ("/backends/monitor/custom/tiled-config",
|
|
|
|
meta_test_monitor_custom_tiled_config);
|
2017-03-06 00:13:07 -05:00
|
|
|
g_test_add_func ("/backends/monitor/custom/tiled-custom-resolution-config",
|
|
|
|
meta_test_monitor_custom_tiled_custom_resolution_config);
|
2017-05-01 00:12:42 -04:00
|
|
|
g_test_add_func ("/backends/monitor/custom/tiled-non-preferred-config",
|
|
|
|
meta_test_monitor_custom_tiled_non_preferred_config);
|
2017-01-19 09:55:10 -05:00
|
|
|
g_test_add_func ("/backends/monitor/custom/mirrored-config",
|
|
|
|
meta_test_monitor_custom_mirrored_config);
|
2017-03-21 02:28:25 -04:00
|
|
|
g_test_add_func ("/backends/monitor/custom/first-rotated-config",
|
|
|
|
meta_test_monitor_custom_first_rotated_config);
|
|
|
|
g_test_add_func ("/backends/monitor/custom/second-rotated-config",
|
|
|
|
meta_test_monitor_custom_second_rotated_config);
|
2017-03-21 03:38:56 -04:00
|
|
|
g_test_add_func ("/backends/monitor/custom/second-rotated-tiled-config",
|
|
|
|
meta_test_monitor_custom_second_rotated_tiled_config);
|
2017-03-21 05:28:45 -04:00
|
|
|
g_test_add_func ("/backends/monitor/custom/second-rotated-nonnative-config",
|
|
|
|
meta_test_monitor_custom_second_rotated_nonnative_config);
|
2017-06-14 02:42:48 -04:00
|
|
|
g_test_add_func ("/backends/monitor/custom/interlaced-config",
|
|
|
|
meta_test_monitor_custom_interlaced_config);
|
2016-12-05 05:40:44 -05:00
|
|
|
}
|