vdec: ADD Secure/nonSecure flags for avs,vc1,h263 single mode [1/1]
authorapollo.ling <apollo.ling@amlogic.com>
Fri, 23 Oct 2020 02:12:57 +0000 (10:12 +0800)
committerApollo Ling <apollo.ling@amlogic.com>
Fri, 23 Oct 2020 11:39:04 +0000 (04:39 -0700)
PD#SWPL-35498

Problem:
Play some avs bitstream, it print abnormal decontour info all the time

Solution:
ADD Secure/nonSecure flags for avs,vc1,h263 single mode

Verify:
u212

Change-Id: Ic4cba115a10931467b445a39c27a0624ff9c8c71
Signed-off-by: apollo.ling <apollo.ling@amlogic.com>
drivers/frame_provider/decoder/avs/avs.c
drivers/frame_provider/decoder/mpeg4/vmpeg4.c
drivers/frame_provider/decoder/vc1/vvc1.c

index ab9fa701503d196eb22f6937a7e239f08315df3e..2b6cdeb550d43f8732d7f7f2f133cd1a749150dd 100644 (file)
@@ -121,6 +121,7 @@ int avs_get_debug_flag(void)
 static struct vframe_s *vavs_vf_peek(void *);
 static struct vframe_s *vavs_vf_get(void *);
 static void vavs_vf_put(struct vframe_s *, void *);
+static int vavs_event_cb(int type, void *data, void *private_data);
 static int vavs_vf_states(struct vframe_states *states, void *);
 
 static const char vavs_dec_id[] = "vavs-dev";
@@ -133,6 +134,7 @@ static const struct vframe_operations_s vavs_vf_provider = {
        .peek = vavs_vf_peek,
        .get = vavs_vf_get,
        .put = vavs_vf_put,
+       .event_cb = vavs_event_cb,
        .vf_states = vavs_vf_states,
 };
 static void *mm_blk_handle;
@@ -191,7 +193,7 @@ static struct work_struct notify_work;
 static struct work_struct set_clk_work;
 static bool is_reset;
 
-static struct vdec_s *vdec;
+static struct vdec_s *vdec = NULL;
 
 #ifdef AVSP_LONG_CABAC
 static struct work_struct long_cabac_wd_work;
@@ -411,7 +413,6 @@ static void UserDataHandler(void)
        }
 }
 
-
 #ifdef HANDLE_AVS_IRQ
 static irqreturn_t vavs_isr(int irq, void *dev_id)
 #else
@@ -739,8 +740,8 @@ static void vavs_isr(void)
                                decoder_bmmu_box_get_mem_handle(
                                        mm_blk_handle,
                                        buffer_index);
-                       decoder_do_frame_check(NULL, vf);
 
+                       decoder_do_frame_check(NULL, vf);
                        kfifo_put(&display_q,
                                          (const struct vframe_s *)vf);
                        ATRACE_COUNTER(MODULE_NAME, vf->pts);
@@ -822,6 +823,20 @@ static void vavs_vf_put(struct vframe_s *vf, void *op_arg)
 
 }
 
+static int vavs_event_cb(int type, void *data, void *private_data)
+{
+       if (type & VFRAME_EVENT_RECEIVER_REQ_STATE) {
+               struct provider_state_req_s *req =
+                       (struct provider_state_req_s *)data;
+               if (req->req_type == REQ_STATE_SECURE && vdec)
+                       req->req_result[0] = vdec_secure(vdec);
+               else
+                       req->req_result[0] = 0xffffffff;
+       }
+
+       return 0;
+}
+
 int vavs_dec_status(struct vdec_s *vdec, struct vdec_info *vstatus)
 {
        if (!(stat & STAT_VDEC_RUN))
@@ -1828,6 +1843,7 @@ static int amvdec_avs_remove(struct platform_device *pdev)
 #endif
        kfree(gvs);
        gvs = NULL;
+       vdec = NULL;
 
        cancel_work_sync(&set_clk_work);
        return 0;
index b0a715a3fccf27d52346aeecf34d57bf0edf8584..183433fb61a78c50ccda3e17432c907dd33a443c 100644 (file)
@@ -134,6 +134,8 @@ static const char vmpeg4_dec_id[] = "vmpeg4-dev";
 
 #define PROVIDER_NAME   "decoder.mpeg4"
 
+struct vdec_s *vdec = NULL;
+
 /*
  *int query_video_status(int type, int *value);
  */
@@ -657,6 +659,15 @@ static int vmpeg_event_cb(int type, void *data, void *private_data)
 #endif
                amvdec_start();
        }
+
+       if (type & VFRAME_EVENT_RECEIVER_REQ_STATE) {
+               struct provider_state_req_s *req =
+                       (struct provider_state_req_s *)data;
+               if (req->req_type == REQ_STATE_SECURE && vdec)
+                       req->req_result[0] = vdec_secure(vdec);
+               else
+                       req->req_result[0] = 0xffffffff;
+       }
        return 0;
 }
 
@@ -1148,6 +1159,7 @@ static int amvdec_mpeg4_probe(struct platform_device *pdev)
        pdata->dec_status = vmpeg4_dec_status;
        pdata->set_isreset = vmpeg4_set_isreset;
        is_reset = 0;
+       vdec = pdata;
 
        INIT_WORK(&reset_work, reset_do_work);
        INIT_WORK(&notify_work, vmpeg4_notify_work);
@@ -1212,6 +1224,7 @@ static int amvdec_mpeg4_remove(struct platform_device *pdev)
                           vmpeg4_amstream_dec_info.rate);
        kfree(gvs);
        gvs = NULL;
+       vdec = NULL;
 
        return 0;
 }
index fd24672624b6a4a93de8c3d0c57c402881c68f1f..2921218a853e2392aaffd884b143d4d0494f5b69 100644 (file)
@@ -93,6 +93,7 @@
 #define MEM_LEVEL_CNT_BIT       18
 #endif
 static struct vdec_info *gvs;
+static struct vdec_s *vdec = NULL;
 
 static struct vframe_s *vvc1_vf_peek(void *);
 static struct vframe_s *vvc1_vf_get(void *);
@@ -726,6 +727,15 @@ static int vvc1_event_cb(int type, void *data, void *private_data)
 #endif
                amvdec_start();
        }
+
+       if (type & VFRAME_EVENT_RECEIVER_REQ_STATE) {
+               struct provider_state_req_s *req =
+                       (struct provider_state_req_s *)data;
+               if (req->req_type == REQ_STATE_SECURE && vdec)
+                       req->req_result[0] = vdec_secure(vdec);
+               else
+                       req->req_result[0] = 0xffffffff;
+       }
        return 0;
 }
 
@@ -1170,6 +1180,7 @@ static int amvdec_vc1_probe(struct platform_device *pdev)
        pdata->dec_status = vvc1_dec_status;
        pdata->set_isreset = vvc1_set_isreset;
        is_reset = 0;
+       vdec = pdata;
 
        vvc1_vdec_info_init();
 
@@ -1234,6 +1245,7 @@ static int amvdec_vc1_remove(struct platform_device *pdev)
 #endif
        kfree(gvs);
        gvs = NULL;
+       vdec = NULL;
 
        return 0;
 }