From 28c98d0c5be04f572edccdabc0e075239d1667f4 Mon Sep 17 00:00:00 2001 From: Jian Cao Date: Thu, 3 Jan 2019 20:36:22 +0800 Subject: [PATCH] ge2d: add support for nv16 [1/1] PD#SWPL-3876 Problem: add support for nv16 Solution: add support for nv16 Verify: verified on g12a-u200 Change-Id: I34c9179ed4fde43b9bd00caa9505ea4c8ee78eb0 Signed-off-by: Jian Cao --- drivers/amlogic/media/common/ge2d/ge2dgen.c | 9 ++++++++- include/linux/amlogic/media/ge2d/ge2d.h | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/amlogic/media/common/ge2d/ge2dgen.c b/drivers/amlogic/media/common/ge2d/ge2dgen.c index 5918d3b..aad11e7 100644 --- a/drivers/amlogic/media/common/ge2d/ge2dgen.c +++ b/drivers/amlogic/media/common/ge2d/ge2dgen.c @@ -90,6 +90,8 @@ static inline void _set_dst_format( unsigned int format_src, unsigned int format_dst) { + unsigned int y_yc_ratio; + src2_dst_data_cfg->dst_format_all = format_dst; src2_dst_data_cfg->dst_format = (format_dst >> 8) & 3; src2_dst_data_cfg->dst_endian = (format_dst & GE2D_ENDIAN_MASK) >> @@ -118,6 +120,8 @@ static inline void _set_dst_format( } else dp_gen_cfg->conv_matrix_en = 0; + y_yc_ratio = (format_dst >> 0) & 1; + /* #if MESON_CPU_TYPE >= MESON_CPU_TYPE_MESON6 */ /* for dest is nv21 or nv12 in m6. */ if ((format_dst & GE2D_FORMAT_YUV) && @@ -125,7 +129,10 @@ static inline void _set_dst_format( src2_dst_data_cfg->dst_format = 0; src2_dst_data_cfg->dst_mode_8b_sel = 0; src2_dst_data_cfg->dst2_pixel_byte_width = 1; - src2_dst_data_cfg->dst2_discard_mode = 0xf; + if (y_yc_ratio == 0) + src2_dst_data_cfg->dst2_discard_mode = 0xc; + else + src2_dst_data_cfg->dst2_discard_mode = 0xf; src2_dst_data_cfg->dst2_enable = 1; src2_dst_data_cfg->dst2_color_map = src2_dst_data_cfg->dst_color_map - 5; diff --git a/include/linux/amlogic/media/ge2d/ge2d.h b/include/linux/amlogic/media/ge2d/ge2d.h index 0855b65..c262542 100644 --- a/include/linux/amlogic/media/ge2d/ge2d.h +++ b/include/linux/amlogic/media/ge2d/ge2d.h @@ -247,6 +247,7 @@ enum ge2d_memtype_s { #define GE2D_FMT_M24_YUV420B 0x2001f /* 00_00_0_11_1_11 */ #define GE2D_FMT_M24_YUV420SP 0x20207 +#define GE2D_FMT_M24_YUV422SP 0x20206 /* 01_00_0_00_1_11 nv12 &nv21, only works on m6. */ #define GE2D_FMT_M24_YUV420SPT 0x20217 /* 01_00_0_00_1_11 nv12 &nv21, only works on m6. */ @@ -302,6 +303,7 @@ enum ge2d_memtype_s { #define GE2D_FORMAT_M24_RGB GE2D_FMT_M24_RGB #define GE2D_FORMAT_M24_YUV420T GE2D_FMT_M24_YUV420T #define GE2D_FORMAT_M24_YUV420B GE2D_FMT_M24_YUV420B +#define GE2D_FORMAT_M24_YUV422SP (GE2D_FMT_M24_YUV422SP | GE2D_COLOR_MAP_NV12) #define GE2D_FORMAT_S16_YUV422T (GE2D_FMT_S16_YUV422T | GE2D_COLOR_MAP_YUV422) #define GE2D_FORMAT_S16_YUV422B (GE2D_FMT_S16_YUV422B | GE2D_COLOR_MAP_YUV422) #define GE2D_FORMAT_S24_YUV444T (GE2D_FMT_S24_YUV444T | GE2D_COLOR_MAP_YUV444) -- 2.7.4