Skip to contentSkip to conversation

drm/bridge: dw-hdmi: use safe format when first in bridge chain

PATCH Superseded Neil Armstrong 3 participants 6 messages Jan 19, 2022 – Feb 4, 2022

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 drm/bridge: dw-hdmi: use safe format when first in bridge chain

When the dw-hdmi bridge is in first place of the bridge chain, this means there is no way to select an input format of the dw-hdmi HW component.

Since introduction of display-connector, negotiation was broken since the dw-hdmi negotiation code only worked when the dw-hdmi bridge was in last position of the bridge chain or behind another bridge also supporting input & output format negotiation.

Commit 0656d1285b79 ("drm/bridge: display-connector: implement bus fmts callbacks") was introduced to make negotiation work again by making display-connector act as a pass-through concerning input & output format negotiation.

But in the case where the dw-hdmi is single in the bridge chain, for example on Renesas SoCs, with the display-connector bridge the dw-hdmi is no more single, breaking output format.

Fixes 0656d1285b79 ("drm/bridge: display-connector: implement bus fmts callbacks").

---
Changes since v1:
- Remove bad fix in dw_hdmi_bridge_atomic_get_input_bus_fmts
- Fix typos in commit message

 drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +3 -2
index 54d8fdad395f..97cdc61b57f6 100644
@@ -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;
 
Signature · 1 line
2.25.1
#1 lore raw
Quoted 36 lines · Neil Armstrong

When the dw-hdmi bridge is in first place of the bridge chain, this means there is no way to select an input format of the dw-hdmi HW component.

Since introduction of display-connector, negotiation was broken since the dw-hdmi negotiation code only worked when the dw-hdmi bridge was in last position of the bridge chain or behind another bridge also supporting input & output format negotiation.

Commit 0656d1285b79 ("drm/bridge: display-connector: implement bus fmts callbacks") was introduced to make negotiation work again by making display-connector act as a pass-through concerning input & output format negotiation.

But in the case where the dw-hdmi is single in the bridge chain, for example on Renesas SoCs, with the display-connector bridge the dw-hdmi is no more single, breaking output format.

Fixes 0656d1285b79 ("drm/bridge: display-connector: implement bus fmts callbacks").

---
Changes since v1:
- Remove bad fix in dw_hdmi_bridge_atomic_get_input_bus_fmts
- Fix typos in commit message

 drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +0 -0
index 54d8fdad395f..97cdc61b57f6 100644

