Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
To: igt-dev@lists.freedesktop.org, swati2.sharma@intel.com
Cc: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
Subject: [i-g-t V3 3/4] lib/dsc: Reset DSC bpc to default on exit
Date: Mon, 18 Nov 2024 15:29:47 +0530	[thread overview]
Message-ID: <20241118095948.2017893-4-bhanuprakash.modem@intel.com> (raw)
In-Reply-To: <20241118095948.2017893-1-bhanuprakash.modem@intel.com>

Add support to force the DSC bpc to default on exit.

V2: - Minor cleanups

Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
---
 lib/igt_dsc.c                | 16 ++++++++++++++++
 lib/igt_dsc.h                |  1 +
 tests/intel/kms_dsc_helper.c | 11 ++++++++++-
 3 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/lib/igt_dsc.c b/lib/igt_dsc.c
index 229cd3298..409807b92 100644
--- a/lib/igt_dsc.c
+++ b/lib/igt_dsc.c
@@ -141,6 +141,22 @@ 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_get_dsc_bpc_debugfs_fd:
+ * @drmfd: A drm file descriptor
+ * @connector_name: Name of the libdrm connector we're going to use
+ *
+ * Returns: fd of the DSC BPC debugfs for the given connector, else returns -1.
+ */
+int igt_get_dsc_bpc_debugfs_fd(int drmfd, char *connector_name)
+{
+	char file_name[128] = {0};
+
+	sprintf(file_name, "%s/i915_dsc_bpc", connector_name);
+
+	return openat(igt_debugfs_dir(drmfd), file_name, O_WRONLY);
+}
+
 /**
  * igt_get_dsc_debugfs_fd:
  * @drmfd: A drm file descriptor
diff --git a/lib/igt_dsc.h b/lib/igt_dsc.h
index 7ab0917ec..1f3ea6920 100644
--- a/lib/igt_dsc.h
+++ b/lib/igt_dsc.h
@@ -18,6 +18,7 @@ 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);
+int igt_get_dsc_bpc_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,
diff --git a/tests/intel/kms_dsc_helper.c b/tests/intel/kms_dsc_helper.c
index 0de09b8e9..52e0469c7 100644
--- a/tests/intel/kms_dsc_helper.c
+++ b/tests/intel/kms_dsc_helper.c
@@ -8,6 +8,7 @@
 static bool force_dsc_en_orig;
 static bool force_dsc_fractional_bpp_en_orig;
 static int force_dsc_restore_fd = -1;
+static int force_dsc_bpc_restore_fd = -1;
 static int force_dsc_fractional_bpp_restore_fd = -1;
 
 void force_dsc_enable(int drmfd, igt_output_t *output)
@@ -36,6 +37,9 @@ void save_force_dsc_en(int drmfd, igt_output_t *output)
 	force_dsc_restore_fd =
 		igt_get_dsc_debugfs_fd(drmfd, output->name);
 	igt_assert_lte(0, force_dsc_restore_fd);
+	force_dsc_bpc_restore_fd =
+		igt_get_dsc_bpc_debugfs_fd(drmfd, output->name);
+	igt_assert_lte(0, force_dsc_bpc_restore_fd);
 }
 
 void restore_force_dsc_en(void)
@@ -45,9 +49,14 @@ void restore_force_dsc_en(void)
 
 	igt_debug("Restoring DSC enable\n");
 	igt_assert(write(force_dsc_restore_fd, force_dsc_en_orig ? "1" : "0", 1) == 1);
-
 	close(force_dsc_restore_fd);
+
+	igt_debug("Restoring DSC BPC enable\n");
+	igt_assert(write(force_dsc_bpc_restore_fd, "0", 1) == 1);
+	close(force_dsc_bpc_restore_fd);
+
 	force_dsc_restore_fd = -1;
+	force_dsc_bpc_restore_fd = -1;
 }
 
 void kms_dsc_exit_handler(int sig)
-- 
2.43.0


  parent reply	other threads:[~2024-11-18 10:10 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-18  9:59 [i-g-t V3 0/4] Force connector/crtc attrs to default Bhanuprakash Modem
2024-11-18  9:59 ` [i-g-t V3 1/4] lib/igt_kms: Add infra to handle crtc arbitrary attributes Bhanuprakash Modem
2024-11-18  9:59 ` [i-g-t V3 2/4] lib/drrs: Add support to force drrs to default on exit Bhanuprakash Modem
2024-11-18  9:59 ` Bhanuprakash Modem [this message]
2024-11-18  9:59 ` [i-g-t V3 4/4] lib/igt_kms: Reset spurious hpd " Bhanuprakash Modem
2024-11-18 23:15 ` ✗ Fi.CI.BAT: failure for Force connector/crtc attrs to default (rev4) Patchwork
2024-11-18 23:15 ` ✓ CI.xeBAT: success " Patchwork
2024-11-19  9:42 ` ✗ CI.xeFULL: failure " Patchwork
2024-11-19 21:07 ` ✓ CI.xeBAT: success for Force connector/crtc attrs to default (rev5) Patchwork
2024-11-19 21:26 ` ✗ GitLab.Pipeline: warning " Patchwork
2024-11-19 21:39 ` ✓ Fi.CI.BAT: success " Patchwork
2024-11-20  9:04 ` ✗ CI.xeFULL: failure " Patchwork
2024-11-21 18:57 ` ✗ i915.CI.Full: " 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=20241118095948.2017893-4-bhanuprakash.modem@intel.com \
    --to=bhanuprakash.modem@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=swati2.sharma@intel.com \
    /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