mirror of https://lore.kernel.org/linux-amlogic/
 help / color / mirror / Atom feed
* [PATCH v2 0/3] Add additional YUV420 bus format check for dw-meson's bridge enable
@ 2023-06-12 11:23 Adrián Larumbe
  2023-06-12 11:23 ` [PATCH v2 1/3] drm/meson: dw-hdmi: change YUV420 selection logic at clock setup Adrián Larumbe
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Adrián Larumbe @ 2023-06-12 11:23 UTC (permalink / raw)
  To: narmstrong, khilman, linux-amlogic, dri-devel, rfoss, andrzej.hajda
  Cc: adrian.larumbe, kernel

This is v2 of:
https://lore.kernel.org/dri-devel/20230528140001.1057084-1-adrian.larumbe@collabora.com/

The only difference is having added an actual commit message to patch
number 3 in the series.

Adrián Larumbe (3):
  drm/meson: dw-hdmi: change YUV420 selection logic at clock setup
  dw-hdmi: truly enforce 420-only formats when drm mode demands it
  dw-hdmi: remove dead code and fix indentation

 drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 35 +++++++++--------------
 drivers/gpu/drm/meson/meson_dw_hdmi.c     |  4 +--
 include/drm/bridge/dw_hdmi.h              |  2 ++
 3 files changed, 18 insertions(+), 23 deletions(-)

-- 
2.40.0


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2 1/3] drm/meson: dw-hdmi: change YUV420 selection logic at clock setup
  2023-06-12 11:23 [PATCH v2 0/3] Add additional YUV420 bus format check for dw-meson's bridge enable Adrián Larumbe
@ 2023-06-12 11:23 ` Adrián Larumbe
  2023-06-12 11:23 ` [PATCH v2 2/3] dw-hdmi: truly enforce 420-only formats when drm mode demands it Adrián Larumbe
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Adrián Larumbe @ 2023-06-12 11:23 UTC (permalink / raw)
  To: narmstrong, khilman, linux-amlogic, dri-devel, rfoss, andrzej.hajda
  Cc: adrian.larumbe, kernel

Right now clocking value selection code is prioritising RGB, YUV444 modes
over YUV420 for HDMI2 sinks. However, because of the bus format selection
procedure in dw-hdmi, for HDMI2 sinks YUV420 is the format that will always
be picked during the drm bridge chain check stage.

Later on dw_hdmi_setup will configure a colour space based on the bus
format that doesn't match the pixel value we had calculated as described
above.

Fix it by bringing back dw-hdmi bus format check when picking the right
pixel clock.

Signed-off-by: Adrián Larumbe <adrian.larumbe@collabora.com>
---
 drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 6 ++++++
 drivers/gpu/drm/meson/meson_dw_hdmi.c     | 4 ++--
 include/drm/bridge/dw_hdmi.h              | 2 ++
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
index 3b40e0fdca5c..e6a456b72610 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
@@ -3346,6 +3346,12 @@ static int dw_hdmi_parse_dt(struct dw_hdmi *hdmi)
 	return 0;
 }
 
+bool dw_hdmi_bus_fmt_is_420(struct dw_hdmi *hdmi)
+{
+	return hdmi_bus_fmt_is_yuv420(hdmi->hdmi_data.enc_out_bus_format);
+}
+EXPORT_SYMBOL_GPL(dw_hdmi_bus_fmt_is_420);
+
 struct dw_hdmi *dw_hdmi_probe(struct platform_device *pdev,
 			      const struct dw_hdmi_plat_data *plat_data)
 {
diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c
index 3d046878ce6c..b49bb0d86efe 100644
--- a/drivers/gpu/drm/meson/meson_dw_hdmi.c
+++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c
@@ -379,8 +379,8 @@ static int dw_hdmi_phy_init(struct dw_hdmi *hdmi, void *data,
 			 mode->clock > 340000 ? 40 : 10);
 
 	if (drm_mode_is_420_only(display, mode) ||
-	    (!is_hdmi2_sink &&
-	     drm_mode_is_420_also(display, mode)))
+	    (!is_hdmi2_sink && drm_mode_is_420_also(display, mode)) ||
+	    dw_hdmi_bus_fmt_is_420(hdmi))
 		mode_is_420 = true;
 
 	/* Enable clocks */
diff --git a/include/drm/bridge/dw_hdmi.h b/include/drm/bridge/dw_hdmi.h
index f668e75fbabe..6a46baa0737c 100644
--- a/include/drm/bridge/dw_hdmi.h
+++ b/include/drm/bridge/dw_hdmi.h
@@ -206,4 +206,6 @@ void dw_hdmi_phy_update_hpd(struct dw_hdmi *hdmi, void *data,
 			    bool force, bool disabled, bool rxsense);
 void dw_hdmi_phy_setup_hpd(struct dw_hdmi *hdmi, void *data);
 
+bool dw_hdmi_bus_fmt_is_420(struct dw_hdmi *hdmi);
+
 #endif /* __IMX_HDMI_H__ */
-- 
2.40.0


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2 2/3] dw-hdmi: truly enforce 420-only formats when drm mode demands it
  2023-06-12 11:23 [PATCH v2 0/3] Add additional YUV420 bus format check for dw-meson's bridge enable Adrián Larumbe
  2023-06-12 11:23 ` [PATCH v2 1/3] drm/meson: dw-hdmi: change YUV420 selection logic at clock setup Adrián Larumbe
