decoder: add low_latency mode in v4l2. [1/1]
authorgan.zhang <gan.zhang@amlogic.com>
Thu, 10 Dec 2020 12:13:19 +0000 (20:13 +0800)
committergan.zhang <gan.zhang@amlogic.com>
Tue, 15 Dec 2020 07:03:12 +0000 (15:03 +0800)
PD#SWPL-38312

Problem:
add param in decoder to control low latency mode for multi-inst

Solution:
add parms low_latency_mode for low latency mode.

Verify:
AH212

Change-Id: I9a97d77d3cc585a566246e024d4fcad0fe0c5b92
Signed-off-by: gan.zhang <gan.zhang@amlogic.com>
drivers/amvdec_ports/decoder/vdec_av1_if.c
drivers/amvdec_ports/decoder/vdec_hevc_if.c
drivers/amvdec_ports/decoder/vdec_vp9_if.c
drivers/frame_provider/decoder/h264_multi/vmh264.c
drivers/frame_provider/decoder/h265/vh265.c
drivers/frame_provider/decoder/vav1/vav1.c
drivers/frame_provider/decoder/vp9/vvp9.c

index 2b9b657fdfcc0bb9a54a77f934977936cca89b6e..63c3e8550b6fe7b06d18ce2a17e862514a54f239 100644 (file)
@@ -283,6 +283,8 @@ static void vdec_parser_parms(struct vdec_av1_inst *inst)
                        ctx->config.parm.dec.cfg.canvas_mem_mode);
                pbuf += sprintf(pbuf, "parm_v4l_canvas_mem_endian:%d;",
                        ctx->config.parm.dec.cfg.canvas_mem_endian);
+               pbuf += sprintf(pbuf, "parm_v4l_low_latency_mode:%d;",
+                       ctx->config.parm.dec.cfg.low_latency_mode);
                ctx->config.length = pbuf - ctx->config.buf;
        } else {
                ctx->config.parm.dec.cfg.double_write_mode = 16;
index dc3a923da52036f211cba00158ba819e565e0fac..4c3cc41fcc6b0437951e941d62a34c1c975c5326 100644 (file)
@@ -185,6 +185,8 @@ static void vdec_parser_parms(struct vdec_hevc_inst *inst)
                        ctx->config.parm.dec.cfg.canvas_mem_mode);
                pbuf += sprintf(pbuf, "parm_v4l_canvas_mem_endian:%d;",
                        ctx->config.parm.dec.cfg.canvas_mem_endian);
+               pbuf += sprintf(pbuf, "parm_v4l_low_latency_mode:%d;",
+                       ctx->config.parm.dec.cfg.low_latency_mode);
                ctx->config.length = pbuf - ctx->config.buf;
        } else {
                ctx->config.parm.dec.cfg.double_write_mode = 16;
index 30c5b3b82e08a149be90fa36483994a3fcc6251e..3b2c87b059b0ce662092e9b3af58bc8793bd6878 100644 (file)
@@ -206,6 +206,8 @@ static void vdec_parser_parms(struct vdec_vp9_inst *inst)
                        ctx->config.parm.dec.cfg.canvas_mem_mode);
                pbuf += sprintf(pbuf, "parm_v4l_canvas_mem_endian:%d;",
                        ctx->config.parm.dec.cfg.canvas_mem_endian);