drivers/gpu/drm/bridge/synopsys/dw-hdmi.c static u32 *dw_hdmi_bridge_atomic_get_output_bus_fmts(struct drm_bridge *bridge, · line 2556

Quoted 8 lines
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +3 -2
@@ -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)) {

What if we use bridge helper, drm_bridge_chain_get_first_bridge in order to find the first bridge in chain?

Thanks,
Jagan.

#2 lore raw

Hi,

Quoted 40 lines · Jagan Teki
Quoted 39 lines · Neil Armstrong

When the dw-hdmi bridge is in first place of the bridge chain, this means there is no way to select an input format of the dw-hdmi HW component.

Since introduction of display-connector, negotiation was broken since the dw-hdmi negotiation code only worked when the dw-hdmi bridge was in last position of the bridge chain or behind another bridge also supporting input & output format negotiation.

Commit 0656d1285b79 ("drm/bridge: display-connector: implement bus fmts callbacks") was introduced to make negotiation work again by making display-connector act as a pass-through concerning input & output format negotiation.

But in the case where the dw-hdmi is single in the bridge chain, for example on Renesas SoCs, with the display-connector bridge the dw-hdmi is no more single, breaking output format.

Fixes 0656d1285b79 ("drm/bridge: display-connector: implement bus fmts callbacks").

---
Changes since v1:
- Remove bad fix in dw_hdmi_bridge_atomic_get_input_bus_fmts
- Fix typos in commit message

 drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +0 -0
index 54d8fdad395f..97cdc61b57f6 100644
@@ -2551,8 +2551,9 @@ static u32 *dw_hdmi_bridge_atomic_get_output_bus_fmts(struct drm_bridge *bridge,
        if (!output_fmts)
                return NULL;
 
Quoted 8 lines

drivers/gpu/drm/bridge/synopsys/dw-hdmi.c static u32 *dw_hdmi_bridge_atomic_get_output_bus_fmts(struct drm_bridge *bridge, · line 2556

Quoted 5 lines
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +3 -2
-       /* 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)) {

What if we use bridge helper, drm_bridge_chain_get_first_bridge in order to find the first bridge in chain?

drm_bridge_chain_get_first_bridge() would be similar, since we already access bridge_chain in the previous check, it's simpler like that.

Neil

Quoted 4 lines

Thanks,
Jagan.

#3 lore raw
In reply to Neil Armstrong

Hi,

Quoted 36 lines · Neil Armstrong

When the dw-hdmi bridge is in first place of the bridge chain, this means there is no way to select an input format of the dw-hdmi HW component.

Since introduction of display-connector, negotiation was broken since the dw-hdmi negotiation code only worked when the dw-hdmi bridge was in last position of the bridge chain or behind another bridge also supporting input & output format negotiation.

Commit 0656d1285b79 ("drm/bridge: display-connector: implement bus fmts callbacks") was introduced to make negotiation work again by making display-connector act as a pass-through concerning input & output format negotiation.

But in the case where the dw-hdmi is single in the bridge chain, for example on Renesas SoCs, with the display-connector bridge the dw-hdmi is no more single, breaking output format.

Fixes 0656d1285b79 ("drm/bridge: display-connector: implement bus fmts callbacks").

---
Changes since v1:
- Remove bad fix in dw_hdmi_bridge_atomic_get_input_bus_fmts
- Fix typos in commit message

  drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +0 -0
index 54d8fdad395f..97cdc61b57f6 100644
@@ -2551,8 +2551,9 @@ static u32 *dw_hdmi_bridge_atomic_get_output_bus_fmts(struct drm_bridge *bridge,
  	if (!output_fmts)

drivers/gpu/drm/bridge/synopsys/dw-hdmi.c static u32 *dw_hdmi_bridge_atomic_get_output_bus_fmts(struct drm_bridge *bridge, · line 2559

Quoted 10 lines
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +3 -2
  		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;
 

Can a bridge reviewer get an eye on this ? this actually solves an issue reported on a Renesas platform.

Neil

Reviewed-by on v2 1/1
#4 lore raw
In reply to Neil Armstrong
Quoted 11 lines · Neil Armstrong

When the dw-hdmi bridge is in first place of the bridge chain, this means there is no way to select an input format of the dw-hdmi HW component.

Since introduction of display-connector, negotiation was broken since the dw-hdmi negotiation code only worked when the dw-hdmi bridge was in last position of the bridge chain or behind another bridge also supporting input & output format negotiation.

Commit 0656d1285b79 ("drm/bridge: display-connector: implement bus fmts callbacks")

I think this is the wrong hash. Is 7cd70656d128 the actual hash?

Quoted 11 lines

was introduced to make negotiation work again by making display-connector act as a pass-through concerning input & output format negotiation.

But in the case where the dw-hdmi is single in the bridge chain, for example on Renesas SoCs, with the display-connector bridge the dw-hdmi is no more single, breaking output format.

Fixes 0656d1285b79 ("drm/bridge: display-connector: implement bus fmts callbacks").

This hash too.

Quoted 26 lines

---
Changes since v1:
- Remove bad fix in dw_hdmi_bridge_atomic_get_input_bus_fmts
- Fix typos in commit message

 drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +3 -3
index 54d8fdad395f..97cdc61b57f6 100644
@@ -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;
 
--
Quoted 2 lines

2.25.1

There are two checkstyle issues apart from the above mentioned hash issues, and I think we can ignore those. With the above mentioned issue fixed, feel free to add my r-b.

#5 lore raw

Hi,

Quoted 6 lines · Robert Foss
Quoted 5 lines · Neil Armstrong

When the dw-hdmi bridge is in first place of the bridge chain, this means there is no way to select an input format of the dw-hdmi HW component.

Quoted 8 lines
Quoted 6 lines

Since introduction of display-connector, negotiation was broken since the dw-hdmi negotiation code only worked when the dw-hdmi bridge was in last position of the bridge chain or behind another bridge also supporting input & output format negotiation.

Commit 0656d1285b79 ("drm/bridge: display-connector: implement bus fmts callbacks")

I think this is the wrong hash. Is 7cd70656d128 the actual hash?

Wow indeed, thanks for checking...

Quoted 48 lines
Quoted 4 lines

was introduced to make negotiation work again by making display-connector act as a pass-through concerning input & output format negotiation.

Quoted 8 lines

But in the case where the dw-hdmi is single in the bridge chain, for example on Renesas SoCs, with the display-connector bridge the dw-hdmi is no more single, breaking output format.

Fixes 0656d1285b79 ("drm/bridge: display-connector: implement bus fmts callbacks").

This hash too.

Quoted 26 lines

---
Changes since v1:
- Remove bad fix in dw_hdmi_bridge_atomic_get_input_bus_fmts
- Fix typos in commit message

  drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +3 -3
index 54d8fdad395f..97cdc61b57f6 100644
@@ -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;
 
--
Quoted 2 lines

2.25.1

There are two checkstyle issues apart from the above mentioned hash issues, and I think we can ignore those. With the above mentioned issue fixed, feel free to add my r-b.

Quoted 1 line

Thanks, I'll fix & resend with your r-b.

Neil