[PATCH i-g-t v3 01/29] lib/igt_kms: Add a detect timeout value
Louis Chauvet
louis.chauvet at bootlin.com
Sat Aug 23 02:11:21 UTC 2025
Some tests need to wait for a specific connector status. In order to make
the timeout customisable for each target, add an option in the
configuration file.
Signed-off-by: Louis Chauvet <louis.chauvet at bootlin.com>
---
lib/igt_core.c | 4 ++++
lib/igt_kms.c | 34 ++++++++++++++++++++++++++++++++++
lib/igt_kms.h | 10 ++++++++++
3 files changed, 48 insertions(+)
diff --git a/lib/igt_core.c b/lib/igt_core.c
index 4477cfef157a26d33552a2dd9209c130bb26afb8..1f4b4c256e64e87712e5f20dfb02adf56e2d6e02 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -271,6 +271,10 @@
* # It is not mandatory and allows overriding default values.
* [DUT]
* SuspendResumeDelay=10
+ *
+ * # The following option define the timeout for detection feature
+ * # (waiting for a connector status)
+ * DisplayDetectTimeout=10.0
* ]|
*
* Some specific configuration options may be used by specific parts of IGT,
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index d240c7ac5bdaae6b30281a701f437252ae84ca55..11e957171a1000889601d56b2c12af9d3d95f754 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -59,6 +59,7 @@
#include "intel_chipset.h"
#include "igt_debugfs.h"
#include "igt_device.h"
+#include "igt_rc.h"
#include "igt_sysfs.h"
#include "sw_sync.h"
#ifdef HAVE_CHAMELIUM
@@ -7538,3 +7539,36 @@ uint32_t igt_get_connected_output_count(igt_display_t *display)
}
return conn_outputs;
}
+/**
+ * igt_default_display_detect_timeout:
+ *
+ * Get the default timeout value for detection feature
+ *
+ * Some tests requires to wait for a specific connector status. This value will determine the
+ * timeout value for this waiting.
+ */
+double igt_default_display_detect_timeout(void)
+{
+ static double timeout = 0.0;
+ static bool first_call = true;
+ GError *error = NULL;
+
+ if (first_call) {
+ if (igt_key_file) {
+ timeout = g_key_file_get_double(igt_key_file, "DUT", "DisplayDetectTimeout",
+ &error);
+ if (error) {
+ igt_debug("Failed to read DisplayDetectTimeout, defaulting to %f\n",
+ DEFAULT_DETECT_TIMEOUT);
+ g_clear_error(&error);
+ timeout = DEFAULT_DETECT_TIMEOUT;
+ }
+ } else {
+ timeout = DEFAULT_DETECT_TIMEOUT;
+ }
+
+ first_call = false;
+ }
+
+ return timeout;
+}
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 6ef6871d5a97c7beecb364453bb2ffdfc3c5c6e9..83d1ed427cdf39875a8f9db48b17eb20978ebfc2 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -40,6 +40,14 @@
#include "igt_fb.h"
#include "ioctl_wrappers.h"
+/**
+ * define DEFAULT_DETECT_TIMEOUT - Default timeout in second used for some screen detection
+ * functions
+ *
+ * It can be overiden by option DetectTimeout in the .igtrc file.
+ */
+#define DEFAULT_DETECT_TIMEOUT 10.0
+
/* Low-level helpers with kmstest_ prefix */
/**
@@ -1289,4 +1297,6 @@ uint32_t igt_get_connected_output_count(igt_display_t *display);
drmModePropertyBlobRes *igt_get_writeback_formats_blob(igt_output_t *output);
+double igt_default_display_detect_timeout(void);
+
#endif /* __IGT_KMS_H__ */
--
2.50.1
More information about the igt-dev
mailing list