2022-02-13 06:18:30

by H. Nikolaus Schaller

[permalink] [raw]
Subject: [PATCH v14 5/9] drm/bridge: dw-hdmi: repair interworking with hdmi-connector for jz4780

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 <[email protected]>
---
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 b0d8110dd412c..826a055a7a273 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_YCBCR422)
+ if (max_bpc >= info->bpc && info->color_formats & DRM_COLOR_FORMAT_YCBCR422)
output_fmts[i++] = MEDIA_BUS_FMT_UYVY8_1X16;

- if (info->color_formats & DRM_COLOR_FORMAT_YCBCR444)
+ if (max_bpc >= info->bpc && info->color_formats & DRM_COLOR_FORMAT_YCBCR444)
output_fmts[i++] = MEDIA_BUS_FMT_YUV8_1X24;

/* Default 8bit RGB fallback */
--
2.33.0


2022-02-13 15:33:47

by Paul Cercueil

[permalink] [raw]
Subject: Re: [PATCH v14 5/9] drm/bridge: dw-hdmi: repair interworking with hdmi-connector for jz4780

Hi Nikolaus,


Le sam., f?vr. 12 2022 at 15:19:23 +0100, H. Nikolaus Schaller
<[email protected]> 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.

Neil pushed a fix yesterday that looks like it could fix your issue.
The fix is: 1528038385c0 ("drm/bridge: dw-hdmi: use safe format when
first in bridge chain")

Could you try if it does indeed fix your issue?

Cheers,
-Paul

> 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 <[email protected]>
> ---
> 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 b0d8110dd412c..826a055a7a273 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_YCBCR422)
> + if (max_bpc >= info->bpc && info->color_formats &
> DRM_COLOR_FORMAT_YCBCR422)
> output_fmts[i++] = MEDIA_BUS_FMT_UYVY8_1X16;
>
> - if (info->color_formats & DRM_COLOR_FORMAT_YCBCR444)
> + if (max_bpc >= info->bpc && info->color_formats &
> DRM_COLOR_FORMAT_YCBCR444)
> output_fmts[i++] = MEDIA_BUS_FMT_YUV8_1X24;
>
> /* Default 8bit RGB fallback */
> --
> 2.33.0
>


2022-02-14 09:39:52

by H. Nikolaus Schaller

[permalink] [raw]
Subject: Re: [PATCH v14 5/9] drm/bridge: dw-hdmi: repair interworking with hdmi-connector for jz4780



> Am 12.02.2022 um 16:06 schrieb Paul Cercueil <[email protected]>:
>
> Hi Nikolaus,
>
>
> Le sam., févr. 12 2022 at 15:19:23 +0100, H. Nikolaus Schaller <[email protected]> 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.
>
> Neil pushed a fix yesterday that looks like it could fix your issue.
> The fix is: 1528038385c0 ("drm/bridge: dw-hdmi: use safe format when first in bridge chain")
>
> Could you try if it does indeed fix your issue?

Sure.

Would have been nice and is a fix addressing same base commit, but is not a replacement for my attempt :(

Fortunately we can have both.

>
> Cheers,
> -Paul
>
>> 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 <[email protected]>
>> ---
>> 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 b0d8110dd412c..826a055a7a273 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_YCBCR422)
>> + if (max_bpc >= info->bpc && info->color_formats & DRM_COLOR_FORMAT_YCBCR422)
>> output_fmts[i++] = MEDIA_BUS_FMT_UYVY8_1X16;
>> - if (info->color_formats & DRM_COLOR_FORMAT_YCBCR444)
>> + if (max_bpc >= info->bpc && info->color_formats & DRM_COLOR_FORMAT_YCBCR444)
>> output_fmts[i++] = MEDIA_BUS_FMT_YUV8_1X24;
>> /* Default 8bit RGB fallback */
>> --
>> 2.33.0
>
>