drm/rockchip: Fix YUV buffers color rendering
authorDaniele Castagna <dcastagna@chromium.org>
Tue, 8 Jan 2019 21:46:59 +0000 (18:46 -0300)
committerHeiko Stuebner <heiko@sntech.de>
Thu, 10 Jan 2019 22:30:24 +0000 (23:30 +0100)
commit1c21aa8f2b687cebfeff9736d60303a14bf32768
tree5a66b4db3b011a3f34e0220f2966c4f4e88ca61b
parent15609559a834a59c9cfba16c032d38a72bd49996
drm/rockchip: Fix YUV buffers color rendering

Currently, YUV hardware overlays are converted to RGB using
a color space conversion different than BT.601.

The result is that colors of e.g. NV12 buffers don't match
colors of YUV hardware overlays.

In order to fix this, enable YUV2YUV and set appropriate coefficients
for formats such as NV12 to be displayed correctly.

This commit was tested using modetest, gstreamer and chromeos (hardware
accelerated video playback). Before the commit, tests rendering
with NV12 format resulted in colors not displayed correctly.

Test examples (Tested on RK3399 and RK3288 boards
connected to HDMI monitor):

  $ modetest 39@32:1920x1080@NV12
  $ gst-launch-1.0 videotestrc ! video/x-raw,format=NV12 ! kmssink

Signed-off-by: Daniele Castagna <dcastagna@chromium.org>
[ezequiel: rebase on linux-next and massage commit log]
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20190108214659.28794-1-ezequiel@collabora.com
drivers/gpu/drm/rockchip/rockchip_drm_vop.c
drivers/gpu/drm/rockchip/rockchip_drm_vop.h
drivers/gpu/drm/rockchip/rockchip_vop_reg.c