[igt-dev] [PATCH i-g-t v3 3/3] tests/kms_ccs: Add GEN12 CCS render compression format modifiers

Mika Kahola mika.kahola at intel.com
Wed Nov 6 08:50:15 UTC 2019


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)

Bspec: 49252

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

diff --git a/tests/kms_ccs.c b/tests/kms_ccs.c
index 1ce66cde..1784886e 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
@@ -84,6 +88,15 @@ static const uint64_t ccs_modifiers[] = {
  */
 #define MAX_SPRITE_PLANE_WIDTH 2000
 
+static bool is_gen12_modifier(uint64_t modifier)
+{
+
+	if (modifier == LOCAL_I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS)
+		return true;
+
+	return false;
+}
+
 static void addfb_init(struct igt_fb *fb, struct drm_mode_fb_cmd2 *f)
 {
 	int i;
@@ -300,17 +313,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);
@@ -328,13 +338,15 @@ static data_t data;
 
 igt_main
 {
+	int i, gen;
 	enum pipe pipe;
 
 	igt_fixture {
 		data.drm_fd = drm_open_driver_master(DRIVER_INTEL);
 
-		igt_require(intel_gen(intel_get_drm_devid(data.drm_fd)) >= 9);
-		kmstest_set_vt_graphics_mode();
+		gen = intel_gen(intel_get_drm_devid(data.drm_fd));
+		igt_require(gen >= 9);
+		kmstest_set_vt_graphics_mode();
 		igt_require_pipe_crc(data.drm_fd);
 
 		igt_display_require(&data.display, data.drm_fd);
@@ -345,51 +357,69 @@ igt_main
 
 		data.pipe = pipe;
 
-		data.flags = TEST_BAD_PIXEL_FORMAT;
-		igt_subtest_f("pipe-%s-bad-pixel-format", pipe_name)
-			test_output(&data);
-
-		data.flags = TEST_BAD_ROTATION_90;
-		igt_subtest_f("pipe-%s-bad-rotation-90", pipe_name)
-			test_output(&data);
-
-		data.flags = TEST_CRC;
-		igt_subtest_f("pipe-%s-crc-primary-basic", pipe_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_subtest_f("pipe-%s-crc-sprite-planes-basic", pipe_name) {
-			int valid_tests = 0;
-
-			igt_display_require_output_on_pipe(&data.display, data.pipe);
-
-			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);
+		for (i = 0; i < ARRAY_SIZE(ccs_modifiers); i++) {
+			if (gen >= 12 && is_gen12_modifier(ccs_modifiers[i].modifier)) {
+				data.ccs_modifier = ccs_modifiers[i].modifier;
+			} else if (gen < 12 && !is_gen12_modifier(ccs_modifiers[i].modifier)) {
+				data.ccs_modifier = ccs_modifiers[i].modifier;
+			} else {
+				continue;
 			}
 
-			igt_require_f(valid_tests > 0,
-				      "CCS not supported, skipping\n");
-		}
+			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_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;
+			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 | 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);
+
+			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;
+
+				igt_display_require_output_on_pipe(&data.display, data.pipe);
+
+				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_require_f(valid_tests > 0,
+					      "CCS not supported, skipping\n");
+			}
 
-		data.plane = NULL;
+			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