vdec: fixed some issues of playback on dv mode. [1/1]
authorNanxin Qin <nanxin.qin@amlogic.com>
Fri, 22 May 2020 12:28:19 +0000 (20:28 +0800)
committerHui Zhang <hui.zhang@amlogic.com>
Tue, 26 May 2020 05:56:19 +0000 (22:56 -0700)
PD#SWPL-26639
PD#SWPL-26646

Problem:
1. fixed the issue of stbuf ops is null on dv mode.
2. the video is stuck in fixed position when play the DV video

Solution:
1. the stbuf ops must be set into second vdec inst.
2. ignore pts adjust when work on dv mode.

Verify:
ab311

Change-Id: I8a275415a3eb647ce2f587b1d3f5a4055cf5d158
Signed-off-by: Nanxin Qin <nanxin.qin@amlogic.com>
drivers/frame_provider/decoder/h265/vh265.c
drivers/frame_provider/decoder/utils/vdec.c

index d161c8410a97046d7f033c67ad0f747abb17bbf9..8a4eda655db7cde1dccfde4f746c070394993a92 100644 (file)
@@ -8763,7 +8763,7 @@ static int prepare_display_buf(struct hevc_state_s *hevc, struct PIC_s *pic)
                else {
 #endif
 #endif
-               if (pic->stream_frame_size > 50 &&
+               if (!vdec_dual(vdec) && pic->stream_frame_size > 50 &&
                        (hevc->min_pic_size > pic->stream_frame_size ||
                        (hevc->min_pic_size == 0))) {
                        hevc->min_pic_size = pic->stream_frame_size;
@@ -8803,7 +8803,8 @@ static int prepare_display_buf(struct hevc_state_s *hevc, struct PIC_s *pic)
                }
 #endif
 #endif
-               if (vdec_stream_based(vdec) && (vf->duration > 0)) {
+               if (!vdec_dual(vdec) &&
+                       vdec_stream_based(vdec) && (vf->duration > 0)) {
                        if ((vf->pts != 0) && (hevc->last_pts != 0)) {
                                int diff = vf->pts - hevc->last_pts;
                                if (diff > ((hevc->pts_continue_miss + 2)
index ddb51bbec91b37a88549503c436de0608aa0ba84..c81f1deb0bd63824c4a8f5d31c9d9de6bb37978a 100644 (file)
@@ -1299,11 +1299,31 @@ static void vdec_sync_input_write(struct vdec_s *vdec)
                return;
 
        if (vdec->input.target == VDEC_INPUT_TARGET_VLD) {
-               WRITE_VREG(VLD_MEM_VIFIFO_WP,
-                       STBUF_READ(&vdec->vbuf, get_wp));
+               if (enable_stream_mode_multi_dec) {
+                       if (!vdec->master) {
+                               WRITE_VREG(VLD_MEM_VIFIFO_WP,
+                                       STBUF_READ(&vdec->vbuf, get_wp));
+                       } else {
+                               STBUF_WRITE(&vdec->vbuf, set_wp,
+                                       STBUF_READ(&vdec->master->vbuf, get_wp));
+                       }
+               } else {
+                       WRITE_VREG(VLD_MEM_VIFIFO_WP,
+                               STBUF_READ(&vdec->vbuf, get_wp));
+               }
        } else if (vdec->input.target == VDEC_INPUT_TARGET_HEVC) {
-               WRITE_VREG(HEVC_STREAM_WR_PTR,
-                       STBUF_READ(&vdec->vbuf, get_wp));
+               if (enable_stream_mode_multi_dec) {
+                       if (!vdec->master) {
+                               WRITE_VREG(HEVC_STREAM_WR_PTR,
+                                       STBUF_READ(&vdec->vbuf, get_wp));
+                       } else {
+                               STBUF_WRITE(&vdec->vbuf, set_wp,
+                                       STBUF_READ(&vdec->master->vbuf, get_wp));
+                       }
+               } else {
+                       WRITE_VREG(HEVC_STREAM_WR_PTR,
+                               STBUF_READ(&vdec->vbuf, get_wp));
+               }
        }
 }
 
@@ -2224,7 +2244,7 @@ s32 vdec_init(struct vdec_s *vdec, int is_4k)
        vdec_frame_check_init(vdec);
 #endif
        /* stream buffer init. */
-       if (vdec->vbuf.ops) {
+       if (vdec->vbuf.ops && !vdec->master) {
                r = vdec->vbuf.ops->init(&vdec->vbuf, vdec);
                if (r) {
                        pr_err("%s stream buffer init err (%d)\n", dev_name, r);
@@ -2235,6 +2255,11 @@ s32 vdec_init(struct vdec_s *vdec, int is_4k)
 
                        goto error;
                }
+
+               if (vdec->slave) {
+                       memcpy(&vdec->slave->vbuf, &vdec->vbuf,
+                               sizeof(vdec->vbuf));
+               }
        }
 
        p->dev = platform_device_register_data(
@@ -2598,7 +2623,7 @@ void vdec_release(struct vdec_s *vdec)
        /*Check if the vdec still in connected list, if yes, delete it*/
        vdec_connect_list_force_clear(vdec_core, vdec);
 
-       if (vdec->vbuf.ops)
+       if (vdec->vbuf.ops && !vdec->master)
                vdec->vbuf.ops->release(&vdec->vbuf);
 
        pr_debug("vdec_release instance %p, total %d\n", vdec,