Skip to contentSkip to conversation

drm bridge: drop drm_bridge_chain_mode_fixup.

PATCH Applied Sam Ravnborg 2 participants 5 messages May 31, 2024 – Jun 11, 2024

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

cover drm bridge: drop drm_bridge_chain_mode_fixup.

I had a few bridge related patches in an old branch.

They were last posted here almost one year ago:
https://lore.kernel.org/dri-devel/[email protected]/

The following two patches gets rid of drm_bridge_chain_mode_fixup. The patches was already rb / ab - but due to the age a repost is due before applying the patches.

Sam

---
Sam Ravnborg (2):
drm/mediatek: Drop chain_mode_fixup call in mode_valid() drm/bridge: Drop drm_bridge_chain_mode_fixup

 drivers/gpu/drm/drm_bridge.c        | 37 -------------------------------------
 drivers/gpu/drm/mediatek/mtk_hdmi.c | 11 -----------
 include/drm/drm_bridge.h            |  3 ---
 3 files changed, 51 deletions(-)

---
base-commit: c9402efe492bb46ccbf94fedc4783eb8f8747567
change-id: 20240531-bridge_chain_mode-9ed8528e92cd

Best regards,

Signature · 1 line
Sam Ravnborg <[email protected]>
#1 lore raw

PATCH 1/2 drm/mediatek: Drop chain_mode_fixup call in mode_valid()

The mode_valid implementation had a call to drm_bridge_chain_mode_fixup() which would be wrong as the mode_valid is not allowed to change anything - only to validate the mode.

As the next bridge is often/always a connector the call had no effect anyway. So drop it.

From the git history I could see this call was included in the original version of the driver so there was no help there to find out why it was added in the first place. But a lot has changed since the initial driver were added and is seems safe to remove the call now.

v4:
- Link to v3: https://lore.kernel.org/dri-devel/[email protected]/
- Rebase, and added acks/rb
v3:
- Link to v2: https://lore.kernel.org/dri-devel/[email protected]/
v2:
- Link to v1: https://lore.kernel.org/dri-devel/[email protected]/

---
 drivers/gpu/drm/mediatek/mtk_hdmi.c | 11 -----------
 1 file changed, 11 deletions(-)
