Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Swati Sharma <swati2.sharma@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: ankit.k.nautiyal@intel.com, Swati Sharma <swati2.sharma@intel.com>
Subject: [PATCH i-g-t 1/2] lib/dsc: Add helper igt_get_dsc_sink_max_slice_count()
Date: Tue, 10 Dec 2024 19:23:21 +0530	[thread overview]
Message-ID: <20241210135322.2117541-2-swati2.sharma@intel.com> (raw)
In-Reply-To: <20241210135322.2117541-1-swati2.sharma@intel.com>

Helper is added to return maximum dsc sink slice count from the
connector debugfs.

Signed-off-by: Swati Sharma <swati2.sharma@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


  reply	other threads:[~2024-12-10 13:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-10 13:53 [PATCH i-g-t 0/2] Add sink max dsc slice count lib helper Swati Sharma
2024-12-10 13:53 ` Swati Sharma [this message]
2024-12-11  2:50   ` [PATCH i-g-t 1/2] lib/dsc: Add helper igt_get_dsc_sink_max_slice_count() Reddy Guddati, Santhosh
2024-12-10 13:53 ` [PATCH i-g-t 2/2] tests/intel/kms_joiner: Add igt_get_dsc_sink_max_slice_count() constraint Swati Sharma
2024-12-12 12:17   ` Bhadane, Dnyaneshwar
2024-12-10 17:55 ` ✓ i915.CI.BAT: success for Add sink max dsc slice count lib helper Patchwork
2024-12-10 19:20 ` ✗ i915.CI.Full: failure " Patchwork
2024-12-10 19:56 ` ✓ Xe.CI.BAT: success " Patchwork
2024-12-10 21:47 ` ✗ Xe.CI.Full: 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=20241210135322.2117541-2-swati2.sharma@intel.com \
    --to=swati2.sharma@intel.com \
    --cc=ankit.k.nautiyal@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