2021-10-11 16:28:50

by Guido Günther

[permalink] [raw]
Subject: [PATCH v3 5/5] drm: mxsfb: Set fallback bus format when the bridge doesn't provide one

If a bridge doesn't do any bus format handling MEDIA_BUS_FMT_FIXED is
returned. Fallback to a reasonable default (MEDIA_BUS_FMT_RGB888_1X24) in
that case.

This unbreaks e.g. using mxsfb with the nwl bridge and mipi dsi panels.

Reported-by: Martin Kepplinger <[email protected]>
Signed-off-by: Guido Günther <[email protected]>
Reviewed-by: Lucas Stach <[email protected]>
---
drivers/gpu/drm/mxsfb/mxsfb_kms.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/mxsfb/mxsfb_kms.c b/drivers/gpu/drm/mxsfb/mxsfb_kms.c
index d6abd2077114..e3fbb8b58d5d 100644
--- a/drivers/gpu/drm/mxsfb/mxsfb_kms.c
+++ b/drivers/gpu/drm/mxsfb/mxsfb_kms.c
@@ -369,6 +369,12 @@ static void mxsfb_crtc_atomic_enable(struct drm_crtc *crtc,
drm_atomic_get_new_bridge_state(state,
mxsfb->bridge);
bus_format = bridge_state->input_bus_cfg.format;
+ if (bus_format == MEDIA_BUS_FMT_FIXED) {
+ dev_warn_once(drm->dev,
+ "Bridge does not provide bus format, assuming MEDIA_BUS_FMT_RGB888_1X24.\n"
+ "Please fix bridge driver by handling atomic_get_input_bus_fmts.\n");
+ bus_format = MEDIA_BUS_FMT_RGB888_1X24;
+ }
}

/* If there is no bridge, use bus format from connector */
--
2.33.0


2021-10-12 07:50:15

by Stefan Agner

[permalink] [raw]
Subject: Re: [PATCH v3 5/5] drm: mxsfb: Set fallback bus format when the bridge doesn't provide one

On 2021-10-11 15:41, Guido Günther wrote:
> If a bridge doesn't do any bus format handling MEDIA_BUS_FMT_FIXED is
> returned. Fallback to a reasonable default (MEDIA_BUS_FMT_RGB888_1X24) in
> that case.
>
> This unbreaks e.g. using mxsfb with the nwl bridge and mipi dsi panels.
>
> Reported-by: Martin Kepplinger <[email protected]>
> Signed-off-by: Guido Günther <[email protected]>
> Reviewed-by: Lucas Stach <[email protected]>

Acked-by: Stefan Agner <[email protected]>

> ---
> drivers/gpu/drm/mxsfb/mxsfb_kms.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/gpu/drm/mxsfb/mxsfb_kms.c
> b/drivers/gpu/drm/mxsfb/mxsfb_kms.c
> index d6abd2077114..e3fbb8b58d5d 100644
> --- a/drivers/gpu/drm/mxsfb/mxsfb_kms.c
> +++ b/drivers/gpu/drm/mxsfb/mxsfb_kms.c
> @@ -369,6 +369,12 @@ static void mxsfb_crtc_atomic_enable(struct drm_crtc *crtc,
> drm_atomic_get_new_bridge_state(state,
> mxsfb->bridge);
> bus_format = bridge_state->input_bus_cfg.format;
> + if (bus_format == MEDIA_BUS_FMT_FIXED) {
> + dev_warn_once(drm->dev,
> + "Bridge does not provide bus format, assuming
> MEDIA_BUS_FMT_RGB888_1X24.\n"
> + "Please fix bridge driver by handling atomic_get_input_bus_fmts.\n");
> + bus_format = MEDIA_BUS_FMT_RGB888_1X24;
> + }
> }
>
> /* If there is no bridge, use bus format from connector */