RE: [PATCH] lib/igt_eld: Poll for async HDA codec probe in eld_is_supported()

"B, Jeevan" <[email protected]> Thu, 30 Jul 2026 08:24:53 +0000
Newsgroups org.freedesktop.lists.igt-dev
Message-ID <DM4PR11MB6312A7B8AD9D90BB7259E73690C92@DM4PR11MB6312.namprd11.prod.outlook.com>
Patch LGTM.=20

Reviewed-by: Jeevan B <[email protected]>

> -----Original Message-----
> From: Shankar, Uma <[email protected]>
> Sent: Friday, July 17, 2026 3:21 PM
> To: [email protected]
> Cc: B, Jeevan <[email protected]>; Shankar, Uma <[email protected]>
> Subject: [PATCH] lib/igt_eld: Poll for async HDA codec probe in eld_is_su=
pported()
>=20
> 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, produ=
cing
> sporadic skips of tests such as kms_hdmi_inject@inject-audio and
> kms_chamelium_audio.
>=20
> 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 return=
s
> immediately, so there is no added cost when audio is already up.
>=20
> Assisted-by: Claude:claude-opus-4-8
> Signed-off-by: Uma Shankar <[email protected]>
> ---
>  lib/igt_eld.c | 26 +++++++++++++++++++++++---
>  1 file changed, 23 insertions(+), 3 deletions(-)
>=20
> diff --git a/lib/igt_eld.c b/lib/igt_eld.c index 6cec9abdd..4a6f867ab 100=
644
> --- a/lib/igt_eld.c
> +++ b/lib/igt_eld.c
> @@ -33,12 +33,22 @@
>  #include <stdio.h>
>  #include <string.h>
>=20
> +#include "igt_aux.h"
>  #include "igt_core.h"
>  #include "igt_eld.h"
>=20
>  #define ELD_PREFIX "eld#"
>  #define ELD_DELIM " \t"
>=20
> +/*
> + * 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 na=
me and
> @@ -266,9 +276,8 @@ bool eld_has_igt(void)
>  	return eld_get_igt(&eld);
>  }
>=20
> -/** eld_is_supported: check whether the ALSA procfs is enabled, audio ca=
rds
> - * 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 =3D {0};
>  	int ret;
> @@ -285,6 +294,17 @@ bool eld_is_supported(void)
>  	return has_elds;
>  }
>=20
> +/** 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