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] lib/igt_kms: generate an EDID suitable for DP audio
Date: Tue, 4 Jun 2019 15:19:23 +0300 [thread overview]
Message-ID: <20190604121923.9298-1-simon.ser@intel.com> (raw)
Prior to this commit, we were using the Chamelium's default EDID for DP audio.
This relies on the fact that this EDID supports audio and has correct audio
paremeters for our testing.
Generating our own EDID is less error-prone and will allow us to test different
audio parameters.
Signed-off-by: Simon Ser <simon.ser@intel.com>
---
lib/igt_kms.c | 44 +++++++++++++++++++++++++++++++++++--------
lib/igt_kms.h | 2 ++
tests/kms_chamelium.c | 7 +++++--
3 files changed, 43 insertions(+), 10 deletions(-)
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index d7d711a72d27..55c48a3776f2 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -183,9 +183,9 @@ const unsigned char *igt_kms_get_alt_edid(void)
}
static void
-generate_hdmi_audio_edid(unsigned char raw_edid[static HDMI_AUDIO_EDID_LENGTH],
- struct cea_sad *sad,
- struct cea_speaker_alloc *speaker_alloc)
+generate_audio_edid(unsigned char raw_edid[static HDMI_AUDIO_EDID_LENGTH],
+ bool with_vsd, struct cea_sad *sad,
+ struct cea_speaker_alloc *speaker_alloc)
{
struct edid *edid;
struct edid_ext *edid_ext;
@@ -210,10 +210,12 @@ generate_hdmi_audio_edid(unsigned char raw_edid[static HDMI_AUDIO_EDID_LENGTH],
cea_data_size += edid_cea_data_block_set_sad(block, sad, 1);
/* A Vendor Specific Data block is needed for HDMI audio */
- block = (struct edid_cea_data_block *) &cea_data[cea_data_size];
- vsd = cea_vsd_get_hdmi_default(&vsd_size);
- cea_data_size += edid_cea_data_block_set_vsd(block, vsd,
- vsd_size);
+ if (with_vsd) {
+ block = (struct edid_cea_data_block *) &cea_data[cea_data_size];
+ vsd = cea_vsd_get_hdmi_default(&vsd_size);
+ cea_data_size += edid_cea_data_block_set_vsd(block, vsd,
+ vsd_size);
+ }
/* Speaker Allocation Data block */
block = (struct edid_cea_data_block *) &cea_data[cea_data_size];
@@ -250,7 +252,33 @@ const unsigned char *igt_kms_get_hdmi_audio_edid(void)
/* Initialize the Speaker Allocation Data */
speaker_alloc.speakers = CEA_SPEAKER_FRONT_LEFT_RIGHT_CENTER;
- generate_hdmi_audio_edid(raw_edid, &sad, &speaker_alloc);
+ generate_audio_edid(raw_edid, true, &sad, &speaker_alloc);
+
+ return raw_edid;
+}
+
+const unsigned char *igt_kms_get_dp_audio_edid(void)
+{
+ int channels;
+ uint8_t sampling_rates, sample_sizes;
+ static unsigned char raw_edid[DP_AUDIO_EDID_LENGTH] = {0};
+ struct cea_sad sad = {0};
+ struct cea_speaker_alloc speaker_alloc = {0};
+
+ /* Initialize the Short Audio Descriptor for PCM */
+ channels = 2;
+ sampling_rates = CEA_SAD_SAMPLING_RATE_32KHZ |
+ CEA_SAD_SAMPLING_RATE_44KHZ |
+ CEA_SAD_SAMPLING_RATE_48KHZ;
+ sample_sizes = CEA_SAD_SAMPLE_SIZE_16 |
+ CEA_SAD_SAMPLE_SIZE_20 |
+ CEA_SAD_SAMPLE_SIZE_24;
+ cea_sad_init_pcm(&sad, channels, sampling_rates, sample_sizes);
+
+ /* Initialize the Speaker Allocation Data */
+ speaker_alloc.speakers = CEA_SPEAKER_FRONT_LEFT_RIGHT_CENTER;
+
+ generate_audio_edid(raw_edid, false, &sad, &speaker_alloc);
return raw_edid;
}
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 4ac28131b6d9..125d743fe7f5 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -758,9 +758,11 @@ struct cea_speaker_alloc;
#define EDID_LENGTH 128
#define HDMI_AUDIO_EDID_LENGTH (2 * EDID_LENGTH)
+#define DP_AUDIO_EDID_LENGTH (2 * EDID_LENGTH)
const unsigned char *igt_kms_get_base_edid(void);
const unsigned char *igt_kms_get_alt_edid(void);
const unsigned char *igt_kms_get_hdmi_audio_edid(void);
+const unsigned char *igt_kms_get_dp_audio_edid(void);
struct udev_monitor *igt_watch_hotplug(void);
bool igt_hotplug_detected(struct udev_monitor *mon,
diff --git a/tests/kms_chamelium.c b/tests/kms_chamelium.c
index 52e3f0953621..18fa3be60617 100644
--- a/tests/kms_chamelium.c
+++ b/tests/kms_chamelium.c
@@ -39,6 +39,7 @@ enum test_edid {
TEST_EDID_BASE,
TEST_EDID_ALT,
TEST_EDID_HDMI_AUDIO,
+ TEST_EDID_DP_AUDIO,
};
typedef struct {
@@ -49,7 +50,7 @@ typedef struct {
int drm_fd;
- int edids[4];
+ int edids[5];
} data_t;
#define HOTPLUG_TIMEOUT 20 /* seconds */
@@ -1997,6 +1998,8 @@ static const unsigned char *get_edid(enum test_edid edid)
return igt_kms_get_alt_edid();
case TEST_EDID_HDMI_AUDIO:
return igt_kms_get_hdmi_audio_edid();
+ case TEST_EDID_DP_AUDIO:
+ return igt_kms_get_dp_audio_edid();
}
assert(0); /* unreachable */
}
@@ -2113,7 +2116,7 @@ igt_main
* Use the Chamelium's default EDID for DP audio. */
connector_subtest("dp-audio", DisplayPort)
test_display_audio(&data, port, "HDMI",
- TEST_EDID_CHAMELIUM_DEFAULT);
+ TEST_EDID_DP_AUDIO);
}
igt_subtest_group {
--
2.21.0
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next reply other threads:[~2019-06-04 12:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-04 12:19 Simon Ser [this message]
2019-06-04 14:18 ` [igt-dev] ✓ Fi.CI.BAT: success for lib/igt_kms: generate an EDID suitable for DP audio Patchwork
2019-06-05 5:15 ` [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=20190604121923.9298-1-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox