vdec: ADD Secure/nonSecure flags to video frame [2/2]
authorzichao.zhang <zichao.zhang@amlogic.com>
Fri, 25 Sep 2020 07:18:34 +0000 (15:18 +0800)
committerHui Zhang <hui.zhang@amlogic.com>
Mon, 28 Sep 2020 05:38:48 +0000 (22:38 -0700)
PD#SWPL-25232

Problem:
This is a new feature.

Solution:
ADD Secure/nonSecure flags to video frame

Verify:
U212

Change-Id: I528ee9f0796ee73c8044abc2c5c16de6ab94d1de
Signed-off-by: zichao.zhang <zichao.zhang@amlogic.com>
drivers/frame_provider/decoder/avs2/vavs2.c
drivers/frame_provider/decoder/avs_multi/avs_multi.c
drivers/frame_provider/decoder/h264_multi/vmh264.c
drivers/frame_provider/decoder/h265/vh265.c
drivers/frame_provider/decoder/mjpeg/vmjpeg_multi.c
drivers/frame_provider/decoder/mpeg12/vmpeg12_multi.c
drivers/frame_provider/decoder/mpeg4/vmpeg4_multi.c
drivers/frame_provider/decoder/utils/vdec.c
drivers/frame_provider/decoder/utils/vdec.h
drivers/frame_provider/decoder/vav1/vav1.c
drivers/frame_provider/decoder/vp9/vvp9.c

index 53e10a5a8bd4f9e3bb4a36094ba7da86891875c7..90b91ae9e0efc921c66a9581fd484116d21c259d 100644 (file)
@@ -4613,7 +4613,7 @@ static int avs2_prepare_display_buf(struct AVS2Decoder_s *dec)
                        struct vdec_info tmp4x;
                        int stream_offset = pic->stream_offset;
                        set_vframe(dec, vf, pic, 0);
-                       decoder_do_frame_check(pvdec, vf);
+                       vdec_vframe_ready(pvdec, vf);
                        kfifo_put(&dec->display_q, (const struct vframe_s *)vf);
                        ATRACE_COUNTER(MODULE_NAME, vf->pts);
 
index 20c504c7b15e0891c0a8f2e6648d528d8b192287..61d4bab60dbc38901b92006414708ba87c69bc8b 100644 (file)
@@ -3670,6 +3670,7 @@ static irqreturn_t vmavs_isr_thread_fn(struct vdec_s *vdec, int irq)
                                        vf->pts_us64 = offset;
                                        vf->pts = 0;
                                }
+                               vdec_vframe_ready(hw_to_vdec(hw), vf);
                                kfifo_put(&hw->display_q,
                                                  (const struct vframe_s *)vf);
                                avs_vf_notify_receiver(hw, PROVIDER_NAME,
@@ -3691,7 +3692,7 @@ static irqreturn_t vmavs_isr_thread_fn(struct vdec_s *vdec, int irq)
                        }
                        avs_update_gvs(hw);
                        vdec_fill_vdec_frame(hw_to_vdec(hw), NULL, hw->gvs, vf, 0);
-       
+
                        /* pr_info("PicType = %d, PTS = 0x%x\n",
                         *       picture_type, vf->pts);
                         */
index 320beb232ac3f1f880f22b53bf98d2fffcce30a5..be1cac80f5dcfc227be694d0cda7f0ed70f0b008 100644 (file)
@@ -3054,7 +3054,7 @@ static int post_video_frame(struct vdec_s *vdec, struct FrameStore *frame)
                        pvdec = hw_to_vdec(hw);
                        memset(&vs, 0, sizeof(struct vdec_info));
                        pvdec->dec_status(pvdec, &vs);
-                       decoder_do_frame_check(pvdec, vf);
+                       vdec_vframe_ready(pvdec, vf);
                        vdec_fill_vdec_frame(pvdec, &hw->vframe_qos, &vs, vf, frame->hw_decode_time);
 
                        dpb_print(DECODE_ID(hw), PRINT_FLAG_DPB_DETAIL,
index 4e4e9848015898797676c198316489c1f85880dc..c00f193191a6494a1493cd790a2f279616ad2298 100644 (file)
@@ -8929,6 +8929,14 @@ static inline void hevc_update_gvs(struct hevc_state_s *hevc)
                hevc->gvs->ratio_control = hevc->ratio_control;
 }
 
+static void put_vf_to_display_q(struct hevc_state_s *hevc, struct vframe_s *vf)
+{
+       hevc->vf_pre_count++;
+       vdec_vframe_ready(hw_to_vdec(hevc), vf);
+       kfifo_put(&hevc->display_q, (const struct vframe_s *)vf);
+       ATRACE_COUNTER(MODULE_NAME, vf->pts);
+}
+
 static int prepare_display_buf(struct hevc_state_s *hevc, struct PIC_s *pic)
 {
        struct vdec_s *vdec = hw_to_vdec(hevc);
@@ -9286,11 +9294,7 @@ static int prepare_display_buf(struct hevc_state_s *hevc, struct PIC_s *pic)
                                vf2->type = VIDTYPE_INTERLACE_TOP
                                | nv_order;
                        }