@ 2023-06-12 11:23 ` Adrián Larumbe
  2023-06-12 11:23 ` [PATCH v2 3/3] dw-hdmi: remove dead code and fix indentation Adrián Larumbe
  2023-06-12 12:34 ` [PATCH v2 0/3] Add additional YUV420 bus format check for dw-meson's bridge enable Neil Armstrong
  3 siblings, 0 replies; 5+ messages in thread
From: Adrián Larumbe @ 2023-06-12 11:23 UTC (permalink / raw)
  To: narmstrong, khilman, linux-amlogic, dri-devel, rfoss, andrzej.hajda
  Cc: adrian.larumbe, kernel

The current output bus format selection logic is enforcing YUV420 even
when the drm mode allows for other bus formats as well.
Fix it by adding check for 420-only drm modes.

Signed-off-by: Adrián Larumbe <adrian.larumbe@collabora.com>
---
 drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
index e6a456b72610..3a788316e2e5 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
@@ -2710,9 +2710,10 @@ static u32 *dw_hdmi_bridge_atomic_get_output_bus_fmts(struct drm_bridge *bridge,
 		/* Default 8bit fallback */
 		output_fmts[i++] = MEDIA_BUS_FMT_UYYVYY8_0_5X24;
 
-		*num_output_fmts = i;
-
-		return output_fmts;
+		if (drm_mode_is_420_only(info, mode)) {
+			*num_output_fmts = i;
+			return output_fmts;
+		}
 	}
 
 	/*
-- 
2.40.0


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2 3/3] dw-hdmi: remove dead code and fix indentation
  2023-06-12 11:23 [PATCH v2 0/3] Add additional YUV420 bus format check for dw-meson's bridge enable Adrián Larumbe
  2023-06-12 11:23 ` [PATCH v2 1/3] drm/meson: dw-hdmi: change YUV420 selection logic at clock setup Adrián Larumbe
  2023-06-12 11:23 ` [PATCH v2 2/3] dw-hdmi: truly enforce 420-only formats when drm mode demands it Adrián Larumbe
@ 2023-06-12 11:23 ` Adrián Larumbe
  2023-06-12 12:34 ` [PATCH v2 0/3] Add additional YUV420 bus format check for dw-meson's bridge enable Neil Armstrong
  3 siblings, 0 replies; 5+ messages in thread
From: Adrián Larumbe @ 2023-06-12 11:23 UTC (permalink / raw)
  To: narmstrong, khilman, linux-amlogic, dri-devel, rfoss, andrzej.hajda
  Cc: adrian.larumbe, kernel

The hdmi_datamap enum is no longer in use. Also reindent enable_audio's
call params.

Signed-off-by: Adrián Larumbe <adrian.larumbe@collabora.com>
---
 drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 22 ++++------------------
 1 file changed, 4 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
index 3a788316e2e5..69c0e80b8525 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
@@ -49,20 +49,6 @@
 
 #define HDMI14_MAX_TMDSCLK	340000000
 
-enum hdmi_datamap {
-	RGB444_8B = 0x01,
-	RGB444_10B = 0x03,
-	RGB444_12B = 0x05,
-	RGB444_16B = 0x07,
-	YCbCr444_8B = 0x09,
-	YCbCr444_10B = 0x0B,
-	YCbCr444_12B = 0x0D,
-	YCbCr444_16B = 0x0F,
-	YCbCr422_8B = 0x16,
-	YCbCr422_10B = 0x14,
-	YCbCr422_12B = 0x12,
-};
-
 static const u16 csc_coeff_default[3][4] = {
 	{ 0x2000, 0x0000, 0x0000, 0x0000 },
 	{ 0x0000, 0x2000, 0x0000, 0x0000 },
@@ -856,10 +842,10 @@ static void dw_hdmi_gp_audio_enable(struct dw_hdmi *hdmi)
 
 	if (pdata->enable_audio)
 		pdata->enable_audio(hdmi,
-					    hdmi->channels,
-					    hdmi->sample_width,
-					    hdmi->sample_rate,
-					    hdmi->sample_non_pcm);
+				    hdmi->channels,
+				    hdmi->sample_width,
+				    hdmi->sample_rate,
+				    hdmi->sample_non_pcm);
 }
 
 static void dw_hdmi_gp_audio_disable(struct dw_hdmi *hdmi)
-- 
2.40.0


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 0/3] Add additional YUV420 bus format check for dw-meson's bridge enable
  2023-06-12 11:23 [PATCH v2 0/3] Add additional YUV420 bus format check for dw-meson's bridge enable Adrián Larumbe
                   ` (2 preceding siblings ...)
  2023-06-12 11:23 ` [PATCH v2 3/3] dw-hdmi: remove dead code and fix indentation Adrián Larumbe
@ 2023-06-12 12:34 ` Neil Armstrong
  3 siblings, 0 replies; 5+ messages in thread
