[igt-dev] [PATCH] tests/kms_addfb_basic: Test addfb2 with DRM_FORMAT_C8 only if supported.

Mark Yacoub markyacoub at chromium.org
Wed Jul 7 20:03:46 UTC 2021


From: Mark Yacoub <markyacoub at google.com>

[Why]
Some devices such as Trogdor do not support DRM_FORMAT_C8 pixel format.
Skip any addfb2 test on such devices that is expected to succeed such as
subtest size-max.

[How]
Only run the check on devices with DRM_FORMAT_C8 support

Tested on Trogdor.

Signed-off-by: Mark Yacoub <markyacoub at chromium.org>
---
 tests/kms_addfb_basic.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/tests/kms_addfb_basic.c b/tests/kms_addfb_basic.c
index 91fb6ac9..20597b69 100644
--- a/tests/kms_addfb_basic.c
+++ b/tests/kms_addfb_basic.c
@@ -411,6 +411,7 @@ static void size_tests(int fd)
 	struct drm_mode_fb_cmd2 f_8 = {};
 	struct drm_mode_fb_cmd2 *framebuffers[] = {&f, &f_16, &f_8};
 	int i;
+	bool is_c8_format_supported = !is_msm_device(fd);
 
 	f.width = 1024;
 	f.height = 1024;
@@ -440,17 +441,19 @@ static void size_tests(int fd)
 	f_16.handles[0] = gem_bo;
 	f_8.handles[0] = gem_bo;
 
-	igt_describe("Check if addfb2 call works with max size of  buffer object");
+	igt_describe("Check if addfb2 call works with max size of buffer object");
 	igt_subtest("size-max") {
 		igt_assert(drmIoctl(fd, DRM_IOCTL_MODE_ADDFB2, &f) == 0);
 		igt_assert(drmIoctl(fd, DRM_IOCTL_MODE_RMFB, &f.fb_id) == 0);
 		f.fb_id = 0;
 		igt_assert(drmIoctl(fd, DRM_IOCTL_MODE_ADDFB2, &f_16) == 0);
 		igt_assert(drmIoctl(fd, DRM_IOCTL_MODE_RMFB, &f_16.fb_id) == 0);
-		f.fb_id = 0;
-		igt_assert(drmIoctl(fd, DRM_IOCTL_MODE_ADDFB2, &f_8) == 0);
-		igt_assert(drmIoctl(fd, DRM_IOCTL_MODE_RMFB, &f_8.fb_id) == 0);
-		f.fb_id = 0;
+		f_16.fb_id = 0;
+		if (is_c8_format_supported) {
+			igt_assert(drmIoctl(fd, DRM_IOCTL_MODE_ADDFB2, &f_8) == 0);
+			igt_assert(drmIoctl(fd, DRM_IOCTL_MODE_RMFB, &f_8.fb_id) == 0);
+			f_8.fb_id = 0;
+		}
 	}
 
 	f.width++;
-- 
2.32.0.93.g670b81a890-goog



More information about the igt-dev mailing list