[PATCH i-g-t 1/6] lib/igt_kms: New helper to check force joiner status
Bhanuprakash Modem
bhanuprakash.modem at intel.com
Wed Apr 17 14:33:20 UTC 2024
Add a new function to check the force joiner status
on selected connecter, so that it would be helpful to
check the force joiner status from other places too.
Cc: Kunal Joshi <kunal1.joshi at intel.com>
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem at intel.com>
---
lib/igt_kms.c | 30 ++++++++++++++++++++++++++++++
lib/igt_kms.h | 1 +
2 files changed, 31 insertions(+)
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 3216fe7e4..5271010be 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -6283,6 +6283,36 @@ bool igt_force_and_check_bigjoiner_status(int drmfd, char *connector_name, bool
strstr(buf, "N");
}
+/**
+ * igt_check_force_joiner_status
+ * @drmfd: file descriptor of the DRM device.
+ * @connector_name: connector to check.
+ *
+ * Checks if the force big joiner is enabled.
+ *
+ * Returns: True if the force big joiner is enabled, False otherwise.
+ */
+bool igt_check_force_joiner_status(int drmfd, char *connector_name)
+{
+ char buf[512];
+ int debugfs_fd, ret;
+
+ if (!connector_name)
+ return false;
+
+ debugfs_fd = igt_debugfs_connector_dir(drmfd, connector_name, O_RDONLY);
+ if (debugfs_fd < 0)
+ return false;
+
+ ret = igt_debugfs_simple_read(debugfs_fd, "i915_bigjoiner_force_enable", buf, sizeof(buf));
+ close(debugfs_fd);
+
+ if (ret < 0)
+ return false;
+
+ return strstr(buf, "Y");
+}
+
/**
* igt_check_bigjoiner_support:
* @display: a pointer to an #igt_display_t structure
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 6d13e5851..b8f7c745b 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -1216,6 +1216,7 @@ bool bigjoiner_mode_found(int drm_fd, drmModeConnector *connector,
int max_dotclock, drmModeModeInfo *mode);
bool igt_has_force_joiner_debugfs(int drmfd, igt_output_t *output);
bool igt_force_and_check_bigjoiner_status(int drmfd, char *connector_name, bool enable);
+bool igt_check_force_joiner_status(int drmfd, char *connector_name);
bool igt_check_bigjoiner_support(igt_display_t *display);
bool igt_parse_mode_string(const char *mode_string, drmModeModeInfo *mode);
bool intel_pipe_output_combo_valid(igt_display_t *display);
--
2.43.2
More information about the igt-dev
mailing list