| Message ID | 20260731-dw-hdmi-qp-scramb-v10-22-294364b2cf15@collabora.com (mailing list archive) |
|---|---|
| State | New |
| Headers |
Return-Path: <linux-sunxi+bounces-24821-sunxi=pue.re@lists.linux.dev> X-Original-To: noreply@patchwork.local Delivered-To: noreply@patchwork.local Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mxe881.netcup.net (Postfix) with ESMTPS id BB5791C0254 for <noreply@patchwork.local>; Fri, 31 Jul 2026 18:31:12 +0200 (CEST) Authentication-Results: mxe881; dkim=pass header.d=collabora.com; spf=pass (sender IP is 172.105.105.114) smtp.mailfrom=linux-sunxi+bounces-24821-noreply=patchwork.local@lists.linux.dev smtp.helo=tor.lore.kernel.org Received-SPF: pass (mxe881: domain of lists.linux.dev designates 172.105.105.114 as permitted sender) client-ip=172.105.105.114; envelope-from=linux-sunxi+bounces-24821-noreply=patchwork.local@lists.linux.dev; helo=tor.lore.kernel.org; Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1]) by tor.lore.kernel.org (Postfix) with ESMTP id 22B91309F73E for <noreply@patchwork.local>; Fri, 31 Jul 2026 16:22:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 44F2A44DB61; Fri, 31 Jul 2026 16:19:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="oPHcO2kn" X-Original-To: linux-sunxi@lists.linux.dev Received: from bali.collaboradmins.com (bali.collaboradmins.com [148.251.105.195]) (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 D20A845628E for <linux-sunxi@lists.linux.dev>; Fri, 31 Jul 2026 16:19:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.251.105.195 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785514782; cv=none; b=Z+x4cIudDAcjLW+f3kDU7n7YPfhSs+HaX8gsc7XECF18D9iYHNmNDNprYVml+SkLC0O8gcR/ymjKvh08wxEe2097/sQ3oH+oJoTFeP1/XUhgjz5keE1O13E8j5jygSryu/WSyiMWIEJ3mj2pssl26BEybSDL1QsSFZn3WsTXGiY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785514782; c=relaxed/simple; bh=t0n10iHhf/9/WODO+84lsoOn3fsfS146FQnPcalTtBc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=lgCwgsu+3bxiBMAWbLZea6vYgtk4UagFSfpnEY6EvEsMTFRiBXkX9T7MldJEBeRWj2nlc5bOMtUvEvOT0yKq8QzZLWDiaMEoaxOQ+6NdDPQl4eR/T3+eVvl1OCXXfaztTnohIAl2N29yHvEmRwOMisD8F3h4H4u3q8oaeoo5upg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=oPHcO2kn; arc=none smtp.client-ip=148.251.105.195 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1785514770; bh=t0n10iHhf/9/WODO+84lsoOn3fsfS146FQnPcalTtBc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=oPHcO2knZfcrbYyL+Fyjs2Qx87cgYxiiKE6eaoviBJst4Fst+LYvUH9kJeDHkZAif ntmEcCBKzOmQTFT7qRuERxlxK284mM6Nwb0ajFbO5vpskSBRFbu4p+TD03DoGJNKp2 XkqRKXOg2inVB3I4wq9MRCPDGrAfxQsbt97QdDAshF3LM3rS2Z19KqywLdXheF0uBd 0WFL2hG1/NywKSKOL6IIvr4YxOoaohamBh3JqI9tLu7UWHducnnnvylVuJKQqj33lB qokdKyX7mYZS2PWkOIPKq72INkfG3TqH7wPEtlZ1u9Fs6Fk7HTq/EQ05GoH+YiTtdn Gthb2vgTnznQw== Received: from localhost (unknown [100.64.0.241]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange secp256r1 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: cristicc) by bali.collaboradmins.com (Postfix) with ESMTPSA id 9A03517E0946; Fri, 31 Jul 2026 18:19:30 +0200 (CEST) From: Cristian Ciocaltea <cristian.ciocaltea@collabora.com> Date: Fri, 31 Jul 2026 19:19:29 +0300 Subject: [PATCH v10 22/69] drm/display: hdmi-state-helper: Sync SCDC state on hotplug Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: <linux-sunxi.lists.linux.dev> List-Subscribe: <mailto:linux-sunxi+subscribe@lists.linux.dev> List-Unsubscribe: <mailto:linux-sunxi+unsubscribe@lists.linux.dev> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260731-dw-hdmi-qp-scramb-v10-22-294364b2cf15@collabora.com> References: <20260731-dw-hdmi-qp-scramb-v10-0-294364b2cf15@collabora.com> In-Reply-To: <20260731-dw-hdmi-qp-scramb-v10-0-294364b2cf15@collabora.com> To: Andrzej Hajda <andrzej.hajda@intel.com>, Neil Armstrong <neil.armstrong@linaro.org>, Robert Foss <rfoss@kernel.org>, Laurent Pinchart <Laurent.pinchart@ideasonboard.com>, Jonas Karlman <jonas@kwiboo.se>, Jernej Skrabec <jernej.skrabec@gmail.com>, Luca Ceresoli <luca.ceresoli@bootlin.com>, Maarten Lankhorst <maarten.lankhorst@linux.intel.com>, Maxime Ripard <mripard@kernel.org>, Thomas Zimmermann <tzimmermann@suse.de>, David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>, Chen-Yu Tsai <wens@kernel.org>, Samuel Holland <samuel@sholland.org>, Dave Stevenson <dave.stevenson@raspberrypi.com>, =?utf-8?q?Ma=C3=ADra_Canal?= <mcanal@igalia.com>, Raspberry Pi Kernel Maintenance <kernel-list@raspberrypi.com>, Sandy Huang <hjc@rock-chips.com>, =?utf-8?q?Heiko_St=C3=BCbner?= <heiko@sntech.de>, Andy Yan <andy.yan@rock-chips.com>, Algea Cao <algea.cao@rock-chips.com>, Daniel Stone <daniels@collabora.com>, Liu Ying <victor.liu@nxp.com>, Phong LE <ple@baylibre.com> Cc: kernel@collabora.com, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-rockchip@lists.infradead.org, Maud Spierings <maud_spierings@hotmail.com>, Diederik de Haas <diederik@cknow-tech.com> X-Mailer: b4 0.15.2 X-MORS-Enabled: yes X-MORS-DOMAIN: patchwork.local X-MORS-HOSTING: hosting172546 X-MORS-USER: hosting172546 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= |
| Series |
Add HDMI 2.0 support to DW HDMI QP TX
|
|
Commit Message
Cristian Ciocaltea
July 31, 2026, 4:19 p.m. UTC
drm_atomic_helper_connector_hdmi_hotplug() does not currently synchronize SCDC status on hotplug events, leaving the scrambler state potentially inconsistent after (re)connect. Hook drm_connector_hdmi_sync_scdc() into both the connect and disconnect paths, replacing the existing TODOs around missing scrambler handling. Tested-by: Maud Spierings <maud_spierings@hotmail.com> Tested-by: Diederik de Haas <diederik@cknow-tech.com> # NanoPC-T6 LTS, Rock 5B Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com> --- drivers/gpu/drm/display/drm_hdmi_state_helper.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-)
Comments
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] SCDC sync fails to handle scrambler teardown on disconnect, leaving the source scrambler active when swapping to a non-scrambling sink. -- --- Patch [22]: [PATCH v10 22/69] drm/display: hdmi-state-helper: Sync SCDC state on hotplug --- commit 7cc2ce705b4793d8696717d86562fbd6c0bde231 Author: Cristian Ciocaltea <cristian.ciocaltea@collabora.com> drm/display: hdmi-state-helper: Sync SCDC state on hotplug This commit hooks drm_connector_hdmi_sync_scdc() into the connect and disconnect paths in drm_atomic_helper_connector_hdmi_update() to synchronize the SCDC status on hotplug events. > diff --git a/drivers/gpu/drm/display/drm_hdmi_state_helper.c b/drivers/gpu/drm/display/drm_hdmi_state_helper.c > index 4a93c279c9a76..3377ea9361209 100644 > --- a/drivers/gpu/drm/display/drm_hdmi_state_helper.c > +++ b/drivers/gpu/drm/display/drm_hdmi_state_helper.c > @@ -1205,13 +1205,16 @@ drm_atomic_helper_connector_hdmi_update(struct drm_connector *connector, > enum drm_connector_status status) > { > const struct drm_edid *drm_edid; > + int ret = 0; > > if (status == connector_status_disconnected) { > - // TODO: also handle scramber, HDMI sink disconnected. > - drm_connector_hdmi_audio_plugged_notify(connector, false); > - drm_edid_connector_update(connector, NULL); > - drm_connector_cec_phys_addr_invalidate(connector); > - return 0; > + ret = drm_connector_hdmi_sync_scdc(connector, false, ctx); [Severity: High] Does this call successfully tear down the scrambler on disconnect? Looking at drm_connector_hdmi_sync_scdc() in drm_hdmi_helper.c, it seems to return immediately if the plugged parameter is false: int drm_connector_hdmi_sync_scdc(struct drm_connector *connector, bool plugged, struct drm_modeset_acquire_ctx *ctx) { ... if (!connector || !plugged || !ctx) return 0; This would make the disconnect call a no-op, failing to disable the source scrambler. Additionally, if a non-scrambling sink is subsequently plugged in, the connect path will call drm_connector_hdmi_sync_scdc() with plugged set to true, which also bails out early: if (!connector->ddc || !drm_scdc_sink_supports_scrambling(connector)) return 0; Could this leave the source scrambler incorrectly enabled if a user swaps from an HDMI 2.0 monitor to an older HDMI 1.4 monitor, resulting in broken display output due to mismatched hardware state? > + if (ret != -EDEADLK) { > + drm_connector_hdmi_audio_plugged_notify(connector, false); > + drm_edid_connector_update(connector, NULL); > + drm_connector_cec_phys_addr_invalidate(connector); > + } > + return ret; > } [ ... ]
On Fri, Jul 31, 2026 at 07:19:29PM +0300, Cristian Ciocaltea wrote: > drm_atomic_helper_connector_hdmi_hotplug() does not currently > synchronize SCDC status on hotplug events, leaving the scrambler state > potentially inconsistent after (re)connect. > > Hook drm_connector_hdmi_sync_scdc() into both the connect and disconnect > paths, replacing the existing TODOs around missing scrambler handling. > > Tested-by: Maud Spierings <maud_spierings@hotmail.com> > Tested-by: Diederik de Haas <diederik@cknow-tech.com> # NanoPC-T6 LTS, Rock 5B > Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com> > --- > drivers/gpu/drm/display/drm_hdmi_state_helper.c | 23 ++++++++++++++--------- > 1 file changed, 14 insertions(+), 9 deletions(-) > > diff --git a/drivers/gpu/drm/display/drm_hdmi_state_helper.c b/drivers/gpu/drm/display/drm_hdmi_state_helper.c > index 4a93c279c9a7..3377ea936120 100644 > --- a/drivers/gpu/drm/display/drm_hdmi_state_helper.c > +++ b/drivers/gpu/drm/display/drm_hdmi_state_helper.c > @@ -1205,13 +1205,16 @@ drm_atomic_helper_connector_hdmi_update(struct drm_connector *connector, > enum drm_connector_status status) > { > const struct drm_edid *drm_edid; > + int ret = 0; > > if (status == connector_status_disconnected) { > - // TODO: also handle scramber, HDMI sink disconnected. > - drm_connector_hdmi_audio_plugged_notify(connector, false); > - drm_edid_connector_update(connector, NULL); > - drm_connector_cec_phys_addr_invalidate(connector); > - return 0; > + ret = drm_connector_hdmi_sync_scdc(connector, false, ctx); > + if (ret != -EDEADLK) { > + drm_connector_hdmi_audio_plugged_notify(connector, false); > + drm_edid_connector_update(connector, NULL); > + drm_connector_cec_phys_addr_invalidate(connector); > + } If there's a deadlock, shouldn't we restart the whole sequence there? Ie, we should return ret all the time anyway? And if we do that, we should return ret for drm_edid_connector_update() too. Either way, a comment on why we're doing it this way would be nice. Maxime
On 8/20/26 11:53 AM, Maxime Ripard wrote: > On Fri, Jul 31, 2026 at 07:19:29PM +0300, Cristian Ciocaltea wrote: >> drm_atomic_helper_connector_hdmi_hotplug() does not currently >> synchronize SCDC status on hotplug events, leaving the scrambler state >> potentially inconsistent after (re)connect. >> >> Hook drm_connector_hdmi_sync_scdc() into both the connect and disconnect >> paths, replacing the existing TODOs around missing scrambler handling. >> >> Tested-by: Maud Spierings <maud_spierings@hotmail.com> >> Tested-by: Diederik de Haas <diederik@cknow-tech.com> # NanoPC-T6 LTS, Rock 5B >> Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com> >> --- >> drivers/gpu/drm/display/drm_hdmi_state_helper.c | 23 ++++++++++++++--------- >> 1 file changed, 14 insertions(+), 9 deletions(-) >> >> diff --git a/drivers/gpu/drm/display/drm_hdmi_state_helper.c b/drivers/gpu/drm/display/drm_hdmi_state_helper.c >> index 4a93c279c9a7..3377ea936120 100644 >> --- a/drivers/gpu/drm/display/drm_hdmi_state_helper.c >> +++ b/drivers/gpu/drm/display/drm_hdmi_state_helper.c >> @@ -1205,13 +1205,16 @@ drm_atomic_helper_connector_hdmi_update(struct drm_connector *connector, >> enum drm_connector_status status) >> { >> const struct drm_edid *drm_edid; >> + int ret = 0; >> >> if (status == connector_status_disconnected) { >> - // TODO: also handle scramber, HDMI sink disconnected. >> - drm_connector_hdmi_audio_plugged_notify(connector, false); >> - drm_edid_connector_update(connector, NULL); >> - drm_connector_cec_phys_addr_invalidate(connector); >> - return 0; >> + ret = drm_connector_hdmi_sync_scdc(connector, false, ctx); >> + if (ret != -EDEADLK) { >> + drm_connector_hdmi_audio_plugged_notify(connector, false); >> + drm_edid_connector_update(connector, NULL); >> + drm_connector_cec_phys_addr_invalidate(connector); >> + } > > If there's a deadlock, shouldn't we restart the whole sequence there? In that case we do already propagate -EDEADLK and let the callers (drm_helper_probe_detect_ctx(), drm_helper_probe_single_connector_modes()) to ensure the sequence is restarted. > Ie, we should return ret all the time anyway? And if we do that, we > should return ret for drm_edid_connector_update() too. Per .detect_ctx() contract, implementations shall return a drm_connector_status value or -EDEADLK only. On the other hand, .force_ctx() accepts any error code, but the probe helpers just log it. Hence returning anything else wouldn't really have an impact on the functionality. Returning errors from drm_edid_connector_update() would potentially override non-deadlock ones from sync_scdc(). Since both helpers already log their own failures, I think it isn't worth the trouble. > Either way, a comment on why we're doing it this way would be nice. Indeed. Would the following be too verbose? /* * The SCDC resync may reset the CRTC, which might involve aquiring * modeset locks. If that fails, -EDEADLK is reported and the callers * passing a non-NULL @ctx drop the locks and restart the sequence * - see drm_helper_probe_detect_ctx() and * drm_helper_probe_single_connector_modes(). * * The resync runs first, and the audio and CEC helpers only once the * link state has settled: the CRTC reset is a blocking commit, so on * success the pipeline is already up again, while on -EDEADLK nothing * has been resynced yet and the pending retry redoes everything. This * keeps userspace from acting upon a link that is about to be reset. * * -EDEADLK is the only status gating the helpers below, as it is the * sole one guaranteeing a new run. The other failures are merely * reported: .force_ctx() accepts any error code and the probe helpers * just log it, while .detect_ctx() has to swallow it, being only * allowed to return a drm_connector_status value or -EDEADLK. * Propagating the status of drm_edid_connector_update() on top would * therefore only make it compete with an earlier resync failure over a * value that triggers no recovery, the more so as both helpers already * log their own errors. */ Thanks, Cristian
diff --git a/drivers/gpu/drm/display/drm_hdmi_state_helper.c b/drivers/gpu/drm/display/drm_hdmi_state_helper.c index 4a93c279c9a7..3377ea936120 100644 --- a/drivers/gpu/drm/display/drm_hdmi_state_helper.c +++ b/drivers/gpu/drm/display/drm_hdmi_state_helper.c @@ -1205,13 +1205,16 @@ drm_atomic_helper_connector_hdmi_update(struct drm_connector *connector, enum drm_connector_status status) { const struct drm_edid *drm_edid; + int ret = 0; if (status == connector_status_disconnected) { - // TODO: also handle scramber, HDMI sink disconnected. - drm_connector_hdmi_audio_plugged_notify(connector, false); - drm_edid_connector_update(connector, NULL); - drm_connector_cec_phys_addr_invalidate(connector); - return 0; + ret = drm_connector_hdmi_sync_scdc(connector, false, ctx); + if (ret != -EDEADLK) { + drm_connector_hdmi_audio_plugged_notify(connector, false); + drm_edid_connector_update(connector, NULL); + drm_connector_cec_phys_addr_invalidate(connector); + } + return ret; } if (connector->hdmi.funcs->read_edid) @@ -1224,12 +1227,14 @@ drm_atomic_helper_connector_hdmi_update(struct drm_connector *connector, drm_edid_free(drm_edid); if (status == connector_status_connected) { - // TODO: also handle scramber, HDMI sink is now connected. - drm_connector_hdmi_audio_plugged_notify(connector, true); - drm_connector_cec_phys_addr_set(connector); + ret = drm_connector_hdmi_sync_scdc(connector, true, ctx); + if (ret != -EDEADLK) { + drm_connector_hdmi_audio_plugged_notify(connector, true); + drm_connector_cec_phys_addr_set(connector); + } } - return 0; + return ret; } /**