Re: dw_hdmi is showing wrong colour after commit 7cd70656d1285b79("drm/bridge: display-connector: implement bus fmts callbacks")

From: Neil Armstrong
Date: Mon Jan 17 2022 - 09:07:51 EST


On 17/01/2022 15:05, Kieran Bingham wrote:
> Quoting Neil Armstrong (2022-01-17 13:53:47)
>> On 17/01/2022 11:58, Kieran Bingham wrote:
>>> Hi Neil,
>
> <big snips to clear up contexts>
>
>>> This fixes the issue for me here on an H3 Salvator-XS.
>>>
>>> Could you add...
>>>
>>> Bisected-by: Kieran Bingham <kieran.bingham+renesas@xxxxxxxxxxxxxxxx>
>>> Tested-by: Kieran Bingham <kieran.bingham+renesas@xxxxxxxxxxxxxxxx>
>>>
>>> alongside Biju's Reported-by: tag when posting as a fix please?
>>
>>
>> Which patch did you test ?
>
> Ah, yes that's not clear is it - sorry! I replied in the wrong place on
> the thread when I went back to the mail ... see below...
>
>>>> I'm not happy with this version since it's merely a hack which makes it work.
>>>>
>>>> Can you test the following change instead, it's correctly handles your situation in a generic manner.
>>>>
>>>> ========================><=============================
>>>> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
>>>> index 54d8fdad395f..9f2e1cac0ae2 100644
>>>> --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
>>>> +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
>>>> @@ -2551,8 +2551,9 @@ static u32 *dw_hdmi_bridge_atomic_get_output_bus_fmts(struct drm_bridge *bridge,
>>>> if (!output_fmts)
>>>> return NULL;
>>>>
>>>> - /* If dw-hdmi is the only bridge, avoid negociating with ourselves */
>>>> - if (list_is_singular(&bridge->encoder->bridge_chain)) {
>>>> + /* If dw-hdmi is the first or only bridge, avoid negociating with ourselves */
>>>> + if (list_is_singular(&bridge->encoder->bridge_chain) ||
>>>> + list_is_first(&bridge->chain_node, &bridge->encoder->bridge_chain)) {
>>>> *num_output_fmts = 1;
>>>> output_fmts[0] = MEDIA_BUS_FMT_FIXED;
>>>>
>>>> @@ -2673,6 +2674,10 @@ static u32 *dw_hdmi_bridge_atomic_get_input_bus_fmts(struct drm_bridge *bridge,
>>>> if (!input_fmts)
>>>> return NULL;
>>>>
>>>> + /* If dw-hdmi is the first bridge fall-back to safe output format */
>>>> + if (list_is_first(&bridge->chain_node, &bridge->encoder->bridge_chain))
>>>> + output_fmt = MEDIA_BUS_FMT_FIXED;
>>>> +
>>>> switch (output_fmt) {
>>>> /* If MEDIA_BUS_FMT_FIXED is tested, return default bus format */
>>>> case MEDIA_BUS_FMT_FIXED:
>>>> ========================><=============================
>
> Sorry, I replied in the wrong part of the thread.
>
> Here's the direct diff on my local tree:
>
>
> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> index 54d8fdad395f..cac9a87949f1 100644
> --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> @@ -2551,8 +2551,10 @@ static u32 *dw_hdmi_bridge_atomic_get_output_bus_fmts(struct drm_bridge *bridge,
> if (!output_fmts)
> return NULL;
>
> - /* If dw-hdmi is the only bridge, avoid negociating with ourselves */
> - if (list_is_singular(&bridge->encoder->bridge_chain)) {
> + /* If dw-hdmi is the first or only bridge, avoid negociating with ourselves */
> + if (list_is_singular(&bridge->encoder->bridge_chain) ||
> + list_is_first(&bridge->chain_node, &bridge->encoder->bridge_chain)) {
> +
> *num_output_fmts = 1;
> output_fmts[0] = MEDIA_BUS_FMT_FIXED;
>
> @@ -2673,6 +2675,10 @@ static u32 *dw_hdmi_bridge_atomic_get_input_bus_fmts(struct drm_bridge *bridge,
> if (!input_fmts)
> return NULL;
>
> + /* If dw-hdmi is the first bridge fall-back to safe output format */
> + if (list_is_first(&bridge->chain_node, &bridge->encoder->bridge_chain))
> + output_fmt = MEDIA_BUS_FMT_FIXED;
> +
> switch (output_fmt) {
> /* If MEDIA_BUS_FMT_FIXED is tested, return default bus format */
> case MEDIA_BUS_FMT_FIXED:
>
> Which I believe matches the above.

Ok thanks of clarifying !

let me post it asap.

Neil

>
> --
> Kieran
>