Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] lib/igt_eld: Poll for async HDA codec probe in eld_is_supported()
@ 2026-07-17  9:51 Uma Shankar
  2026-07-17 12:01 ` ✓ Xe.CI.BAT: success for " Patchwork
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Uma Shankar @ 2026-07-17  9:51 UTC (permalink / raw)
  To: igt-dev; +Cc: jeevan.b, Uma Shankar

The ALSA HDA HDMI/DP codec enumerates and creates its eld# procfs nodes
asynchronously with respect to the graphics driver load and the
i915/xe <-> snd_hda_intel audio-component binding. When eld_is_supported()
is queried before that probe completes (e.g. shortly after boot or a driver
reload), the glob for /proc/asound/card*/eld#* returns no match and the
caller skips, producing sporadic skips of tests such as
kms_hdmi_inject@inject-audio and kms_chamelium_audio.

Split the glob check into eld_has_nodes() and poll it via igt_wait() for a
bounded 2s before giving up. The common case where the nodes already exist
returns immediately, so there is no added cost when audio is already up.

Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Uma Shankar <uma.shankar@intel.com>
---
 lib/igt_eld.c | 26 +++++++++++++++++++++++---
 1 file changed, 23 insertions(+), 3 deletions(-)

diff --git a/lib/igt_eld.c b/lib/igt_eld.c
index 6cec9abdd..4a6f867ab 100644
--- a/lib/igt_eld.c
+++ b/lib/igt_eld.c
@@ -33,12 +33,22 @@
 #include <stdio.h>
 #include <string.h>
 
+#include "igt_aux.h"
 #include "igt_core.h"
 #include "igt_eld.h"
 
 #define ELD_PREFIX "eld#"
 #define ELD_DELIM " \t"
 
+/*
+ * The ALSA HDA HDMI/DP codec enumerates and creates its eld# procfs nodes
+ * asynchronously with respect to the graphics driver load and the
+ * i915/xe <-> snd_hda_intel audio-component binding. Poll for a short while
+ * so a not-yet-probed codec doesn't cause a spurious skip.
+ */
+#define ELD_SUPPORTED_TIMEOUT_MS 2000
+#define ELD_SUPPORTED_INTERVAL_MS 100
+
 /**
  * EDID-Like Data (ELD) is metadata parsed and exposed by ALSA for HDMI and
  * DisplayPort connectors supporting audio. This includes the monitor name and
@@ -266,9 +276,8 @@ bool eld_has_igt(void)
 	return eld_get_igt(&eld);
 }
 
-/** eld_is_supported: check whether the ALSA procfs is enabled, audio cards
- * are found and ELDs are supported */
-bool eld_is_supported(void)
+/* eld_has_nodes: check whether any ALSA eld# procfs node exists */
+static bool eld_has_nodes(void)
 {
 	glob_t glob_buf = {0};
 	int ret;
@@ -285,6 +294,17 @@ bool eld_is_supported(void)
 	return has_elds;
 }
 
+/** eld_is_supported: check whether the ALSA procfs is enabled, audio cards
+ * are found and ELDs are supported.
+ *
+ * The eld# nodes are created asynchronously by the HDA HDMI codec, so poll
+ * for a bounded amount of time before giving up to avoid spurious skips. */
+bool eld_is_supported(void)
+{
+	return igt_wait(eld_has_nodes(), ELD_SUPPORTED_TIMEOUT_MS,
+			ELD_SUPPORTED_INTERVAL_MS);
+}
+
 #define ELD_MAX_SIZE 256
 #define MONITOR_NAME_OFFSET 20
 #define MONITOR_NAME_MAX_SIZE 16
-- 
2.50.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-07-30  8:25 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-17  9:51 [PATCH] lib/igt_eld: Poll for async HDA codec probe in eld_is_supported() Uma Shankar
2026-07-17 12:01 ` ✓ Xe.CI.BAT: success for " Patchwork
2026-07-17 12:10 ` ✗ i915.CI.BAT: failure " Patchwork
2026-07-17 17:33 ` ✓ Xe.CI.FULL: success " Patchwork
2026-07-21  0:17 ` ✓ Xe.CI.BAT: success for lib/igt_eld: Poll for async HDA codec probe in eld_is_supported() (rev2) Patchwork
2026-07-21  0:24 ` ✓ i915.CI.BAT: " Patchwork
2026-07-21  7:43 ` ✓ Xe.CI.FULL: " Patchwork
2026-07-21 11:16 ` ✓ i915.CI.Full: " Patchwork
2026-07-30  8:24 ` [PATCH] lib/igt_eld: Poll for async HDA codec probe in eld_is_supported() B, Jeevan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox