[PATCH i-g-t 1/2] lib/dsc: Add helper igt_get_dsc_sink_max_slice_count()
Swati Sharma
swati2.sharma at intel.com
Tue Dec 10 13:53:21 UTC 2024
Helper is added to return maximum dsc sink slice count from the
connector debugfs.
Signed-off-by: Swati Sharma <swati2.sharma at intel.com>
---
lib/igt_dsc.c | 24 ++++++++++++++++++++++++
lib/igt_dsc.h | 1 +
2 files changed, 25 insertions(+)
diff --git a/lib/igt_dsc.c b/lib/igt_dsc.c
index 229cd3298..8d259b734 100644
--- a/lib/igt_dsc.c
+++ b/lib/igt_dsc.c
@@ -308,3 +308,27 @@ int igt_get_dsc_fractional_bpp_debugfs_fd(int drmfd, char *connector_name)
return openat(igt_debugfs_dir(drmfd), file_name, O_WRONLY);
}
+
+/**
+ * igt_get_dsc_sink_max_slice_count:
+ * @drmfd: A drm file descriptor
+ * @connector_name: Name of the libdrm connector we're going to use
+ *
+ * Returns: The maximum dsc sink slice count from the connector debugfs.
+ */
+int igt_get_dsc_sink_max_slice_count(int drmfd, char *connector_name)
+{
+ char file_name[128] = {0};
+ char buf[512];
+ char *start_loc;
+ int max_slice_count;
+
+ sprintf(file_name, "%s/i915_dsc_fec_support", connector_name);
+ igt_debugfs_read(drmfd, file_name, buf);
+
+ igt_assert(start_loc = strstr(buf, "DSC_Sink_Max_Slice_Count: "));
+ igt_assert_eq(sscanf(start_loc, "DSC_Sink_Max_Slice_Count: %d", &max_slice_count), 1);
+ igt_assert(max_slice_count > 0);
+
+ return max_slice_count;
+}
diff --git a/lib/igt_dsc.h b/lib/igt_dsc.h
index 7ab0917ec..3cf2d4e76 100644
--- a/lib/igt_dsc.h
+++ b/lib/igt_dsc.h
@@ -27,5 +27,6 @@ int igt_get_dsc_fractional_bpp_supported(int drmfd, char *connector_name);
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);
#endif
--
2.25.1
More information about the igt-dev
mailing list