-                       hevc->vf_pre_count++;
-                       decoder_do_frame_check(vdec, vf);
-                       kfifo_put(&hevc->display_q,
-                       (const struct vframe_s *)vf);
-                       ATRACE_COUNTER(MODULE_NAME, vf->pts);
+                       put_vf_to_display_q(hevc, vf);
                        hevc->vf_pre_count++;
                        kfifo_put(&hevc->display_q,
                        (const struct vframe_s *)vf2);
@@ -9335,11 +9339,7 @@ static int prepare_display_buf(struct hevc_state_s *hevc, struct PIC_s *pic)
                                vf3->type = VIDTYPE_INTERLACE_BOTTOM
                                | nv_order;
                        }
-                       hevc->vf_pre_count++;
-                       decoder_do_frame_check(vdec, vf);
-                       kfifo_put(&hevc->display_q,
-                       (const struct vframe_s *)vf);
-                       ATRACE_COUNTER(MODULE_NAME, vf->pts);
+                       put_vf_to_display_q(hevc, vf);
                        hevc->vf_pre_count++;
                        kfifo_put(&hevc->display_q,
                        (const struct vframe_s *)vf2);
@@ -9362,7 +9362,7 @@ static int prepare_display_buf(struct hevc_state_s *hevc, struct PIC_s *pic)
                        process_pending_vframe(hevc,
                        pic, (pic->pic_struct == 9));
 
-                       decoder_do_frame_check(vdec, vf);
+                       vdec_vframe_ready(vdec, vf);
                        /* process current vf */
                        kfifo_put(&hevc->pending_q,
                        (const struct vframe_s *)vf);
@@ -9411,7 +9411,7 @@ static int prepare_display_buf(struct hevc_state_s *hevc, struct PIC_s *pic)
                                nv_order | VIDTYPE_VIU_FIELD;
                                vf->index = (pic->index << 8) | 0xff;
                        }
-                       decoder_do_frame_check(vdec, vf);
+                       vdec_vframe_ready(vdec, vf);
                        kfifo_put(&hevc->pending_q,
                        (const struct vframe_s *)vf);
                        if (hevc->vf_pre_count == 0)
@@ -9455,19 +9455,12 @@ static int prepare_display_buf(struct hevc_state_s *hevc, struct PIC_s *pic)
                                hevc->pre_bot_pic = pic;
                                break;
                        }
-                       hevc->vf_pre_count++;
-                       decoder_do_frame_check(vdec, vf);
-                       kfifo_put(&hevc->display_q,
-                       (const struct vframe_s *)vf);
-                       ATRACE_COUNTER(MODULE_NAME, vf->pts);
+                       put_vf_to_display_q(hevc, vf);
                }
 #else
                vf->type_original = vf->type;
                pic->vf_ref = 1;
-               hevc->vf_pre_count++;
-               decoder_do_frame_check(vdec, vf);
-               kfifo_put(&hevc->display_q, (const struct vframe_s *)vf);
-               ATRACE_COUNTER(MODULE_NAME, vf->pts);
+               put_vf_to_display_q(hevc, vf);
 #endif
                /*count info*/
                vdec_count_info(hevc->gvs, 0, stream_offset);
index 583aa42f3769520784f7a486c9a6ca6b2824974b..83a748fecd6ec0fd6bd1cae325dc6ad654e23df7 100644 (file)
@@ -436,7 +436,7 @@ static irqreturn_t vmjpeg_isr_thread_fn(struct vdec_s *vdec, int irq)
        vf->mem_handle =
                decoder_bmmu_box_get_mem_handle(
                        hw->mm_blk_handle, index);
-       decoder_do_frame_check(vdec, vf);
+       vdec_vframe_ready(vdec, vf);
        kfifo_put(&hw->display_q, (const struct vframe_s *)vf);
        ATRACE_COUNTER(MODULE_NAME, vf->pts);
        hw->frame_num++;
