[PATCH i-g-t v2 01/39] lib/igt_kms: Add a detect timeout value
Louis Chauvet
louis.chauvet at bootlin.com
Tue Jul 9 15:34:17 UTC 2024
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 | 3 +++
lib/igt_kms.c | 24 ++++++++++++++++++++++++
lib/igt_kms.h | 9 +++++++++
3 files changed, 36 insertions(+)
diff --git a/lib/igt_core.c b/lib/igt_core.c
index 3ff3e0392316..5f5adb553629 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -260,6 +260,9 @@
* # 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)
+ * DetectTimeout=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 64318ef7fb15..4877da4c6c9d 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -57,6 +57,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
@@ -6662,3 +6663,26 @@ int get_num_scalers(int drm_fd, enum pipe pipe)
return num_scalers;
}
+
+/**
+ * igt_default_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.
+ */
+float igt_default_detect_timeout(void)
+{
+ static double timeout = 0.0;
+ static bool first_call = true;
+
+ if (first_call) {
+ if (igt_key_file)
+ timeout = g_key_file_get_double(igt_key_file, "DUT", "DetectTimeout", NULL);
+ else
+ timeout = DEFAULT_DETECT_TIMEOUT;
+
+ first_call = false;
+ }
+
+ return timeout;
+}
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 501d48763fb6..f89e1be86b30 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -39,6 +39,13 @@
#include "igt_fb.h"
#include "ioctl_wrappers.h"
+/**
+ * define DEFAULT_DETECT_TIMEOUT - Default timeout used for some 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 */
/**
@@ -1224,4 +1231,6 @@ bool igt_check_output_is_dp_mst(igt_output_t *output);
int igt_get_dp_mst_connector_id(igt_output_t *output);
int get_num_scalers(int drm_fd, enum pipe pipe);
+float igt_default_detect_timeout(void);
+
#endif /* __IGT_KMS_H__ */
--
2.44.2
More information about the igt-dev
mailing list