All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Ser <simon.ser@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: martin.peres@intel.com
Subject: [igt-dev] [PATCH i-g-t 4/5] lib/igt_eld: allow retrieving an ELD entry per monitor name
Date: Fri, 31 May 2019 14:21:59 +0300	[thread overview]
Message-ID: <20190531112200.22403-5-simon.ser@intel.com> (raw)
In-Reply-To: <20190531112200.22403-1-simon.ser@intel.com>

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).

(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);
 
-- 
2.21.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  parent reply	other threads:[~2019-05-31 11:21 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 ` Simon Ser [this message]
2019-06-03 13:04   ` [igt-dev] [PATCH i-g-t 4/5] lib/igt_eld: allow retrieving an ELD entry per monitor name Martin Peres
2019-06-03 15:10     ` Ser, Simon
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=20190531112200.22403-5-simon.ser@intel.com \
    --to=simon.ser@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=martin.peres@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.