[igt-dev] [PATCH 1/2] lib/dsc: Add helpers for VDSC output format debugfs entry
Swati Sharma
swati2.sharma at intel.com
Tue May 2 12:26:37 UTC 2023
Helper functions are added for VDSC output format debugfs entry.
Signed-off-by: Swati Sharma <swati2.sharma at intel.com>
Reviewed-by: Jouni Högander <jouni.hogander at intel.com>
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal at intel.com>
---
lib/igt_dsc.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
lib/igt_dsc.h | 5 +++++
lib/igt_kms.h | 6 ++++++
3 files changed, 60 insertions(+)
diff --git a/lib/igt_dsc.c b/lib/igt_dsc.c
index 64dd6b29..9e1ab9b1 100644
--- a/lib/igt_dsc.c
+++ b/lib/igt_dsc.c
@@ -134,3 +134,52 @@ int igt_get_dsc_debugfs_fd(int drmfd, char *connector_name)
return openat(igt_debugfs_dir(drmfd), file_name, O_WRONLY);
}
+
+/*
+ * igt_is_dsc_output_format_supported_by_sink:
+ * @drmfd: A drm file descriptor
+ * @connector_name: Name of the libdrm connector we're going to use
+ * @output_format: Output format
+ *
+ * Returns: True if DSC output format is supported for the given connector,
+ * false otherwise.
+ */
+bool igt_is_dsc_output_format_supported_by_sink(int drmfd, char *connector_name,
+ enum dsc_output_format output_format)
+{
+ const char *check_str = "OUTPUTFORMATNOTFOUND";
+
+ switch (output_format) {
+ case DSC_FORMAT_RGB:
+ check_str = "RGB: yes";
+ break;
+ case DSC_FORMAT_YCBCR420:
+ check_str = "YCBCR420: yes";
+ break;
+ case DSC_FORMAT_YCBCR444:
+ check_str = "YCBCR444: yes";
+ break;
+ default:
+ break;
+ }
+
+ return check_dsc_debugfs(drmfd, connector_name, check_str);
+}
+
+/*
+ * igt_force_dsc_output_format:
+ * @drmfd: A drm file descriptor
+ * @connector_name: Name of the libdrm connector we're going to use
+ * @output_format: Output format
+ *
+ * Returns: 0 on success or negative error code, in case of failure.
+ */
+int igt_force_dsc_output_format(int drmfd, char *connector_name,
+ enum dsc_output_format output_format)
+{
+ char buf[20] = {0};
+
+ sprintf(buf, "%d", output_format);
+
+ return write_dsc_debugfs(drmfd, connector_name, "i915_dsc_output_format", buf);
+}
diff --git a/lib/igt_dsc.h b/lib/igt_dsc.h
index 291c2cde..9608aad4 100644
--- a/lib/igt_dsc.h
+++ b/lib/igt_dsc.h
@@ -7,6 +7,7 @@
#define IGT_DSC_H
#include "igt_fb.h"
+#include "igt_kms.h"
bool igt_is_dsc_supported(int drmfd, char *connector_name);
bool igt_is_fec_supported(int drmfd, char *connector_name);
@@ -15,5 +16,9 @@ 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_get_dsc_debugfs_fd(int drmfd, char *connector_name);
+bool igt_is_dsc_output_format_supported_by_sink(int drmfd, char *connector_name,
+ enum dsc_output_format output_format);
+int igt_force_dsc_output_format(int drmfd, char *connector_name,
+ enum dsc_output_format output_format);
#endif
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 483b4165..41e041b6 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -108,6 +108,12 @@ enum igt_custom_edid_type {
*/
#define kmstest_port_name(port) ((port) + 'A')
+enum dsc_output_format {
+ DSC_FORMAT_RGB = 0,
+ DSC_FORMAT_YCBCR420,
+ DSC_FORMAT_YCBCR444,
+};
+
const char *kmstest_encoder_type_str(int type);
const char *kmstest_connector_status_str(int status);
const char *kmstest_connector_type_str(int type);
--
2.25.1
More information about the igt-dev
mailing list