[PATCH i-g-t 3/4] lib/dsc: Add igt_get_dsc_sink_compressed_bpp()
Swati Sharma <[email protected]> Fri, 31 Jul 2026 17:51:44 +0530
| Newsgroups | org.freedesktop.lists.igt-dev |
|---|---|
| Message-ID | <[email protected]> |
Function is added to return compressed bpp after parsing i915_display_info debugfs. v2: Rebase Signed-off-by: Swati Sharma <[email protected]> --- lib/igt_dsc.c | 38 ++++++++++++++++++++++++++++++++++++++ lib/igt_dsc.h | 1 + 2 files changed, 39 insertions(+) diff --git a/lib/igt_dsc.c b/lib/igt_dsc.c index 93b67655f..d30730f5c 100644 --- a/lib/igt_dsc.c +++ b/lib/igt_dsc.c @@ -375,3 +375,41 @@ 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. + */ +float igt_get_dsc_sink_compressed_bpp(int drmfd, enum pipe pipe) +{ + char buf[8192]; + char dest[20]; + char *start_loc1, *start_loc2; + int dir, res; + float comp_bpp = 0; + + snprintf(dest, sizeof(dest), ":pipe %s", kmstest_pipe_name(pipe)); + + igt_require_intel(drmfd); + + dir = igt_debugfs_dir(drmfd); + igt_assert_lte(0, dir); + + res = igt_debugfs_simple_read(dir, "i915_display_info", buf, sizeof(buf)); + close(dir); + igt_require(res > 0); + + start_loc1 = strstr(buf, dest); + igt_require_f(start_loc1, "Pipe %s not found in i915_display_info\n", + kmstest_pipe_name(pipe)); + + start_loc2 = strstr(start_loc1, "dsc-dss: compressed-bpp:"); + igt_assert(start_loc2); + 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 0ba06d8c5..f895af7f3 100644 --- a/lib/igt_dsc.h +++ b/lib/igt_dsc.h @@ -31,5 +31,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); +float igt_get_dsc_sink_compressed_bpp(int drmfd, enum pipe pipe); #endif -- 2.25.1