[igt-dev] [PATCH i-g-t] tests/i915/kms_dsc: add has_dsc()

Swati Sharma swati2.sharma at intel.com
Thu May 18 05:27:22 UTC 2023


Instead of assuming dsc is supported gen11+, lets use has_dsc
flag in i915_capability to check h/w support.

Signed-off-by: Swati Sharma <swati2.sharma at intel.com>
---
 tests/i915/kms_dsc.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/tests/i915/kms_dsc.c b/tests/i915/kms_dsc.c
index 3ce28f84..ad698f27 100644
--- a/tests/i915/kms_dsc.c
+++ b/tests/i915/kms_dsc.c
@@ -253,6 +253,24 @@ static void test_dsc(data_t *data, enum dsc_test_type test_type, int bpc,
 	}
 }
 
+static bool has_dsc(data_t *data)
+{
+	char buf[4096];
+	int dir, res;
+
+	dir = igt_debugfs_dir(data->drm_fd);
+	igt_assert(dir >= 0);
+
+	igt_require_intel(data->drm_fd);
+
+	res = igt_debugfs_simple_read(dir, "i915_capabilities",
+				      buf, sizeof(buf));
+	igt_require(res > 0);
+	close(dir);
+
+	return strstr(buf, "has_dsc: yes");
+}
+
 igt_main
 {
 	data_t data = {};
@@ -265,7 +283,7 @@ igt_main
 		igt_install_exit_handler(kms_dsc_exit_handler);
 		igt_display_require(&data.display, data.drm_fd);
 		igt_display_require_output(&data.display);
-		igt_require(data.disp_ver >= 11);
+		igt_require(has_dsc(&data));
 	}
 
 	igt_describe("Tests basic display stream compression functionality if supported "
-- 
2.25.1



More information about the igt-dev mailing list