[PATCH i-g-t 4/5] lib/dsc: Add igt_get_dsc_sink_compressed_bpp()
Swati Sharma
swati2.sharma at intel.com
Wed May 21 07:28:35 UTC 2025
Function is added to return compressed bpp after
parsing i915_display_info debugfs.
Signed-off-by: Swati Sharma <swati2.sharma at intel.com>
---
lib/igt_dsc.c | 37 +++++++++++++++++++++++++++++++++++++
lib/igt_dsc.h | 1 +
2 files changed, 38 insertions(+)
diff --git a/lib/igt_dsc.c b/lib/igt_dsc.c
index 21677b0e0..db7af3c7c 100644
--- a/lib/igt_dsc.c
+++ b/lib/igt_dsc.c
@@ -350,3 +350,40 @@ int igt_get_dsc_sink_max_slice_count(int drmfd, char *connector_name)
return max_slice_count;
}
+
+/**
+ * igt_get_dsc_sink_compressed_bpp:
+ * @drmfd: A drm file descriptor
+ * @pipe: display pipe
+ *
+ * Returns: The dsc sink compressed bpp.
+ */
+int igt_get_dsc_sink_compressed_bpp(int drmfd, enum pipe pipe)
+{
+ char buf[8120];
+ char dest[20] = ":pipe ";
+ char *start_loc1, *start_loc2;
+ int dir, res;
+ float comp_bpp = 0;
+
+ strcat(dest, kmstest_pipe_name(pipe));
+
+ dir = igt_debugfs_dir(drmfd);
+ igt_assert_lte(0, dir);
+
+ igt_require_intel(drmfd);
+
+ res = igt_debugfs_simple_read(dir, "i915_display_info", buf, sizeof(buf));
+ igt_require(res > 0);
+ close(dir);
+
+ start_loc1 = strstr(buf, dest);
+
+ if ((start_loc1 = strstr(buf, dest))) {
+ igt_assert(start_loc2 = strstr(buf, "dsc-dss: compressed-bpp:"));
+ igt_assert_eq(sscanf(start_loc2, "dsc-dss: compressed-bpp:%f", &comp_bpp), 1);
+ igt_assert(comp_bpp > 0);
+ }
+
+ return comp_bpp;
+}
diff --git a/lib/igt_dsc.h b/lib/igt_dsc.h
index ab5d27b06..f7d13c99c 100644
--- a/lib/igt_dsc.h
+++ b/lib/igt_dsc.h
@@ -29,5 +29,6 @@ bool igt_is_force_dsc_fractional_bpp_enabled(int drmfd, char *connector_name);
int igt_force_dsc_fractional_bpp_enable(int drmfd, char *connector_name);
int igt_get_dsc_fractional_bpp_debugfs_fd(int drmfd, char *connector_name);
int igt_get_dsc_sink_max_slice_count(int drmfd, char *connector_name);
+int igt_get_dsc_sink_compressed_bpp(int drmfd, enum pipe pipe);
#endif
--
2.25.1
More information about the igt-dev
mailing list