Skip to contentSkip to conversation

drm: mxsfb: Set proper default bus format when using a bridge

PATCH In review Guido Günther 3 participants 7 messages Sep 28, 2021

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm: mxsfb: Set proper default bus format when using a bridge

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 panels.

Fixes b776b0f00f24 ("drm: mxsfb: Use bus_format from the nearest bridge if present")

---

I'll look at what needs to be done in nwl separately but this also unbreaks other bridge seupts that don't to format negotiation yet.

 drivers/gpu/drm/mxsfb/mxsfb_kms.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/mxsfb/mxsfb_kms.c +2 -0
index af6c620adf6e..4ef94cf686b0 100644
@@ -369,6 +369,8 @@ 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)
+			bus_format = MEDIA_BUS_FMT_RGB888_1X24;
 	}
 
 	/* If there is no bridge, use bus format from connector */
Signature · 1 line
2.33.0
maintainer
#1 lore raw
Quoted 22 lines · Guido Günther

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 panels.

Fixes b776b0f00f24 ("drm: mxsfb: Use bus_format from the nearest bridge if present")

---

I'll look at what needs to be done in nwl separately but this also unbreaks other bridge seupts that don't to format negotiation yet.

  drivers/gpu/drm/mxsfb/mxsfb_kms.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/gpu/drm/mxsfb/mxsfb_kms.c +0 -0
index af6c620adf6e..4ef94cf686b0 100644

drivers/gpu/drm/mxsfb/mxsfb_kms.c static void mxsfb_crtc_atomic_enable(struct drm_crtc *crtc, · line 373

Quoted 5 lines
drivers/gpu/drm/mxsfb/mxsfb_kms.c +2 -0
@@ -369,6 +369,8 @@ 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)
+			bus_format = MEDIA_BUS_FMT_RGB888_1X24;

Shouldn't the NWL bridge return the correct format ?

#2 lore raw

Hi,

Quoted 18 lines · Marek Vasut
Quoted 17 lines · Guido Günther

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 panels.

Fixes b776b0f00f24 ("drm: mxsfb: Use bus_format from the nearest bridge if present")

---

I'll look at what needs to be done in nwl separately but this also unbreaks other bridge seupts that don't to format negotiation yet.

  drivers/gpu/drm/mxsfb/mxsfb_kms.c | 2 ++
  1 file changed, 2 insertions(+)
Quoted 12 lines

drivers/gpu/drm/mxsfb/mxsfb_kms.c static void mxsfb_crtc_atomic_enable(struct drm_crtc *crtc, · line 373

Quoted 10 lines
drivers/gpu/drm/mxsfb/mxsfb_kms.c +2 -0
index af6c620adf6e..4ef94cf686b0 100644
@@ -369,6 +369,8 @@ 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)
+			bus_format = MEDIA_BUS_FMT_RGB888_1X24;

Shouldn't the NWL bridge return the correct format ?

Yes it should and I'll send a separate patch for that but we currently don't do anything meaningful at all if the bridge doesn't do format negotiation and then fail setup in mxsfb_set_formats().

I think we should at least preserve the status quo (as we do with the non bridge case in b776b0f00f24 too).

We could have a warning to spot drivers that don't do that yet and hence the generic code returns MEDIA_BUS_FMT_FIXED.

Cheers,
-- Guido

maintainer
#3 lore raw
Quoted 37 lines · Guido Günther

Hi,

Quoted 18 lines · Marek Vasut
Quoted 17 lines · Guido Günther

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 panels.

Fixes b776b0f00f24 ("drm: mxsfb: Use bus_format from the nearest bridge if present")

---

I'll look at what needs to be done in nwl separately but this also unbreaks other bridge seupts that don't to format negotiation yet.

   drivers/gpu/drm/mxsfb/mxsfb_kms.c | 2 ++
   1 file changed, 2 insertions(+)
Quoted 12 lines

drivers/gpu/drm/mxsfb/mxsfb_kms.c static void mxsfb_crtc_atomic_enable(struct drm_crtc *crtc, · line 373

Quoted 10 lines
drivers/gpu/drm/mxsfb/mxsfb_kms.c +2 -0
index af6c620adf6e..4ef94cf686b0 100644
@@ -369,6 +369,8 @@ 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)
+			bus_format = MEDIA_BUS_FMT_RGB888_1X24;

Shouldn't the NWL bridge return the correct format ?

Yes it should and I'll send a separate patch for that but we currently don't do anything meaningful at all if the bridge doesn't do format negotiation and then fail setup in mxsfb_set_formats().

Quoted 5 lines

I think we should at least preserve the status quo (as we do with the non bridge case in b776b0f00f24 too).

We could have a warning to spot drivers that don't do that yet and hence the generic code returns MEDIA_BUS_FMT_FIXED.

I am not gonna push back against this patch, I think you need feedback from the drm people on this. A warning would indeed be nice. Preserving the old behavior in stable releases would be good (if there are any releases which contain the mxsfb patch this fixes).

#4 lore raw
In reply to Guido Günther

Am Dienstag, dem 28.09.2021 um 11:19 +0200 schrieb Guido Günther:

Quoted 37 lines

Hi,

Quoted 18 lines · Marek Vasut
Quoted 17 lines · Guido Günther

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 panels.

Fixes b776b0f00f24 ("drm: mxsfb: Use bus_format from the nearest bridge if present")

---

I'll look at what needs to be done in nwl separately but this also unbreaks other bridge seupts that don't to format negotiation yet.

  drivers/gpu/drm/mxsfb/mxsfb_kms.c | 2 ++
  1 file changed, 2 insertions(+)
