diff mbox series

[v13,6/9] dw-hdmi/ingenic-dw-hdmi: repair interworking with hdmi-connector

Message ID 866f84621974992f4831bd471ae5a53414de9255.1643819482.git.hns@goldelico.com (mailing list archive)
State New, archived
Headers show
Series MIPS: JZ4780 and CI20 HDMI | expand

Commit Message

H. Nikolaus Schaller Feb. 2, 2022, 4:31 p.m. UTC
Commit 7cd70656d1285b ("drm/bridge: display-connector: implement bus fmts callbacks")

introduced a new mechanism to negotiate bus formats between hdmi connector
and the synopsys hdmi driver inside the jz4780.

By this, the dw-hdmi is no longer the only bridge and sets up a list
of formats in dw_hdmi_bridge_atomic_get_output_bus_fmts().

This includes MEDIA_BUS_FMT_UYVY8_1X16 which is chosen for the jz4780 but only
produces a black screen.

This fix is based on the observation that max_bpc = 0 when running this
function while info->bpc = 8. Since the formats checks before this always test
for max_bpc >= info->pbc indirectly my assumption is that we must check it
here as well.

Adding the proposed patch makes the CI20/jz4780 panel work again in
MEDIA_BUS_FMT_RGB888_1X24 mode.

Fixes: 7cd70656d1285b ("drm/bridge: display-connector: implement bus fmts callbacks")
Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
---
 drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Paul Cercueil Feb. 9, 2022, 12:18 p.m. UTC | #1
Hi Nikolaus,