index 31e27bde815015bf24ba05c3ea271047e88085f4..a2f570335e249a240c4f4c1a54290211448dd578 100644 (file)
@@ -1676,7 +1676,7 @@ static int prepare_display_buf(struct vdec_mpeg12_hw_s *hw,
                        if (i == 0) {
                                struct vdec_s *vdec = hw_to_vdec(hw);
 
-                               decoder_do_frame_check(vdec, vf);
+                               vdec_vframe_ready(vdec, vf);
                                hw_update_gvs(hw);
                                vdec_fill_vdec_frame(vdec, &hw->vframe_qos,
                                        &hw->gvs, vf, pic->hw_decode_time);
index 5d69fedf66c6f1221352c4f234865ecae96c4a0b..12d458dbe8e75757bb431bbd93bfce3d2d5839cb 100644 (file)
@@ -807,11 +807,11 @@ static int prepare_display_buf(struct vdec_mpeg4_hw_s * hw,
                        vf->mem_handle =
                                decoder_bmmu_box_get_mem_handle(
                                        hw->mm_blk_handle, index);
+                       vdec_vframe_ready(vdec, vf);
                        kfifo_put(&hw->display_q,
                                (const struct vframe_s *)vf);
                        ATRACE_COUNTER(MODULE_NAME, vf->pts);
                        vdec->vdec_fps_detec(vdec->id);
-                       decoder_do_frame_check(vdec, vf);
                        hw->frame_num++;
                        if (pic->pic_type == I_PICTURE) {
                                hw->i_decoded_frames++;
@@ -893,11 +893,11 @@ static int prepare_display_buf(struct vdec_mpeg4_hw_s * hw,
                        vf->mem_handle =
                                decoder_bmmu_box_get_mem_handle(
                                        hw->mm_blk_handle, index);
+                       vdec_vframe_ready(vdec, vf);
                        kfifo_put(&hw->display_q,
                                (const struct vframe_s *)vf);
                        ATRACE_COUNTER(MODULE_NAME, vf->pts);
                        vdec->vdec_fps_detec(vdec->id);
-                       decoder_do_frame_check(vdec, vf);
                        hw->frame_num++;
                        if (pic->pic_type == I_PICTURE) {
                                hw->i_decoded_frames++;
index 82180eb9cb87b3bf99ae07c734e5238e67de7b7d..7113a7e3827b7e8de43d39db51d0a2dc5e0f76fb 100644 (file)
@@ -5176,6 +5176,16 @@ void vdec_fill_vdec_frame(struct vdec_s *vdec, struct vframe_qos_s *vframe_qos,
 }
 EXPORT_SYMBOL(vdec_fill_vdec_frame);
 
+void vdec_vframe_ready(struct vdec_s *vdec, struct vframe_s *vf) {
+       decoder_do_frame_check(vdec, vf);
+       if (vdec_secure(vdec)) {
+               vf->flag |= VFRAME_FLAG_VIDEO_SECURE;
+       } else {
+               vf->flag &= ~VFRAME_FLAG_VIDEO_SECURE;
+       }
+}
+EXPORT_SYMBOL(vdec_vframe_ready);
+
 /* In this function,if we use copy_to_user, we may encounter sleep,
 which may block the vdec_fill_vdec_frame,this is not acceptable.
 So, we should use a tmp buffer(passed by caller) to get the content */
index bf1b4111d51ceda33cd6875541345ae2dac7f74f..df2b409308a320e3629a910556c3927f853c22eb 100644 (file)
@@ -129,6 +129,8 @@ extern void vdec_fill_vdec_frame(struct vdec_s *vdec,
                                struct vframe_qos_s *vframe_qos,
                                struct vdec_info *vinfo,
                                struct vframe_s *vf, u32 hw_dec_time);
+
+extern void vdec_vframe_ready(struct vdec_s *vdec, struct vframe_s *vf);
 extern void vdec_set_vframe_comm(struct vdec_s *vdec, char *n);
 
 
index c4e81b3ece24f2c9bc3f2adbebae84781602bad3..072c7bf507dfb147e02155244f7f22ee8e4e677c 100644 (file)
@@ -6273,7 +6273,7 @@ static int prepare_display_buf(struct AV1HW_s *hw,
                update_vf_memhandle(hw, vf, pic_config);
 
                av1_inc_vf_ref(hw, pic_config->index);
-               decoder_do_frame_check(hw_to_vdec(hw), vf);
+               vdec_vframe_ready(hw_to_vdec(hw), vf);
                kfifo_put(&hw->display_q, (const struct vframe_s *)vf);
                ATRACE_COUNTER(MODULE_NAME, vf->pts);
                hw->vf_pre_count++;
index d6ac49a9bcdd84facc0fb228c30687ed6da191a5..f86998f0537e17a9075b94b523bd1fc7d5f47238 100644 (file)
@@ -7444,7 +7444,7 @@ static int prepare_display_buf(struct VP9Decoder_s *pbi,
                        struct vdec_info tmp4x;
 
                        inc_vf_ref(pbi, pic_config->index);
-                       decoder_do_frame_check(pvdec, vf);
+                       vdec_vframe_ready(pvdec, vf);
                        kfifo_put(&pbi->display_q, (const struct vframe_s *)vf);
                        ATRACE_COUNTER(MODULE_NAME, vf->pts);
                        pbi->vf_pre_count++;