Quoted 12 lines

drivers/gpu/drm/mxsfb/mxsfb_kms.c static void mxsfb_crtc_atomic_enable(struct drm_crtc *crtc, · line 373

Quoted 10 lines
drivers/gpu/drm/mxsfb/mxsfb_kms.c +2 -0
index af6c620adf6e..4ef94cf686b0 100644
@@ -369,6 +369,8 @@ 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)
+			bus_format = MEDIA_BUS_FMT_RGB888_1X24;

Shouldn't the NWL bridge return the correct format ?

Yes it should and I'll send a separate patch for that but we currently don't do anything meaningful at all if the bridge doesn't do format negotiation and then fail setup in mxsfb_set_formats().

Quoted 6 lines

I think we should at least preserve the status quo (as we do with the non bridge case in b776b0f00f24 too).

We could have a warning to spot drivers that don't do that yet and hence the generic code returns MEDIA_BUS_FMT_FIXED.

That sounds sensible. Using a default format if we don't know what to do is going to be a unpleasant surprise for those with a display pipeline that doesn't work with the default format. So please add a dev_warn when we are doing this fallback.

Also I would argue that the NWL fix is the patch that should go in the stable tree. This one should only be a additional safety net, so I would drop the Fixes tag.

Regards,
Lucas

maintainer
#5 lore raw
Quoted 44 lines · Lucas Stach

Am Dienstag, dem 28.09.2021 um 11:19 +0200 schrieb Guido Günther:

Quoted 37 lines

Hi,

Quoted 18 lines · Marek Vasut
Quoted 17 lines · Guido Günther

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 panels.

Fixes b776b0f00f24 ("drm: mxsfb: Use bus_format from the nearest bridge if present")

---

I'll look at what needs to be done in nwl separately but this also unbreaks other bridge seupts that don't to format negotiation yet.

   drivers/gpu/drm/mxsfb/mxsfb_kms.c | 2 ++
   1 file changed, 2 insertions(+)
Quoted 12 lines

drivers/gpu/drm/mxsfb/mxsfb_kms.c static void mxsfb_crtc_atomic_enable(struct drm_crtc *crtc, · line 373

Quoted 10 lines
drivers/gpu/drm/mxsfb/mxsfb_kms.c +2 -0
index af6c620adf6e..4ef94cf686b0 100644
@@ -369,6 +369,8 @@ 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)
+			bus_format = MEDIA_BUS_FMT_RGB888_1X24;

Shouldn't the NWL bridge return the correct format ?

Yes it should and I'll send a separate patch for that but we currently don't do anything meaningful at all if the bridge doesn't do format negotiation and then fail setup in mxsfb_set_formats().

Quoted 6 lines

I think we should at least preserve the status quo (as we do with the non bridge case in b776b0f00f24 too).

We could have a warning to spot drivers that don't do that yet and hence the generic code returns MEDIA_BUS_FMT_FIXED.

Quoted 8 lines

That sounds sensible. Using a default format if we don't know what to do is going to be a unpleasant surprise for those with a display pipeline that doesn't work with the default format. So please add a dev_warn when we are doing this fallback.

Also I would argue that the NWL fix is the patch that should go in the stable tree. This one should only be a additional safety net, so I would drop the Fixes tag.

Indeed

#6 lore raw
In reply to Lucas Stach

Hi,

Quoted 44 lines · Lucas Stach

Am Dienstag, dem 28.09.2021 um 11:19 +0200 schrieb Guido Günther:

Quoted 37 lines

Hi,

Quoted 18 lines · Marek Vasut
Quoted 17 lines · Guido Günther

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 panels.

Fixes b776b0f00f24 ("drm: mxsfb: Use bus_format from the nearest bridge if present")

---

I'll look at what needs to be done in nwl separately but this also unbreaks other bridge seupts that don't to format negotiation yet.

  drivers/gpu/drm/mxsfb/mxsfb_kms.c | 2 ++
  1 file changed, 2 insertions(+)
Quoted 12 lines

drivers/gpu/drm/mxsfb/mxsfb_kms.c static void mxsfb_crtc_atomic_enable(struct drm_crtc *crtc, · line 373

Quoted 10 lines
drivers/gpu/drm/mxsfb/mxsfb_kms.c +2 -0
index af6c620adf6e..4ef94cf686b0 100644
@@ -369,6 +369,8 @@ 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)
+			bus_format = MEDIA_BUS_FMT_RGB888_1X24;

Shouldn't the NWL bridge return the correct format ?

Yes it should and I'll send a separate patch for that but we currently don't do anything meaningful at all if the bridge doesn't do format negotiation and then fail setup in mxsfb_set_formats().

Quoted 6 lines

I think we should at least preserve the status quo (as we do with the non bridge case in b776b0f00f24 too).

We could have a warning to spot drivers that don't do that yet and hence the generic code returns MEDIA_BUS_FMT_FIXED.

Quoted 8 lines

That sounds sensible. Using a default format if we don't know what to do is going to be a unpleasant surprise for those with a display pipeline that doesn't work with the default format. So please add a dev_warn when we are doing this fallback.

Also I would argue that the NWL fix is the patch that should go in the stable tree. This one should only be a additional safety net, so I would drop the Fixes tag.

Dropped and folded into the small series with other fixes needed to get get the bus format propagated up from the panel. Cheers,
-- Guido

Quoted 4 lines

Regards,
Lucas