From: sashiko-bot@kernel.org
To: "Luo Liu" <Luo.Liu@cixtech.com>
Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org,
robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v4 3/5] drm/bridge: trilinear: add the DPTX DRM bridge
Date: Wed, 25 Nov 2026 03:58:27 +0000 [thread overview]
Message-ID: <sashiko-outbox-232538@kernel.org> (raw)
In-Reply-To: <20261125033238.3436046-4-Luo.Liu@cixtech.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [High] drm/bridge: trilinear: force_hpd corruption in
dptx_hpd_notify()
- [Low] drm/bridge: trilinear: dptx_bridge_mode_valid() ignores
info->bpc < 8 for YCbCr
--
commit fc27a9663705ea0c07bb63dcb67db3ac74bea16f
Author: Luo Liu <Luo.Liu@cixtech.com>
drm/bridge: trilinear: add the DPTX DRM bridge
This commit adds the DRM bridge callbacks and helper functions for the
Trilinear DisplayPort transmitter, covering connector detection, EDID
mode enumeration, mode validation, and atomic modeset operations.
> diff --git a/drivers/gpu/drm/bridge/trilinear/dptx_drm.c b/drivers/gpu/drm/bridge/trilinear/dptx_drm.c
> new file mode 100644
> index 0000000000000..099dd53eb2d4d
> --- /dev/null
> +++ b/drivers/gpu/drm/bridge/trilinear/dptx_drm.c
[ ... ]
> +static enum drm_connector_status dptx_bridge_detect(struct drm_bridge *bridge,
> + struct drm_connector *connector)
> +{
> + struct dptx_dev *dp = bridge_to_dp(bridge);
> +
> + return dp->ops->detect_status(dp);
> +}
> +
> +static void dptx_hpd_notify(struct dptx_dev *dp,
> + enum drm_connector_status hpd_state)
> +{
> + dp->ops->lock(dp);
> + if (READ_ONCE(dp->hpd_stopped)) {
> + dp->ops->unlock(dp);
> + return;
> + }
> +
> + if (dp->state & DPTX_STATE_SUSPENDED) {
> + dp->force_hpd = hpd_state;
> + dp->ops->unlock(dp);
> + return;
> + }
> +
> + if (hpd_state != dp->status) {
> + dp->force_hpd = hpd_state;
> + queue_delayed_work(system_freezable_wq, &dp->hpd_event_work, 0);
> +
> + if (hpd_state == connector_status_connected)
> + schedule_delayed_work(&dp->sw_hpd_irq_work, 1);
> + }
> + dp->ops->unlock(dp);
> +}
> +
> +static void dptx_bridge_hpd_notify(struct drm_bridge *bridge,
> + struct drm_connector *connector,
> + enum drm_connector_status status)
> +{
> + dptx_hpd_notify(bridge_to_dp(bridge), status);
> +}
[Severity: High]
Can dptx_bridge_hpd_notify() corrupt dp->force_hpd during normal connector
detection?
drm_bridge_connector_detect_ctx() invokes dptx_bridge_hpd_notify() right
after every dptx_bridge_detect() call:
drivers/gpu/drm/display/drm_bridge_connector.c:drm_bridge_connector_detect_ctx() {
if (detect) {
status = detect->funcs->detect(detect, connector);
...
drm_bridge_connector_hpd_notify(connector, status);
}
}
Because dp->ops->detect_status() does not update dp->status (which starts
at connector_status_unknown at boot and after suspend until hpd_event_work
runs), probing a connected native DisplayPort sink enters dptx_hpd_notify()
with hpd_state != dp->status and latches dp->force_hpd to
connector_status_connected. Once dp->force_hpd is set, physical HPD state
checks evaluate true even after the cable is unplugged, wedging the native
port in a connected state.
On USB-C Alt-Mode ports, if KMS probes the connector while hpd_event_work
is still waiting for the PHY to enter DP mode, dptx_bridge_detect() fails
AUX reads and returns connector_status_disconnected; the follow-up
dptx_bridge_hpd_notify() call then overwrites dp->force_hpd with
connector_status_disconnected and aborts the PHY wait. Similarly, probing
while DPTX_STATE_SUSPENDED is set causes dptx_bridge_detect() to return
connector_status_unknown and dptx_hpd_notify() to overwrite dp->force_hpd
with connector_status_unknown.
Also, gating the dp->force_hpd update on hpd_state != dp->status while
dp->status is updated asynchronously by hpd_event_work drops rapid
plug/unplug transitions that arrive before hpd_event_work finishes (or
after the PHY wait times out without updating dp->status), leaving
dp->force_hpd stuck at the stale state.
[ ... ]
> +static enum drm_mode_status
> +dptx_bridge_mode_valid(struct drm_bridge *bridge,
> + const struct drm_display_info *info,
> + const struct drm_display_mode *mode)
> +{
[ ... ]
> + can_420 = drm_mode_is_420(info, mode) && bridge->ycbcr_420_allowed &&
> + vsc_supported;
> +
> + if (drm_mode_is_420_only(info, mode)) {
> + if (!can_420)
> + return MODE_NO_420;
> +
> + minbpp = 8 * 3 / 2;
> + pixel_per_cycle = 1;
> + } else if (can_420 && adjusted.clock <= DPTX_MAX_FREQ) {
> + minbpp = 8 * 3 / 2;
> + } else if (info->color_formats &
> + BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR422)) {
> + minbpp = 8 * 2;
> + }
[ ... ]
> +}
[ ... ]
> +static int dptx_cal_bpc(struct drm_connector_state *connector_state,
> + int format, int bpc)
> +{
> + struct drm_display_info *info =
> + &connector_state->connector->display_info;
> +
> + if (dptx_bt2020_colorspace(connector_state))
> + bpc = min(bpc, 10);
> +
> + if (info->bpc)
> + bpc = min_t(int, bpc, info->bpc);
> +
> + if (connector_state->max_requested_bpc)
> + bpc = min(bpc, connector_state->max_requested_bpc);
> +
> + if (bpc < 8 && format != DRM_OUTPUT_COLOR_FORMAT_RGB444)
> + return -EINVAL;
> +
> + return bpc;
> +}
[Severity: Low]
Can dptx_bridge_mode_valid() accept YCbCr modes that
dptx_bridge_atomic_check() will reject when 0 < info->bpc < 8?
dptx_cal_bpc() clamps bpc to info->bpc and rejects any format other than
DRM_OUTPUT_COLOR_FORMAT_RGB444 when bpc < 8. However,
dptx_bridge_mode_valid() allows 4:2:0-only modes and lowers minbpp to 12
(YCbCr 4:2:0) or 16 (YCbCr 4:2:2) without checking that info->bpc is 0 or
at least 8, so modes that rely on YCbCr on a 6-bpc sink pass validation
and then fail in dptx_bridge_atomic_check() with -EINVAL.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261125033238.3436046-1-Luo.Liu@cixtech.com?part=3
next prev parent reply other threads:[~2026-11-25 3:58 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 3:32 [PATCH v4 0/5] drm/bridge: trilinear: add the Sky1 DisplayPort transmitter Luo Liu
2026-11-25 3:32 ` [PATCH v4 1/5] dt-bindings: display: add CIX " Luo Liu
2026-11-25 3:52 ` sashiko-bot
2026-11-25 3:32 ` [PATCH v4 2/5] drm/bridge: trilinear: add the DPTX hardware layer Luo Liu
2026-11-25 3:32 ` [PATCH v4 3/5] drm/bridge: trilinear: add the DPTX DRM bridge Luo Liu
2026-11-25 3:58 ` sashiko-bot [this message]
2026-11-25 3:32 ` [PATCH v4 4/5] drm/bridge: trilinear: add the DPTX core and build glue Luo Liu
2026-11-25 4:00 ` sashiko-bot
2026-11-25 3:32 ` [PATCH v4 5/5] drm/cix: add the Sky1 DisplayPort platform glue Luo Liu
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=sashiko-outbox-232538@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Luo.Liu@cixtech.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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