public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Ser, Simon" <simon.ser@intel.com>
To: "igt-dev@lists.freedesktop.org" <igt-dev@lists.freedesktop.org>,
	"martin.peres@linux.intel.com" <martin.peres@linux.intel.com>
Cc: "Peres, Martin" <martin.peres@intel.com>
Subject: Re: [igt-dev] [PATCH i-g-t 4/5] lib/igt_eld: allow retrieving an ELD entry per monitor name
Date: Mon, 3 Jun 2019 15:10:20 +0000	[thread overview]
Message-ID: <686c4b212da46bddf1fe5d0a3e0e2ae5da87a606.camel@intel.com> (raw)
In-Reply-To: <d59a97f8-b1c7-2eac-d2ac-3657fed199c9@linux.intel.com>

On Mon, 2019-06-03 at 16:04 +0300, Martin Peres wrote:
> On 31/05/2019 14:21, Simon Ser wrote:
> > The previous function eld_has_igt (1) assumed the monitor name was always "IGT"
> > and (2) didn't provide a way to access the ELD data.
> > 
> > (1) is an issue for EDIDs that don't have "IGT" as the monitor name. This is
> > the case for the Chamelium default EDID, but this will also become an issue
> > with MST where each monitor will need to have a unique name (to be able to tell
> > them apart).
> 
> I dislike the idea of not checking that the EDID has been generated by
> IGT, but I understand that you might want some freedom there.
> 
> How about checking that the monitor name STARTS with IGT.
> 
> Given that Arek is also complaining about something like in patch 5, how
> about merging 1-4, then reviewing/merging your DP patches, then
> re-spinning the last two patches of this series?

Good idea!

