vvc1: unstable pts support [1/3]
authorZhao Yi <zhao.yi@amlogic.com>
Thu, 10 Dec 2020 06:37:20 +0000 (14:37 +0800)
committerZhao Yi <zhao.yi@amlogic.com>
Thu, 17 Dec 2020 10:46:04 +0000 (02:46 -0800)
PD#TV-27965

Problem:
pts is unstbale

Solution:
if unstable flag is set to 1,
 get a pts value by frame duration.

Verify:
androidP

Change-Id: I7a0de6aaa1071874f8323f3df561286c596b451d
Signed-off-by: Zhao Yi <zhao.yi@amlogic.com>
drivers/frame_provider/decoder/vc1/vvc1.c

index 681de1340ccbf40e22dd50bfe0e30d3efe102274..6e329ca89374972ad786a88cec1be7e297efe405 100644 (file)
@@ -131,6 +131,8 @@ static u32 stat;
 static u32 buf_size = 32 * 1024 * 1024;
 static u32 buf_offset;
 static u32 avi_flag;
+static u32 unstable_pts_debug;
+static u32 unstable_pts;
 static u32 vvc1_ratio;
 static u32 vvc1_format;
 
@@ -459,6 +461,11 @@ static irqreturn_t vvc1_isr(int irq, void *dev_id)
                                        vvc1_amstream_dec_info.rate >> 1;
                                        next_pts = 0;
                                        next_pts_us64 = 0;
+                                       if (picture_type != I_PICTURE &&
+                                               unstable_pts) {
+                                               vf->pts = 0;
+                                               vf->pts_us64 = 0;
+                                       }
                                }
                        } else {
                                vf->pts = next_pts;
@@ -482,6 +489,11 @@ static irqreturn_t vvc1_isr(int irq, void *dev_id)
                                        vvc1_amstream_dec_info.rate >> 1;
                                        next_pts = 0;
                                        next_pts_us64 = 0;
+                                       if (picture_type != I_PICTURE &&
+                                               unstable_pts) {
+                                               vf->pts = 0;
+                                               vf->pts_us64 = 0;
+                                       }
                                }
                        }
 
@@ -542,6 +554,11 @@ static irqreturn_t vvc1_isr(int irq, void *dev_id)
                                        vvc1_amstream_dec_info.rate >> 1;
                                next_pts = 0;
                                next_pts_us64 = 0;
+                               if (picture_type != I_PICTURE &&
+                                       unstable_pts) {
+                                       vf->pts = 0;
+                                       vf->pts_us64 = 0;
+                               }
                        }
 
                        vf->duration_pulldown = 0;
@@ -601,6 +618,11 @@ static irqreturn_t vvc1_isr(int irq, void *dev_id)
                                                vvc1_amstream_dec_info.rate;
                                        next_pts = 0;
                                        next_pts_us64 = 0;
+                                       if (picture_type != I_PICTURE &&
+                                               unstable_pts) {
+                                               vf->pts = 0;
+                                               vf->pts_us64 = 0;
+                                       }
                                }
                        } else {
                                vf->pts = next_pts;
@@ -624,6 +646,11 @@ static irqreturn_t vvc1_isr(int irq, void *dev_id)
                                                vvc1_amstream_dec_info.rate;
                                        next_pts = 0;
                                        next_pts_us64 = 0;
+                                       if (picture_type != I_PICTURE &&
+                                               unstable_pts) {
+                                               vf->pts = 0;
+                                               vf->pts_us64 = 0;
+                                       }
                                }
                        }
 
@@ -941,8 +968,13 @@ static void vvc1_local_init(bool is_reset)
        /* vvc1_ratio = vvc1_amstream_dec_info.ratio; */
        vvc1_ratio = 0x100;
 
-       avi_flag = (unsigned long) vvc1_amstream_dec_info.param;
+       avi_flag = (unsigned long) vvc1_amstream_dec_info.param & 0x01;
 
+       unstable_pts = (((unsigned long) vvc1_amstream_dec_info.param & 0x40) >> 6);
+       if (unstable_pts_debug == 1) {
+               unstable_pts = 1;
+               pr_info("vc1 init , unstable_pts_debug = %u\n",unstable_pts_debug);
+       }
        total_frame = 0;
 
        next_pts = 0;
@@ -1118,7 +1150,7 @@ static s32 vvc1_init(void)
                return ret;
 
        if (vdec_request_irq(VDEC_IRQ_1, vvc1_isr,
-                   "vvc1-irq", (void *)vvc1_dec_id)) {
+                       "vvc1-irq", (void *)vvc1_dec_id)) {
                amvdec_disable();
 
                pr_info("vvc1 irq register error.\n");
@@ -1315,6 +1347,8 @@ static void __exit amvdec_vc1_driver_remove_module(void)
 
        platform_driver_unregister(&amvdec_vc1_driver);
 }
+module_param(unstable_pts_debug, uint, 0664);
+MODULE_PARM_DESC(unstable_pts_debug, "\n amvdec_vc1 unstable_pts\n");
 
 /****************************************/
 module_init(amvdec_vc1_driver_init_module);