DE3 supports 10-bit formats, so it's only naturally to also support
BT2020 encoding.

Add support for it.

Signed-off-by: Jernej Skrabec <jernej.skra...@siol.net>
---
 drivers/gpu/drm/sun4i/sun8i_csc.c      | 12 +++++++++++-
 drivers/gpu/drm/sun4i/sun8i_vi_layer.c |  2 ++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/sun4i/sun8i_csc.c 
b/drivers/gpu/drm/sun4i/sun8i_csc.c
index 1d10714e417e..9bd62de0c288 100644
--- a/drivers/gpu/drm/sun4i/sun8i_csc.c
+++ b/drivers/gpu/drm/sun4i/sun8i_csc.c
@@ -69,7 +69,7 @@ static const u32 yuv2rgb[2][2][12] = {
  * c20 c21 c22 [d2 const2]
  */
 
-static const u32 yuv2rgb_de3[2][2][12] = {
+static const u32 yuv2rgb_de3[2][3][12] = {
        [DRM_COLOR_YCBCR_LIMITED_RANGE] = {
                [DRM_COLOR_YCBCR_BT601] = {
                        0x0002542A, 0x00000000, 0x0003312A, 0xFFC00000,
@@ -80,6 +80,11 @@ static const u32 yuv2rgb_de3[2][2][12] = {
                        0x0002542A, 0x00000000, 0x000395E2, 0xFFC00000,
                        0x0002542A, 0xFFFF92D2, 0xFFFEEF27, 0xFE000000,
                        0x0002542A, 0x0004398C, 0x00000000, 0xFE000000,
+               },
+               [DRM_COLOR_YCBCR_BT2020] = {
+                       0x0002542A, 0x00000000, 0x00035B7B, 0xFFC00000,
+                       0x0002542A, 0xFFFFA017, 0xFFFEB2FC, 0xFE000000,
+                       0x0002542A, 0x00044896, 0x00000000, 0xFE000000,
                }
        },
        [DRM_COLOR_YCBCR_FULL_RANGE] = {
@@ -92,6 +97,11 @@ static const u32 yuv2rgb_de3[2][2][12] = {
                        0x00020000, 0x00000000, 0x0003264C, 0x00000000,
                        0x00020000, 0xFFFFA018, 0xFFFF1053, 0xFE000000,
                        0x00020000, 0x0003B611, 0x00000000, 0xFE000000,
+               },
+               [DRM_COLOR_YCBCR_BT2020] = {
+                       0x00020000, 0x00000000, 0x0002F2FE, 0x00000000,
+                       0x00020000, 0xFFFFABC0, 0xFFFEDB78, 0xFE000000,
+                       0x00020000, 0x0003C346, 0x00000000, 0xFE000000,
                }
        },
 };
diff --git a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c 
b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c
index 76393fc976fe..8cc294a9969d 100644
--- a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c
+++ b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c
@@ -543,6 +543,8 @@ struct sun8i_vi_layer *sun8i_vi_layer_init_one(struct 
drm_device *drm,
 
        supported_encodings = BIT(DRM_COLOR_YCBCR_BT601) |
                              BIT(DRM_COLOR_YCBCR_BT709);
+       if (mixer->cfg->is_de3)
+               supported_encodings |= BIT(DRM_COLOR_YCBCR_BT2020);
 
        supported_ranges = BIT(DRM_COLOR_YCBCR_LIMITED_RANGE) |
                           BIT(DRM_COLOR_YCBCR_FULL_RANGE);
-- 
2.30.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reply via email to