* [PATCH v3 0/3] Add additional YUV420 bus format check for dw-meson's bridge enable
@ 2023-06-25 14:17 Adrián Larumbe
2023-06-25 14:17 ` [PATCH v3 1/3] drm/bridge: 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-25 14:17 UTC (permalink / raw)
To: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, David Airlie, Daniel Vetter,
Kevin Hilman, Jerome Brunet, Martin Blumenstingl
Cc: Adrián Larumbe, dri-devel, linux-kernel, linux-amlogic,
linux-arm-kernel
This is a belated follow-up on
https://lore.kernel.org/dri-devel/20220515204412.2733803-1-adrian.larumbe@collabora.com
Commit e67f6037ae1be34b2b68 ("drm/meson: split out encoder from meson_dw_hdmi")
broke 4K display modes for me, and I discovered it was because the right
pixel clock wasn't being chosen in dw_hdmi_phy_init. I misinterpreted the
reason as a problem in figuring out whether we want to enforce YUV420 mode,
but it turned out to be a mismatch between what dw-meson code is doing and
the way the bus format is being picked by the dw-hdmi bus output format drm
helper.
I fixed it by bringing back dw-hdmi bus format check in dw-meson.
The second patch makes sure YUV420 bus format is the only one being
returned by dw-hdmi's output format bridge function when that's the only
drm mode allowed.
Changelog:
v3:
- Change commit message for all three commits to accurately
reflect the modified files' subsystem.
- Add v1's Acked-by tags from subsystem maintainer
v2:
- Add commit message to patch number 3 in the series
Adrián Larumbe (3):
drm/bridge: dw-hdmi: change YUV420 selection logic at clock setup
drm/bridge: dw-hdmi: truly enforce 420-only formats when drm mode
demands it
drm/bridge: 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-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v3 1/3] drm/bridge: dw-hdmi: change YUV420 selection logic at clock setup
2023-06-25 14:17 [PATCH v3 0/3] Add additional YUV420 bus format check for dw-meson's bridge enable Adrián Larumbe
@ 2023-06-25 14:17 ` Adrián Larumbe
2023-06-25 14:17 ` [PATCH v3 2/3] drm/bridge: 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-25 14:17 UTC (permalink / raw)
To: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, David Airlie, Daniel Vetter,
Kevin Hilman, Jerome Brunet, Martin Blumenstingl
Cc: Adrián Larumbe, dri-devel, linux-kernel, linux-amlogic,
linux-arm-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>
Acked-by: Neil Armstrong <neil.armstrong@linaro.org>
---
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-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v3 2/3] drm/bridge: dw-hdmi: truly enforce 420-only formats when drm mode demands it
2023-06-25 14:17 [PATCH v3 0/3] Add additional YUV420 bus format check for dw-meson's bridge enable Adrián Larumbe
2023-06-25 14:17 ` [PATCH v3 1/3] drm/bridge: dw-hdmi: change YUV420 selection logic at clock setup Adrián Larumbe
@ 2023-06-25 14:17 ` Adrián Larumbe
2023-06-25 14:17 ` [PATCH v3 3/3] drm/bridge: dw-hdmi: remove dead code and fix indentation Adrián Larumbe
2023-06-27 7:54 ` [PATCH v3 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-25 14:17 UTC (permalink / raw)
To: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, David Airlie, Daniel Vetter,
Kevin Hilman, Jerome Brunet, Martin Blumenstingl
Cc: Adrián Larumbe, dri-devel, linux-kernel, linux-amlogic,
linux-arm-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>
Acked-by: Neil Armstrong <neil.armstrong@linaro.org>
---
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-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v3 3/3] drm/bridge: dw-hdmi: remove dead code and fix indentation
2023-06-25 14:17 [PATCH v3 0/3] Add additional YUV420 bus format check for dw-meson's bridge enable Adrián Larumbe
2023-06-25 14:17 ` [PATCH v3 1/3] drm/bridge: dw-hdmi: change YUV420 selection logic at clock setup Adrián Larumbe
2023-06-25 14:17 ` [PATCH v3 2/3] drm/bridge: dw-hdmi: truly enforce 420-only formats when drm mode demands it Adrián Larumbe
@ 2023-06-25 14:17 ` Adrián Larumbe
2023-06-27 7:54 ` [PATCH v3 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-25 14:17 UTC (permalink / raw)
To: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, David Airlie, Daniel Vetter,
Kevin Hilman, Jerome Brunet, Martin Blumenstingl
Cc: Adrián Larumbe, dri-devel, linux-kernel, linux-amlogic,
linux-arm-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>
Acked-by: Neil Armstrong <neil.armstrong@linaro.org>
---
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-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v3 0/3] Add additional YUV420 bus format check for dw-meson's bridge enable
2023-06-25 14:17 [PATCH v3 0/3] Add additional YUV420 bus format check for dw-meson's bridge enable Adrián Larumbe
` (2 preceding siblings ...)
2023-06-25 14:17 ` [PATCH v3 3/3] drm/bridge: dw-hdmi: remove dead code and fix indentation Adrián Larumbe
@ 2023-06-27 7:54 ` Neil Armstrong
3 siblings, 0 replies; 5+ messages in thread
From: Neil Armstrong @ 2023-06-27 7:54 UTC (permalink / raw)
To: Andrzej Hajda, Robert Foss, Laurent Pinchart, Jonas Karlman,
Jernej Skrabec, David Airlie, Daniel Vetter, Kevin Hilman,
Jerome Brunet, Martin Blumenstingl, Adrián Larumbe
Cc: dri-devel, linux-kernel, linux-amlogic, linux-arm-kernel
Hi,
On Sun, 25 Jun 2023 15:17:14 +0100, Adrián Larumbe wrote:
> This is a belated follow-up on
> https://lore.kernel.org/dri-devel/20220515204412.2733803-1-adrian.larumbe@collabora.com
>
> Commit e67f6037ae1be34b2b68 ("drm/meson: split out encoder from meson_dw_hdmi")
> broke 4K display modes for me, and I discovered it was because the right
> pixel clock wasn't being chosen in dw_hdmi_phy_init. I misinterpreted the
> reason as a problem in figuring out whether we want to enforce YUV420 mode,
> but it turned out to be a mismatch between what dw-meson code is doing and
> the way the bus format is being picked by the dw-hdmi bus output format drm
> helper.
>
> [...]
Thanks, Applied to https://anongit.freedesktop.org/git/drm/drm-misc.git (drm-misc-next)
[1/3] drm/bridge: dw-hdmi: change YUV420 selection logic at clock setup
https://cgit.freedesktop.org/drm/drm-misc/commit/?id=7ed40ff1d134bf3a4aef706eed478b926f35b404
[2/3] drm/bridge: dw-hdmi: truly enforce 420-only formats when drm mode demands it
https://cgit.freedesktop.org/drm/drm-misc/commit/?id=f3710b424a96078f416e1be9cf52b87eadabae78
[3/3] drm/bridge: dw-hdmi: remove dead code and fix indentation
https://cgit.freedesktop.org/drm/drm-misc/commit/?id=2299a8d12c1cbcdc7086027615d9936a970e7d68
--
Neil
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-06-27 7:54 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-25 14:17 [PATCH v3 0/3] Add additional YUV420 bus format check for dw-meson's bridge enable Adrián Larumbe
2023-06-25 14:17 ` [PATCH v3 1/3] drm/bridge: dw-hdmi: change YUV420 selection logic at clock setup Adrián Larumbe
2023-06-25 14:17 ` [PATCH v3 2/3] drm/bridge: dw-hdmi: truly enforce 420-only formats when drm mode demands it Adrián Larumbe
2023-06-25 14:17 ` [PATCH v3 3/3] drm/bridge: dw-hdmi: remove dead code and fix indentation Adrián Larumbe
2023-06-27 7:54 ` [PATCH v3 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;
as well as URLs for NNTP newsgroup(s).