[igt-dev] [PATCH v6 3/3] tests/kms_ccs: Add GEN12 CCS render compression format modifiers

Mika Kahola mika.kahola at gmail.com
Thu Nov 14 09:44:03 UTC 2019


From: Mika Kahola <mika.kahola at intel.com>

Add GEN12 CCS format modifiers for render compression. Render
compression is not supported for 90/270 rotation.

v2: Added new subtests for each format modifier.
v3: Add IGT description for each subtest (GitLab)
v4: Fix errorneous subtest execution and listing
v5: Fix AUX surface units for GEN12 (Imre)

Bspec: 49252

Signed-off-by: Mika Kahola <mika.kahola at intel.com>
---
 tests/kms_ccs.c | 117 +++++++++++++++++++++++++++++-------------------
 1 file changed, 71 insertions(+), 46 deletions(-)

diff --git a/tests/kms_ccs.c b/tests/kms_ccs.c
index 1ce66cde..a99eba87 100644
--- a/tests/kms_ccs.c
+++ b/tests/kms_ccs.c
@@ -70,10 +70,14 @@ static const struct {
 	{0.0, 1.0, 0.0}
 };
 
-static const uint64_t ccs_modifiers[] = {
-	LOCAL_I915_FORMAT_MOD_Y_TILED_CCS,
-	LOCAL_I915_FORMAT_MOD_Yf_TILED_CCS,
-};
+static const struct {
+	uint64_t modifier;
+	char name[8];
+} ccs_modifiers[3] = {
+	{LOCAL_I915_FORMAT_MOD_Y_TILED_CCS, "Y"},
+	{LOCAL_I915_FORMAT_MOD_Yf_TILED_CCS, "Yf"},
+	{LOCAL_I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS, "Y-rc"},
+ };
 
 /*
  * Limit maximum used sprite plane width so this test will not mistakenly
@@ -109,8 +113,14 @@ static void generate_fb(data_t *data, struct igt_fb *fb,
 	uint32_t format;
 	uint64_t modifier;
 	cairo_t *cr;
+	int unit;
 	int ret;
 
+	if (intel_gen(intel_get_drm_devid(data->drm_fd)) >= 12)
+		unit = 64;
+	else
+		unit = 128;
+
 	/* Use either compressed or Y-tiled to test. However, given the lack of
 	 * available bandwidth, we use linear for the primary plane when
 	 * testing sprites, since we cannot fit two CCS planes into the
@@ -137,13 +147,13 @@ static void generate_fb(data_t *data, struct igt_fb *fb,
 		if (fb_flags & FB_MISALIGN_AUX_STRIDE) {
 			igt_skip_on_f(width <= 1024,
 				      "FB already has the smallest possible stride\n");
-			f.pitches[1] -= 64;
+			f.pitches[1] -= (unit/2);
 		}
 
 		if (fb_flags & FB_SMALL_AUX_STRIDE) {
 			igt_skip_on_f(width <= 1024,
 				      "FB already has the smallest possible stride\n");
-			f.pitches[1] = ALIGN(f.pitches[1]/2, 128);
+			f.pitches[1] = ALIGN(f.pitches[1]/2, unit);
 		}
 
 		if (fb_flags & FB_ZERO_AUX_STRIDE)
@@ -300,17 +310,14 @@ static int test_ccs(data_t *data)
 static int __test_output(data_t *data)
 {
 	igt_display_t *display = &data->display;
-	int i, valid_tests = 0;
+	int valid_tests = 0;
 
 	data->output = igt_get_single_output_for_pipe(display, data->pipe);
 	igt_require(data->output);
 
 	igt_output_set_pipe(data->output, data->pipe);
 
-	for (i = 0; i < ARRAY_SIZE(ccs_modifiers); i++) {
-		data->ccs_modifier = ccs_modifiers[i];
-		valid_tests += test_ccs(data);
-	}
+	valid_tests += test_ccs(data);
 
 	igt_output_set_pipe(data->output, PIPE_NONE);
 	igt_display_commit2(display, display->is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
@@ -320,7 +327,12 @@ static int __test_output(data_t *data)
 
 static void test_output(data_t *data)
 {
-	int valid_tests = __test_output(data);
+	int valid_tests;
+
+	igt_skip_on(!igt_display_has_format_mod(&data->display, DRM_FORMAT_XRGB8888,
+						data->ccs_modifier));
+
+	valid_tests = __test_output(data);
 	igt_require_f(valid_tests > 0, "CCS not supported, skipping\n");
 }
 
@@ -328,6 +340,7 @@ static data_t data;
 
 igt_main
 {
+	int i;
 	enum pipe pipe;
 
 	igt_fixture {
@@ -345,51 +358,63 @@ igt_main
 
 		data.pipe = pipe;
 
-		data.flags = TEST_BAD_PIXEL_FORMAT;
-		igt_subtest_f("pipe-%s-bad-pixel-format", pipe_name)
-			test_output(&data);
+		for (i = 0; i < ARRAY_SIZE(ccs_modifiers); i++) {
+			data.ccs_modifier = ccs_modifiers[i].modifier;
 
-		data.flags = TEST_BAD_ROTATION_90;
-		igt_subtest_f("pipe-%s-bad-rotation-90", pipe_name)
-			test_output(&data);
+			data.flags = TEST_BAD_PIXEL_FORMAT;
+			igt_describe("Test bad pixel format with given CCS modifier");
+			igt_subtest_f("pipe-%s-tiling-%s-bad-pixel-format", pipe_name, ccs_modifiers[i].name)
+				test_output(&data);
 
-		data.flags = TEST_CRC;
-		igt_subtest_f("pipe-%s-crc-primary-basic", pipe_name)
-			test_output(&data);
+			data.flags = TEST_BAD_ROTATION_90;
+			igt_describe("Test 90 degree rotation with given CCS modifier");
+			igt_subtest_f("pipe-%s-tiling-%s-bad-rotation-90", pipe_name, ccs_modifiers[i].name)
+				test_output(&data);
 
-		data.flags = TEST_CRC | TEST_ROTATE_180;
-		igt_subtest_f("pipe-%s-crc-primary-rotation-180", pipe_name)
-			test_output(&data);
+			data.flags = TEST_CRC;
+			igt_describe("Test primary plane CRC compatibility with given CCS modifier");
+			igt_subtest_f("pipe-%s-tiling-%s-crc-primary-basic", pipe_name, ccs_modifiers[i].name)
+				test_output(&data);
 
-		data.flags = TEST_CRC;
-		igt_subtest_f("pipe-%s-crc-sprite-planes-basic", pipe_name) {
-			int valid_tests = 0;
+			data.flags = TEST_CRC | TEST_ROTATE_180;
+			igt_describe("Test 180 degree rotation with given CCS modifier");
+			igt_subtest_f("pipe-%s-tiling-%s-crc-primary-rotation-180", pipe_name, ccs_modifiers[i].name)
+				test_output(&data);
 
-			igt_display_require_output_on_pipe(&data.display, data.pipe);
+			data.flags = TEST_CRC;
+			igt_describe("Test sprite plane CRC compatibility with given CCS modifier");
+			igt_subtest_f("pipe-%s-tiling-%s-crc-sprite-planes-basic", pipe_name, ccs_modifiers[i].name) {
+				int valid_tests = 0;
 
-			for_each_plane_on_pipe(&data.display, data.pipe, data.plane) {
-				if (data.plane->type == DRM_PLANE_TYPE_PRIMARY)
-					continue;
-				valid_tests += __test_output(&data);
-			}
+				igt_display_require_output_on_pipe(&data.display, data.pipe);
 
-			igt_require_f(valid_tests > 0,
-				      "CCS not supported, skipping\n");
-		}
+				for_each_plane_on_pipe(&data.display, data.pipe, data.plane) {
+					if (data.plane->type == DRM_PLANE_TYPE_PRIMARY)
+						continue;
+					valid_tests += __test_output(&data);
+				}
 
-		data.plane = NULL;
+				igt_require_f(valid_tests > 0,
+					      "CCS not supported, skipping\n");
+			}
+
+			data.plane = NULL;
 
-		data.flags = TEST_NO_AUX_BUFFER;
-		igt_subtest_f("pipe-%s-missing-ccs-buffer", pipe_name)
-			test_output(&data);
+			data.flags = TEST_NO_AUX_BUFFER;
+			igt_describe("Test missing CCS buffer with given CCS modifier");
+			igt_subtest_f("pipe-%s-tiling-%s-missing-ccs-buffer", pipe_name, ccs_modifiers[i].name)
+				test_output(&data);
 
-		data.flags = TEST_BAD_CCS_HANDLE;
-		igt_subtest_f("pipe-%s-ccs-on-another-bo", pipe_name)
-			test_output(&data);
+			data.flags = TEST_BAD_CCS_HANDLE;
+			igt_describe("Test CCS with different BO with given modifier");
+			igt_subtest_f("pipe-%s-tiling-%s-ccs-on-another-bo", pipe_name, ccs_modifiers[i].name)
+				test_output(&data);
 
-		data.flags = TEST_BAD_AUX_STRIDE;
-		igt_subtest_f("pipe-%s-bad-aux-stride", pipe_name)
-			test_output(&data);
+			data.flags = TEST_BAD_AUX_STRIDE;
+			igt_describe("Test with bad AUX stride with given CCS modifier");
+			igt_subtest_f("pipe-%s-tiling-%s-bad-aux-stride", pipe_name, ccs_modifiers[i].name)
+				test_output(&data);
+		}
 	}
 
 	igt_fixture
-- 
2.17.1



More information about the igt-dev mailing list