ionvideo: support yuv422 frame from di
authorRico Yang <wei.yang@amlogic.com>
Tue, 17 Apr 2018 08:51:47 +0000 (16:51 +0800)
committerJianxin Pan <jianxin.pan@amlogic.com>
Mon, 10 Sep 2018 14:49:42 +0000 (07:49 -0700)
PD#160993: ionvideo: support yuv422 frame from di

support yuv422 frame from di in ionvideo to enable deinterlacing on OSD

Change-Id: Ibc9a1e3021f06d0f9c3f21ac3e6359c0fd465b7c
Signed-off-by: Rico Yang <wei.yang@amlogic.com>
drivers/amlogic/media/video_processor/ionvideo/ionvideo.h
drivers/amlogic/media/video_processor/ionvideo/ppmgr2.c

index b1dae53..edbfffe 100644 (file)
@@ -35,6 +35,7 @@
 #include <media/v4l2-fh.h>
 #include <media/v4l2-event.h>
 #include <media/v4l2-common.h>
+#include <linux/amlogic/cpu_version.h>
 
 #include <linux/mm.h>
 /* #include <mach/mod_gate.h> */
index 9ab7de9..6c06640 100644 (file)
@@ -84,6 +84,12 @@ static int get_input_format(struct vframe_s *vf)
                } else {
                        format = GE2D_FORMAT_S16_YUV422;
                }
+
+               if (get_cpu_type() >= MESON_CPU_MAJOR_ID_TXL) {
+                       if ((vf->bitdepth & BITDEPTH_Y10) &&
+                               (vf->bitdepth & FULL_PACK_422_MODE))
+                               format = GE2D_FORMAT_S16_10BIT_YUV422;
+               }
        } else if (vf->type & VIDTYPE_VIU_NV21) {
                if ((vf->type & 3) == VIDTYPE_INTERLACE_BOTTOM) {
                        format = GE2D_FORMAT_M24_NV21
@@ -116,23 +122,20 @@ static inline void ge2d_src_config(struct vframe_s *vf,
 
        if (vf->canvas0Addr == (u32)-1) {
                canvas_config_config(PPMGR2_CANVAS_INDEX_SRC,
-                                       &src_vf.canvas0_config[0]);
-               canvas_config_config(PPMGR2_CANVAS_INDEX_SRC + 1,
-                                       &src_vf.canvas0_config[1]);
-               if (src_vf.plane_num == 2) {
-                       src_vf.canvas0Addr =
-                               (PPMGR2_CANVAS_INDEX_SRC)
-                               | ((PPMGR2_CANVAS_INDEX_SRC + 1) << 8)
-                               | ((PPMGR2_CANVAS_INDEX_SRC + 1) << 16);
-               } else if (src_vf.plane_num == 3) {
+                       &src_vf.canvas0_config[0]);
+
+               if (src_vf.plane_num > 1)
+                       canvas_config_config(PPMGR2_CANVAS_INDEX_SRC + 1,
+                               &src_vf.canvas0_config[1]);
+
+               if (src_vf.plane_num > 2)
                        canvas_config_config(PPMGR2_CANVAS_INDEX_SRC + 2,
                                        &src_vf.canvas0_config[2]);
 
-                       src_vf.canvas0Addr =
-                               (PPMGR2_CANVAS_INDEX_SRC)
-                               | ((PPMGR2_CANVAS_INDEX_SRC + 1) << 8)
-                               | ((PPMGR2_CANVAS_INDEX_SRC + 2) << 16);
-               }
+               src_vf.canvas0Addr =
+                       (PPMGR2_CANVAS_INDEX_SRC)
+                       | ((PPMGR2_CANVAS_INDEX_SRC + 1) << 8)
+                       | ((PPMGR2_CANVAS_INDEX_SRC + 2) << 16);
 
                ge2d_config->src_planes[0].addr =
                                src_vf.canvas0_config[0].phy_addr;
@@ -188,6 +191,7 @@ static inline void ge2d_src_config(struct vframe_s *vf,
        ge2d_config->src_para.top = 0;
        ge2d_config->src_para.left = 0;
        ge2d_config->src_para.width = src_vf.width;
+
        if (vf->type & VIDTYPE_INTERLACE)
                ge2d_config->src_para.height = src_vf.height >> 1;
        else