Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

+9 -4
+2 -1
drivers/gpu/drm/meson/meson_dw_hdmi.c
··· 752 752 DRM_DEBUG_DRIVER("\"%s\" vic %d\n", mode->name, vic); 753 753 754 754 /* 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); 756 757 757 758 /* VCLK Set clock */ 758 759 dw_hdmi_set_vclk(dw_hdmi, mode);
+5 -3
drivers/gpu/drm/meson/meson_venc.c
··· 946 946 EXPORT_SYMBOL_GPL(meson_venc_hdmi_venc_repeat); 947 947 948 948 void meson_venc_hdmi_mode_set(struct meson_drm *priv, int vic, 949 + unsigned int ycrcb_map, 950 + bool yuv420_mode, 949 951 const struct drm_display_mode *mode) 950 952 { 951 953 union meson_hdmi_venc_mode *vmode = NULL; ··· 1530 1528 if (mode->flags & DRM_MODE_FLAG_PVSYNC) 1531 1529 reg |= VPU_HDMI_INV_VSYNC; 1532 1530 1533 - /* Output data format: CbYCr */ 1534 - reg |= VPU_HDMI_OUTPUT_CBYCR; 1531 + /* Output data format */ 1532 + reg |= ycrcb_map; 1535 1533 1536 1534 /* 1537 1535 * Write rate to the async FIFO between VENC and HDMI. 1538 1536 * One write every 2 wr_clk. 1539 1537 */ 1540 - if (venc_repeat) 1538 + if (venc_repeat || yuv420_mode) 1541 1539 reg |= VPU_HDMI_WR_RATE(2); 1542 1540 1543 1541 /*
+2
drivers/gpu/drm/meson/meson_venc.h
··· 60 60 void meson_venci_cvbs_mode_set(struct meson_drm *priv, 61 61 struct meson_cvbs_enci_mode *mode); 62 62 void meson_venc_hdmi_mode_set(struct meson_drm *priv, int vic, 63 + unsigned int ycrcb_map, 64 + bool yuv420_mode, 63 65 const struct drm_display_mode *mode); 64 66 unsigned int meson_venci_get_field(struct meson_drm *priv); 65 67