From: Luca Ceresoli <luca.ceresoli@bootlin.com>
To: Damon Ding <damon.ding@rock-chips.com>
Cc: andrzej.hajda@intel.com, neil.armstrong@linaro.org,
rfoss@kernel.org, Laurent.pinchart@ideasonboard.com,
jonas@kwiboo.se, jernej.skrabec@gmail.com,
maarten.lankhorst@linux.intel.com, mripard@kernel.org,
tzimmermann@suse.de, airlied@gmail.com, simona@ffwll.ch,
shawnguo@kernel.org, s.hauer@pengutronix.de,
kernel@pengutronix.de, festevam@gmail.com, inki.dae@samsung.com,
sw0312.kim@samsung.com, kyungmin.park@samsung.com,
krzk@kernel.org, alim.akhtar@samsung.com, jingoohan1@gmail.com,
p.zabel@pengutronix.de, hjc@rock-chips.com, heiko@sntech.de,
andy.yan@rock-chips.com, dmitry.baryshkov@oss.qualcomm.com,
dianders@chromium.org, m.szyprowski@samsung.com,
jani.nikula@intel.com, linux-kernel@vger.kernel.org,
dri-devel@lists.freedesktop.org, imx@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
linux-samsung-soc@vger.kernel.org,
linux-rockchip@lists.infradead.org
Subject: Re: [PATCH v6 11/18] drm/display: bridge_connector: Ensure last bridge determines EDID/modes detection capabilities
Date: Wed, 1 Oct 2025 18:09:22 +0200 [thread overview]
Message-ID: <20251001180922.6bbe42ac@booty> (raw)
In-Reply-To: <20250930090920.131094-12-damon.ding@rock-chips.com>
Hello Damon,
On Tue, 30 Sep 2025 17:09:13 +0800
Damon Ding <damon.ding@rock-chips.com> wrote:
> When multiple bridges are present, EDID detection capability
> (DRM_BRIDGE_OP_EDID) takes precedence over modes detection
> (DRM_BRIDGE_OP_MODES). To ensure the above two capabilities are
> determined by the last bridge in the chain, we handle three cases:
>
> Case 1: The later bridge declares only DRM_BRIDGE_OP_MODES
> - If the previous bridge declares DRM_BRIDGE_OP_EDID, set
> &drm_bridge_connector.bridge_edid to NULL and set
> &drm_bridge_connector.bridge_modes to the later bridge.
> - Ensure modes detection capability of the later bridge will not
> be ignored.
>
> Case 2: The later bridge declares only DRM_BRIDGE_OP_EDID
> - If the previous bridge declares DRM_BRIDGE_OP_MODES, set
> &drm_bridge_connector.bridge_modes to NULL and set
> &drm_bridge_connector.bridge_edid to the later bridge.
> - Although EDID detection capability has higher priority, this
> operation is for balance and makes sense.
>
> Case 3: the later bridge declares both of them
> - Assign later bridge as &drm_bridge_connector.bridge_edid and
> and &drm_bridge_connector.bridge_modes to this bridge.
> - Just leave transfer of these two capabilities as before.
I think the whole explanation can be more concisely rewritten as:
If the later bridge declares OP_EDID, OP_MODES or both, then both
.bridge_modes and .bridge_edid should be set to NULL (if any was set
from a previous bridge), and then .bridge_modes and/or .bridge_edid be
set to the later bridge as is done already.
Does this look correct (i.e. does it convey the same meaning)?
> --- a/drivers/gpu/drm/display/drm_bridge_connector.c
> +++ b/drivers/gpu/drm/display/drm_bridge_connector.c
> @@ -640,6 +640,7 @@ struct drm_connector *drm_bridge_connector_init(struct drm_device *drm,
> struct drm_connector *connector;
> struct i2c_adapter *ddc = NULL;
> struct drm_bridge *bridge, *panel_bridge = NULL;
> + struct drm_bridge *pre_bridge_edid, *pre_bridge_modes;
> unsigned int supported_formats = BIT(HDMI_COLORSPACE_RGB);
> unsigned int max_bpc = 8;
> bool support_hdcp = false;
> @@ -668,6 +669,9 @@ struct drm_connector *drm_bridge_connector_init(struct drm_device *drm,
> */
> connector_type = DRM_MODE_CONNECTOR_Unknown;
> drm_for_each_bridge_in_chain(encoder, bridge) {
> + pre_bridge_edid = bridge_connector->bridge_edid;
> + pre_bridge_modes = bridge_connector->bridge_modes;
> +
> if (!bridge->interlace_allowed)
> connector->interlace_allowed = false;
> if (!bridge->ycbcr_420_allowed)
> @@ -681,6 +685,44 @@ struct drm_connector *drm_bridge_connector_init(struct drm_device *drm,
> bridge_connector->bridge_detect = bridge;
> if (bridge->ops & DRM_BRIDGE_OP_MODES)
> bridge_connector->bridge_modes = bridge;
> +
> + /*
> + * When multiple bridges are present, EDID detection capability
> + * (DRM_BRIDGE_OP_EDID) takes precedence over modes detection
> + * (DRM_BRIDGE_OP_MODES). To ensure the above two capabilities
> + * are determined by the last bridge in the chain, we handle
> + * three cases:
> + *
> + * Case 1: The later bridge declares only DRM_BRIDGE_OP_MODES
> + * - If the previous bridge declares DRM_BRIDGE_OP_EDID, set
> + * &drm_bridge_connector.bridge_edid to NULL and set
> + * &drm_bridge_connector.bridge_modes to the later bridge.
> + * - Ensure modes detection capability of the later bridge
> + * will not be ignored.
> + *
> + * Case 2: The later bridge declares only DRM_BRIDGE_OP_EDID
> + * - If the previous bridge declares DRM_BRIDGE_OP_MODES, set
> + * &drm_bridge_connector.bridge_modes to NULL and set
> + * &drm_bridge_connector.bridge_edid to the later bridge.
> + * - Although EDID detection capability has higher priority,
> + * this operation is for balance and makes sense.
> + *
> + * Case 3: the later bridge declares both of them
> + * - Assign later bridge as &drm_bridge_connector.bridge_edid
> + * and &drm_bridge_connector.bridge_modes to this bridge.
> + * - Just leave transfer of these two capabilities as before.
> + */
> + if (bridge->ops & DRM_BRIDGE_OP_EDID &&
> + !(bridge->ops & DRM_BRIDGE_OP_MODES)) {
> + if (pre_bridge_modes)
> + bridge_connector->bridge_modes = NULL;
> + }
> + if (bridge->ops & DRM_BRIDGE_OP_MODES &&
> + !(bridge->ops & DRM_BRIDGE_OP_EDID)) {
> + if (pre_bridge_edid)
> + bridge_connector->bridge_edid = NULL;
> + }
> +
If the above rewrite is correct, then I think this patch can be
rewritten in a simple way (build tested only):
diff --git a/drivers/gpu/drm/display/drm_bridge_connector.c b/drivers/gpu/drm/display/drm_bridge_connector.c
index a5bdd6c10643..bd5dbafe88bc 100644
--- a/drivers/gpu/drm/display/drm_bridge_connector.c
+++ b/drivers/gpu/drm/display/drm_bridge_connector.c
@@ -672,14 +672,18 @@ struct drm_connector *drm_bridge_connector_init(struct drm_device *drm,
if (!bridge->ycbcr_420_allowed)
connector->ycbcr_420_allowed = false;
- if (bridge->ops & DRM_BRIDGE_OP_EDID)
- bridge_connector->bridge_edid = bridge;
+ if (bridge->ops & DRM_BRIDGE_OP_EDID || bridge->ops & DRM_BRIDGE_OP_MODES) {
+ bridge_connector->bridge_edid = NULL;
+ bridge_connector->bridge_modes = NULL;
+ if (bridge->ops & DRM_BRIDGE_OP_EDID)
+ bridge_connector->bridge_edid = bridge;
+ if (bridge->ops & DRM_BRIDGE_OP_MODES)
+ bridge_connector->bridge_modes = bridge;
+ }
if (bridge->ops & DRM_BRIDGE_OP_HPD)
bridge_connector->bridge_hpd = bridge;
if (bridge->ops & DRM_BRIDGE_OP_DETECT)
bridge_connector->bridge_detect = bridge;
- if (bridge->ops & DRM_BRIDGE_OP_MODES)
- bridge_connector->bridge_modes = bridge;
if (bridge->ops & DRM_BRIDGE_OP_HDMI) {
if (bridge_connector->bridge_hdmi)
return ERR_PTR(-EBUSY);
Another thing to note is that this patch conflicts with [0], which I
plan to apply in the next few days. The two patches are orthogonal but
they insist on the same lines (those assigning
bridge_connector->bridge_* = bridge). Not a big deal, whichever patch
comes later will be easily adapted. Just wanted to ensure you are aware.
[0] https://lore.kernel.org/all/20250926-drm-bridge-alloc-getput-bridge-connector-v2-1-138b4bb70576@bootlin.com/
Best regards,
Luca
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
next prev parent reply other threads:[~2025-10-01 16:10 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20250930091415eucas1p1f82ef0c96cbe0c7c673d975d502629e2@eucas1p1.samsung.com>
2025-09-30 9:09 ` [PATCH v6 00/18] Apply drm_bridge_connector and panel_bridge helper for the Analogix DP driver Damon Ding
2025-09-30 9:09 ` [PATCH v6 01/18] drm/bridge: analogix_dp: Formalize the struct analogix_dp_device Damon Ding
2025-09-30 9:09 ` [PATCH v6 02/18] drm/bridge: analogix_dp: Move &drm_bridge_funcs.mode_set to &drm_bridge_funcs.atomic_enable Damon Ding
2025-09-30 9:09 ` [PATCH v6 03/18] drm/bridge: analogix_dp: Add &analogix_dp_plat_data.next_bridge Damon Ding
2025-09-30 9:09 ` [PATCH v6 04/18] drm/bridge: Move legacy bridge driver out of imx directory for multi-platform use Damon Ding
2025-09-30 20:10 ` Dmitry Baryshkov
2025-10-09 1:46 ` Damon Ding
2025-09-30 9:09 ` [PATCH v6 05/18] drm/exynos: exynos_dp: Remove &exynos_dp_device.ptn_bridge Damon Ding
2025-09-30 9:09 ` [PATCH v6 06/18] drm/exynos: exynos_dp: Remove unused &exynos_dp_device.connector Damon Ding
2025-09-30 9:09 ` [PATCH v6 07/18] drm/exynos: exynos_dp: Apply legacy bridge to parse the display-timings node Damon Ding
2025-09-30 20:17 ` Dmitry Baryshkov
2025-10-09 2:01 ` Damon Ding
2025-09-30 9:09 ` [PATCH v6 08/18] drm/bridge: analogix_dp: Remove redundant &analogix_dp_plat_data.skip_connector Damon Ding
2025-09-30 9:09 ` [PATCH v6 09/18] drm/bridge: analogix_dp: Move the color format check to .atomic_check() for Rockchip platforms Damon Ding
2025-09-30 20:18 ` Dmitry Baryshkov
2025-09-30 9:09 ` [PATCH v6 10/18] drm/bridge: analogix_dp: Remove unused &analogix_dp_plat_data.get_modes() Damon Ding
2025-09-30 20:18 ` Dmitry Baryshkov
2025-09-30 9:09 ` [PATCH v6 11/18] drm/display: bridge_connector: Ensure last bridge determines EDID/modes detection capabilities Damon Ding
2025-09-30 20:21 ` Dmitry Baryshkov
2025-10-09 3:15 ` Damon Ding
2025-10-01 16:09 ` Luca Ceresoli [this message]
2025-10-03 7:34 ` Luca Ceresoli
2025-10-09 4:10 ` Damon Ding
2025-10-10 14:02 ` Dmitry Baryshkov
2025-10-11 1:04 ` Damon Ding
2025-09-30 9:09 ` [PATCH v6 12/18] drm/bridge: analogix_dp: Apply drm_bridge_connector helper Damon Ding
2025-09-30 9:09 ` [PATCH v6 13/18] drm/bridge: analogix_dp: Add new API analogix_dp_finish_probe() Damon Ding
2025-09-30 10:17 ` [PATCH v6 00/18] Apply drm_bridge_connector and panel_bridge helper for the Analogix DP driver Marek Szyprowski
2025-10-09 1:29 ` Damon Ding
2025-09-30 20:29 ` Dmitry Baryshkov
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=20251001180922.6bbe42ac@booty \
--to=luca.ceresoli@bootlin.com \
--cc=Laurent.pinchart@ideasonboard.com \
--cc=airlied@gmail.com \
--cc=alim.akhtar@samsung.com \
--cc=andrzej.hajda@intel.com \
--cc=andy.yan@rock-chips.com \
--cc=damon.ding@rock-chips.com \
--cc=dianders@chromium.org \
--cc=dmitry.baryshkov@oss.qualcomm.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=festevam@gmail.com \
--cc=heiko@sntech.de \
--cc=hjc@rock-chips.com \
--cc=imx@lists.linux.dev \
--cc=inki.dae@samsung.com \
--cc=jani.nikula@intel.com \
--cc=jernej.skrabec@gmail.com \
--cc=jingoohan1@gmail.com \
--cc=jonas@kwiboo.se \
--cc=kernel@pengutronix.de \
--cc=krzk@kernel.org \
--cc=kyungmin.park@samsung.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=p.zabel@pengutronix.de \
--cc=rfoss@kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
--cc=simona@ffwll.ch \
--cc=sw0312.kim@samsung.com \
--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;
as well as URLs for NNTP newsgroup(s).