[PATCH i-g-t v2 01/26] lib/igt_kms: Add a detect timeout value
Louis Chauvet
louis.chauvet at bootlin.com
Thu Jul 17 18:46: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 | 35 +++++++++++++++++++++++++++++++++++
lib/igt_kms.h | 10 ++++++++++
3 files changed, 49 insertions(+)
diff --git a/lib/igt_core.c b/lib/igt_core.c
index c2674a27203cbbe5413cb579153dbeed105621bc..3bafaf971c4c9f0fe8718cab261464c0f4477d3f 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 9ee03e87092716841a91322d38da8023aaaae611..d0dcce5d008eb0e1953a2b60a6670c98562ba7a1 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
@@ -7472,3 +7473,37 @@ int igt_backlight_write(int value, const char *fname, igt_backlight_context_t *c
return 0;
}
+
+/**
+ * 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 a85fee515f56206d14394682f878e84cde62a758..e39745b0a68cbac4bd57c4c4ceae82a64cfab5a9 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 */
/**
@@ -1281,4 +1289,6 @@ void igt_set_link_params(int drm_fd, igt_output_t *output,
int igt_backlight_read(int *result, const char *fname, igt_backlight_context_t *context);
int igt_backlight_write(int value, const char *fname, igt_backlight_context_t *context);
+double igt_default_display_detect_timeout(void);
+
#endif /* __IGT_KMS_H__ */
--
2.50.0
More information about the igt-dev
mailing list