Skip to content

Commit 64db601

Browse files
committed
drm/meson: venc: add support for YUV420 setup
This patch adds encoding support for the YUV420 output from the Amlogic Meson SoCs Video Processing Unit to the HDMI Controller. The YUV420 is obtained by generating a YUV444 pixel stream like the classic HDMI display modes, but then the Video Encoder output can be configured to down-sample the YUV444 pixel stream to a YUV420 stream. In addition if pixel stream down-sampling, the Y Cb Cr components must also be mapped differently to align with the HDMI2.0 specifications. Signed-off-by: Neil Armstrong <narmstrong@baylibre.com> Reviewed-by: Jernej Škrabec <jernej.skrabec@siol.net> Link: https://patchwork.freedesktop.org/patch/msgid/20200304104052.17196-10-narmstrong@baylibre.com
1 parent 1fd3418 commit 64db601

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

drivers/gpu/drm/meson/meson_dw_hdmi.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,8 @@ static void meson_venc_hdmi_encoder_mode_set(struct drm_bridge *bridge,
752752
DRM_DEBUG_DRIVER("\"%s\" vic %d\n", mode->name, vic);
753753

754754
/* VENC + VENC-DVI Mode setup */
755-
meson_venc_hdmi_mode_set(priv, vic, mode);
755+
meson_venc_hdmi_mode_set(priv, vic, ycrcb_map, false,
756+
VPU_HDMI_OUTPUT_CBYCR);
756757

757758
/* VCLK Set clock */
758759
dw_hdmi_set_vclk(dw_hdmi, mode);

drivers/gpu/drm/meson/meson_venc.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -946,6 +946,8 @@ bool meson_venc_hdmi_venc_repeat(int vic)
946946
EXPORT_SYMBOL_GPL(meson_venc_hdmi_venc_repeat);
947947

948948
void meson_venc_hdmi_mode_set(struct meson_drm *priv, int vic,
949+
unsigned int ycrcb_map,
950+
bool yuv420_mode,
949951
const struct drm_display_mode *mode)
950952
{
951953
union meson_hdmi_venc_mode *vmode = NULL;
@@ -1528,14 +1530,14 @@ void meson_venc_hdmi_mode_set(struct meson_drm *priv, int vic,
15281530
if (mode->flags & DRM_MODE_FLAG_PVSYNC)
15291531
reg |= VPU_HDMI_INV_VSYNC;
15301532

1531-
/* Output data format: CbYCr */
1532-
reg |= VPU_HDMI_OUTPUT_CBYCR;
1533+
/* Output data format */
1534+
reg |= ycrcb_map;
15331535

15341536
/*
15351537
* Write rate to the async FIFO between VENC and HDMI.
15361538
* One write every 2 wr_clk.
15371539
*/
1538-
if (venc_repeat)
1540+
if (venc_repeat || yuv420_mode)
15391541
reg |= VPU_HDMI_WR_RATE(2);
15401542

15411543
/*

drivers/gpu/drm/meson/meson_venc.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ extern struct meson_cvbs_enci_mode meson_cvbs_enci_ntsc;
6060
void meson_venci_cvbs_mode_set(struct meson_drm *priv,
6161
struct meson_cvbs_enci_mode *mode);
6262
void meson_venc_hdmi_mode_set(struct meson_drm *priv, int vic,
63+
unsigned int ycrcb_map,
64+
bool yuv420_mode,
6365
const struct drm_display_mode *mode);
6466
unsigned int meson_venci_get_field(struct meson_drm *priv);
6567

0 commit comments

Comments
 (0)