[PATCH i-g-t 1/3] tests/kms/plane: Rename test_planar_settings to test_odd_size_with_yuv

Louis Chauvet louis.chauvet at bootlin.com
Thu Feb 1 16:35:53 UTC 2024


Rename the test test_planar_settings to test_odd_size_with_yuv, remove the
intel guard on this test.

Signed-off-by: Louis Chauvet <louis.chauvet at bootlin.com>
---
 tests/kms_plane.c | 91 ++++++++++++++++++++++++++-----------------------------
 1 file changed, 43 insertions(+), 48 deletions(-)

diff --git a/tests/kms_plane.c b/tests/kms_plane.c
index 406aecc04297..0bca96692b14 100644
--- a/tests/kms_plane.c
+++ b/tests/kms_plane.c
@@ -42,8 +42,8 @@
 #include "xe/xe_query.h"
 
 /**
- * SUBTEST: planar-pixel-format-settings
- * Description: verify planar settings for pixel format are handled correctly
+ * SUBTEST: test-odd-size-with-yuv
+ * Description: verify that yuv odd size are handled correctly by the driver
  * Functionality: pixel_formats, plane
  *
  * SUBTEST: plane-position-%s
@@ -1226,8 +1226,7 @@ test_pixel_formats(data_t *data, enum pipe pipe)
 
 	igt_assert_f(result, "At least one CRC mismatch happened\n");
 }
-
-static void test_planar_settings(data_t *data)
+static void test_odd_size_with_yuv(data_t *data)
 {
 	enum pipe pipe = PIPE_A;
 	igt_output_t *output;
@@ -1236,14 +1235,18 @@ static void test_planar_settings(data_t *data)
 	int devid;
 	int rval;
 
-	/*
-	 * If here is added non-intel tests below require will need to be
-	 * changed to if(..)
-	 */
+	bool should_fail = false;
 	igt_require(data->display.is_atomic);
-	igt_require_intel(data->drm_fd);
-	devid = intel_get_drm_devid(data->drm_fd);
-	igt_require(intel_display_ver(devid) >= 9);
+
+	/* Add more devices here if they are expected to fail */
+	if(is_intel_device(data->drm_fd)) {
+		/* This was required in the original test */
+		igt_require(intel_display_ver(devid) >= 9);
+		/* Intel display version below 20 are expected to fail */
+		if (intel_display_ver(devid) < 20) {
+			should_fail = true;
+		}
+	}
 
 	output = igt_get_single_output_for_pipe(&data->display, pipe);
 	igt_require(output);
@@ -1255,44 +1258,37 @@ static void test_planar_settings(data_t *data)
 				  DRM_MODE_ATOMIC_ALLOW_MODESET,
 				  NULL);
 
-	/* test against intel_plane_check_src_coordinates() in i915 */
-	if (igt_plane_has_format_mod(primary, DRM_FORMAT_NV12,
-				     DRM_FORMAT_MOD_LINEAR)) {
-		int expected_rval = -EINVAL;
-
-		if (intel_display_ver(devid) >= 20)
-			expected_rval = 0;
-
-		igt_create_fb(data->drm_fd, 257, 256,
-			      DRM_FORMAT_NV12, DRM_FORMAT_MOD_LINEAR, &fb);
-		igt_plane_set_fb(primary, &fb);
-		rval = igt_display_try_commit_atomic(&data->display,
-						     DRM_MODE_ATOMIC_ALLOW_MODESET,
-						     NULL);
-		igt_remove_fb(data->drm_fd, &fb);
-		igt_assert_f(rval == expected_rval, "Odd width NV12 framebuffer\n");
+	igt_require(igt_plane_has_format_mod(primary, DRM_FORMAT_NV12,
+					     DRM_FORMAT_MOD_LINEAR));
+
+
+	igt_create_fb(data->drm_fd, 257, 256,
+		      DRM_FORMAT_NV12, DRM_FORMAT_MOD_LINEAR, &fb);
+	igt_plane_set_fb(primary, &fb);
+	rval = igt_display_try_commit_atomic(&data->display,
+					     DRM_MODE_ATOMIC_ALLOW_MODESET,
+					     NULL);
+	igt_remove_fb(data->drm_fd, &fb);
+
+	if(should_fail) {
+		igt_assert_f(rval == -EINVAL, "Odd width NV12 framebuffer correctly failed\n");
 	} else {
-		igt_debug("Odd width NV12 framebuffer test skipped\n");
+		igt_assert_f(rval == 0, "Odd width NV12 framebuffer correctly succeed\n");
 	}
 
-	/* test against intel_plane_check_src_coordinates() in i915 */
-	if (igt_plane_has_format_mod(primary, DRM_FORMAT_NV12,
-				     DRM_FORMAT_MOD_LINEAR)) {
-		int expected_rval = -EINVAL;
-
-		if (intel_display_ver(devid) >= 20)
-			expected_rval = 0;
-
-		igt_create_fb(data->drm_fd, 256, 257,
-			      DRM_FORMAT_NV12, DRM_FORMAT_MOD_LINEAR, &fb);
-		igt_plane_set_fb(primary, &fb);
-		rval = igt_display_try_commit_atomic(&data->display,
-						     DRM_MODE_ATOMIC_ALLOW_MODESET,
-						     NULL);
-		igt_remove_fb(data->drm_fd, &fb);
-		igt_assert_f(rval == expected_rval, "Odd height NV12 framebuffer\n");
+
+	igt_create_fb(data->drm_fd, 256, 257,
+		      DRM_FORMAT_NV12, DRM_FORMAT_MOD_LINEAR, &fb);
+	igt_plane_set_fb(primary, &fb);
+	rval = igt_display_try_commit_atomic(&data->display,
+					     DRM_MODE_ATOMIC_ALLOW_MODESET,
+					     NULL);
+	igt_remove_fb(data->drm_fd, &fb);
+
+	if(should_fail) {
+		igt_assert_f(rval == -EINVAL, "Odd height NV12 framebuffer correctly failed\n");
 	} else {
-		igt_debug("Odd height NV12 framebuffer test skipped\n");
+		igt_assert_f(rval == 0, "Odd height NV12 framebuffer correctly succeed\n");
 	}
 }
 
@@ -1377,9 +1373,8 @@ run_tests_for_pipe_plane(data_t *data)
 		run_test(data, test_plane_panning);
 	}
 
-	igt_describe("verify planar settings for pixel format are accepted or rejected correctly");
-	igt_subtest_f("planar-pixel-format-settings")
-		test_planar_settings(data);
+	igt_describe("verify that odd sizes for yuv format are accepted or rejected correctly");
+	igt_subtest_f("test-odd-size-with-yuv") test_odd_size_with_yuv(data);
 }
 
 static int opt_handler(int opt, int opt_index, void *_data)

-- 
2.43.0



More information about the igt-dev mailing list