Le mer., févr. 2 2022 at 17:31:20 +0100, H. Nikolaus Schaller 
<hns@goldelico.com> a écrit :
> Commit 7cd70656d1285b ("drm/bridge: display-connector: implement bus 
> fmts callbacks")
> 
> introduced a new mechanism to negotiate bus formats between hdmi 
> connector
> and the synopsys hdmi driver inside the jz4780.
> 
> By this, the dw-hdmi is no longer the only bridge and sets up a list
> of formats in dw_hdmi_bridge_atomic_get_output_bus_fmts().
> 
> This includes MEDIA_BUS_FMT_UYVY8_1X16 which is chosen for the jz4780 
> but only
> produces a black screen.
> 
> This fix is based on the observation that max_bpc = 0 when running 
> this
> function while info->bpc = 8. Since the formats checks before this 
> always test
> for max_bpc >= info->pbc indirectly my assumption is that we must 
> check it
> here as well.

This fix looks really strange to me, so I'll let the DRM experts 
comment.

It would still be better to move the patch before the introduction of 
dw-ingenic-hdmi.c, so that once this one is introduced, everything 
works. This also enables bisectability.

Cheers,
-Paul


> 
> Adding the proposed patch makes the CI20/jz4780 panel work again in
> MEDIA_BUS_FMT_RGB888_1X24 mode.
> 
> Fixes: 7cd70656d1285b ("drm/bridge: display-connector: implement bus 
> fmts callbacks")
> Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
> ---
>  drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c 
> b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> index 52e7cd2e020d3..34703a15ee4ff 100644
> --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> @@ -2620,10 +2620,10 @@ static u32 
> *dw_hdmi_bridge_atomic_get_output_bus_fmts(struct drm_bridge *bridge,
>  		output_fmts[i++] = MEDIA_BUS_FMT_RGB101010_1X30;
>  	}
> 
> -	if (info->color_formats & DRM_COLOR_FORMAT_YCRCB422)
> +	if (max_bpc >= info->bpc && info->color_formats & 
> DRM_COLOR_FORMAT_YCRCB422)
>  		output_fmts[i++] = MEDIA_BUS_FMT_UYVY8_1X16;
> 
> -	if (info->color_formats & DRM_COLOR_FORMAT_YCRCB444)
> +	if (max_bpc >= info->bpc && info->color_formats & 
> DRM_COLOR_FORMAT_YCRCB444)
>  		output_fmts[i++] = MEDIA_BUS_FMT_YUV8_1X24;
> 
>  	/* Default 8bit RGB fallback */
> --
> 2.33.0
>
H. Nikolaus Schaller Feb. 9, 2022, 1:51 p.m. UTC | #2
Hi Paul,

> Am 09.02.2022 um 13:18 schrieb Paul Cercueil <paul@crapouillou.net>:
> 
> Hi Nikolaus,
> 
> Le mer., févr. 2 2022 at 17:31:20 +0100, H. Nikolaus Schaller <hns@goldelico.com> a écrit :
>> Commit 7cd70656d1285b ("drm/bridge: display-connector: implement bus fmts callbacks")
>> introduced a new mechanism to negotiate bus formats between hdmi connector
>> and the synopsys hdmi driver inside the jz4780.
>> By this, the dw-hdmi is no longer the only bridge and sets up a list
>> of formats in dw_hdmi_bridge_atomic_get_output_bus_fmts().
>> This includes MEDIA_BUS_FMT_UYVY8_1X16 which is chosen for the jz4780 but only
>> produces a black screen.
>> This fix is based on the observation that max_bpc = 0 when running this
>> function while info->bpc = 8. Since the formats checks before this always test
>> for max_bpc >= info->pbc indirectly my assumption is that we must check it
>> here as well.
> 
> This fix looks really strange to me, so I'll let the DRM experts comment.

Well, yes. We should maybe look for comments by the synopsys/dw-hdmi specialists.

> 
> It would still be better to move the patch before the introduction of dw-ingenic-hdmi.c, so that once this one is introduced, everything works. This also enables bisectability.

Ok, good.

BR and thanks,
Nikolaus

> 
> Cheers,
> -Paul
> 
> 
>> Adding the proposed patch makes the CI20/jz4780 panel work again in
>> MEDIA_BUS_FMT_RGB888_1X24 mode.
>> Fixes: 7cd70656d1285b ("drm/bridge: display-connector: implement bus fmts callbacks")
>> Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
>> ---
>> drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
>> index 52e7cd2e020d3..34703a15ee4ff 100644
>> --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
>> +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
>> @@ -2620,10 +2620,10 @@ static u32 *dw_hdmi_bridge_atomic_get_output_bus_fmts(struct drm_bridge *bridge,
>> 		output_fmts[i++] = MEDIA_BUS_FMT_RGB101010_1X30;
>> 	}
>> -	if (info->color_formats & DRM_COLOR_FORMAT_YCRCB422)
>> +	if (max_bpc >= info->bpc && info->color_formats & DRM_COLOR_FORMAT_YCRCB422)
>> 		output_fmts[i++] = MEDIA_BUS_FMT_UYVY8_1X16;
>> -	if (info->color_formats & DRM_COLOR_FORMAT_YCRCB444)
>> +	if (max_bpc >= info->bpc && info->color_formats & DRM_COLOR_FORMAT_YCRCB444)
>> 		output_fmts[i++] = MEDIA_BUS_FMT_YUV8_1X24;
>> 	/* Default 8bit RGB fallback */
>> --
>> 2.33.0
> 
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
index 52e7cd2e020d3..34703a15ee4ff 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
@@ -2620,10 +2620,10 @@  static u32 *dw_hdmi_bridge_atomic_get_output_bus_fmts(struct drm_bridge *bridge,
 		output_fmts[i++] = MEDIA_BUS_FMT_RGB101010_1X30;
 	}
 
-	if (info->color_formats & DRM_COLOR_FORMAT_YCRCB422)
+	if (max_bpc >= info->bpc && info->color_formats & DRM_COLOR_FORMAT_YCRCB422)
 		output_fmts[i++] = MEDIA_BUS_FMT_UYVY8_1X16;
 
-	if (info->color_formats & DRM_COLOR_FORMAT_YCRCB444)
+	if (max_bpc >= info->bpc && info->color_formats & DRM_COLOR_FORMAT_YCRCB444)
 		output_fmts[i++] = MEDIA_BUS_FMT_YUV8_1X24;
 
 	/* Default 8bit RGB fallback */