From: Gil Dekel <gildekel@google.com>
To: igt-dev@lists.freedesktop.org
Cc: Gil Dekel <gildekel@google.com>,
Swati Sharma <swati2.sharma@intel.com>,
Karthik B S <karthik.b.s@intel.com>,
Mark Yacoub <markyacoub@google.com>
Subject: [PATCH i-g-t 2/3] lib/igt_hdr: Parse DisplayID CTA data blocks
Date: Sat, 14 Nov 2026 17:29:10 -0500 [thread overview]
Message-ID: <20261114222911.1405626-3-gildekel@google.com> (raw)
In-Reply-To: <20261114222911.1405626-1-gildekel@google.com>
Some eDP panels have no CTA-861 extension at all. The Samsung
ATNA40LE01 OLED carries two DisplayID 2.0 extensions instead, and the
second one holds a CTA data block (tag 0x81) with an HDR Static
Metadata Data Block that lists SDR gamma and SMPTE ST 2084.
igt_is_edid_hdr() only looks at CTA-861 extensions, so it reports the
panel as SDR. kms_hdr then runs invalid-hdr on it, a negative test
that expects the kernel to refuse the ST 2084 EOTF, and the subtest
fails because this panel accepts it.
Also walk DisplayID extensions. For each CTA data block in the
section, scan its CTA-861 data block collection with the same check.
Every block is bounded by the section length, which stops before the
section checksum.
Extend lib/tests/igt_hdr with the panel's EDID, plus copies where the
HDR block only lists SDR gamma and where the CTA block runs past the
section.
Cc: Swati Sharma <swati2.sharma@intel.com>
Cc: Karthik B S <karthik.b.s@intel.com>
Cc: Mark Yacoub <markyacoub@google.com>
Assisted-by: Claude:claude-opus-5.5
Signed-off-by: Gil Dekel <gildekel@google.com>
---
lib/igt_hdr.c | 41 +++++++++++++++++++++--
lib/tests/igt_hdr.c | 82 +++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 121 insertions(+), 2 deletions(-)
diff --git a/lib/igt_hdr.c b/lib/igt_hdr.c
index 8c36a035e..27e4a2426 100644
--- a/lib/igt_hdr.c
+++ b/lib/igt_hdr.c
@@ -27,6 +27,7 @@
#define CTA_DATA_BLOCK_OFFSET 4
#define HDR_STATIC_METADATA_BLOCK 0x06
#define USE_EXTENDED_TAG 0x07
+#define DISPLAYID_DATA_BLOCK_CTA 0x81
static bool cta_block(const char *edid_ext)
{
@@ -88,14 +89,46 @@ static bool cta_ext_has_hdr(const struct edid_cea *cea)
cta_data_blocks_have_hdr((const uint8_t *)cea->data, len);
}
+/*
+ * eDP panels such as the Samsung ATNA40LE01 OLED advertise HDR through a
+ * CTA data block (tag 0x81) inside a DisplayID extension, rather than
+ * through a CTA-861 extension block.
+ */
+static bool displayid_ext_has_hdr(const struct edid_dispid *dispid)
+{
+ /* The section checksum follows the data blocks inside data[]. */
+ int end = min_t(int, dispid->header.num_bytes,
+ sizeof(dispid->data) - 1);
+ const uint8_t *data = (const uint8_t *)dispid->data;
+ int i = 0;
+
+ while (i + (int)sizeof(struct dispid_block_header) <= end) {
+ const struct dispid_block_header *block =
+ (const struct dispid_block_header *)&data[i];
+ int payload = i + sizeof(*block);
+
+ if (payload + block->num_bytes > end)
+ break;
+
+ if (block->tag == DISPLAYID_DATA_BLOCK_CTA &&
+ cta_data_blocks_have_hdr(&data[payload], block->num_bytes))
+ return true;
+
+ i = payload + block->num_bytes;
+ }
+
+ return false;
+}
+
/**
* igt_is_edid_hdr:
* @data: raw EDID, the base block followed by its extension blocks
* @size: size of @data in bytes
*
* Looks for an HDR Static Metadata Block in the CTA extensions of an
- * EDID. A sink is considered HDR-capable when it advertises support for
- * Traditional Gamma HDR or SMPTE ST 2084 EOTFs. Never reads past @size.
+ * EDID, and in the CTA data blocks of its DisplayID extensions. A sink is
+ * considered HDR-capable when it advertises support for Traditional
+ * Gamma HDR or SMPTE ST 2084 EOTFs. Never reads past @size.
*
* Returns: true if the EDID advertises HDR support, false otherwise.
*/
@@ -116,6 +149,10 @@ bool igt_is_edid_hdr(const void *data, size_t size)
if (ext->tag == EDID_EXT_CEA && cta_ext_has_hdr(&ext->data.cea))
return true;
+
+ if (ext->tag == EDID_EXT_DISPLAYID &&
+ displayid_ext_has_hdr(&ext->data.dispid))
+ return true;
}
return false;
diff --git a/lib/tests/igt_hdr.c b/lib/tests/igt_hdr.c
index 628d4b2e6..b2f9433e1 100644
--- a/lib/tests/igt_hdr.c
+++ b/lib/tests/igt_hdr.c
@@ -33,9 +33,72 @@ static void make_cta_edid(uint8_t edid[2 * EDID_BLOCK_SIZE], uint8_t eotf)
cta[7] = 0x01; /* static metadata descriptor type 1 */
}
+/*
+ * EDID of a Samsung ATNA40LE01 eDP OLED panel. It has no CTA-861
+ * extension: its second DisplayID 2.0 extension carries a CTA data
+ * block (tag 0x81) with an HDR Static Metadata Data Block.
+ */
+static const uint8_t atna40le01_edid[3 * EDID_BLOCK_SIZE] = {
+ 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00,
+ 0x4c, 0x83, 0x17, 0x42, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x23, 0x01, 0x04, 0xb5, 0x1e, 0x13, 0x78,
+ 0x01, 0x3a, 0xe5, 0xae, 0x51, 0x3d, 0xb6, 0x23,
+ 0x0b, 0x50, 0x54, 0x00, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00,
+ 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x00, 0x00, 0x00, 0xfd, 0x00, 0x1e, 0x78, 0xe6,
+ 0xe6, 0x47, 0x01, 0x0a, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x3d,
+ 0x4f, 0x34, 0x31, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0xff, 0x00, 0x00, 0x00, 0xfc,
+ 0x00, 0x41, 0x54, 0x4e, 0x41, 0x34, 0x30, 0x4c,
+ 0x45, 0x30, 0x31, 0x2d, 0x30, 0x20, 0x02, 0xe8,
+ /* DisplayID 2.0 extension 1: product ID, display params, timings. */
+ 0x70, 0x20, 0x79, 0x02, 0x00, 0x20, 0x00, 0x18,
+ 0x4c, 0x83, 0x00, 0x17, 0x42, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x23, 0x0c, 0x41, 0x54, 0x4e, 0x41,
+ 0x34, 0x30, 0x4c, 0x45, 0x30, 0x31, 0x2d, 0x30,
+ 0x21, 0x00, 0x1d, 0xca, 0x0b, 0x5e, 0x07, 0x40,
+ 0x0b, 0x08, 0x07, 0x00, 0xe1, 0xba, 0x51, 0xd7,
+ 0x83, 0xb6, 0x3d, 0x82, 0x0b, 0x02, 0x45, 0x54,
+ 0x78, 0x61, 0x40, 0x66, 0x00, 0x44, 0x23, 0x78,
+ 0x26, 0x00, 0x09, 0x06, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x50, 0x00, 0x00, 0x22, 0x00, 0x14, 0x00,
+ 0xd4, 0x0a, 0x85, 0x3f, 0x0b, 0xc7, 0x00, 0x07,
+ 0x00, 0x1f, 0x00, 0x07, 0x07, 0x77, 0x00, 0x4f,
+ 0x00, 0x0f, 0x00, 0x2e, 0x00, 0x06, 0x00, 0x44,
+ 0x78, 0x61, 0x78, 0x61, 0x2b, 0x00, 0x0c, 0x27,
+ 0x00, 0x1e, 0x77, 0x00, 0x00, 0x27, 0x00, 0x1e,
+ 0x3b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x99, 0x90,
+ /* DisplayID 2.0 extension 2: timing, then the CTA block at 284. */
+ 0x70, 0x20, 0x79, 0x00, 0x00, 0x22, 0x00, 0x14,
+ 0x00, 0xd4, 0x0a, 0x05, 0x3f, 0x0b, 0xc7, 0x00,
+ 0x07, 0x00, 0x1f, 0x00, 0x07, 0x07, 0xf7, 0x07,
+ 0xcf, 0x07, 0x0f, 0x00, 0x81, 0x00, 0x1f, 0x73,
+ 0x1a, 0x00, 0x00, 0x03, 0x5b, 0x1e, 0x78, 0x00,
+ 0xa0, 0xa0, 0x01, 0x7a, 0x02, 0x78, 0x00, 0x00,
+ 0x00, 0x00, 0x8d, 0xe3, 0x05, 0x80, 0x00, 0xe6,
+ 0x06, 0x05, 0x01, 0xa0, 0x7a, 0x01, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xce, 0x90,
+};
+
+/* Offsets into atna40le01_edid. */
+#define ATNA40LE01_CTA_BLOCK_LEN 286 /* payload size of the 0x81 block */
+#define ATNA40LE01_HDR_EOTF 313 /* EOTF byte of the HDR block */
+
int igt_main()
{
uint8_t edid[2 * EDID_BLOCK_SIZE];
+ uint8_t dispid_edid[sizeof(atna40le01_edid)];
igt_subtest("cta-hdr") {
make_cta_edid(edid, 0x05); /* SDR gamma + SMPTE ST 2084 */
@@ -51,4 +114,23 @@ int igt_main()
make_cta_edid(edid, 0x05);
igt_assert(!igt_is_edid_hdr(edid, EDID_BLOCK_SIZE));
}
+
+ igt_subtest("displayid-cta-hdr")
+ igt_assert(igt_is_edid_hdr(atna40le01_edid,
+ sizeof(atna40le01_edid)));
+
+ igt_subtest("displayid-cta-sdr-only") {
+ memcpy(dispid_edid, atna40le01_edid, sizeof(dispid_edid));
+ igt_assert_eq(dispid_edid[ATNA40LE01_HDR_EOTF], 0x05);
+ dispid_edid[ATNA40LE01_HDR_EOTF] = 0x01; /* SDR gamma */
+ igt_assert(!igt_is_edid_hdr(dispid_edid, sizeof(dispid_edid)));
+ }
+
+ igt_subtest("displayid-cta-block-overflow") {
+ /* The CTA block claims to run past the DisplayID section. */
+ memcpy(dispid_edid, atna40le01_edid, sizeof(dispid_edid));
+ igt_assert_eq(dispid_edid[ATNA40LE01_CTA_BLOCK_LEN], 0x1f);
+ dispid_edid[ATNA40LE01_CTA_BLOCK_LEN] = 0x7f;
+ igt_assert(!igt_is_edid_hdr(dispid_edid, sizeof(dispid_edid)));
+ }
}
--
Gil Dekel, Software Engineer, Google / ChromeOS Display and Graphics
next prev parent reply other threads:[~2026-11-16 5:25 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-14 22:29 [PATCH i-g-t 0/3] lib/igt_hdr: Find HDR in DisplayID EDIDs Gil Dekel
2026-11-14 22:29 ` [PATCH i-g-t 1/3] lib/igt_hdr: Add a testable igt_is_edid_hdr() Gil Dekel
2026-11-14 22:29 ` Gil Dekel [this message]
2026-11-14 22:29 ` [PATCH i-g-t 3/3] tests/kms_hdr: Use /dev/kmsg in invalid-hdr Gil Dekel
2026-11-15 0:19 ` [PATCH i-g-t v2 0/3] lib/igt_hdr: Find HDR in DisplayID EDIDs Gil Dekel
2026-11-15 0:19 ` [PATCH i-g-t v2 1/3] lib/igt_hdr: Add a testable igt_is_edid_hdr() Gil Dekel
2026-11-15 0:19 ` [PATCH i-g-t v2 2/3] lib/igt_hdr: Parse DisplayID CTA data blocks Gil Dekel
2026-11-15 0:19 ` [PATCH i-g-t v2 3/3] tests/kms_hdr: Use /dev/kmsg in invalid-hdr Gil Dekel
2026-11-16 7:51 ` ✓ Xe.CI.BAT: success for lib/igt_hdr: Find HDR in DisplayID EDIDs Patchwork
2026-11-16 8:07 ` ✓ i915.CI.BAT: " Patchwork
2026-11-16 9:07 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-11-16 9:40 ` [PATCH i-g-t 0/3] " Jani Nikula
2026-11-17 3:13 ` Gil Dekel
2026-11-16 11:26 ` ✗ i915.CI.Full: failure for " 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=20261114222911.1405626-3-gildekel@google.com \
--to=gildekel@google.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=karthik.b.s@intel.com \
--cc=markyacoub@google.com \
--cc=swati2.sharma@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