From: "Ser, Simon" <simon.ser@intel.com>
To: "igt-dev@lists.freedesktop.org" <igt-dev@lists.freedesktop.org>,
"chris@chris-wilson.co.uk" <chris@chris-wilson.co.uk>
Subject: Re: [igt-dev] [PATCH i-g-t] lib/igt_eld: introduce eld_is_supported
Date: Thu, 12 Sep 2019 11:09:37 +0000 [thread overview]
Message-ID: <6fde8d00fcdb25a1c930f9c05465bd3422f865cd.camel@intel.com> (raw)
In-Reply-To: <156820710097.3439.15544638354081035626@skylake-alporthouse-com>
On Wed, 2019-09-11 at 14:05 +0100, Chris Wilson wrote:
> Quoting Simon Ser (2019-09-11 14:00:24)
> > We've seen cases in which /proc/asound doesn't exist (e.g. with the new SOF
> > framework). We've also seen cases in which no soundcard is exposed by ALSA (see
> > bugzilla link). In both of these cases, skipping the tests depending on ELD
> > makes more sense and makes it clearer what happens.
> >
> > Signed-off-by: Simon Ser <simon.ser@intel.com>
> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102370
> > ---
> > lib/igt_eld.c | 30 ++++++++++++++++++++++++++++++
> > lib/igt_eld.h | 1 +
> > tests/kms_chamelium.c | 2 ++
> > tests/kms_hdmi_inject.c | 2 ++
> > 4 files changed, 35 insertions(+)
> >
> > diff --git a/lib/igt_eld.c b/lib/igt_eld.c
> > index 16c4ac06c6f6..8fdc6e8e8f0b 100644
> > --- a/lib/igt_eld.c
> > +++ b/lib/igt_eld.c
> > @@ -26,6 +26,7 @@
> > #include "config.h"
> >
> > #include <dirent.h>
> > +#include <errno.h>
> > #include <stdint.h>
> > #include <stdio.h>
> > #include <string.h>
> > @@ -262,3 +263,32 @@ bool eld_has_igt(void)
> > struct eld_entry eld;
> > return eld_get_igt(&eld);
> > }
> > +
> > +/** eld_is_supported: check whether the ALSA procfs is enabled and audio cards
> > + * are found */
> > +bool eld_is_supported(void)
>
> eld? I don't see where you confirm that these sound cards could only be
> provided by hmdi/eld. So alsa_is_supported() ?
Well, hmm, indeed. We need to perform three checks here:
1. Does the ALSA driver support the ALSA procfs? (e.g. SOF doesn't,
yet)
2. Does the ALSA driver detect any card?
3. Does the ALSA driver support ELDs? (only Intel HDA supports it)
This patch only does (1) and (2). I'll send a v2 to check for (3). This
can be done by making sure some files in the sound card directory are
prefixed with "eld" (these exist even if ELDs are empty).
> > +{
> > + FILE *f;
> > + char buf[1024];
> > +
> > + f = fopen("/proc/asound/cards", "r");
> > + if (f == NULL) {
> > + if (errno == ENOENT) {
> > + igt_debug("/proc/asound doesn't exist\n");
> > + return false;
> > + }
> > + igt_assert_f(false,
> > + "Failed to open /proc/asound/cards "
> > + "(but the file exists)\n");
> > + }
> > +
> > + igt_assert_f(fgets(buf, sizeof(buf), f) != NULL,
> > + "fgets failed\n");
> > + igt_assert_f(buf[0] != '\0', "/proc/asound/cards is empty\n");
> > + fclose(f);
> > +
> > + bool has_card = strstr(buf, "no soundcards") == NULL;
>
> C99 is not yet default.
Oh, right
> Would strncmp be more succinct?
There are some little "---" around the text [1], so this wouldn't work.
[1]: https://bugs.freedesktop.org/show_bug.cgi?id=102370#c42
> Principle holds,
> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
> -Chris
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2019-09-12 11:09 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-11 13:00 [igt-dev] [PATCH i-g-t] lib/igt_eld: introduce eld_is_supported Simon Ser
2019-09-11 13:05 ` Chris Wilson
2019-09-12 11:09 ` Ser, Simon [this message]
2019-09-11 13:41 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2019-09-11 22:18 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
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=6fde8d00fcdb25a1c930f9c05465bd3422f865cd.camel@intel.com \
--to=simon.ser@intel.com \
--cc=chris@chris-wilson.co.uk \
--cc=igt-dev@lists.freedesktop.org \
/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