All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/bridge: ti-sn65dsi83: Replace connector format patching with atomic_get_input_bus_fmts
@ 2021-06-20 22:42 Marek Vasut
  2021-06-21 12:30 ` Laurent Pinchart
  0 siblings, 1 reply; 3+ messages in thread
From: Marek Vasut @ 2021-06-20 22:42 UTC (permalink / raw)
  To: dri-devel
  Cc: Marek Vasut, Loic Poulain, ch, Sam Ravnborg, Robert Foss,
	Douglas Anderson, Frieder Schrempf, Stephen Boyd,
	Philippe Schenker, Jagan Teki, Valentin Raevsky, Adam Ford,
	Laurent Pinchart

Patching the connector format is causing various problematic
side effects. Implement .atomic_get_input_bus_fmts callback
instead, which sets up the input (DSI-end) format, and that
format can then be used in pipeline format negotiation between
the DSI-end of this bridge and the other component closer to
the scanout engine.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Adam Ford <aford173@gmail.com>
Cc: Douglas Anderson <dianders@chromium.org>
Cc: Frieder Schrempf <frieder.schrempf@kontron.de>
Cc: Jagan Teki <jagan@amarulasolutions.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Loic Poulain <loic.poulain@linaro.org>
Cc: Philippe Schenker <philippe.schenker@toradex.com>
Cc: Robert Foss <robert.foss@linaro.org>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Stephen Boyd <swboyd@chromium.org>
Cc: Valentin Raevsky <valentin@compulab.co.il>
Cc: dri-devel@lists.freedesktop.org
---
 drivers/gpu/drm/bridge/ti-sn65dsi83.c | 35 ++++++++++++++++++++++++---
 1 file changed, 31 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi83.c b/drivers/gpu/drm/bridge/ti-sn65dsi83.c
index 750f2172ef08..32bda20f5dda 100644
--- a/drivers/gpu/drm/bridge/ti-sn65dsi83.c
+++ b/drivers/gpu/drm/bridge/ti-sn65dsi83.c
@@ -517,7 +517,6 @@ static bool sn65dsi83_mode_fixup(struct drm_bridge *bridge,
 				 struct drm_display_mode *adj)
 {
 	struct sn65dsi83 *ctx = bridge_to_sn65dsi83(bridge);
-	u32 input_bus_format = MEDIA_BUS_FMT_RGB888_1X24;
 	struct drm_encoder *encoder = bridge->encoder;
 	struct drm_device *ddev = encoder->dev;
 	struct drm_connector *connector;
@@ -550,14 +549,37 @@ static bool sn65dsi83_mode_fixup(struct drm_bridge *bridge,
 				 connector->display_info.bus_formats[0]);
 			break;
 		}
-
-		drm_display_info_set_bus_formats(&connector->display_info,
-						 &input_bus_format, 1);
 	}
 
 	return true;
 }
 
+#define MAX_INPUT_SEL_FORMATS	1
+
+static u32 *
+sn65dsi83_atomic_get_input_bus_fmts(struct drm_bridge *bridge,
+				    struct drm_bridge_state *bridge_state,
+				    struct drm_crtc_state *crtc_state,
+				    struct drm_connector_state *conn_state,
+				    u32 output_fmt,
+				    unsigned int *num_input_fmts)
+{
+	u32 *input_fmts;
+
+	*num_input_fmts = 0;
+
+	input_fmts = kcalloc(MAX_INPUT_SEL_FORMATS, sizeof(*input_fmts),
+			     GFP_KERNEL);
+	if (!input_fmts)
+		return NULL;
+
+	/* This is the DSI-end bus format */
+	input_fmts[0] = MEDIA_BUS_FMT_RGB888_1X24;
+	*num_input_fmts = 1;
+
+	return input_fmts;
+}
+
 static const struct drm_bridge_funcs sn65dsi83_funcs = {
 	.attach		= sn65dsi83_attach,
 	.pre_enable	= sn65dsi83_pre_enable,
@@ -567,6 +589,11 @@ static const struct drm_bridge_funcs sn65dsi83_funcs = {
 	.mode_valid	= sn65dsi83_mode_valid,
 	.mode_set	= sn65dsi83_mode_set,
 	.mode_fixup	= sn65dsi83_mode_fixup,
+
+	.atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state,
+	.atomic_destroy_state = drm_atomic_helper_bridge_destroy_state,
+	.atomic_reset = drm_atomic_helper_bridge_reset,
+	.atomic_get_input_bus_fmts = sn65dsi83_atomic_get_input_bus_fmts,
 };
 
 static int sn65dsi83_parse_dt(struct sn65dsi83 *ctx, enum sn65dsi83_model model)
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/bridge: ti-sn65dsi83: Replace connector format patching with atomic_get_input_bus_fmts
  2021-06-20 22:42 [PATCH] drm/bridge: ti-sn65dsi83: Replace connector format patching with atomic_get_input_bus_fmts Marek Vasut
@ 2021-06-21 12:30 ` Laurent Pinchart
  2021-06-21 17:06   ` Robert Foss
  0 siblings, 1 reply; 3+ messages in thread
From: Laurent Pinchart @ 2021-06-21 12:30 UTC (permalink / raw)
  To: Marek Vasut
  Cc: Loic Poulain, ch, Adam Ford, Douglas Anderson, Robert Foss,
	Frieder Schrempf, Philippe Schenker, dri-devel, Valentin Raevsky,
	Stephen Boyd, Sam Ravnborg, Jagan Teki

Hi Marek,

Thank you for the patch.

On Mon, Jun 21, 2021 at 12:42:08AM +0200, Marek Vasut wrote:
> Patching the connector format is causing various problematic
> side effects. Implement .atomic_get_input_bus_fmts callback
> instead, which sets up the input (DSI-end) format, and that
> format can then be used in pipeline format negotiation between
> the DSI-end of this bridge and the other component closer to
> the scanout engine.
> 
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Adam Ford <aford173@gmail.com>
> Cc: Douglas Anderson <dianders@chromium.org>
> Cc: Frieder Schrempf <frieder.schrempf@kontron.de>
> Cc: Jagan Teki <jagan@amarulasolutions.com>
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Loic Poulain <loic.poulain@linaro.org>
> Cc: Philippe Schenker <philippe.schenker@toradex.com>
> Cc: Robert Foss <robert.foss@linaro.org>
> Cc: Sam Ravnborg <sam@ravnborg.org>
> Cc: Stephen Boyd <swboyd@chromium.org>
> Cc: Valentin Raevsky <valentin@compulab.co.il>
> Cc: dri-devel@lists.freedesktop.org
> ---
>  drivers/gpu/drm/bridge/ti-sn65dsi83.c | 35 ++++++++++++++++++++++++---
>  1 file changed, 31 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi83.c b/drivers/gpu/drm/bridge/ti-sn65dsi83.c
> index 750f2172ef08..32bda20f5dda 100644
> --- a/drivers/gpu/drm/bridge/ti-sn65dsi83.c
> +++ b/drivers/gpu/drm/bridge/ti-sn65dsi83.c
> @@ -517,7 +517,6 @@ static bool sn65dsi83_mode_fixup(struct drm_bridge *bridge,
>  				 struct drm_display_mode *adj)
>  {
>  	struct sn65dsi83 *ctx = bridge_to_sn65dsi83(bridge);
> -	u32 input_bus_format = MEDIA_BUS_FMT_RGB888_1X24;
>  	struct drm_encoder *encoder = bridge->encoder;
>  	struct drm_device *ddev = encoder->dev;
>  	struct drm_connector *connector;
> @@ -550,14 +549,37 @@ static bool sn65dsi83_mode_fixup(struct drm_bridge *bridge,
>  				 connector->display_info.bus_formats[0]);
>  			break;
>  		}
> -
> -		drm_display_info_set_bus_formats(&connector->display_info,
> -						 &input_bus_format, 1);
>  	}
>  
>  	return true;
>  }
>  
> +#define MAX_INPUT_SEL_FORMATS	1
> +
> +static u32 *
> +sn65dsi83_atomic_get_input_bus_fmts(struct drm_bridge *bridge,
> +				    struct drm_bridge_state *bridge_state,
> +				    struct drm_crtc_state *crtc_state,
> +				    struct drm_connector_state *conn_state,
> +				    u32 output_fmt,
> +				    unsigned int *num_input_fmts)
> +{
> +	u32 *input_fmts;
> +
> +	*num_input_fmts = 0;
> +
> +	input_fmts = kcalloc(MAX_INPUT_SEL_FORMATS, sizeof(*input_fmts),
> +			     GFP_KERNEL);
> +	if (!input_fmts)
> +		return NULL;
> +
> +	/* This is the DSI-end bus format */
> +	input_fmts[0] = MEDIA_BUS_FMT_RGB888_1X24;
> +	*num_input_fmts = 1;
> +
> +	return input_fmts;
> +}

Perfect :-)

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> +
>  static const struct drm_bridge_funcs sn65dsi83_funcs = {
>  	.attach		= sn65dsi83_attach,
>  	.pre_enable	= sn65dsi83_pre_enable,
> @@ -567,6 +589,11 @@ static const struct drm_bridge_funcs sn65dsi83_funcs = {
>  	.mode_valid	= sn65dsi83_mode_valid,
>  	.mode_set	= sn65dsi83_mode_set,
>  	.mode_fixup	= sn65dsi83_mode_fixup,
> +
> +	.atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state,
> +	.atomic_destroy_state = drm_atomic_helper_bridge_destroy_state,
> +	.atomic_reset = drm_atomic_helper_bridge_reset,
> +	.atomic_get_input_bus_fmts = sn65dsi83_atomic_get_input_bus_fmts,
>  };
>  
>  static int sn65dsi83_parse_dt(struct sn65dsi83 *ctx, enum sn65dsi83_model model)

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/bridge: ti-sn65dsi83: Replace connector format patching with atomic_get_input_bus_fmts
  2021-06-21 12:30 ` Laurent Pinchart
@ 2021-06-21 17:06   ` Robert Foss
  0 siblings, 0 replies; 3+ messages in thread
From: Robert Foss @ 2021-06-21 17:06 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Marek Vasut, Loic Poulain, ch, Adam Ford, Douglas Anderson,
	dri-devel, Stephen Boyd, Philippe Schenker, Frieder Schrempf,
	Valentin Raevsky, Sam Ravnborg, Jagan Teki

>
> Perfect :-)
>
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
>

Pulled into drm-misc-next.

https://cgit.freedesktop.org/drm/drm-misc/commit/?id=db8b7ca5b232083c82f627af7fe653d8074c5ca0

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-06-21 17:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-20 22:42 [PATCH] drm/bridge: ti-sn65dsi83: Replace connector format patching with atomic_get_input_bus_fmts Marek Vasut
2021-06-21 12:30 ` Laurent Pinchart
2021-06-21 17:06   ` Robert Foss

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.