From: Simon Ser <simon.ser@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t v4 3/9] lib/igt_edid: add support for Vendor Specific Data blocks
Date: Wed, 15 May 2019 10:29:16 +0300 [thread overview]
Message-ID: <20190515072922.30768-4-simon.ser@intel.com> (raw)
In-Reply-To: <20190515072922.30768-1-simon.ser@intel.com>
For some reason HDMI audio won't work unless you cast a magic IEEE Registration
Identifier alongside with its appropriate Components of Source Physical
Address. The easiest way to do this is to capture a wild HDMI EDID, study it,
and blindly copy bytes because you don't understand anything about their
possible meaning (if any).
This commit also changes the SAD API exposed by igt_edid, to allow for both a
SAD block and a VSD block to be included in the same CEA block.
Signed-off-by: Simon Ser <simon.ser@intel.com>
Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
---
lib/igt_edid.c | 72 +++++++++++++++++++++++++++++++++++++++-----------
lib/igt_edid.h | 23 ++++++++++++++--
2 files changed, 78 insertions(+), 17 deletions(-)
diff --git a/lib/igt_edid.c b/lib/igt_edid.c
index d01defb0925e..fbdb0c06b8d7 100644
--- a/lib/igt_edid.c
+++ b/lib/igt_edid.c
@@ -292,30 +292,72 @@ void cea_sad_init_pcm(struct cea_sad *sad, int channels,
}
/**
- * edid_ext_set_cea_sad: set an extension block to be CEA SAD
+ * cea_vsd_get_hdmi_default:
+ *
+ * Returns the default Vendor Specific Data block for HDMI.
*/
-void edid_ext_set_cea_sad(struct edid_ext *ext, const struct cea_sad *sads,
- size_t sads_len)
+const struct cea_vsd *cea_vsd_get_hdmi_default(size_t *size)
{
- struct edid_cea *cea = &ext->data.cea;
- struct edid_cea_data_block *data_block;
- size_t sads_size, data_block_size;
+ static char raw[sizeof(struct cea_vsd) + 4] = {0};
+ struct cea_vsd *vsd;
+
+ *size = sizeof(raw);
+
+ /* Magic incantation. Works better if you orient your screen in the
+ * direction of the VESA headquarters. */
+ vsd = (struct cea_vsd *) raw;
+ vsd->ieee_oui[0] = 0x03;
+ vsd->ieee_oui[1] = 0x0C;
+ vsd->ieee_oui[2] = 0x00;
+ vsd->data[0] = 0x10;
+ vsd->data[1] = 0x00;
+ vsd->data[2] = 0x38;
+ vsd->data[3] = 0x2D;
+
+ return vsd;
+}
+
+static void edid_cea_data_block_init(struct edid_cea_data_block *block,
+ enum edid_cea_data_type type, size_t size)
+{
+ assert(size <= 0xFF);
+ block->type_len = type << 5 | size;
+}
- memset(ext, 0, sizeof(struct edid_ext));
+size_t edid_cea_data_block_set_sad(struct edid_cea_data_block *block,
+ const struct cea_sad *sads, size_t sads_len)
+{
+ size_t sads_size;
sads_size = sizeof(struct cea_sad) * sads_len;
- data_block_size = sizeof(struct edid_cea_data_block) + sads_size;
+ edid_cea_data_block_init(block, EDID_CEA_DATA_AUDIO, sads_size);
+
+ memcpy(block->data.sads, sads, sads_size);
+
+ return sizeof(struct edid_cea_data_block) + sads_size;
+}
+
+size_t edid_cea_data_block_set_vsd(struct edid_cea_data_block *block,
+ const struct cea_vsd *vsd, size_t vsd_size)
+{
+ edid_cea_data_block_init(block, EDID_CEA_DATA_VENDOR_SPECIFIC,
+ vsd_size);
+
+ memcpy(block->data.vsds, vsd, vsd_size);
+
+ return sizeof(struct edid_cea_data_block) + vsd_size;
+}
+
+void edid_ext_set_cea(struct edid_ext *ext, size_t data_blocks_size,
+ uint8_t flags)
+{
+ struct edid_cea *cea = &ext->data.cea;
ext->tag = EDID_EXT_CEA;
cea->revision = 3;
- cea->dtd_start = 4 + data_block_size;
- cea->misc = 1 << 6; /* basic audio, no DTD */
-
- assert(sads_size <= 0xFF);
- data_block = (struct edid_cea_data_block *) cea->data;
- data_block->type_len = EDID_CEA_DATA_AUDIO << 5 | sads_size;
- memcpy(data_block->data.sads, sads, sads_size);
+ cea->dtd_start = 4 + data_blocks_size;
+ cea->misc = flags; /* just flags, no DTD */
}
void edid_ext_update_cea_checksum(struct edid_ext *ext)
diff --git a/lib/igt_edid.h b/lib/igt_edid.h
index 3668d733f06a..7edd7e38f41e 100644
--- a/lib/igt_edid.h
+++ b/lib/igt_edid.h
@@ -189,6 +189,12 @@ struct cea_sad {
uint8_t bitrate;
} __attribute__((packed));
+/* Vendor Specific Data */
+struct cea_vsd {
+ uint8_t ieee_oui[3];
+ char data[];
+};
+
enum edid_cea_data_type {
EDID_CEA_DATA_AUDIO = 1,
EDID_CEA_DATA_VIDEO = 2,
@@ -200,9 +206,17 @@ struct edid_cea_data_block {
uint8_t type_len; /* type is from enum edid_cea_data_type */
union {
struct cea_sad sads[0];
+ struct cea_vsd vsds[0];
} data;
} __attribute__((packed));
+enum edid_cea_flag {
+ EDID_CEA_YCBCR422 = 1 << 4,
+ EDID_CEA_YCBCR444 = 1 << 5,
+ EDID_CEA_BASIC_AUDIO = 1 << 6,
+ EDID_CEA_UNDERSCAN = 1 << 7,
+};
+
struct edid_cea {
uint8_t revision;
uint8_t dtd_start;
@@ -275,8 +289,13 @@ void detailed_timing_set_string(struct detailed_timing *dt,
void cea_sad_init_pcm(struct cea_sad *sad, int channels,
uint8_t sampling_rates, uint8_t sample_sizes);
-void edid_ext_set_cea_sad(struct edid_ext *ext, const struct cea_sad *sads,
- size_t sads_len);
void edid_ext_update_cea_checksum(struct edid_ext *ext);
+const struct cea_vsd *cea_vsd_get_hdmi_default(size_t *size);
+size_t edid_cea_data_block_set_sad(struct edid_cea_data_block *block,
+ const struct cea_sad *sads, size_t sads_len);
+size_t edid_cea_data_block_set_vsd(struct edid_cea_data_block *block,
+ const struct cea_vsd *vsd, size_t vsd_size);
+void edid_ext_set_cea(struct edid_ext *ext, size_t data_blocks_size,
+ uint8_t flags);
#endif
--
2.21.0
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2019-05-15 7:29 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-15 7:29 [igt-dev] [PATCH i-g-t v4 0/9] tests/kms_chamelium: add HDMI audio test Simon Ser
2019-05-15 7:29 ` [igt-dev] [PATCH i-g-t v4 1/9] tests/kms_chamelium: skip if GetAudioFormat is not supported Simon Ser
2019-05-16 7:27 ` [igt-dev] [PATCH i-g-t v5] " Simon Ser
2019-05-16 8:30 ` Arkadiusz Hiler
2019-05-15 7:29 ` [igt-dev] [PATCH i-g-t v4 2/9] lib/igt_edid: add support for Short Audio Descriptors Simon Ser
2019-05-15 7:29 ` Simon Ser [this message]
2019-05-15 7:29 ` [igt-dev] [PATCH i-g-t v4 4/9] lib/igt_chamelium: add CHAMELIUM_DEFAULT_EDID Simon Ser
2019-05-15 7:29 ` [igt-dev] [PATCH i-g-t v4 5/9] tests/kms_chamelium: generate an EDID with audio support Simon Ser
2019-05-15 7:29 ` [igt-dev] [PATCH i-g-t v4 6/9] tests/kms_chamelium: disable >48KHz audio tests Simon Ser
2019-05-15 7:29 ` [igt-dev] [PATCH i-g-t v4 7/9] tests/kms_chamelium: enable audio test on HDMI ports Simon Ser
2019-05-15 7:29 ` [igt-dev] [PATCH i-g-t v4 8/9] tests/kms_chamelium: don't abort audio test on first fail Simon Ser
2019-05-15 7:29 ` [igt-dev] [PATCH i-g-t v4 9/9] HAX: add {dp, hdmi}-audio test to fast-feedback Simon Ser
2019-05-15 8:25 ` [igt-dev] ✗ Fi.CI.BAT: failure for tests/kms_chamelium: add HDMI audio test (rev2) Patchwork
2019-05-15 8:36 ` Ser, Simon
2019-05-15 13:30 ` Arkadiusz Hiler
2019-05-16 9:44 ` Petri Latvala
2019-05-15 16:37 ` [igt-dev] ✓ Fi.CI.IGT: success " Patchwork
2019-05-16 7:58 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/kms_chamelium: add HDMI audio test (rev3) Patchwork
2019-05-16 9:52 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2019-05-16 10:19 ` Arkadiusz Hiler
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=20190515072922.30768-4-simon.ser@intel.com \
--to=simon.ser@intel.com \
--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 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.