[PATCH i-g-t 5/9] lib/igt_kms: add igt_reset_connectors_debugfs
Kunal Joshi
kunal1.joshi at intel.com
Wed Apr 10 06:44:22 UTC 2024
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 at linux.intel.com>
Cc: Ankit Nautiyal <ankit.k.nautiyal at intel.com>
Cc: Bhanuprakash Modem <bhanuprakash.modem at intel.com>
Cc: Karthik B S <karthik.b.s at intel.com>
Signed-off-by: Kunal Joshi <kunal1.joshi at 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
More information about the igt-dev
mailing list