From: Kunal Joshi <kunal1.joshi@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: "Kunal Joshi" <kunal1.joshi@intel.com>,
"Ville Syrjälä" <ville.syrjala@linux.intel.com>,
"Ankit Nautiyal" <ankit.k.nautiyal@intel.com>,
"Bhanuprakash Modem" <bhanuprakash.modem@intel.com>,
"Karthik B S" <karthik.b.s@intel.com>
Subject: [PATCH i-g-t 5/9] lib/igt_kms: add igt_reset_connectors_debugfs
Date: Wed, 10 Apr 2024 12:14:22 +0530 [thread overview]
Message-ID: <20240410064426.1968399-6-kunal1.joshi@intel.com> (raw)
In-Reply-To: <20240410064426.1968399-1-kunal1.joshi@intel.com>
add igt_reset_connectors_debugfs to clean the state
along with some helpers to get debugfs attribute and default value
to set.
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Cc: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
Cc: Karthik B S <karthik.b.s@intel.com>
Signed-off-by: Kunal Joshi <kunal1.joshi@intel.com>
---
lib/igt_kms.c | 38 ++++++++++++++++++++++++++++++++++++++
lib/igt_kms.h | 11 +++++++++++
2 files changed, 49 insertions(+)
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index dac822c7a..18605531b 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -1495,6 +1495,26 @@ int igt_connector_sysfs_open(int drm_fd,
return conn_dir;
}
+static const char *get_debugfs_default_value(enum kmstest_force_debugfs debugfs)
+{
+ switch (debugfs) {
+ case FORCE_JOINER:
+ return "0";
+ default:
+ return "0";
+ }
+}
+
+static const char *get_debugfs_default_attr(enum kmstest_force_debugfs debugfs)
+{
+ switch (debugfs) {
+ case FORCE_JOINER:
+ return "i915_bigjoiner_force_enable";
+ default:
+ return "0";
+ }
+}
+
static bool connector_is_forced(int idx, drmModeConnector *connector, enum kmstest_force_type type)
{
struct forced_connector *connectors;
@@ -5320,6 +5340,24 @@ void igt_reset_connectors(void)
igt_sysfs_set(forced_connectors[i].dir, "status", "detect");
}
+/**
+ * igt_reset_connectors_debugfs:
+ *
+ * Remove any forced state from the connectors debugfs.
+ */
+void igt_reset_connectors_debugfs(void)
+{
+ /*
+ * reset the connectors debugfs avoiding any
+ * functions that are not safe to call in signal handlers
+ */
+ for (int i = FORCE_JOINER; i < FORCE_DEBUGFS_MAX; i++)
+ for (int j = 0; j < forced_connectors_debugfs[j].connector_type; j++)
+ igt_sysfs_set(forced_connectors_debugfs[i].dir,
+ get_debugfs_default_attr(i),
+ get_debugfs_default_value(i));
+}
+
/**
* igt_watch_uevents:
*
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 561edf98b..f676de737 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -256,6 +256,16 @@ enum kmstest_force_type {
FORCED_CONNECTOR_MAX
};
+/**
+ * kmstest_force_type:
+ * @FORCED_CONNECTOR: Uses sysfs
+ * @FORCED_CONNECTOR_DEBUGFS: Uses debugfs
+*/
+enum kmstest_force_debugfs {
+ FORCE_JOINER,
+ FORCE_DEBUGFS_MAX
+};
+
/**
* intel_broadcast_rgb_mode:
* @BROADCAST_RGB_AUTO: Choose the color range to use automatically
@@ -1094,6 +1104,7 @@ void igt_pipe_refresh(igt_display_t *display, enum pipe pipe, bool force);
void igt_enable_connectors(int drm_fd);
void igt_reset_connectors(void);
+void igt_reset_connectors_debugfs(void);
uint32_t kmstest_get_vbl_flag(int crtc_offset);
--
2.34.1
next prev parent reply other threads:[~2024-04-10 6:33 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-10 6:44 [PATCH i-g-t 0/9] enhancements for forcing debugfs of connector Kunal Joshi
2024-04-10 6:44 ` [PATCH i-g-t 1/9] lib/igt_kms: Refacror forced_connector struct Kunal Joshi
2024-04-10 6:44 ` [PATCH i-g-t 2/9] lib/igt_kms: add forced_connectors_debugfs array Kunal Joshi
2024-04-10 6:44 ` [PATCH i-g-t 3/9] lib/igt_kms: add enum kmstest_force_type Kunal Joshi
2024-04-10 6:44 ` [PATCH i-g-t 4/9] lib/igt_kms: refactor helpers forced_connectors helpers Kunal Joshi
2024-04-10 6:44 ` Kunal Joshi [this message]
2024-04-10 6:44 ` [PATCH i-g-t 6/9] lib/igt_kms: add exit handler function to clear force debugfs state Kunal Joshi
2024-04-10 6:44 ` [PATCH i-g-t 7/9] lib/igt_kms: add kmstest_force_connector_debugfs Kunal Joshi
2024-04-10 6:44 ` [PATCH i-g-t 8/9] tests/intel/km_big_joiner: use kmstest_force_connector_debugfs for better cleanup functionality Kunal Joshi
2024-04-10 6:44 ` [PATCH i-g-t 9/9] lib/igt_kms: remove unused igt_force_and_check_bigjoiner_status Kunal Joshi
2024-04-10 6:54 ` ✗ GitLab.Pipeline: warning for enhancements for forcing debugfs of connector Patchwork
2024-04-10 7:20 ` ✓ CI.xeBAT: success " Patchwork
2024-04-10 7:26 ` ✗ Fi.CI.BAT: failure " Patchwork
2024-04-10 15:03 ` [PATCH i-g-t 0/9] " Ville Syrjälä
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=20240410064426.1968399-6-kunal1.joshi@intel.com \
--to=kunal1.joshi@intel.com \
--cc=ankit.k.nautiyal@intel.com \
--cc=bhanuprakash.modem@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=karthik.b.s@intel.com \
--cc=ville.syrjala@linux.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