[PATCH i-g-t 1/5] lib/igt_kms: Add a detect timeout value
Louis Chauvet
louis.chauvet at bootlin.com
Wed Aug 28 14:31:50 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 e0edfe18f50e..6ad63ad31593 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -265,6 +265,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 dd530dbabf89..d78b239c3bd7 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
@@ -6705,3 +6706,26 @@ int get_num_scalers(igt_display_t *display, 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 25ba509164e3..e4a64cb19322 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 */
/**
@@ -1225,4 +1232,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(igt_display_t *display, enum pipe pipe);
+float igt_default_detect_timeout(void);
+
#endif /* __IGT_KMS_H__ */
--
2.44.2
More information about the igt-dev
mailing list