From: Neil Armstrong @ 2023-06-12 12:34 UTC (permalink / raw)
  To: Adrián Larumbe, khilman, linux-amlogic, dri-devel, rfoss,
	andrzej.hajda
  Cc: kernel

Hi,

On 12/06/2023 13:23, Adrián Larumbe wrote:
> This is v2 of:
> https://lore.kernel.org/dri-devel/20230528140001.1057084-1-adrian.larumbe@collabora.com/
> 
> The only difference is having added an actual commit message to patch
> number 3 in the series.

Seems you didn't keep my Acked-by/Reviewed-by and you used my old narmstrong@baylibre.com
email address.... and you only selected the Meson & Bridge maintainers and not the reviewers.

> 
> Adrián Larumbe (3):
>    drm/meson: dw-hdmi: change YUV420 selection logic at clock setup
>    dw-hdmi: truly enforce 420-only formats when drm mode demands it

The subject should be: "drm/bridge: dw-hdmi: ..."

>    dw-hdmi: remove dead code and fix indentation

Ditto

> 
>   drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 35 +++++++++--------------
>   drivers/gpu/drm/meson/meson_dw_hdmi.c     |  4 +--
>   include/drm/bridge/dw_hdmi.h              |  2 ++
>   3 files changed, 18 insertions(+), 23 deletions(-)
> 

Please resend a v3 with all those changes,
Thanks

Neil

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-06-12 12:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-12 11:23 [PATCH v2 0/3] Add additional YUV420 bus format check for dw-meson's bridge enable Adrián Larumbe
2023-06-12 11:23 ` [PATCH v2 1/3] drm/meson: dw-hdmi: change YUV420 selection logic at clock setup Adrián Larumbe
2023-06-12 11:23 ` [PATCH v2 2/3] dw-hdmi: truly enforce 420-only formats when drm mode demands it Adrián Larumbe
2023-06-12 11:23 ` [PATCH v2 3/3] dw-hdmi: remove dead code and fix indentation Adrián Larumbe
2023-06-12 12:34 ` [PATCH v2 0/3] Add additional YUV420 bus format check for dw-meson's bridge enable Neil Armstrong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®