ionvideo: support no drop i for cts [1/1]
authorjintao xu <jintao.xu@amlogic.com>
Tue, 20 Jul 2021 12:47:54 +0000 (20:47 +0800)
committerChristian Hoffmann <chrmhoffmann@gmail.com>
Sun, 12 Feb 2023 08:13:12 +0000 (09:13 +0100)
PD#SWPL-54823

Problem:
ionvideo drop i cause cts fail

Solution:
ionvideo not drop i

Verify:
U221

Change-Id: Icbfcb56b69a657a43aaee26428568a5140836167
Signed-off-by: jintao xu <jintao.xu@amlogic.com>
drivers/amlogic/media/video_processor/ionvideo/ionvideo.c
drivers/amlogic/media/video_processor/ionvideo/ionvideo.h
drivers/amlogic/media/video_processor/ionvideo/ppmgr2.c

index 7e82e398735459c97863ed9b47871ef0ebadfc45..cc759b8a70d37118aec80f26caa57d3ecf469729 100644 (file)
@@ -34,6 +34,7 @@
 #define IONVIDEO_DEVICE_NAME   "ionvideo"
 
 #define V4L2_CID_USER_AMLOGIC_IONVIDEO_BASE  (V4L2_CID_USER_BASE + 0x1100)
+#define V4L2_CID_USER_AMLOGIC_IONVIDEO_NO_DROP_I  (V4L2_CID_USER_BASE + 0x1101)
 #define SCALE_4K_TO_1080P 1
 static struct mutex ppmgr2_ge2d_canvas_mutex;
 
@@ -65,6 +66,10 @@ static unsigned int freerun_mode = 1;
 module_param(freerun_mode, uint, 0664);
 MODULE_PARM_DESC(freerun_mode, "av synchronization");
 
+static unsigned int no_drop_i;
+module_param(no_drop_i, uint, 0664);
+MODULE_PARM_DESC(no_drop_i, "no drop i");
+
 static const struct ionvideo_fmt formats[] = {
        {.name = "RGB32 (LE)",
        .fourcc = V4L2_PIX_FMT_RGB32, /* argb */
@@ -125,6 +130,11 @@ static int vidioc_s_ctrl(struct file *file, void *priv,
                        dev->freerun_mode = 1;
                        IONVID_DBG("ionvideo: set freerun mode\n");
                }
+       } else if (ctrl->id == V4L2_CID_USER_AMLOGIC_IONVIDEO_NO_DROP_I) {
+               if (ctrl->value) {
+                       dev->no_drop_i = 1;
+                       IONVID_DBG("ionvideo: set no_drop_i mode\n");
+               }
        }
        return 0;
 }
@@ -216,7 +226,8 @@ static void videoc_omx_compute_pts(struct ionvideo_dev *dev,
                if (dev->is_omx_video_started == 0) {
                        dev->pts = dev->last_pts_us64
                                + (DUR2PTS(vf->duration) * 100 / 9);
-                       if ((vf->type & 0x1) == VIDTYPE_INTERLACE)
+                       if ((vf->type & 0x1) == VIDTYPE_INTERLACE &&
+                               !dev->no_drop_i)
                                dev->pts += (DUR2PTS(vf->duration) * 100 / 9);
                }
        }
@@ -265,6 +276,8 @@ static int ionvideo_fillbuff(struct ionvideo_dev *dev,
                return -EAGAIN;
        }
 
+       dev->ppmgr2_dev.no_drop_i = dev->no_drop_i;
+
        if (vf && dev->once_record == 1) {
                dev->once_record = 0;
                if ((vf->type & VIDTYPE_INTERLACE_BOTTOM) == 0x3)
@@ -281,7 +294,8 @@ static int ionvideo_fillbuff(struct ionvideo_dev *dev,
                }
                vf_put(vf, dev->vf_receiver_name);
        } else {
-               if ((vf->type & 0x1) == VIDTYPE_INTERLACE) {
+               if ((vf->type & 0x1) == VIDTYPE_INTERLACE &&
+                       dev->no_drop_i == 0) {
                        if ((dev->ppmgr2_dev.bottom_first
                                && (vf->type & 0x2)) || (dev
                                ->ppmgr2_dev
@@ -574,6 +588,7 @@ static int vidioc_open(struct file *file)
        dev->vf_wait_cnt = 0;
        /*for libplayer osd*/
        dev->freerun_mode = freerun_mode;
+       dev->no_drop_i = no_drop_i;
 
        v4l2q_init(&dev->input_queue, IONVIDEO_POOL_SIZE + 1,
                        &dev->ionvideo_input_queue[0]);
index c3fe7d6a609d1d3ae7b4d39492c3b4d23ffda233..092ae30e94c64cb000bb87691c6458f4663e4a38 100644 (file)
@@ -221,6 +221,7 @@ struct ppmgr2_device {
        int bottom_first;
 
        struct mutex *ge2d_canvas_mutex;
+       unsigned int no_drop_i;
 };
 
 #define ION_VF_RECEIVER_NAME_SIZE 32
@@ -292,6 +293,7 @@ struct ionvideo_dev {
        int is_actived;
        u64 last_pts_us64;
        unsigned int freerun_mode;
+       unsigned int no_drop_i;
        unsigned int skip_frames;
 
        wait_queue_head_t wq;
index 2c5a405d449170ba018c00955d8e45707f21b572..5e42d3bfc6743c91172d00417141e937b973aff1 100644 (file)
@@ -495,11 +495,13 @@ int ppmgr2_process(struct vframe_s *vf, struct ppmgr2_device *ppd, int index)
                return -1;
        }
 
-       if (src_vf->type & VIDTYPE_INTERLACE) {
-               if ((ppd->bottom_first && src_vf->type & 0x2)
-                       || (ppd->bottom_first == 0
-                       && (src_vf->type & 0x2) == 0)) {
-                       return -EAGAIN;
+       if (ppd->no_drop_i == 0) {
+               if (src_vf->type & VIDTYPE_INTERLACE) {
+                       if ((ppd->bottom_first && src_vf->type & 0x2) ||
+                           (ppd->bottom_first == 0 &&
+                            (src_vf->type & 0x2) == 0)) {
+                               return -EAGAIN;
+                       }
                }
        }