Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BC3B5D2ECF8 for ; Tue, 20 Jan 2026 00:05:05 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E37EE10E0BA; Tue, 20 Jan 2026 00:05:04 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=ubuntu.com header.i=@ubuntu.com header.b="RTC9I5xb"; dkim-atps=neutral X-Greylist: delayed 1312 seconds by postgrey-1.36 at gabe; Mon, 19 Jan 2026 23:06:49 UTC Received: from smtp.forwardemail.net (smtp.forwardemail.net [121.127.44.73]) by gabe.freedesktop.org (Postfix) with ESMTPS id BBB9310E0B1 for ; Mon, 19 Jan 2026 23:06:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ubuntu.com; h=References: To: Cc: In-Reply-To: Date: Subject: Mime-Version: Content-Type: Message-Id: From; q=dns/txt; s=fe-953a8a3ca9; t=1768864009; bh=GOAvIkS47JMRryc+5uLQ2an69IO4ucmVZCQ3lmjAAFU=; b=RTC9I5xbbz1uRLclmTGj5srArml+2KQbHmaz65VojjleYKvp/iv0mIkdNfz2EXM1itsI3TqU8 FrjSDPNitid2ghKTBeBTnNxBokpLW/HvSMis/qtjR0SNVG7VIbJBIuLl/EkajUXC48Jt0s0uJkY pF7wOAeedtwPDRL04x8DKzOJaMslnDUntShBlSv9YcZzml13ObemwNbo9+Lyy8LsI/LFJQ5psT6 sy9ohTQJ3Ose3JfLasWp9+4S+ZSsD8oj0eJgdu8beEISixZQYBptboTgx+q0LwH8A6W/RUTiESR L3fg+HiutZUf0rnt+5KNMiHid+W/mKEJgkW227qEmmaw== X-Forward-Email-ID: 696eb3e65e9fa1468af18b8b X-Forward-Email-Sender: rfc822; jpeisach@ubuntu.com, smtp.forwardemail.net, 121.127.44.73 X-Forward-Email-Version: 2.3.7 X-Forward-Email-Website: https://forwardemail.net X-Complaints-To: abuse@forwardemail.net X-Report-Abuse: abuse@forwardemail.net X-Report-Abuse-To: abuse@forwardemail.net From: "jpeisach@ubuntu.com" Message-Id: Content-Type: multipart/alternative; boundary="Apple-Mail=_0077CD56-AB61-40C6-ACE1-3EA75817006A" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3864.400.12\)) Subject: Re: [PATCH] drm/edid: Use struct cea_db when parsing HDMI VSDB Date: Mon, 19 Jan 2026 17:44:43 -0500 In-Reply-To: Cc: dri-devel@lists.freedesktop.org, ville.syrjala@linux.intel.com To: Jani Nikula References: <20260117205139.13991-1-jpeisach@ubuntu.com> X-Mailer: Apple Mail (2.3864.400.12) X-Mailman-Approved-At: Tue, 20 Jan 2026 00:05:04 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" --Apple-Mail=_0077CD56-AB61-40C6-ACE1-3EA75817006A Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Jan 19, 2026, at 8:39=E2=80=AFAM, Jani Nikula = wrote: >=20 > On Sat, 17 Jan 2026, Joshua Peisach > wrote: >> drm_parse_hdmi_vsdb_video is one of the parsers that still do not use = the >> cea_db struct, and currently passes a u8 pointer. >>=20 >> Set the correct struct type and update references to the data = accordingly. >> This also makes the same change to drm_parse_hdmi_deep_color_info as >> necessary. >>=20 >> Signed-off-by: Joshua Peisach >> --- >> drivers/gpu/drm/drm_edid.c | 26 +++++++++++++------------- >> 1 file changed, 13 insertions(+), 13 deletions(-) >>=20 >> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c >> index 26bb7710a..15bd99e65 100644 >> --- a/drivers/gpu/drm/drm_edid.c >> +++ b/drivers/gpu/drm/drm_edid.c >> @@ -6290,7 +6290,7 @@ static void drm_parse_hdmi_forum_scds(struct = drm_connector *connector, >> } >>=20 >> static void drm_parse_hdmi_deep_color_info(struct drm_connector = *connector, >> - const u8 *hdmi) >> + const struct cea_db *db) >> { >> struct drm_display_info *info =3D &connector->display_info; >> unsigned int dc_bpc =3D 0; >> @@ -6298,24 +6298,24 @@ static void = drm_parse_hdmi_deep_color_info(struct drm_connector *connector, >> /* HDMI supports at least 8 bpc */ >> info->bpc =3D 8; >>=20 >> - if (cea_db_payload_len(hdmi) < 6) >> + if (cea_db_payload_len(db) < 6) >> return; >>=20 >> - if (hdmi[6] & DRM_EDID_HDMI_DC_30) { >> + if (db->data[6] & DRM_EDID_HDMI_DC_30) { >=20 > That's not the same thing, but off-by-one now. Ditto everywhere that > changes from u8* to db->data[]. >=20 > The main problem with the change (even with fixed offsets) is that the > *specs* typically use indexing from the beginning of the data block, = not > from the beginning of payload data. >=20 > We've discussed this before with Ville (Cc'd) but I'm not sure if we > reached a conclusion. >=20 Okay, I'll thought the pointer was to the literal same information. Keep me posted about the indexing of the specs, I will probably submit a = v2. Thanks, -Josh > BR, > Jani. >=20 >=20 >> dc_bpc =3D 10; >> info->edid_hdmi_rgb444_dc_modes |=3D = DRM_EDID_HDMI_DC_30; >> drm_dbg_kms(connector->dev, "[CONNECTOR:%d:%s] HDMI sink = does deep color 30.\n", >> connector->base.id, connector->name); >> } >>=20 >> - if (hdmi[6] & DRM_EDID_HDMI_DC_36) { >> + if (db->data[6] & DRM_EDID_HDMI_DC_36) { >> dc_bpc =3D 12; >> info->edid_hdmi_rgb444_dc_modes |=3D = DRM_EDID_HDMI_DC_36; >> drm_dbg_kms(connector->dev, "[CONNECTOR:%d:%s] HDMI sink = does deep color 36.\n", >> connector->base.id, connector->name); >> } >>=20 >> - if (hdmi[6] & DRM_EDID_HDMI_DC_48) { >> + if (db->data[6] & DRM_EDID_HDMI_DC_48) { >> dc_bpc =3D 16; >> info->edid_hdmi_rgb444_dc_modes |=3D = DRM_EDID_HDMI_DC_48; >> drm_dbg_kms(connector->dev, "[CONNECTOR:%d:%s] HDMI sink = does deep color 48.\n", >> @@ -6333,7 +6333,7 @@ static void = drm_parse_hdmi_deep_color_info(struct drm_connector *connector, >> info->bpc =3D dc_bpc; >>=20 >> /* YCRCB444 is optional according to spec. */ >> - if (hdmi[6] & DRM_EDID_HDMI_DC_Y444) { >> + if (db->data[6] & DRM_EDID_HDMI_DC_Y444) { >> info->edid_hdmi_ycbcr444_dc_modes =3D = info->edid_hdmi_rgb444_dc_modes; >> drm_dbg_kms(connector->dev, "[CONNECTOR:%d:%s] HDMI sink = does YCRCB444 in deep color.\n", >> connector->base.id, connector->name); >> @@ -6343,7 +6343,7 @@ static void = drm_parse_hdmi_deep_color_info(struct drm_connector *connector, >> * Spec says that if any deep color mode is supported at all, >> * then deep color 36 bit must be supported. >> */ >> - if (!(hdmi[6] & DRM_EDID_HDMI_DC_36)) { >> + if (!(db->data[6] & DRM_EDID_HDMI_DC_36)) { >> drm_dbg_kms(connector->dev, "[CONNECTOR:%d:%s] HDMI sink = should do DC_36, but does not!\n", >> connector->base.id, connector->name); >> } >> @@ -6351,19 +6351,19 @@ static void = drm_parse_hdmi_deep_color_info(struct drm_connector *connector, >>=20 >> /* HDMI Vendor-Specific Data Block (HDMI VSDB, H14b-VSDB) */ >> static void >> -drm_parse_hdmi_vsdb_video(struct drm_connector *connector, const u8 = *db) >> +drm_parse_hdmi_vsdb_video(struct drm_connector *connector, const = struct cea_db *db) >> { >> struct drm_display_info *info =3D &connector->display_info; >> u8 len =3D cea_db_payload_len(db); >>=20 >> info->is_hdmi =3D true; >>=20 >> - info->source_physical_address =3D (db[4] << 8) | db[5]; >> + info->source_physical_address =3D (db->data[4] << 8) | = db->data[5]; >>=20 >> if (len >=3D 6) >> - info->dvi_dual =3D db[6] & 1; >> + info->dvi_dual =3D db->data[6] & 1; >> if (len >=3D 7) >> - info->max_tmds_clock =3D db[7] * 5000; >> + info->max_tmds_clock =3D db->data[7] * 5000; >>=20 >> /* >> * Try to infer whether the sink supports HDMI infoframes. >> @@ -6371,7 +6371,7 @@ drm_parse_hdmi_vsdb_video(struct drm_connector = *connector, const u8 *db) >> * HDMI infoframe support was first added in HDMI 1.4. Assume = the sink >> * supports infoframes if HDMI_Video_present is set. >> */ >> - if (len >=3D 8 && db[8] & BIT(5)) >> + if (len >=3D 8 && db->data[8] & BIT(5)) >> info->has_hdmi_infoframe =3D true; >>=20 >> drm_dbg_kms(connector->dev, "[CONNECTOR:%d:%s] HDMI: DVI dual = %d, max TMDS clock %d kHz\n", >> @@ -6443,7 +6443,7 @@ static void drm_parse_cea_ext(struct = drm_connector *connector, >> const u8 *data =3D (const u8 *)db; >>=20 >> if (cea_db_is_hdmi_vsdb(db)) >> - drm_parse_hdmi_vsdb_video(connector, data); >> + drm_parse_hdmi_vsdb_video(connector, db); >> else if (cea_db_is_hdmi_forum_vsdb(db) || >> cea_db_is_hdmi_forum_scdb(db)) >> drm_parse_hdmi_forum_scds(connector, data); >=20 > --=20 > Jani Nikula, Intel --Apple-Mail=_0077CD56-AB61-40C6-ACE1-3EA75817006A Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

On Jan 19, 2026, at 8:39=E2=80=AFAM, Jani Nikula = <jani.nikula@linux.intel.com> wrote:

On Sat, 17 Jan 2026, Joshua Peisach = <jpeisach@ubuntu.com> wrote:
drm_parse_hdmi_vsdb_video is one of the parsers that still do = not use the
cea_db struct, and currently passes a u8 = pointer.

Set the correct struct type and update references to the = data accordingly.
This also makes the same change to = drm_parse_hdmi_deep_color_info as
necessary.

Signed-off-by: = Joshua Peisach = <jpeisach@ubuntu.com>
---
drivers/gpu/drm/drm_edid.c | 26 = +++++++++++++-------------
1 file changed, 13 insertions(+), 13 = deletions(-)

diff --git a/drivers/gpu/drm/drm_edid.c = b/drivers/gpu/drm/drm_edid.c
index 26bb7710a..15bd99e65 100644
--- = a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ = -6290,7 +6290,7 @@ static void drm_parse_hdmi_forum_scds(struct = drm_connector *connector,
}

static void = drm_parse_hdmi_deep_color_info(struct drm_connector = *connector,
-    const u8 = *hdmi)
+ = = = = =    const struct = cea_db *db)
{
struct drm_display_info *info =3D = &connector->display_info;
unsigned int dc_bpc =3D 0;
@@ = -6298,24 +6298,24 @@ static void drm_parse_hdmi_deep_color_info(struct = drm_connector *connector,
/* HDMI supports at least 8 bpc = */
= info->bpc =3D 8;

- if (cea_db_payload_len(hdmi) < = 6)
+ = if (cea_db_payload_len(db) < 6)
= return;

- if (hdmi[6] & = DRM_EDID_HDMI_DC_30) {
+ if (db->data[6] & = DRM_EDID_HDMI_DC_30) {

That's not the same thing, but off-by-one = now. Ditto everywhere that
changes from u8* to = db->data[].

The main problem with the change (even with = fixed offsets) is that the
*specs* typically use indexing from the = beginning of the data block, not
from the beginning of payload = data.

We've discussed this before with Ville = (Cc'd) but I'm not sure if we
reached a conclusion.


Okay, I'll thought the = pointer was to the literal same = information.

Keep me posted about the indexing = of the specs, I will probably submit a = v2.

Thanks,
-Josh

BR,
Jani.


= = dc_bpc =3D 10;
= info->edid_hdmi_rgb444_dc_modes |=3D = DRM_EDID_HDMI_DC_30;
drm_dbg_kms(connector->dev, = "[CONNECTOR:%d:%s] HDMI sink does deep color 30.\n",
    connector-&= gt;base.id, connector->name);
}

- if = (hdmi[6] & DRM_EDID_HDMI_DC_36) {
+ if (db->data[6] & = DRM_EDID_HDMI_DC_36) {
dc_bpc =3D 12;
= info->edid_hdmi_rgb444_dc_modes |=3D = DRM_EDID_HDMI_DC_36;
drm_dbg_kms(connector->dev, = "[CONNECTOR:%d:%s] HDMI sink does deep color 36.\n",
    connector-&= gt;base.id, connector->name);
}

- if = (hdmi[6] & DRM_EDID_HDMI_DC_48) {
+ if (db->data[6] & = DRM_EDID_HDMI_DC_48) {
dc_bpc =3D 16;
= info->edid_hdmi_rgb444_dc_modes |=3D = DRM_EDID_HDMI_DC_48;
drm_dbg_kms(connector->dev, = "[CONNECTOR:%d:%s] HDMI sink does deep color 48.\n",
@@ -6333,7 = +6333,7 @@ static void drm_parse_hdmi_deep_color_info(struct = drm_connector *connector,
info->bpc =3D = dc_bpc;

/* YCRCB444 is optional according to spec. */
- if = (hdmi[6] & DRM_EDID_HDMI_DC_Y444) {
+ if (db->data[6] & = DRM_EDID_HDMI_DC_Y444) {
= info->edid_hdmi_ycbcr444_dc_modes =3D = info->edid_hdmi_rgb444_dc_modes;
drm_dbg_kms(connector->dev, = "[CONNECTOR:%d:%s] HDMI sink does YCRCB444 in deep color.\n",
    connector-&= gt;base.id, connector->name);
@@ -6343,7 +6343,7 @@ static void = drm_parse_hdmi_deep_color_info(struct drm_connector *connector,
 * Spec says that if any = deep color mode is supported at all,
 * then deep color 36 bit = must be supported.
 */
- if = (!(hdmi[6] & DRM_EDID_HDMI_DC_36)) {
+ if = (!(db->data[6] & DRM_EDID_HDMI_DC_36)) {
= drm_dbg_kms(connector->dev, "[CONNECTOR:%d:%s] HDMI sink = should do DC_36, but does not!\n",
    connector-&= gt;base.id, connector->name);
}
@@ -6351,19 +6351,19 @@ = static void drm_parse_hdmi_deep_color_info(struct drm_connector = *connector,

/* HDMI Vendor-Specific Data Block (HDMI VSDB, = H14b-VSDB) */
static void
-drm_parse_hdmi_vsdb_video(struct = drm_connector *connector, const u8 = *db)
+drm_parse_hdmi_vsdb_video(struct drm_connector *connector, = const struct cea_db *db)
{
struct drm_display_info *info =3D = &connector->display_info;
u8 len =3D = cea_db_payload_len(db);

info->is_hdmi =3D = true;

- info->source_physical_address =3D (db[4] << 8) | = db[5];
+ = info->source_physical_address =3D (db->data[4] << 8) = | db->data[5];

if (len >=3D 6)
- = info->dvi_dual =3D db[6] & 1;
+ = info->dvi_dual =3D db->data[6] & 1;
if (len = >=3D 7)
- info->max_tmds_clock =3D db[7] * 5000;
+ = info->max_tmds_clock =3D db->data[7] * 5000;

= /*
=  * Try to infer = whether the sink supports HDMI infoframes.
@@ -6371,7 +6371,7 @@ = drm_parse_hdmi_vsdb_video(struct drm_connector *connector, const u8 = *db)
=  * HDMI = infoframe support was first added in HDMI 1.4. Assume the sink
 * supports infoframes if = HDMI_Video_present is set.
 */
- if (len = >=3D 8 && db[8] & BIT(5))
+ if (len = >=3D 8 && db->data[8] & BIT(5))
= info->has_hdmi_infoframe =3D true;

= drm_dbg_kms(connector->dev, "[CONNECTOR:%d:%s] HDMI: DVI dual = %d, max TMDS clock %d kHz\n",
@@ -6443,7 +6443,7 @@ static void = drm_parse_cea_ext(struct drm_connector *connector,
const u8 = *data =3D (const u8 *)db;

if = (cea_db_is_hdmi_vsdb(db))
- = drm_parse_hdmi_vsdb_video(connector, data);
+ = drm_parse_hdmi_vsdb_video(connector, db);
else if = (cea_db_is_hdmi_forum_vsdb(db) ||
 cea_db_is_hdmi_forum_scdb(db)= )
= = = drm_parse_hdmi_forum_scds(connector, data);

-- 
Jani Nikula, = Intel

= --Apple-Mail=_0077CD56-AB61-40C6-ACE1-3EA75817006A--