> Martin
> 
> > (2) makes it impossible to check ELD audio parameters.
> > 
> > This commit fixes both (1) and (2).
> > 
> > Signed-off-by: Simon Ser <simon.ser@intel.com>
> > ---
> >  lib/igt_eld.c           | 12 +++++-------
> >  lib/igt_eld.h           |  2 +-
> >  tests/kms_hdmi_inject.c |  8 +++-----
> >  3 files changed, 9 insertions(+), 13 deletions(-)
> > 
> > diff --git a/lib/igt_eld.c b/lib/igt_eld.c
> > index 732bbabd2d7c..53655c5e18f1 100644
> > --- a/lib/igt_eld.c
> > +++ b/lib/igt_eld.c
> > @@ -171,16 +171,14 @@ static bool eld_parse_entry(const char *path, struct eld_entry *eld)
> >  	return monitor_present;
> >  }
> >  
> > -/** eld_has_igt: check whether ALSA has detected the audio-capable IGT EDID by
> > - * parsing ELD entries */
> > -bool eld_has_igt(void)
> > +/** eld_from_monitor_name: retrieve an ELD entry from a monitor name */
> > +bool eld_from_monitor_name(struct eld_entry *eld, const char *monitor_name)
> >  {
> >  	DIR *dir;
> >  	struct dirent *dirent;
> >  	int i;
> >  	char card[64];
> >  	char path[PATH_MAX];
> > -	struct eld_entry eld;
> >  
> >  	for (i = 0; i < 8; i++) {
> >  		snprintf(card, sizeof(card), "/proc/asound/card%d", i);
> > @@ -195,16 +193,16 @@ bool eld_has_igt(void)
> >  
> >  			snprintf(path, sizeof(path), "%s/%s", card,
> >  				 dirent->d_name);
> > -			if (!eld_parse_entry(path, &eld)) {
> > +			if (!eld_parse_entry(path, eld)) {
> >  				continue;
> >  			}
> >  
> > -			if (!eld.valid) {
> > +			if (!eld->valid) {
> >  				igt_debug("Skipping invalid ELD: %s\n", path);
> >  				continue;
> >  			}
> >  
> > -			if (strcmp(eld.monitor_name, "IGT") == 0) {
> > +			if (strcmp(eld->monitor_name, monitor_name) == 0) {
> >  				closedir(dir);
> >  				return true;
> >  			}
> > diff --git a/lib/igt_eld.h b/lib/igt_eld.h
> > index e16187884d4b..1f34f784749b 100644
> > --- a/lib/igt_eld.h
> > +++ b/lib/igt_eld.h
> > @@ -49,6 +49,6 @@ struct eld_entry {
> >  	struct eld_sad sads[ELD_SADS_CAP];
> >  };
> >  
> > -bool eld_has_igt(void);
> > +bool eld_from_monitor_name(struct eld_entry *eld, const char *monitor_name);
> >  
> >  #endif
> > diff --git a/tests/kms_hdmi_inject.c b/tests/kms_hdmi_inject.c
> > index eba25046cead..31ddda731d7b 100644
> > --- a/tests/kms_hdmi_inject.c
> > +++ b/tests/kms_hdmi_inject.c
> > @@ -146,6 +146,7 @@ hdmi_inject_audio(int drm_fd, drmModeConnector *connector)
> >  	int fb_id, cid, ret, crtc_mask = -1;
> >  	struct igt_fb fb;
> >  	struct kmstest_connector_config config;
> > +	struct eld_entry eld;
> >  
> >  	kmstest_edid_add_audio(igt_kms_get_base_edid(), EDID_LENGTH, &edid,
> >  			       &length);
> > @@ -178,11 +179,8 @@ hdmi_inject_audio(int drm_fd, drmModeConnector *connector)
> >  
> >  	igt_assert(ret == 0);
> >  
> > -	/*
> > -	 * Test if we have /proc/asound/HDMI/eld#0.0 and is its contents are
> > -	 * valid.
> > -	 */
> > -	igt_assert(eld_has_igt());
> > +	/* Check whether ALSA has properly detected the audio-capable EDID */
> > +	igt_assert(eld_from_monitor_name(&eld, "IGT"));
> >  
> >  	igt_remove_fb(drm_fd, &fb);
> >  
> > 
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  reply	other threads:[~2019-06-03 15:10 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-31 11:21 [igt-dev] [PATCH i-g-t 0/5] Add audio EDID tests to Chamelium Simon Ser
2019-05-31 11:21 ` [igt-dev] [PATCH i-g-t 1/5] lib/igt_eld: introduce an ELD library Simon Ser
2019-06-03 12:27   ` Martin Peres
2019-05-31 11:21 ` [igt-dev] [PATCH i-g-t 2/5] lib/igt_eld: consolidate ELD parsing Simon Ser
2019-06-03 12:42   ` Martin Peres
2019-06-03 14:34     ` Ser, Simon
2019-06-04  8:02       ` Peres, Martin
2019-05-31 11:21 ` [igt-dev] [PATCH i-g-t 3/5] lib/igt_eld: parse Short Audio Descriptors Simon Ser
2019-06-03 12:57   ` Martin Peres
2019-06-03 15:06     ` Ser, Simon
2019-05-31 11:21 ` [igt-dev] [PATCH i-g-t 4/5] lib/igt_eld: allow retrieving an ELD entry per monitor name Simon Ser
2019-06-03 13:04   ` Martin Peres
2019-06-03 15:10     ` Ser, Simon [this message]
2019-05-31 11:22 ` [igt-dev] [PATCH i-g-t 5/5] tests/kms_chamelium: add an audio EDID test Simon Ser
2019-05-31 13:18   ` Arkadiusz Hiler
2019-05-31 13:25     ` Arkadiusz Hiler
2019-05-31 14:06     ` Ser, Simon
2019-06-03 12:56     ` Ser, Simon
2019-05-31 16:02 ` [igt-dev] ✓ Fi.CI.BAT: success for Add audio EDID tests to Chamelium Patchwork
2019-06-01 18:54 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2019-06-03  6:38   ` Ser, Simon
2019-06-03 12:12     ` Peres, Martin
2019-06-03 12:17 ` [igt-dev] ✓ Fi.CI.IGT: success " Patchwork
2019-06-03 13:24 ` [igt-dev] ✓ Fi.CI.BAT: success for Add audio EDID tests to Chamelium (rev2) Patchwork
2019-06-03 19:53 ` [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=686c4b212da46bddf1fe5d0a3e0e2ae5da87a606.camel@intel.com \
    --to=simon.ser@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=martin.peres@intel.com \
    --cc=martin.peres@linux.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