[PATCH i-g-t 1/4] lib/dsc: Add igt_force_dsc_enable_compressed_bpp()

Swati Sharma <[email protected]> Fri, 31 Jul 2026 17:51:42 +0530
Newsgroups org.freedesktop.lists.igt-dev
Message-ID <[email protected]>
Function is added to force compressed bpp via debugfs
intel_force_link_bpp.

v2: Rebase

Signed-off-by: Swati Sharma <[email protected]>
---
 lib/igt_dsc.c | 18 ++++++++++++++++++
 lib/igt_dsc.h |  1 +
 2 files changed, 19 insertions(+)

diff --git a/lib/igt_dsc.c b/lib/igt_dsc.c
index 3754eef07..93b67655f 100644
--- a/lib/igt_dsc.c
+++ b/lib/igt_dsc.c
@@ -6,6 +6,7 @@
 #include <unistd.h>
 #include <fcntl.h>
 #include <string.h>
+#include "drmtest.h"
 #include "igt_core.h"
 #include "igt_dsc.h"
 #include "igt_sysfs.h"
@@ -166,6 +167,23 @@ int igt_force_dsc_enable_bpc(int drmfd, char *connector_name, int bpc)
 	return write_dsc_debugfs(drmfd, connector_name, "i915_dsc_bpc", buf);
 }
 
+/**
+ * igt_force_dsc_enable_compressed_bpp:
+ * @drmfd: A drm file descriptor
+ * @connector_name: Name of the libdrm connector we're going to use
+ * @bpp: Compressed BPP
+ *
+ * Returns: 0 on success or negative error code, in case of failure.
+ */
+int igt_force_dsc_enable_compressed_bpp(int drmfd, char *connector_name, float bpp)
+{
+	char buf[20] = {0};
+
+	snprintf(buf, sizeof(buf), "%.2f", bpp);
+
+	return write_dsc_debugfs(drmfd, connector_name, "intel_force_link_bpp", buf);
+}
+
 /**
  * igt_get_dsc_debugfs_fd:
  * @drmfd: A drm file descriptor
diff --git a/lib/igt_dsc.h b/lib/igt_dsc.h
index f63345848..0ba06d8c5 100644
--- a/lib/igt_dsc.h
+++ b/lib/igt_dsc.h
@@ -17,6 +17,7 @@ bool igt_is_dsc_enabled(int drmfd, char *connector_name);
 bool igt_is_force_dsc_enabled(int drmfd, char *connector_name);
 int igt_force_dsc_enable(int drmfd, char *connector_name);
 int igt_force_dsc_enable_bpc(int drmfd, char *connector_name, int bpc);
+int igt_force_dsc_enable_compressed_bpp(int drmfd, char *connector_name, float bpp);
 int igt_force_dsc_disable(int drmfd, char *connector_name);
 bool igt_is_force_dsc_disabled(int drmfd, char *connector_name);
 int igt_get_dsc_debugfs_fd(int drmfd, char *connector_name);
-- 
2.25.1