Message ID | 20220717174454.46616-8-sam@ravnborg.org (mailing list archive) |
---|---|
State | New |
Delegated to: | Kieran Bingham |
Headers | show |
Series | drm bridge updates | expand |
On Sun, 17 Jul 2022 at 18:45, Sam Ravnborg <sam@ravnborg.org> wrote: > > When atomic_check() is defined, then mode_fixup() is ignored, > so it had no effect that drm_bridge_funcs.mode_fixup was assigned. > Embed the original implementation in the caller and drop the function. > > Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com> (There was a point when drm_bridge_chain_mode_fixup still existed, but that's gone/going now). > Cc: Andrzej Hajda <andrzej.hajda@intel.com> > Cc: Neil Armstrong <narmstrong@baylibre.com> > Cc: Robert Foss <robert.foss@linaro.org> > Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com> > Cc: Jonas Karlman <jonas@kwiboo.se> > Cc: Jernej Skrabec <jernej.skrabec@gmail.com> > --- > drivers/gpu/drm/bridge/tc358767.c | 21 ++++++--------------- > 1 file changed, 6 insertions(+), 15 deletions(-) > > diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c > index 02bd757a8987..b2ab967504af 100644 > --- a/drivers/gpu/drm/bridge/tc358767.c > +++ b/drivers/gpu/drm/bridge/tc358767.c > @@ -1496,26 +1496,18 @@ tc_edp_bridge_atomic_disable(struct drm_bridge *bridge, > dev_err(tc->dev, "main link disable error: %d\n", ret); > } > > -static bool tc_bridge_mode_fixup(struct drm_bridge *bridge, > - const struct drm_display_mode *mode, > - struct drm_display_mode *adj) > -{ > - /* Fixup sync polarities, both hsync and vsync are active low */ > - adj->flags = mode->flags; > - adj->flags |= (DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC); > - adj->flags &= ~(DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC); > - > - return true; > -} > - > static int tc_common_atomic_check(struct drm_bridge *bridge, > struct drm_bridge_state *bridge_state, > struct drm_crtc_state *crtc_state, > struct drm_connector_state *conn_state, > const unsigned int max_khz) > { > - tc_bridge_mode_fixup(bridge, &crtc_state->mode, > - &crtc_state->adjusted_mode); > + struct drm_display_mode *adj = &crtc_state->adjusted_mode; > + > + /* Fixup sync polarities, both hsync and vsync are active low */ > + adj->flags = crtc_state->mode.flags; > + adj->flags |= (DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC); > + adj->flags &= ~(DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC); > > if (crtc_state->adjusted_mode.clock > max_khz) > return -EINVAL; > @@ -1783,7 +1775,6 @@ static const struct drm_bridge_funcs tc_edp_bridge_funcs = { > .atomic_check = tc_edp_atomic_check, > .atomic_enable = tc_edp_bridge_atomic_enable, > .atomic_disable = tc_edp_bridge_atomic_disable, > - .mode_fixup = tc_bridge_mode_fixup, > .detect = tc_bridge_detect, > .get_edid = tc_get_edid, > .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, > -- > 2.34.1 >
Hi Sam, Thank you for the patch. On Sun, Jul 17, 2022 at 07:44:49PM +0200, Sam Ravnborg wrote: > When atomic_check() is defined, then mode_fixup() is ignored, > so it had no effect that drm_bridge_funcs.mode_fixup was assigned. > Embed the original implementation in the caller and drop the function. > > Signed-off-by: Sam Ravnborg <sam@ravnborg.org> > Cc: Andrzej Hajda <andrzej.hajda@intel.com> > Cc: Neil Armstrong <narmstrong@baylibre.com> > Cc: Robert Foss <robert.foss@linaro.org> > Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com> > Cc: Jonas Karlman <jonas@kwiboo.se> > Cc: Jernej Skrabec <jernej.skrabec@gmail.com> Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> > --- > drivers/gpu/drm/bridge/tc358767.c | 21 ++++++--------------- > 1 file changed, 6 insertions(+), 15 deletions(-) > > diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c > index 02bd757a8987..b2ab967504af 100644 > --- a/drivers/gpu/drm/bridge/tc358767.c > +++ b/drivers/gpu/drm/bridge/tc358767.c > @@ -1496,26 +1496,18 @@ tc_edp_bridge_atomic_disable(struct drm_bridge *bridge, > dev_err(tc->dev, "main link disable error: %d\n", ret); > } > > -static bool tc_bridge_mode_fixup(struct drm_bridge *bridge, > - const struct drm_display_mode *mode, > - struct drm_display_mode *adj) > -{ > - /* Fixup sync polarities, both hsync and vsync are active low */ > - adj->flags = mode->flags; > - adj->flags |= (DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC); > - adj->flags &= ~(DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC); > - > - return true; > -} > - > static int tc_common_atomic_check(struct drm_bridge *bridge, > struct drm_bridge_state *bridge_state, > struct drm_crtc_state *crtc_state, > struct drm_connector_state *conn_state, > const unsigned int max_khz) > { > - tc_bridge_mode_fixup(bridge, &crtc_state->mode, > - &crtc_state->adjusted_mode); > + struct drm_display_mode *adj = &crtc_state->adjusted_mode; > + > + /* Fixup sync polarities, both hsync and vsync are active low */ > + adj->flags = crtc_state->mode.flags; > + adj->flags |= (DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC); > + adj->flags &= ~(DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC); > > if (crtc_state->adjusted_mode.clock > max_khz) > return -EINVAL; > @@ -1783,7 +1775,6 @@ static const struct drm_bridge_funcs tc_edp_bridge_funcs = { > .atomic_check = tc_edp_atomic_check, > .atomic_enable = tc_edp_bridge_atomic_enable, > .atomic_disable = tc_edp_bridge_atomic_disable, > - .mode_fixup = tc_bridge_mode_fixup, > .detect = tc_bridge_detect, > .get_edid = tc_get_edid, > .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state,
On Mon, Sep 19, 2022 at 06:29:41PM +0300, Laurent Pinchart wrote: > On Sun, Jul 17, 2022 at 07:44:49PM +0200, Sam Ravnborg wrote: > > When atomic_check() is defined, then mode_fixup() is ignored, > > so it had no effect that drm_bridge_funcs.mode_fixup was assigned. > > Embed the original implementation in the caller and drop the function. > > > > Signed-off-by: Sam Ravnborg <sam@ravnborg.org> > > Cc: Andrzej Hajda <andrzej.hajda@intel.com> > > Cc: Neil Armstrong <narmstrong@baylibre.com> > > Cc: Robert Foss <robert.foss@linaro.org> > > Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com> > > Cc: Jonas Karlman <jonas@kwiboo.se> > > Cc: Jernej Skrabec <jernej.skrabec@gmail.com> > > Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> But this doesn't apply anymore, as the mode_fixup operation has been removed from the driver already. You can just drop this patch. > > --- > > drivers/gpu/drm/bridge/tc358767.c | 21 ++++++--------------- > > 1 file changed, 6 insertions(+), 15 deletions(-) > > > > diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c > > index 02bd757a8987..b2ab967504af 100644 > > --- a/drivers/gpu/drm/bridge/tc358767.c > > +++ b/drivers/gpu/drm/bridge/tc358767.c > > @@ -1496,26 +1496,18 @@ tc_edp_bridge_atomic_disable(struct drm_bridge *bridge, > > dev_err(tc->dev, "main link disable error: %d\n", ret); > > } > > > > -static bool tc_bridge_mode_fixup(struct drm_bridge *bridge, > > - const struct drm_display_mode *mode, > > - struct drm_display_mode *adj) > > -{ > > - /* Fixup sync polarities, both hsync and vsync are active low */ > > - adj->flags = mode->flags; > > - adj->flags |= (DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC); > > - adj->flags &= ~(DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC); > > - > > - return true; > > -} > > - > > static int tc_common_atomic_check(struct drm_bridge *bridge, > > struct drm_bridge_state *bridge_state, > > struct drm_crtc_state *crtc_state, > > struct drm_connector_state *conn_state, > > const unsigned int max_khz) > > { > > - tc_bridge_mode_fixup(bridge, &crtc_state->mode, > > - &crtc_state->adjusted_mode); > > + struct drm_display_mode *adj = &crtc_state->adjusted_mode; > > + > > + /* Fixup sync polarities, both hsync and vsync are active low */ > > + adj->flags = crtc_state->mode.flags; > > + adj->flags |= (DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC); > > + adj->flags &= ~(DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC); > > > > if (crtc_state->adjusted_mode.clock > max_khz) > > return -EINVAL; > > @@ -1783,7 +1775,6 @@ static const struct drm_bridge_funcs tc_edp_bridge_funcs = { > > .atomic_check = tc_edp_atomic_check, > > .atomic_enable = tc_edp_bridge_atomic_enable, > > .atomic_disable = tc_edp_bridge_atomic_disable, > > - .mode_fixup = tc_bridge_mode_fixup, > > .detect = tc_bridge_detect, > > .get_edid = tc_get_edid, > > .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state,
diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c index 02bd757a8987..b2ab967504af 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -1496,26 +1496,18 @@ tc_edp_bridge_atomic_disable(struct drm_bridge *bridge, dev_err(tc->dev, "main link disable error: %d\n", ret); } -static bool tc_bridge_mode_fixup(struct drm_bridge *bridge, - const struct drm_display_mode *mode, - struct drm_display_mode *adj) -{ - /* Fixup sync polarities, both hsync and vsync are active low */ - adj->flags = mode->flags; - adj->flags |= (DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC); - adj->flags &= ~(DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC); - - return true; -} - static int tc_common_atomic_check(struct drm_bridge *bridge, struct drm_bridge_state *bridge_state, struct drm_crtc_state *crtc_state, struct drm_connector_state *conn_state, const unsigned int max_khz) { - tc_bridge_mode_fixup(bridge, &crtc_state->mode, - &crtc_state->adjusted_mode); + struct drm_display_mode *adj = &crtc_state->adjusted_mode; + + /* Fixup sync polarities, both hsync and vsync are active low */ + adj->flags = crtc_state->mode.flags; + adj->flags |= (DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC); + adj->flags &= ~(DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC); if (crtc_state->adjusted_mode.clock > max_khz) return -EINVAL; @@ -1783,7 +1775,6 @@ static const struct drm_bridge_funcs tc_edp_bridge_funcs = { .atomic_check = tc_edp_atomic_check, .atomic_enable = tc_edp_bridge_atomic_enable, .atomic_disable = tc_edp_bridge_atomic_disable, - .mode_fixup = tc_bridge_mode_fixup, .detect = tc_bridge_detect, .get_edid = tc_get_edid, .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state,
When atomic_check() is defined, then mode_fixup() is ignored, so it had no effect that drm_bridge_funcs.mode_fixup was assigned. Embed the original implementation in the caller and drop the function. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Cc: Andrzej Hajda <andrzej.hajda@intel.com> Cc: Neil Armstrong <narmstrong@baylibre.com> Cc: Robert Foss <robert.foss@linaro.org> Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com> Cc: Jonas Karlman <jonas@kwiboo.se> Cc: Jernej Skrabec <jernej.skrabec@gmail.com> --- drivers/gpu/drm/bridge/tc358767.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-)