From: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
To: Maxime Ripard <mripard@kernel.org>
Cc: "Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
"Thomas Zimmermann" <tzimmermann@suse.de>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"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>,
"Sandy Huang" <hjc@rock-chips.com>,
"Heiko Stübner" <heiko@sntech.de>,
"Andy Yan" <andy.yan@rock-chips.com>,
"Daniel Stone" <daniels@collabora.com>,
"Dave Stevenson" <dave.stevenson@raspberrypi.com>,
"Maíra Canal" <mcanal@igalia.com>,
"Raspberry Pi Kernel Maintenance" <kernel-list@raspberrypi.com>,
kernel@collabora.com, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-rockchip@lists.infradead.org
Subject: Re: [PATCH v7 25/30] drm/vc4: hdmi: Convert to common HDMI 2.0 SCDC scrambling helpers
Date: Thu, 25 Jun 2026 11:19:22 +0300 [thread overview]
Message-ID: <b520e77d-1ae3-4222-b442-e59442903107@collabora.com> (raw)
In-Reply-To: <20260625-busy-ultra-oryx-ffb3c9@houat>
On 6/25/26 10:44 AM, Maxime Ripard wrote:
> On Sat, Jun 13, 2026 at 03:41:20AM +0300, Cristian Ciocaltea wrote:
>> Hi Maxime,
>>
>> On 6/12/26 3:04 PM, Maxime Ripard wrote:
>>> Hi,
>>>
>>> On Tue, Jun 02, 2026 at 01:44:25AM +0300, Cristian Ciocaltea wrote:
>>>> Replace the vc4-local scrambling implementation with the newly
>>>> introduced DRM common SCDC scrambling infrastructure:
>>>>
>>>> - Advertise source-side scrambling support by setting
>>>> connector->hdmi.scrambling_supported based on the variant's
>>>> max_pixel_clock before drmm_connector_hdmi_init().
>>>>
>>>> - Provide minimal .scrambler_{enable|disable} connector callbacks that
>>>> only toggle the VC5 HDMI_SCRAMBLER_CTL register. Sink-side SCDC
>>>> programming and periodic status monitoring are now delegated to
>>>> drm_scdc_{start|stop}_scrambling().
>>>>
>>>> - Replace vc4_hdmi_enable_scrambling() with a conditional call to
>>>> drm_scdc_start_scrambling() in post_crtc_enable, gated on
>>>> conn_state->hdmi.scrambler_needed (computed by the HDMI state helper).
>>>>
>>>> - Replace vc4_hdmi_disable_scrambling() with drm_scdc_stop_scrambling()
>>>> in post_crtc_disable.
>>>>
>>>> - Drop vc4_hdmi_reset_link() and vc4_hdmi_handle_hotplug(), switching
>>>> the .detect_ctx() path to
>>>> drm_atomic_helper_connector_hdmi_hotplug_ctx() which internally calls
>>>> drm_scdc_sync_status() to trigger a CRTC reset on reconnection.
>>>>
>>>> - Drop the local scrambling_work delayed workqueue and scdc_enabled
>>>> flag, now tracked by the common drm_connector_hdmi layer.
>>>>
>>>> - Drop vc4_hdmi_supports_scrambling() and
>>>> vc4_hdmi_mode_needs_scrambling() helpers, inlining the remaining 4KP60
>>>> warning with an explicit drm_hdmi_compute_mode_clock() check.
>>>>
>>>> - Seed connector->hdmi.scrambler_enabled = true in connector_init() to
>>>> ensure drm_scdc_stop_scrambling() runs at boot and disables any stale
>>>> scrambling state left by the bootloader.
>>>>
>>>> No functional change is expected for the supported modes.
>>>>
>>>> Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
>>>
>>> I'd really like it to be broken down into several patches:
>>>
>>>> ---
>>>> drivers/gpu/drm/vc4/vc4_hdmi.c | 265 ++++++-----------------------------------
>>>> drivers/gpu/drm/vc4/vc4_hdmi.h | 8 --
>>>> 2 files changed, 35 insertions(+), 238 deletions(-)
>>>>
[...]
>>>> -
>>>> - /*
>>>> - * HDMI 2.0 says that one should not send scrambled data
>>>> - * prior to configuring the sink scrambling, and that
>>>> - * TMDS clock/data transmission should be suspended when
>>>> - * changing the TMDS clock rate in the sink. So let's
>>>> - * just do a full modeset here, even though some sinks
>>>> - * would be perfectly happy if were to just reconfigure
>>>> - * the SCDC settings on the fly.
>>>> - */
>>>> - return drm_atomic_helper_reset_crtc(crtc, ctx);
>>>> -}
>>>
>>> This one doesn't look functionally equivalent to me to
>>> drm_scdc_reset_crtc: this part was, in part, making sure we would only
>>> reset the scrambler if it was enabled in the first place.
>>> drm_scdc_reset_crtc() doesn't and will always trigger a modeset on
>>> hotplug. That's unnecessary and a significant functional different.
>>
>> drm_scdc_reset_crtc() alone was not meant to be an equivalent of
>> vc4_hdmi_reset_link(), as it only checks the sink side and it serves as an
>> internal helper used exclusively by drm_scdc_sync_status().
>>
>> As a matter of fact, the latter is the one responsible for verifying if the
>> scrambler was enabled on the controller side before attempting to invoke the
>> reset logic, hence we should get the same behavior. But we don't invoke it
>> directly either, it's part of the drm_atomic_helper_connector_hdmi_hotplug_ctx()
>> call path.
>
> Oh, right, sorry.
>
>>> I'd argue that it's drm_scdc_reset_crtc() that needs to align to what
>>> vc4 was doing, not the opposite.
>>
>> The only difference consists in dropping the crtc state check:
>>
>> ret = drm_modeset_lock(&crtc->mutex, ctx);
>> if (ret)
>> return ret;
>>
>> crtc_state = crtc->state;
>> if (!crtc_state->active)
>> return 0;
>>
>> The rationale was that when CRTC is inactive, drm_atomic_helper_reset_crtc()
>> should result in a no-op commit anyway.
>
> A commit is expensive, so I'd skip it if we can.
>
>> And the one for the in-flight commit:
>>
>> if (conn_state->commit &&
>> !try_wait_for_completion(&conn_state->commit->hw_done)) {
>> mutex_unlock(&vc4_hdmi->mutex);
>> return 0;
>> }
>
> And yeah, we'll need this one too.
>
>> Both checks are also missing in drm_bridge_helper_reset_crtc(), taken as an
>> initial reference. Should we still keep any/both and sync the bridge helper
>> accordingly?
>
> Yes, but I'd expect the bridge helpers to converge / reuse your helpers
> eventually anyway?
Ack.
[...]
>>>> - vc4_hdmi_disable_scrambling(encoder);
>>>> + drm_scdc_stop_scrambling(&vc4_hdmi->connector);
>>>
>>> I don't think the names here are right. It's not *only* related to scdc
>>> but also to the HDMI controller. I'm fine with using a scdc prefix but
>>> only for the things related to scdc. This is related (in part) to the
>>> HDMI controller, so it should use a drm_connector_hdmi prefix.
>>
>> Ack. I guess we should also move these helpers out of drm_scdc_helper.c, but
>> unsure where. FWIW I'm currently working on adding HDMI 2.1 FRL support, and
>> implemented the link training in a dedicated drm_hdmi_frl_helper.c.
>>
>> Should we create drm_hdmi_scrambler_helper.c? Or maybe have a common one to
>> hold both - any suggestion for the naming?
>
> display/drm_hdmi_helper.c sounds like a great place for both?
Indeed, let's move all the stuff there.
>>>> drm_dev_exit(idx);
>>>>
>>>> @@ -1625,6 +1434,7 @@ static void vc4_hdmi_encoder_post_crtc_enable(struct drm_encoder *encoder,
>>>> struct drm_display_info *display = &vc4_hdmi->connector.display_info;
>>>> bool hsync_pos = mode->flags & DRM_MODE_FLAG_PHSYNC;
>>>> bool vsync_pos = mode->flags & DRM_MODE_FLAG_PVSYNC;
>>>> + struct drm_connector_state *conn_state;
>>>> unsigned long flags;
>>>> int ret;
>>>> int idx;
>>>> @@ -1693,7 +1503,10 @@ static void vc4_hdmi_encoder_post_crtc_enable(struct drm_encoder *encoder,
>>>> }
>>>>
>>>> vc4_hdmi_recenter_fifo(vc4_hdmi);
>>>> - vc4_hdmi_enable_scrambling(encoder);
>>>> +
>>>> + conn_state = drm_atomic_get_new_connector_state(state, connector);
>>>> + if (conn_state && conn_state->hdmi.scrambler_needed)
>>>> + drm_scdc_start_scrambling(connector);
>>>
>>> And the nice thing with a drm_connector_hdmi_* prefix is that you don't
>>> have to shoehorn it into SCDC support anymore, so you can take a state
>>> as an argument, and do the check in the helper instead of doing it in
>>> every driver and hoping they get it right.
>>
>> I was about to consider a similar approach before deciding to let drivers manage
>> the logic, i.e. to prevent loosing flexibility later when dealing with HDMI 2.1.
>> That was mostly in the context of supporting drivers to define if/when a display
>> mode that fits in TMDS should be sent over FRL.
>>
>> Thinking again, that's not really a valid concern right now, e.g. will use TMDS
>> by default for all supported modes, and switch to FRL only when absolutely
>> required. Later we might consider extending the infrastructure to support
>> dynamic control if required.
>
> Thanks for working on FRL as well :)
>
> I agree, let's focus on getting HDMI 2.0 right, and then we'll try to
> make 2.1 the easiest to work with for drivers.
Thanks for clarifying the remaining details — I should now have everything I
need to prepare a new revision. :)
Regards,
Cristian
next prev parent reply other threads:[~2026-06-25 8:19 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-01 22:44 [PATCH v7 00/30] Add HDMI 2.0 support to DW HDMI QP TX Cristian Ciocaltea
2026-06-01 22:44 ` [PATCH v7 01/30] drm/fb-helper: Remove unused local variable in hotplug_event() Cristian Ciocaltea
2026-06-11 9:49 ` Maxime Ripard
2026-06-12 13:46 ` Thomas Zimmermann
2026-06-12 17:40 ` Cristian Ciocaltea
2026-06-01 22:44 ` [PATCH v7 02/30] drm/connector: Add HDMI 2.0 scrambler infrastructure Cristian Ciocaltea
2026-06-12 12:06 ` Maxime Ripard
2026-06-12 18:11 ` Cristian Ciocaltea
2026-06-19 12:44 ` Maxime Ripard
2026-06-01 22:44 ` [PATCH v7 03/30] drm/display: scdc_helper: Add macro for connector-prefixed debug messages Cristian Ciocaltea
2026-06-11 15:19 ` Maxime Ripard
2026-06-01 22:44 ` [PATCH v7 04/30] drm/display: scdc_helper: Add HDMI 2.0 scrambling management helpers Cristian Ciocaltea
2026-06-12 13:43 ` Maxime Ripard
2026-06-13 1:30 ` Cristian Ciocaltea
2026-06-25 7:53 ` Maxime Ripard
2026-06-25 8:05 ` Maxime Ripard
2026-06-25 8:27 ` Cristian Ciocaltea
2026-06-01 22:44 ` [PATCH v7 05/30] drm/display: hdmi_state_helper: Add ctx-aware hotplug helper for SCDC sync Cristian Ciocaltea
2026-06-11 15:25 ` Maxime Ripard
2026-06-12 19:23 ` Cristian Ciocaltea
2026-06-01 22:44 ` [PATCH v7 06/30] drm/display: hdmi_state_helper: Plumb HDMI 2.0 source scrambling capability Cristian Ciocaltea
2026-06-01 22:44 ` [PATCH v7 07/30] drm/bridge: Remove redundant error check in drm_bridge_helper_reset_crtc() Cristian Ciocaltea
2026-06-01 22:44 ` [PATCH v7 08/30] drm/bridge: Add HDMI 2.0 scrambler bridge operation and callbacks Cristian Ciocaltea
2026-06-01 22:44 ` [PATCH v7 09/30] drm/display: bridge_connector: Use cached connector status in .get_modes() Cristian Ciocaltea
2026-06-01 22:44 ` [PATCH v7 10/30] drm/display: bridge_connector: Switch to .detect_ctx() connector helper Cristian Ciocaltea
2026-06-01 22:44 ` [PATCH v7 11/30] drm/display: bridge_connector: Wire up HDMI 2.0 scrambler callbacks Cristian Ciocaltea
2026-06-12 8:52 ` Maxime Ripard
2026-06-12 20:42 ` Cristian Ciocaltea
2026-06-19 13:58 ` Maxime Ripard
2026-06-01 22:44 ` [PATCH v7 12/30] drm/bridge: dw-hdmi-qp: Rate limit i2c read error messages Cristian Ciocaltea
2026-06-01 22:44 ` [PATCH v7 13/30] drm/bridge: dw-hdmi-qp: Provide .{enable|disable}_hpd() PHY ops Cristian Ciocaltea
2026-06-01 22:44 ` [PATCH v7 14/30] drm/bridge: dw-hdmi-qp: Add HDMI 2.0 SCDC scrambling support Cristian Ciocaltea
2026-06-01 22:44 ` [PATCH v7 15/30] drm/bridge: dw-hdmi-qp: Provide dw_hdmi_qp_hpd_notify() helper Cristian Ciocaltea
2026-06-01 22:44 ` [PATCH v7 16/30] drm/rockchip: dw_hdmi_qp: Add missing newlines in dev_err_probe() messages Cristian Ciocaltea
2026-06-01 22:44 ` [PATCH v7 17/30] drm/rockchip: dw_hdmi_qp: Use local dev variable consistently in bind() Cristian Ciocaltea
2026-06-01 22:44 ` [PATCH v7 18/30] drm/rockchip: dw_hdmi_qp: Drop unnecessary #include Cristian Ciocaltea
2026-06-01 22:44 ` [PATCH v7 19/30] drm/rockchip: dw_hdmi_qp: Defer HPD IRQ enable until after connector setup Cristian Ciocaltea
2026-06-01 22:44 ` [PATCH v7 20/30] drm/rockchip: dw_hdmi_qp: Mask HPD IRQ in rk3576_io_init() Cristian Ciocaltea
2026-06-01 22:44 ` [PATCH v7 21/30] drm/rockchip: dw_hdmi_qp: Implement .{enable|disable}_hpd() PHY ops Cristian Ciocaltea
2026-06-01 22:44 ` [PATCH v7 22/30] drm/rockchip: dw_hdmi_qp: Switch to dw_hdmi_qp_hpd_notify() Cristian Ciocaltea
2026-06-01 22:44 ` [PATCH v7 23/30] drm/bridge: dw-hdmi-qp: Remove obsolete .setup_hpd() phy op Cristian Ciocaltea
2026-06-01 22:44 ` [PATCH v7 24/30] drm/vc4: hdmi: Use common TMDS char rate constants Cristian Ciocaltea
2026-06-11 15:32 ` Maxime Ripard
2026-06-11 17:14 ` Dave Stevenson
2026-06-01 22:44 ` [PATCH v7 25/30] drm/vc4: hdmi: Convert to common HDMI 2.0 SCDC scrambling helpers Cristian Ciocaltea
2026-06-12 12:04 ` Maxime Ripard
2026-06-13 0:41 ` Cristian Ciocaltea
2026-06-25 7:44 ` Maxime Ripard
2026-06-25 8:19 ` Cristian Ciocaltea [this message]
2026-06-01 22:44 ` [PATCH v7 26/30] drm/tests: connector: Add HDMI source-side scrambler capability tests Cristian Ciocaltea
2026-06-01 22:44 ` [PATCH v7 27/30] drm/tests: edid: Add 4K@60Hz EDID with 600MHz TMDS Cristian Ciocaltea
2026-06-01 22:44 ` [PATCH v7 28/30] drm/tests: hdmi_state_helper: Add HDMI 2.0 scrambling tests Cristian Ciocaltea
2026-06-01 22:44 ` [PATCH v7 29/30] drm/tests: edid: Fix conformity for 1080p+4K YUV420 200MHz EDID Cristian Ciocaltea
2026-06-01 22:44 ` [PATCH v7 30/30] drm/tests: edid: Fix conformity for 4K RGB/YUV 340MHz EDID Cristian Ciocaltea
2026-06-24 14:08 ` (subset) [PATCH v7 00/30] Add HDMI 2.0 support to DW HDMI QP TX Luca Ceresoli
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=b520e77d-1ae3-4222-b442-e59442903107@collabora.com \
--to=cristian.ciocaltea@collabora.com \
--cc=Laurent.pinchart@ideasonboard.com \
--cc=airlied@gmail.com \
--cc=andrzej.hajda@intel.com \
--cc=andy.yan@rock-chips.com \
--cc=daniels@collabora.com \
--cc=dave.stevenson@raspberrypi.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=heiko@sntech.de \
--cc=hjc@rock-chips.com \
--cc=jernej.skrabec@gmail.com \
--cc=jonas@kwiboo.se \
--cc=kernel-list@raspberrypi.com \
--cc=kernel@collabora.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=luca.ceresoli@bootlin.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mcanal@igalia.com \
--cc=mripard@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=rfoss@kernel.org \
--cc=simona@ffwll.ch \
--cc=tzimmermann@suse.de \
/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