+               pbuf += sprintf(pbuf, "parm_v4l_low_latency_mode:%d;",
+                       ctx->config.parm.dec.cfg.low_latency_mode);
                ctx->config.length = pbuf - ctx->config.buf;
        } else {
                ctx->config.parm.dec.cfg.double_write_mode = 16;
index 7ff9f51ade8022142b6674f2e2ea479ab97d2ad2..85ef3cc71f150019e44abcc7154b63a4fdca9ee7 100644 (file)
@@ -9944,7 +9944,7 @@ static int ammvdec_h264_probe(struct platform_device *pdev)
                if (get_config_int(pdata->config,
                        "parm_v4l_low_latency_mode",
                        &config_val) == 0)
-                       hw->low_latency_mode = config_val;
+                       hw->low_latency_mode = config_val ? 0x8:0;
                if (get_config_int(pdata->config, "sidebind_type",
                                &config_val) == 0)
                        hw->sidebind_type = config_val;
index f65c12596e90c225f426d1f2dc5434ff1964d253..feffe991fe460232b5c9263a4d8fcbf0e48a7eef 100644 (file)
@@ -1827,6 +1827,7 @@ struct hevc_state_s {
        bool discard_dv_data;
        bool enable_fence;
        int fence_usage;
+       int low_latency_flag;
 } /*hevc_stru_t */;
 
 #ifdef AGAIN_HAS_THRESHOLD
@@ -6080,7 +6081,8 @@ static struct PIC_s *v4l_get_new_pic(struct hevc_state_s *hevc,
        new_pic->num_reorder_pic = rpm_param->p.sps_num_reorder_pics_0;
        new_pic->ip_mode = (!new_pic->num_reorder_pic &&
                                                        !(vdec->slave || vdec->master) &&
-                                                       !disable_ip_mode) ? true : false;
+                                                       !disable_ip_mode &&
+                                                       hevc->low_latency_flag) ? true : false;
        new_pic->losless_comp_body_size = hevc->losless_comp_body_size;
        new_pic->POC = hevc->curr_POC;
        new_pic->pic_struct = hevc->curr_pic_struct;
@@ -11174,7 +11176,8 @@ force_output:
                        hevc->param.p.sps_num_reorder_pics_0;
                        hevc->ip_mode = (!hevc->sps_num_reorder_pics_0 &&
                                                                !(vdec->slave || vdec->master) &&
-                                                               !disable_ip_mode) ? true : false;
+                                                               !disable_ip_mode &&
+                                                               hevc->low_latency_flag) ? true : false;
                        hevc->pic_list_init_flag = 1;
                        if ((!IS_4K_SIZE(hevc->pic_w, hevc->pic_h)) &&
                                ((hevc->param.p.profile_etc & 0xc) == 0x4)
@@ -14183,6 +14186,12 @@ static int ammvdec_h265_probe(struct platform_device *pdev)
                        "parm_fence_usage",
                        &config_val) == 0)
                        hevc->fence_usage = config_val;
+
+               if (get_config_int(pdata->config,
+                       "parm_v4l_low_latency_mode",
+                       &config_val) == 0)
+                       hevc->low_latency_flag = config_val;
+
 #endif
        } else {
                if (pdata->sys_info)
index 6785d2338dc1d86b6bb36931627bee13f4578617..c006e094336860ca1bd86d8ea7c53f95953c47f4 100644 (file)
@@ -10279,6 +10279,12 @@ static int ammvdec_av1_probe(struct platform_device *pdev)
                        "parm_v4l_canvas_mem_mode",
                        &config_val) == 0)
                        hw->mem_map_mode = config_val;
+
+               if (get_config_int(pdata->config,
+                       "parm_v4l_low_latency_mode",
+                       &config_val) == 0)
+                       hw->low_latency_flag = config_val;
+
 #endif
                if (get_config_int(pdata->config, "HDRStaticInfo",
                                &vf_dp.present_flag) == 0
index 6e2a974307ba8124fab22fb86ba30918236d0034..b6f1ac6cf48e4d5c16550f4fd12788fd16a309a5 100644 (file)
@@ -10926,6 +10926,11 @@ static int ammvdec_vp9_probe(struct platform_device *pdev)
                        "parm_fence_usage",
                        &config_val) == 0)
                        pbi->fence_usage = config_val;
+
+               if (get_config_int(pdata->config,
+                       "parm_v4l_low_latency_mode",
+                       &config_val) == 0)
+                       pbi->low_latency_flag = config_val;
 #endif
                if (get_config_int(pdata->config, "HDRStaticInfo",
                                &vf_dp.present_flag) == 0
@@ -11028,8 +11033,8 @@ static int ammvdec_vp9_probe(struct platform_device *pdev)
                pbi->vvp9_amstream_dec_info.height = 0;
                pbi->vvp9_amstream_dec_info.rate = 30;
        }
-       pbi->low_latency_flag = 1;
 
+       pbi->low_latency_flag = 1;
        vp9_print(pbi, 0,
                        "no_head %d  low_latency %d\n",
                        pbi->no_head, pbi->low_latency_flag);