summaryrefslogtreecommitdiff
path: root/tests/kms_rotation_crc.c
diff options
context:
space:
mode:
authorJuha-Pekka Heikkila <juhapekka.heikkila@gmail.com>2018-12-21 15:42:33 +0200
committerJuha-Pekka Heikkila <juhapekka.heikkila@gmail.com>2019-01-17 11:00:28 +0200
commit8614d5eb114a660c3bd7ff77eab8bed53424cd30 (patch)
tree9a5a22e36418981f5fa898c0b3db188e7a601be5 /tests/kms_rotation_crc.c
parentf162956b538cd6457d13b60c12cc0ae427246580 (diff)
tests/kms_rotation_crc: add NV12 support for multiplane* tests
Add NV12 support for testing where available. Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Diffstat (limited to 'tests/kms_rotation_crc.c')
-rw-r--r--tests/kms_rotation_crc.c35
1 files changed, 20 insertions, 15 deletions
diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index 796115ac..8f343e01 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -426,7 +426,7 @@ typedef struct {
igt_rotation_t rotation_sw, rotation_hw;
} planeinfos;
-static void get_multiplane_crc(data_t *data, igt_output_t *output,
+static bool get_multiplane_crc(data_t *data, igt_output_t *output,
igt_crc_t *crc_output, planeinfos *planeinfo,
int numplanes)
{
@@ -436,22 +436,27 @@ static void get_multiplane_crc(data_t *data, igt_output_t *output,
int c, ret;
oldplanes = data->multiplaneoldview;
- planes = malloc(sizeof(*planes) * numplanes);
+ planes = calloc(sizeof(*planes), numplanes);
for (c = 0; c < numplanes; c++) {
planes[c].plane = igt_output_get_plane_type(output,
planeinfo[c].planetype);
/*
- * make plane and fb width and height always even due to
- * test image rendering
+ * make plane and fb width and height always divisible by 4
+ * due to NV12 support and Intel hw workarounds.
*/
- w = planeinfo[c].width & ~1;
- h = planeinfo[c].height & ~1;
+ w = planeinfo[c].width & ~3;
+ h = planeinfo[c].height & ~3;
if (planeinfo[c].rotation_sw & (IGT_ROTATION_90 | IGT_ROTATION_270))
igt_swap(w, h);
+ if (!igt_plane_has_format_mod(planes[c].plane,
+ planeinfo[c].format,
+ planeinfo[c].tiling))
+ return false;
+
igt_create_fb(data->gfx_fd, w, h, planeinfo[c].format,
planeinfo[c].tiling, &planes[c].fb);
@@ -475,6 +480,7 @@ static void get_multiplane_crc(data_t *data, igt_output_t *output,
free(oldplanes);
data->multiplaneoldview = (void*)planes;
+ return true;
}
static void pointlocation(data_t *data, planeinfos *p, drmModeModeInfo *mode,
@@ -523,13 +529,10 @@ static void test_multi_plane_rotation(data_t *data, enum pipe pipe)
/*
* These are those modes which are tested. For testing feel interesting
- * case with tiling are 2 byte wide and 4 byte wide.
- *
- * TODO:
- * Built support for NV12 here.
+ * case with tiling are 2 bpp, 4 bpp and NV12.
*/
static const uint32_t formatlist[] = {DRM_FORMAT_RGB565,
- DRM_FORMAT_XRGB8888};
+ DRM_FORMAT_XRGB8888, DRM_FORMAT_NV12};
for_each_valid_output_on_pipe(display, pipe, output) {
int i, j, k, l;
@@ -581,13 +584,15 @@ static void test_multi_plane_rotation(data_t *data, enum pipe pipe)
p[0].rotation_hw = IGT_ROTATION_0;
p[1].rotation_sw = planeconfigs[j].rotation;
p[1].rotation_hw = IGT_ROTATION_0;
- get_multiplane_crc(data, output, &retcrc_sw,
- (planeinfos *)&p, MAXMULTIPLANESAMOUNT);
+ if (!get_multiplane_crc(data, output, &retcrc_sw,
+ (planeinfos *)&p, MAXMULTIPLANESAMOUNT))
+ continue;
igt_swap(p[0].rotation_sw, p[0].rotation_hw);
igt_swap(p[1].rotation_sw, p[1].rotation_hw);
- get_multiplane_crc(data, output, &retcrc_hw,
- (planeinfos *)&p, MAXMULTIPLANESAMOUNT);
+ if (!get_multiplane_crc(data, output, &retcrc_hw,
+ (planeinfos *)&p, MAXMULTIPLANESAMOUNT))
+ continue;
igt_assert_crc_equal(&retcrc_sw, &retcrc_hw);
}