Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Uma Shankar <uma.shankar@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: jeevan.b@intel.com, Uma Shankar <uma.shankar@intel.com>
Subject: [PATCH] lib/igt_eld: Poll for async HDA codec probe in eld_is_supported()
Date: Fri, 17 Jul 2026 15:21:10 +0530	[thread overview]
Message-ID: <20260717095110.4193078-1-uma.shankar@intel.com> (raw)

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


             reply	other threads:[~2026-07-17  9:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-17  9:51 Uma Shankar [this message]
2026-07-17 12:01 ` ✓ Xe.CI.BAT: success for lib/igt_eld: Poll for async HDA codec probe in eld_is_supported() 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260717095110.4193078-1-uma.shankar@intel.com \
    --to=uma.shankar@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=jeevan.b@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox