From 017523fe3711088da95b005459421d72ea7f73de Mon Sep 17 00:00:00 2001 From: jintao xu Date: Tue, 20 Jul 2021 20:47:54 +0800 Subject: [PATCH] ionvideo: support no drop i for cts [1/1] 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 --- .../media/video_processor/ionvideo/ionvideo.c | 19 +++++++++++++++++-- .../media/video_processor/ionvideo/ionvideo.h | 2 ++ .../media/video_processor/ionvideo/ppmgr2.c | 12 +++++++----- 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/drivers/amlogic/media/video_processor/ionvideo/ionvideo.c b/drivers/amlogic/media/video_processor/ionvideo/ionvideo.c index 7e82e3987354..cc759b8a70d3 100644 --- a/drivers/amlogic/media/video_processor/ionvideo/ionvideo.c +++ b/drivers/amlogic/media/video_processor/ionvideo/ionvideo.c @@ -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]); diff --git a/drivers/amlogic/media/video_processor/ionvideo/ionvideo.h b/drivers/amlogic/media/video_processor/ionvideo/ionvideo.h index c3fe7d6a609d..092ae30e94c6 100644 --- a/drivers/amlogic/media/video_processor/ionvideo/ionvideo.h +++ b/drivers/amlogic/media/video_processor/ionvideo/ionvideo.h @@ -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; diff --git a/drivers/amlogic/media/video_processor/ionvideo/ppmgr2.c b/drivers/amlogic/media/video_processor/ionvideo/ppmgr2.c index 2c5a405d4491..5e42d3bfc674 100644 --- a/drivers/amlogic/media/video_processor/ionvideo/ppmgr2.c +++ b/drivers/amlogic/media/video_processor/ionvideo/ppmgr2.c @@ -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; + } } } -- 2.20.1