From: Swati Sharma <swati2.sharma@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t v4 6/8] lib/dsc: Add helpers for VDSC Fractional BPP debugfs entry
Date: Thu, 12 Jan 2023 13:05:35 +0530 [thread overview]
Message-ID: <20230112073537.27890-7-swati2.sharma@intel.com> (raw)
In-Reply-To: <20230112073537.27890-1-swati2.sharma@intel.com>
Helper functions are added for getting/setting VDSC Fractional BPP
debugfs entry.
v2: -improved func description (Ankit)
-increased buff size (Ankit)
-asserted bpp_prec (Ankit)
Signed-off-by: Swati Sharma <swati2.sharma@intel.com>
---
lib/igt_dsc.c | 84 +++++++++++++++++++++++++++++++++++++++++++++++++++
lib/igt_dsc.h | 5 +++
2 files changed, 89 insertions(+)
diff --git a/lib/igt_dsc.c b/lib/igt_dsc.c
index 269d574e9..e5e67a469 100644
--- a/lib/igt_dsc.c
+++ b/lib/igt_dsc.c
@@ -198,3 +198,87 @@ int igt_get_dsc_ycbcr420_debugfs_fd(int drmfd, char *connector_name)
return openat(igt_debugfs_dir(drmfd), file_name, O_WRONLY);
}
+
+static
+bool check_dsc_fractional_bpp_debugfs(int drmfd, char *connector_name,
+ const char *check_str)
+{
+ char file_name[128] = {0};
+ char buf[512];
+
+ sprintf(file_name, "%s/i915_dsc_fractional_bpp", connector_name);
+
+ igt_debugfs_read(drmfd, file_name, buf);
+
+ return strstr(buf, check_str);
+}
+
+/*
+ * igt_get_dsc_fractional_bpp_supported:
+ * @drmfd: A drm file descriptor
+ * @connector_name: Name of the libdrm connector we're going to use
+ *
+ * Returns: The dsc sink bpp precision.
+ * Precision value of
+ * 16 => 1/16
+ * 8 => 1/8
+ * 1 => fractional bpp not supported
+ */
+int igt_get_dsc_fractional_bpp_supported(int drmfd, char *connector_name)
+{
+ char file_name[128] = {0};
+ char buf[512];
+ char *start_loc;
+ int bpp_prec;
+
+ 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_BPP_Precision: "));
+ igt_assert_eq(sscanf(start_loc, "DSC_Sink_BPP_Precision: %d", &bpp_prec), 1);
+ igt_assert(bpp_prec > 0);
+
+ return bpp_prec;
+}
+
+/*
+ * igt_is_force_dsc_fractional_bpp_enabled:
+ * @drmfd: A drm file descriptor
+ * @connector_name: Name of the libdrm connector we're going to use
+ *
+ * Returns: True if DSC Fractional BPP is force enabled (via debugfs) for the given connector,
+ * false otherwise.
+ */
+bool igt_is_force_dsc_fractional_bpp_enabled(int drmfd, char *connector_name)
+{
+ return check_dsc_fractional_bpp_debugfs(drmfd, connector_name, "Force_DSC_Fractional_BPP_Enable: yes");
+}
+
+/*
+ * igt_force_dsc_fractional_bpp_enable:
+ * @drmfd: A drm file descriptor
+ * @connector_name: Name of the libdrm connector we're going to use
+ *
+ * Returns: 1 on success or negative error code, in case of failure.
+ */
+int igt_force_dsc_fractional_bpp_enable(int drmfd, char *connector_name)
+{
+ return write_dsc_debugfs(drmfd, connector_name, "i915_dsc_fractional_bpp", "1");
+}
+
+/*
+ * igt_get_dsc_fractional_bpp_debugfs_fd:
+ * @drmfd: A drm file descriptor
+ * @connector_name: Name of the libdrm connector we're going to use
+ *
+ * Returns: fd of the DSC Fractional BPP debugfs for the given connector,
+ * else returns -1.
+ */
+int igt_get_dsc_fractional_bpp_debugfs_fd(int drmfd, char *connector_name)
+{
+ char file_name[128] = {0};
+
+ sprintf(file_name, "%s/i915_dsc_fractional_bpp", connector_name);
+
+ return openat(igt_debugfs_dir(drmfd), file_name, O_WRONLY);
+}
diff --git a/lib/igt_dsc.h b/lib/igt_dsc.h
index e2b039f42..7dc958406 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_core.h"
bool igt_is_dsc_supported(int drmfd, char *connector_name);
bool igt_is_fec_supported(int drmfd, char *connector_name);
@@ -19,5 +20,9 @@ bool igt_is_dsc_ycbcr420_supported(int drmfd, char *connector_name);
bool igt_is_force_dsc_ycbcr420_enabled(int drmfd, char *connector_name);
int igt_force_dsc_ycbcr420_enable(int drmfd, char *connector_name);
int igt_get_dsc_ycbcr420_debugfs_fd(int drmfd, char *connector_name);
+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);
#endif
--
2.25.1
next prev parent reply other threads:[~2023-01-12 7:33 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-12 7:35 [igt-dev] [PATCH i-g-t v4 0/8] VDSC YCbCr420 + Fractional BPP Swati Sharma
2023-01-12 7:35 ` [igt-dev] [PATCH i-g-t v4 1/8] lib/dsc: Move VDSC functions to separate lib file Swati Sharma
2023-01-12 7:35 ` [igt-dev] [PATCH i-g-t v4 2/8] Move wrapper functions from kms_dsc to kms_dsc_helper Swati Sharma
2023-01-13 7:55 ` Hogander, Jouni
2023-01-12 7:35 ` [igt-dev] [PATCH i-g-t v4 3/8] lib/dsc: Add helpers for VDSC YCbCr420 debugfs entry Swati Sharma
2023-01-13 8:17 ` Hogander, Jouni
2023-01-18 16:36 ` Swati Sharma
2023-01-20 11:02 ` Hogander, Jouni
2023-01-21 5:28 ` Swati Sharma
2023-01-12 7:35 ` [igt-dev] [PATCH i-g-t v4 4/8] tests/i915/kms_dsc: Prep work for extending val support for VDSC YCbCr420 Swati Sharma
2023-01-12 7:35 ` [igt-dev] [PATCH i-g-t v4 5/8] tests/i915/kms_dsc: Enable validation " Swati Sharma
2023-01-13 8:29 ` Hogander, Jouni
2023-01-12 7:35 ` Swati Sharma [this message]
2023-01-13 8:31 ` [igt-dev] [PATCH i-g-t v4 6/8] lib/dsc: Add helpers for VDSC Fractional BPP debugfs entry Hogander, Jouni
2023-01-12 7:35 ` [igt-dev] [PATCH i-g-t v4 7/8] tests/i915/kms_dsc: Enable validation for VDSC Fractional BPP Swati Sharma
2023-01-12 7:35 ` [igt-dev] [PATCH i-g-t v4 8/8] tests/i915/kms_dsc: Add test summary Swati Sharma
2023-01-12 8:51 ` [igt-dev] ✗ GitLab.Pipeline: warning for VDSC YCbCr420 + Fractional BPP (rev3) Patchwork
2023-01-12 14:56 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2023-01-12 17:56 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230112073537.27890-7-swati2.sharma@intel.com \
--to=swati2.sharma@intel.com \
--cc=igt-dev@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox