From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 86C82282F1E for ; Mon, 17 Aug 2026 23:52:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787010723; cv=none; b=Vh7wUEwOZjyKmnEHWjpfOk9YLX6uHFEQ6jVLeNQiU03Ft0S3glDHOP9LzIx8/7Gy1zRrDpbqyD0B3vgXUZ41QqF1qeIRdxSPE/8SAOJ9j7XzIZhi4GA7/HnMjmI/Dp7SohHuiHmFQA0gusYbp5O0e5HcSWYzgGb2I2KZlvZ9vZs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787010723; c=relaxed/simple; bh=0IqGxIANQwpZSd9bR2bmr7plnvSCnJmSAtJu8hw3/TM=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=HztdNk709yf6bvPFo5avt9olUV5nBokeAWDP3ik36XYwoRr+qCQONE2PBAeGfeiXIwaZbqwVe70FmeFoVhykeBWtOXaSKZsOdoA/8W5oqSMEvIJz8v/9uzUX+Nmfxhu4a65PjEgwVVKSFOvEgmNJGBQMbaT1vyiop4d5F97Kbfg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=du26R4vi; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=tu43eByx; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="du26R4vi"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="tu43eByx" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787010720; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iSF/FvhwTwSJgXW6nLHqHhB1nUwj7OkN5gXEkNQV4vc=; b=du26R4vidJZdm79Ico6Re+9d6Joa5toPbc6d1bQ0YqCgKuR3HEdctzP7P5aIh3StXOK2Vf bjNcZbPkY6TM0gg5n92f+O0f26a9+Nc+kRMqGRgX//JsYN7FyF6E/CG8WHaaaf9Vv7/BpY zfgeOX7LILz3/kxBKOirmoI2gTSuFJg= Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-190-AbOMial_N2uRfG_8vn6SqA-1; Mon, 17 Aug 2026 19:51:57 -0400 X-MC-Unique: AbOMial_N2uRfG_8vn6SqA-1 X-Mimecast-MFC-AGG-ID: AbOMial_N2uRfG_8vn6SqA_1787010716 Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-91931144870so513116485a.1 for ; Mon, 17 Aug 2026 16:51:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1787010716; x=1787615516; darn=vger.kernel.org; h=mime-version:user-agent:content-transfer-encoding:content-type :references:in-reply-to:date:cc:to:from:subject:message-id:from:to :cc:subject:date:message-id:reply-to:content-type; bh=iSF/FvhwTwSJgXW6nLHqHhB1nUwj7OkN5gXEkNQV4vc=; b=tu43eByxmcrfijr2nvsv4gmkyAkAjzwYWb1qzkaoe6jvneuGFOyFMbcbf0tjuo7RUn ng3WR+0RknHiAQDIA27NRE8QiRK1+h0AteJTmq4DN5U3XMuPW0Ft8T8vi4BdwMc6JeLm Uh4C2LyMIP5v9syvpyTgPXkoDAzB4p15GvTs98tO8ex7YthWwF8WhUFWJe9iWCbzQzkc BecurgK79Ied2BgB5dhe8xUL8fDzR+Z3M09jC93kxUuCcG3U4pAYIKgeH7ML/vycXips k6BSCinRSX5dtRbLDLQ0lVblVbrEZBx/tH/sQUWvy8iATlX7D2S0jPICR52ks7am3Und GCVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787010716; x=1787615516; h=mime-version:user-agent:content-transfer-encoding:content-type :references:in-reply-to:date:cc:to:from:subject:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=iSF/FvhwTwSJgXW6nLHqHhB1nUwj7OkN5gXEkNQV4vc=; b=ByRp6OoyLDcGaXZbC2v5L8UfjPveSyxq9ml1oXK4MYQaIXbzmCmu7d2dJvn9889kMw BIfaQpua7z50fphQJp49TzWRcg8tbyYrl/0itbq+NTzh8QSMdwtjVUvdFMtggc9hd40J RDlwBi2wIdzgb/8OVfMGuoWLLWqwja3qLoMjNVApBEwCsN9/U++v+N9zxBbA4uRm0zFs xH5UN5DyHdsxVLLpaxniBDacux1Dz+5tMfb+3m8HQEpOkAxUsTEWMkMDjPgGFR90uYE9 V8nxbdBuLE+EAKbigTNvBt4Uidm3ZCe8rUwqVwEG5SunBRsAhMD0NF89piszniEUL0sG ICOA== X-Forwarded-Encrypted: i=1; AHgh+Ro2jhCF2sEU5FSKSD9i02UOTU4AxZtEeICpYP2rjTOo4x95/cAlwWpJcwc62Mor3zS83LUGGizoXoKTLNI=@vger.kernel.org X-Gm-Message-State: AOJu0YzGPhHwT0qUkrXy083oW39+j/B9Esd5ghuZGxXO0KnCxSIfa1qM ogSOuwn45r+/GRRt9+zKnd0msZ8/3ZTRckQTEhF9JB1muallstzp1MWtVFY9frPqhAJdJVZLWTD y4cnkTsmIvLmHAuSuu7UnHFHLc2hRzZhiNCrnHlLKgXtcLjPhyLjlRTsccqYoUXLh4g== X-Gm-Gg: AR+sD13wtY+tQPneqphHrqvYs818fRyB3NRyRUyZCOlix9aI2pm+7ERp362AunzTodb yzgrfNwnMqVABlok9oT3k414b4G+fW1lmhW13CpTnYwAsehiDFH9dlvudm8yqgJLkzlTtpSSnVc Ms/SSiMW/648lgk0P+kzLJTFn5tAkNLbXmetW3munp+yByGgCubj9fnp6YPJlJDFNAIeKbCgUaw AK32YUE4bGvrxxdJLIwykD3ZSC2i7m99VEZCoK+uvaYuu2OAJPAYO8QQvoyZOdaVwVfbVNYJcuW UK27eVi5Lcl2syF6pO1qKENDWTEHoCo8n0izXSMAHB4o9qfIZIbl4356GI8DDhs8N8irNEwj X-Received: by 2002:a05:620a:701c:b0:936:dbf1:f495 with SMTP id af79cd13be357-93704b1ba0dmr480099685a.1.1787010716530; Mon, 17 Aug 2026 16:51:56 -0700 (PDT) X-Received: by 2002:a05:620a:701c:b0:936:dbf1:f495 with SMTP id af79cd13be357-93704b1ba0dmr480096585a.1.1787010716063; Mon, 17 Aug 2026 16:51:56 -0700 (PDT) Received: from [192.168.8.4] ([100.0.180.93]) by smtp.gmail.com with ESMTPSA id af79cd13be357-937010240absm207239685a.0.2026.08.17.16.51.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Aug 2026 16:51:54 -0700 (PDT) Message-ID: <9ed92694e5cb9c6f89755b41b705346b7bf83590.camel@redhat.com> Subject: Re: [PATCH 7/7] nouveau: honor HF-EEODB EDIDs by converting to struct drm_edid From: lyude@redhat.com To: Mohamed Ahmed , linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, Danilo Krummrich , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Mary Guillemard , nouveau@lists.freedesktop.org Date: Mon, 17 Aug 2026 19:51:54 -0400 In-Reply-To: <20260814235705.59132-8-mohamedahmedegypt2001@gmail.com> References: <20260814235705.59132-1-mohamedahmedegypt2001@gmail.com> <20260814235705.59132-8-mohamedahmedegypt2001@gmail.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.58.3 (3.58.3-1.fc43) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Ah, how rust has changed me. Some comments below: On Sat, 2026-08-15 at 03:57 +0400, Mohamed Ahmed wrote: > HDMI 2.1 sinks ship HF-EEODB EDIDs. Byte 126 deliberately claims one > extension block for legacy sources, and the true count lives in the > CTA > block's first data block. Their high-refresh timings (e.g., 4K240, > 6K165, > etc) sit in DisplayID extension blocks 2+. >=20 > The kernel already reads these EDIDs whole, and on GSP boards RM > returns > the full EDID with its true size. However, nouveau then hands the > buffer > to the legacy API which sizes the EDID from byte 126 so the DisplayID > blocks are not parsed/exposed and the sysfs blob truncates to 256 > bytes. >=20 > Convert to the struct drm_edid API, which carries the real size. > Read via drm_edid_read_ddc()/drm_edid_read_switcheroo() where an > adapter exists, and serve RM's buffer through drm_edid_read_custom() > with a block-reading callback where not, which also routes the GSP > path through drm's block validation and the debugfs EDID override > (previously dead on GSP boards, since nothing consulted it outside > the i2c readers). >=20 > The connector keeps a borrowed const drm_edid_raw() view in ->edid, > same > as i915's detect_edid so the raw-EDID consumers (SAD parsing, deep- > color > flags, the DVI dual-link byte, DP CEC) are untouched. Ownership and > freeing move to the drm_edid. The OF path additionally now frees any > previous EDID itself rather than relying on the callers. MST > connectors > keep their separate legacy path. >=20 > Signed-off-by: Mohamed Ahmed > --- > =C2=A0drivers/gpu/drm/nouveau/dispnv50/disp.c=C2=A0=C2=A0=C2=A0=C2=A0 |= =C2=A0 2 +- > =C2=A0drivers/gpu/drm/nouveau/nouveau_connector.c | 95 ++++++++++++++++--= - > -- > =C2=A0drivers/gpu/drm/nouveau/nouveau_connector.h |=C2=A0 7 +- > =C2=A03 files changed, 80 insertions(+), 24 deletions(-) >=20 > diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c > b/drivers/gpu/drm/nouveau/dispnv50/disp.c > index 364227f5456f..c3b7fd29c077 100644 > --- a/drivers/gpu/drm/nouveau/dispnv50/disp.c > +++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c > @@ -1804,7 +1804,7 @@ nv50_sor_atomic_enable(struct drm_encoder > *encoder, struct drm_atomic_commit *st > =C2=A0 lvds_8bpc =3D bios->fp.if_is_24bit; > =C2=A0 } else { > =C2=A0 if (nv_connector->type =3D=3D > DCB_CONNECTOR_LVDS_SPWG) { > - if (((u8 *)nv_connector->edid)[121] > =3D=3D 2) > + if (((const u8 *)nv_connector- > >edid)[121] =3D=3D 2) > =C2=A0 lvds_dual =3D true; > =C2=A0 } else > =C2=A0 if (mode->clock >=3D bios- > >fp.duallink_transition_clk) { > diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c > b/drivers/gpu/drm/nouveau/nouveau_connector.c > index b0b0ad9a0c24..4105555151c9 100644 > --- a/drivers/gpu/drm/nouveau/nouveau_connector.c > +++ b/drivers/gpu/drm/nouveau/nouveau_connector.c > @@ -397,7 +397,7 @@ nouveau_connector_destroy(struct drm_connector > *connector) > =C2=A0 struct nouveau_connector *nv_connector =3D > nouveau_connector(connector); > =C2=A0 nvif_event_dtor(&nv_connector->irq); > =C2=A0 nvif_event_dtor(&nv_connector->hpd); > - kfree(nv_connector->edid); > + drm_edid_free(nv_connector->drm_edid); > =C2=A0 drm_connector_unregister(connector); > =C2=A0 drm_connector_cleanup(connector); > =C2=A0 if (nv_connector->aux.transfer) > @@ -490,8 +490,11 @@ nouveau_connector_of_detect(struct drm_connector > *connector) > =C2=A0 int idx =3D name ? name[strlen(name) - 1] - 'A' : 0; > =C2=A0 > =C2=A0 if (nv_encoder->dcb->i2c_index =3D=3D idx && edid) { > + drm_edid_free(nv_connector->drm_edid); > + nv_connector->drm_edid =3D > + drm_edid_alloc(edid, EDID_LENGTH); > =C2=A0 nv_connector->edid =3D > - kmemdup(edid, EDID_LENGTH, > GFP_KERNEL); > + drm_edid_raw(nv_connector- > >drm_edid); > =C2=A0 return nv_encoder; > =C2=A0 } > =C2=A0 } > @@ -546,17 +549,42 @@ nouveau_connector_set_encoder(struct > drm_connector *connector, > =C2=A0 } > =C2=A0} > =C2=A0 > +struct nouveau_rm_edid { > + u8 *data; > + int size; > +}; > + > +static int > +nouveau_connector_rm_edid_block(void *context, u8 *buf, unsigned int > block, > + size_t len) > +{ > + struct nouveau_rm_edid *rm =3D context; > + size_t offset =3D (size_t)block * EDID_LENGTH; > + > + if (offset + len > rm->size) > + return -EINVAL; > + > + memcpy(buf, rm->data + offset, len); > + return 0; > +} > + > =C2=A0static void > =C2=A0nouveau_connector_set_edid(struct nouveau_connector *nv_connector, > - =C2=A0=C2=A0 struct edid *edid) > + =C2=A0=C2=A0 const struct drm_edid *drm_edid) > =C2=A0{ > - if (nv_connector->edid !=3D edid) { > - struct edid *old_edid =3D nv_connector->edid; > + if (nv_connector->drm_edid =3D=3D drm_edid) > + return; > =C2=A0 > - drm_connector_update_edid_property(&nv_connector- > >base, edid); > - kfree(old_edid); > - nv_connector->edid =3D edid; > - } > + /* Updates the EDID property and display_info with HF-EEODB- > aware > + * sizing. The legacy helpers truncate both to what EDID > byte 126 > + * admits, hiding the DisplayID extension blocks that carry > every > + * timing a DTD can't express (>655.35 MHz). > + */ > + drm_edid_connector_update(&nv_connector->base, drm_edid); > + > + drm_edid_free(nv_connector->drm_edid); > + nv_connector->drm_edid =3D drm_edid; > + nv_connector->edid =3D drm_edid_raw(drm_edid); > =C2=A0} > =C2=A0 > =C2=A0static enum drm_connector_status > @@ -590,20 +618,36 @@ nouveau_connector_detect(struct drm_connector > *connector, bool force) > =C2=A0 > =C2=A0 nv_encoder =3D nouveau_connector_ddc_detect(connector); > =C2=A0 if (nv_encoder) { > - struct edid *new_edid =3D NULL; > + const struct drm_edid *new_edid =3D NULL; > =C2=A0 > =C2=A0 if (nv_encoder->i2c) { > =C2=A0 if ((vga_switcheroo_handler_flags() & > VGA_SWITCHEROO_CAN_SWITCH_DDC) && > =C2=A0 =C2=A0=C2=A0=C2=A0 nv_connector->type =3D=3D > DCB_CONNECTOR_LVDS) > - new_edid =3D > drm_get_edid_switcheroo(connector, nv_encoder->i2c); > + new_edid =3D > drm_edid_read_switcheroo(connector, nv_encoder->i2c); > =C2=A0 else > - new_edid =3D drm_get_edid(connector, > nv_encoder->i2c); > + new_edid =3D > drm_edid_read_ddc(connector, nv_encoder->i2c); > =C2=A0 } else { > - ret =3D nvif_outp_edid_get(&nv_encoder->outp, > (u8 **)&new_edid); > + struct nouveau_rm_edid rm =3D {}; > + > + ret =3D nvif_outp_edid_get(&nv_encoder->outp, > &rm.data); > =C2=A0 if (ret < 0) > =C2=A0 return > connector_status_disconnected; > + > + /* ret is RM's true buffer size: an HF-EEODB > EDID is > + * larger than its byte 126 admits, and RM > (which > + * owns the DDC pads on GSP boards) reads it > whole. > + * Serve it through drm's block reader so > EEODB > + * sizing, block validation, and the debugfs > EDID > + * override all apply. > + */ > + rm.size =3D ret; > + new_edid =3D drm_edid_read_custom(connector, > + nouveau_conn > ector_rm_edid_block, > + &rm); > + kfree(rm.data); > =C2=A0 } > =C2=A0 > + > =C2=A0 nouveau_connector_set_edid(nv_connector, new_edid); > =C2=A0 if (!nv_connector->edid) { > =C2=A0 NV_ERROR(drm, "DDC responded, but no EDID > for %s\n", > @@ -686,7 +730,7 @@ nouveau_connector_detect_lvds(struct > drm_connector *connector, bool force) > =C2=A0 struct nouveau_drm *drm =3D nouveau_drm(dev); > =C2=A0 struct nouveau_connector *nv_connector =3D > nouveau_connector(connector); > =C2=A0 struct nouveau_encoder *nv_encoder =3D NULL; > - struct edid *edid =3D NULL; > + const struct drm_edid *edid =3D NULL; > =C2=A0 enum drm_connector_status status =3D > connector_status_disconnected; > =C2=A0 > =C2=A0 nv_encoder =3D find_encoder(connector, DCB_OUTPUT_LVDS); > @@ -697,7 +741,7 @@ nouveau_connector_detect_lvds(struct > drm_connector *connector, bool force) > =C2=A0 if (!drm->vbios.fp_no_ddc) { > =C2=A0 status =3D nouveau_connector_detect(connector, force); > =C2=A0 if (status =3D=3D connector_status_connected) { > - edid =3D nv_connector->edid; > + edid =3D nv_connector->drm_edid; > =C2=A0 goto out; > =C2=A0 } > =C2=A0 } > @@ -712,7 +756,13 @@ nouveau_connector_detect_lvds(struct > drm_connector *connector, bool force) > =C2=A0 * valid - it's not (rh#613284) > =C2=A0 */ > =C2=A0 if (nv_encoder->dcb->lvdsconf.use_acpi_for_edid) { > - edid =3D nouveau_acpi_edid(dev, connector); > + struct edid *raw =3D nouveau_acpi_edid(dev, > connector); > + > + if (raw) { > + edid =3D drm_edid_alloc(raw, > + =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 EDID_LENGTH * (1 + > raw->extensions)); > + kfree(raw); Maybe check drm_edid_alloc() after calling it so we can print something if it fails? Otherwise, an allocation failure might mask itself as some other unrelated connector probing error > + } > =C2=A0 if (edid) { > =C2=A0 status =3D connector_status_connected; > =C2=A0 goto out; > @@ -733,9 +783,10 @@ nouveau_connector_detect_lvds(struct > drm_connector *connector, bool force) > =C2=A0 * stored for the panel stored in them. > =C2=A0 */ > =C2=A0 if (!drm->vbios.fp_no_ddc) { > - edid =3D (struct edid > *)nouveau_bios_embedded_edid(dev); > - if (edid) { > - edid =3D kmemdup(edid, EDID_LENGTH, > GFP_KERNEL); > + const void *embedded =3D > nouveau_bios_embedded_edid(dev); > + > + if (embedded) { > + edid =3D drm_edid_alloc(embedded, > EDID_LENGTH); > =C2=A0 if (edid) > =C2=A0 status =3D connector_status_connected; > =C2=A0 } > @@ -915,7 +966,7 @@ nouveau_connector_detect_depth(struct > drm_connector *connector) > =C2=A0 */ > =C2=A0 if (nv_connector->edid && > =C2=A0 =C2=A0=C2=A0=C2=A0 nv_connector->type =3D=3D DCB_CONNECTOR_LVDS_SP= WG) > - duallink =3D ((u8 *)nv_connector->edid)[121] =3D=3D 2; > + duallink =3D ((const u8 *)nv_connector->edid)[121] =3D=3D > 2; > =C2=A0 else > =C2=A0 duallink =3D mode->clock >=3D bios- > >fp.duallink_transition_clk; > =C2=A0 > @@ -973,8 +1024,8 @@ nouveau_connector_get_modes(struct drm_connector > *connector) > =C2=A0 nv_connector->native_mode =3D NULL; > =C2=A0 } > =C2=A0 > - if (nv_connector->edid) > - ret =3D drm_add_edid_modes(connector, nv_connector- > >edid); > + if (nv_connector->drm_edid) > + ret =3D drm_edid_connector_add_modes(connector); > =C2=A0 else > =C2=A0 if (nv_encoder->dcb->type =3D=3D DCB_OUTPUT_LVDS && > =C2=A0 =C2=A0=C2=A0=C2=A0 (nv_encoder->dcb->lvdsconf.use_straps_for_mode = || > diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.h > b/drivers/gpu/drm/nouveau/nouveau_connector.h > index 0608cabed058..ca8f310b3680 100644 > --- a/drivers/gpu/drm/nouveau/nouveau_connector.h > +++ b/drivers/gpu/drm/nouveau/nouveau_connector.h > @@ -137,7 +137,12 @@ struct nouveau_connector { > =C2=A0 int scaling_mode; > =C2=A0 > =C2=A0 struct nouveau_encoder *detected_encoder; > - struct edid *edid; > + /* Borrowed decoded view of ->drm_edid for the raw-EDID > consumers > + * (SADs, deep-colour flags, dual-link byte); do not free. > + */ > + const struct edid *edid; > + /* Owner of the sink's EDID, HF-EEODB-complete. */ > + const struct drm_edid *drm_edid; > =C2=A0 struct drm_display_mode *native_mode; > =C2=A0#ifdef CONFIG_DRM_NOUVEAU_BACKLIGHT > =C2=A0 struct nouveau_backlight *backlight;