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: Swati Sharma <swati2.sharma@intel.com>
Subject: [PATCH i-g-t v3,2/3] dsc: add dsc+big joiner helper func
Date: Wed,  4 Sep 2024 12:54:24 +0530	[thread overview]
Message-ID: <20240904072425.1022100-3-swati2.sharma@intel.com> (raw)
In-Reply-To: <20240904072425.1022100-1-swati2.sharma@intel.com>

Add dsc with big joiner helper functions.

Signed-off-by: Swati Sharma <swati2.sharma@intel.com>
---
 lib/igt_dsc.c                | 17 +++++++++++++++++
 lib/igt_dsc.h                |  1 +
 tests/intel/kms_dsc_helper.c | 33 +++++++++++++++++++++++++++++++++
 tests/intel/kms_dsc_helper.h |  3 +++
 4 files changed, 54 insertions(+)

diff --git a/lib/igt_dsc.c b/lib/igt_dsc.c
index 229cd3298..6674ba77e 100644
--- a/lib/igt_dsc.c
+++ b/lib/igt_dsc.c
@@ -308,3 +308,20 @@ 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_bigjoiner_debugfs_fd:
+ * @drmfd: A drm file descriptor
+ * @connector_name: Name of the libdrm connector we're going to use
+ *
+ * Returns: fd of the Big Joiner debugfs for the given connector,
+ * else returns -1.
+*/
+int igt_get_bigjoiner_debugfs_fd(int drmfd, char *connector_name)
+{
+	char file_name[128] = {0};
+
+	sprintf(file_name, "%s/i915_bigjoiner_force_enable", 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 7ab0917ec..52651ab95 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_bigjoiner_debugfs_fd(int drmfd, char *connector_name);
 
 #endif
diff --git a/tests/intel/kms_dsc_helper.c b/tests/intel/kms_dsc_helper.c
index 0de09b8e9..22095b215 100644
--- a/tests/intel/kms_dsc_helper.c
+++ b/tests/intel/kms_dsc_helper.c
@@ -7,8 +7,10 @@
 
 static bool force_dsc_en_orig;
 static bool force_dsc_fractional_bpp_en_orig;
+static bool force_dsc_bigjoiner_en_orig;
 static int force_dsc_restore_fd = -1;
 static int force_dsc_fractional_bpp_restore_fd = -1;
+static int force_dsc_bigjoiner_restore_fd = -1;
 
 void force_dsc_enable(int drmfd, igt_output_t *output)
 {
@@ -54,6 +56,7 @@ void kms_dsc_exit_handler(int sig)
 {
 	restore_force_dsc_en();
 	restore_force_dsc_fractional_bpp_en();
+	restore_force_dsc_bigjoiner_en();
 }
 
 bool is_dsc_supported_by_source(int drmfd)
@@ -201,3 +204,33 @@ bool is_dsc_fractional_bpp_supported(int disp_ver, int drmfd, igt_output_t *outp
 
 	return true;
 }
+
+void force_dsc_bigjoiner_enable(int drmfd, igt_output_t *output)
+{
+	bool status;
+
+	igt_debug("Forcing DSC Big Joiner on %s\n", output->name);
+	status = kmstest_force_connector_bigjoiner(drmfd, output->config.connector);
+	igt_assert_f(status, "forcing dsc big joiner debugfs_write failed\n");
+}
+
+void save_force_dsc_bigjoiner_en(int drmfd, igt_output_t *output)
+{
+	force_dsc_bigjoiner_en_orig =
+		igt_check_force_joiner_status(drmfd, output->name);
+	force_dsc_bigjoiner_restore_fd =
+		igt_get_bigjoiner_debugfs_fd(drmfd, output->name);
+	igt_assert(force_dsc_bigjoiner_restore_fd >= 0);
+}
+
+void restore_force_dsc_bigjoiner_en(void)
+{
+	if (force_dsc_bigjoiner_restore_fd < 0)
+		return;
+
+	igt_debug("Restoring DSC Big Joiner enable\n");
+	igt_assert(write(force_dsc_bigjoiner_restore_fd, force_dsc_bigjoiner_en_orig ? "1" : "0", 1) == 1);
+
+	close(force_dsc_bigjoiner_restore_fd);
+	force_dsc_bigjoiner_restore_fd = -1;
+}
diff --git a/tests/intel/kms_dsc_helper.h b/tests/intel/kms_dsc_helper.h
index 4dbd88fe7..b2f8ea1ca 100644
--- a/tests/intel/kms_dsc_helper.h
+++ b/tests/intel/kms_dsc_helper.h
@@ -38,5 +38,8 @@ void force_dsc_fractional_bpp_enable(int drmfd, igt_output_t *output);
 void save_force_dsc_fractional_bpp_en(int drmfd, igt_output_t *output);
 void restore_force_dsc_fractional_bpp_en(void);
 bool is_dsc_fractional_bpp_supported(int disp_ver, int drmfd, igt_output_t *output);
+void force_dsc_bigjoiner_enable(int drmfd, igt_output_t *output);
+void save_force_dsc_bigjoiner_en(int drmfd, igt_output_t *output);
+void restore_force_dsc_bigjoiner_en(void);
 
 #endif
-- 
2.25.1


  parent reply	other threads:[~2024-09-04  7:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-04  7:24 [PATCH i-g-t v3,0/3] Add dsc+bigjoiner subtest Swati Sharma
2024-09-04  7:24 ` [PATCH i-g-t v3, 1/3] tests/intel/kms_dsc: move restore funcs() to reset func() Swati Sharma
2024-09-04  7:24 ` Swati Sharma [this message]
2024-09-04  7:24 ` [PATCH i-g-t v3,3/3] tests/intel/kms_dsc: add new subtest Swati Sharma
2024-09-04 17:02 ` ✓ Fi.CI.BAT: success for Add dsc+bigjoiner subtest (rev3) Patchwork
2024-09-04 17:05 ` ✓ CI.xeBAT: " Patchwork
2024-09-05 14:33 ` ✗ 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=20240904072425.1022100-3-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