summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJosé Roberto de Souza <jose.souza@intel.com>2019-03-29 13:13:22 -0700
committerJosé Roberto de Souza <jose.souza@intel.com>2019-04-01 12:42:47 -0700
commit4383f7f7e0932ff652823db0ab8b80acf43a20e5 (patch)
treefe201d7e6bc597769d020af0cc0fd59baa6f4088 /tests
parentd15e00b9b4ebda5bbacdb4eea0af1e80e3da16da (diff)
lib: Share the 1024x768 mode among tests
Three test were duplicating this 1024x768 mode so lets move it to lib and share it. Reviewed-by: Mika Kahola <mika.kahola@intel.com> Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/kms_concurrent.c28
-rw-r--r--tests/kms_frontbuffer_tracking.c32
-rw-r--r--tests/kms_plane_lowres.c19
3 files changed, 13 insertions, 66 deletions
diff --git a/tests/kms_concurrent.c b/tests/kms_concurrent.c
index af8ca70c..117016dc 100644
--- a/tests/kms_concurrent.c
+++ b/tests/kms_concurrent.c
@@ -236,29 +236,11 @@ test_plane_position_with_output(data_t *data, enum pipe pipe, igt_output_t *outp
}
}
-static drmModeModeInfo std_1024_mode = {
- .clock = 65000,
- .hdisplay = 1024,
- .hsync_start = 1048,
- .hsync_end = 1184,
- .htotal = 1344,
- .hskew = 0,
- .vdisplay = 768,
- .vsync_start = 771,
- .vsync_end = 777,
- .vtotal = 806,
- .vscan = 0,
- .vrefresh = 60,
- .flags = 0xA,
- .type = 0x40,
- .name = "Custom 1024x768",
-};
-
-static drmModeModeInfo *
-get_lowres_mode(data_t *data, drmModeModeInfo *mode_default,
+static const drmModeModeInfo *
+get_lowres_mode(data_t *data, const drmModeModeInfo *mode_default,
igt_output_t *output)
{
- drmModeModeInfo *mode = &std_1024_mode;
+ const drmModeModeInfo *mode = igt_std_1024_mode_get();
drmModeConnector *connector = output->config.connector;
int limit = mode_default->vdisplay - SIZE_PLANE;
bool found;
@@ -277,7 +259,7 @@ get_lowres_mode(data_t *data, drmModeModeInfo *mode_default,
}
if (!found)
- mode = &std_1024_mode;
+ mode = igt_std_1024_mode_get();
return mode;
}
@@ -285,7 +267,7 @@ get_lowres_mode(data_t *data, drmModeModeInfo *mode_default,
static void
test_resolution_with_output(data_t *data, enum pipe pipe, igt_output_t *output)
{
- drmModeModeInfo *mode_hi, *mode_lo;
+ const drmModeModeInfo *mode_hi, *mode_lo;
int iterations = opt.iterations < 1 ? 1 : opt.iterations;
bool loop_forever = opt.iterations == LOOP_FOREVER ? true : false;
int i;
diff --git a/tests/kms_frontbuffer_tracking.c b/tests/kms_frontbuffer_tracking.c
index 4d15ce1c..89586326 100644
--- a/tests/kms_frontbuffer_tracking.c
+++ b/tests/kms_frontbuffer_tracking.c
@@ -295,28 +295,10 @@ struct {
.stop = true,
};
-drmModeModeInfo std_1024_mode = {
- .clock = 65000,
- .hdisplay = 1024,
- .hsync_start = 1048,
- .hsync_end = 1184,
- .htotal = 1344,
- .hskew = 0,
- .vdisplay = 768,
- .vsync_start = 771,
- .vsync_end = 777,
- .vtotal = 806,
- .vscan = 0,
- .vrefresh = 60,
- .flags = 0xA,
- .type = 0x40,
- .name = "Custom 1024x768",
-};
-
-static drmModeModeInfo *get_connector_smallest_mode(igt_output_t *output)
+static const drmModeModeInfo *get_connector_smallest_mode(igt_output_t *output)
{
drmModeConnector *c = output->config.connector;
- drmModeModeInfo *smallest = NULL;
+ const drmModeModeInfo *smallest = NULL;
int i;
for (i = 0; i < c->count_modes; i++) {
@@ -331,14 +313,14 @@ static drmModeModeInfo *get_connector_smallest_mode(igt_output_t *output)
}
if (c->connector_type == DRM_MODE_CONNECTOR_eDP)
- smallest = &std_1024_mode;
+ smallest = igt_std_1024_mode_get();
return smallest;
}
-static drmModeModeInfo *connector_get_mode(igt_output_t *output)
+static const drmModeModeInfo *connector_get_mode(igt_output_t *output)
{
- drmModeModeInfo *mode = NULL;
+ const drmModeModeInfo *mode = NULL;
if (opt.small_modes)
mode = get_connector_smallest_mode(output);
@@ -349,7 +331,7 @@ static drmModeModeInfo *connector_get_mode(igt_output_t *output)
* bugged. */
if (IS_HASWELL(intel_get_drm_devid(drm.fd)) &&
output->config.connector->connector_type == DRM_MODE_CONNECTOR_eDP)
- mode = &std_1024_mode;
+ mode = igt_std_1024_mode_get();
return mode;
}
@@ -357,7 +339,7 @@ static drmModeModeInfo *connector_get_mode(igt_output_t *output)
static void init_mode_params(struct modeset_params *params,
igt_output_t *output, enum pipe pipe)
{
- drmModeModeInfo *mode;
+ const drmModeModeInfo *mode;
igt_output_override_mode(output, NULL);
mode = connector_get_mode(output);
diff --git a/tests/kms_plane_lowres.c b/tests/kms_plane_lowres.c
index f7739b11..51bb7cd8 100644
--- a/tests/kms_plane_lowres.c
+++ b/tests/kms_plane_lowres.c
@@ -46,23 +46,6 @@ static drmModeModeInfo
get_lowres_mode(int drmfd, igt_output_t *output, drmModeModeInfo *mode_default)
{
drmModeModeInfo mode;
- drmModeModeInfo std_1024_mode = {
- .clock = 65000,
- .hdisplay = 1024,
- .hsync_start = 1048,
- .hsync_end = 1184,
- .htotal = 1344,
- .hskew = 0,
- .vdisplay = 768,
- .vsync_start = 771,
- .vsync_end = 777,
- .vtotal = 806,
- .vscan = 0,
- .vrefresh = 60,
- .flags = 0xA,
- .type = 0x40,
- .name = "Custom 1024x768",
- };
bool found = false;
int limit = mode_default->vdisplay - SIZE;
int j;
@@ -76,7 +59,7 @@ get_lowres_mode(int drmfd, igt_output_t *output, drmModeModeInfo *mode_default)
}
if (!found)
- return std_1024_mode;
+ return *igt_std_1024_mode_get();
return mode;
}