drivers/gpu/drm/mediatek/mtk_hdmi.c +0 -11
index 6e1cca97a654..0a90fe448d14 100644
@@ -1208,22 +1208,11 @@ mtk_hdmi_bridge_mode_valid(struct drm_bridge *bridge,
 			   const struct drm_display_mode *mode)
 {
 	struct mtk_hdmi *hdmi = hdmi_ctx_from_bridge(bridge);
-	struct drm_bridge *next_bridge;
 
 	dev_dbg(hdmi->dev, "xres=%d, yres=%d, refresh=%d, intl=%d clock=%d\n",
 		mode->hdisplay, mode->vdisplay, drm_mode_vrefresh(mode),
 		!!(mode->flags & DRM_MODE_FLAG_INTERLACE), mode->clock * 1000);
 
-	next_bridge = drm_bridge_get_next_bridge(&hdmi->bridge);
-	if (next_bridge) {
-		struct drm_display_mode adjusted_mode;
-
-		drm_mode_init(&adjusted_mode, mode);
-		if (!drm_bridge_chain_mode_fixup(next_bridge, mode,
-						 &adjusted_mode))
-			return MODE_BAD;
-	}
-
 	if (hdmi->conf) {
 		if (hdmi->conf->cea_modes_only && !drm_match_cea_mode(mode))
 			return MODE_BAD;
Signature · 1 line
2.34.1
#2 lore raw

PATCH 2/2 drm/bridge: Drop drm_bridge_chain_mode_fixup

In reply to Sam Ravnborg

There are no users left of drm_bridge_chain_mode_fixup() and we do not want to have this function available, so drop it.

Cc Laurent Pinchart <[email protected]>
Cc Maarten Lankhorst <[email protected]>
Cc Maxime Ripard <[email protected]>
Cc Thomas Zimmermann <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/drm_bridge.c | 37 -------------------------------------
 include/drm/drm_bridge.h     |  3 ---
 2 files changed, 40 deletions(-)
drivers/gpu/drm/drm_bridge.c +0 -37
index 584d109330ab..d44f055dbe3e 100644
@@ -467,43 +467,6 @@ void drm_bridge_detach(struct drm_bridge *bridge)
  *   needed, in order to gradually transition to the new model.
  */
 
-/**
- * drm_bridge_chain_mode_fixup - fixup proposed mode for all bridges in the
- *				 encoder chain
- * @bridge: bridge control structure
- * @mode: desired mode to be set for the bridge
- * @adjusted_mode: updated mode that works for this bridge
- *
- * Calls &drm_bridge_funcs.mode_fixup for all the bridges in the
- * encoder chain, starting from the first bridge to the last.
- *
- * Note: the bridge passed should be the one closest to the encoder
- *
- * RETURNS:
- * true on success, false on failure
- */
-bool drm_bridge_chain_mode_fixup(struct drm_bridge *bridge,
-				 const struct drm_display_mode *mode,
-				 struct drm_display_mode *adjusted_mode)
-{
-	struct drm_encoder *encoder;
-
-	if (!bridge)
-		return true;
-
-	encoder = bridge->encoder;
-	list_for_each_entry_from(bridge, &encoder->bridge_chain, chain_node) {
-		if (!bridge->funcs->mode_fixup)
-			continue;
-
-		if (!bridge->funcs->mode_fixup(bridge, mode, adjusted_mode))
-			return false;
-	}
-
-	return true;
-}
-EXPORT_SYMBOL(drm_bridge_chain_mode_fixup);
-
 /**
  * drm_bridge_chain_mode_valid - validate the mode against all bridges in the
  *				 encoder chain.
include/drm/drm_bridge.h +0 -3
index 4baca0d9107b..5cf41f92d1f0 100644
@@ -855,9 +855,6 @@ drm_bridge_chain_get_first_bridge(struct drm_encoder *encoder)
 #define drm_for_each_bridge_in_chain(encoder, bridge)			\
 	list_for_each_entry(bridge, &(encoder)->bridge_chain, chain_node)
 
-bool drm_bridge_chain_mode_fixup(struct drm_bridge *bridge,
-				 const struct drm_display_mode *mode,
-				 struct drm_display_mode *adjusted_mode);
 enum drm_mode_status
 drm_bridge_chain_mode_valid(struct drm_bridge *bridge,
 			    const struct drm_display_info *info,
Signature · 1 line
2.34.1
maintainer Applied
#3 lore raw
In reply to Sam Ravnborg
Quoted 10 lines · Sam Ravnborg

I had a few bridge related patches in an old branch.

They were last posted here almost one year ago:
https://lore.kernel.org/dri-devel/[email protected]/

The following two patches gets rid of drm_bridge_chain_mode_fixup. The patches was already rb / ab - but due to the age a repost is due before applying the patches.

[...]

Applied, thanks!

[1/2] drm/mediatek: Drop chain_mode_fixup call in mode_valid()

      https://cgit.freedesktop.org/drm/drm-misc/commit/?id=ac4be1e50165
[2/2] drm/bridge: Drop drm_bridge_chain_mode_fixup
      https://cgit.freedesktop.org/drm/drm-misc/commit/?id=1f0204954583

Rob

#4 lore raw

Hi Robert,

Quoted 14 lines · Robert Foss
Quoted 10 lines · Sam Ravnborg

I had a few bridge related patches in an old branch.

They were last posted here almost one year ago:
https://lore.kernel.org/dri-devel/[email protected]/

The following two patches gets rid of drm_bridge_chain_mode_fixup. The patches was already rb / ab - but due to the age a repost is due before applying the patches.

[...]

Applied, thanks!

Quoted 8 lines

[1/2] drm/mediatek: Drop chain_mode_fixup call in mode_valid()

      https://cgit.freedesktop.org/drm/drm-misc/commit/?id=ac4be1e50165
[2/2] drm/bridge: Drop drm_bridge_chain_mode_fixup
      https://cgit.freedesktop.org/drm/drm-misc/commit/?id=1f0204954583

Rob

Thanks!

Next step will be to address use of other deprecated operations in drm_bridge_funcs.

Sam