[PATCH i-g-t 06/12] lib/igt_kms: add function to check if retrain disabled

Kunal Joshi kunal1.joshi at intel.com
Wed Aug 7 18:25:38 UTC 2024


add helper to check if retraining is disabled,
retraining will be disable if we are at the lowest
link parameters or the lowest mode supported on a panel

Signed-off-by: Kunal Joshi <kunal1.joshi at intel.com>
---
 lib/igt_kms.c | 24 ++++++++++++++++++++++++
 lib/igt_kms.h |  1 +
 2 files changed, 25 insertions(+)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index f6ee7ab2e..1caf9df6e 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -6978,3 +6978,27 @@ void igt_force_lt_failure(int drm_fd, igt_output_t *output, int failure_count)
 			     value, sizeof(value));
 	close(dir);
 }
+
+/**
+ * igt_get_dp_link_retrain_disabled:
+ * @drm_fd: A drm file descriptor
+ * @output: Target output
+ *
+ * Returns: True if link retrain disabled, false otherwise
+ */
+bool igt_get_dp_link_retrain_disabled(int drm_fd, igt_output_t *output)
+{
+	int dir, res;
+	char buf[512];
+
+	igt_require_f(output->name, "Invalid output");
+	dir = igt_debugfs_connector_dir(drm_fd, output->name, O_RDONLY);
+	igt_assert_f(dir >= 0, "Failed to open debugfs dir for connector %s\n",
+			       igt_output_name(output));
+	res = igt_debugfs_simple_read(dir,
+				      "i915_dp_link_retrain_disabled",
+				      buf, sizeof(buf));
+	close(dir);
+	igt_require(res > 0);
+	return strstr(buf, "yes");
+}
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 43bfd4a67..39396ba40 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -1259,5 +1259,6 @@ enum dp_link_rate igt_get_dp_max_link_rate(int drm_fd, igt_output_t *output);
 enum dp_lane_count igt_get_dp_max_lane_count(int drm_fd, igt_output_t *output);
 void igt_force_link_retrain(int drm_fd, igt_output_t *output, int retrain_count);
 void igt_force_lt_failure(int drm_fd, igt_output_t *output, int failure_count);
+bool igt_get_dp_link_retrain_disabled(int drm_fd, igt_output_t *output);
 
 #endif /* __IGT_KMS_H__ */
-- 
2.43.0



More information about the Intel-gfx-trybot mailing list