From: gan.zhang Date: Thu, 10 Dec 2020 12:13:19 +0000 (+0800) Subject: decoder: add low_latency mode in v4l2. [1/1] X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=5dab1423835c633cfc9a4c5aaa7b3eed08007599;p=GitHub%2FLineageOS%2FG12%2Fandroid_hardware_amlogic_kernel-modules_media.git decoder: add low_latency mode in v4l2. [1/1] 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 --- diff --git a/drivers/amvdec_ports/decoder/vdec_av1_if.c b/drivers/amvdec_ports/decoder/vdec_av1_if.c index 2b9b657..63c3e85 100644 --- a/drivers/amvdec_ports/decoder/vdec_av1_if.c +++ b/drivers/amvdec_ports/decoder/vdec_av1_if.c @@ -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; diff --git a/drivers/amvdec_ports/decoder/vdec_hevc_if.c b/drivers/amvdec_ports/decoder/vdec_hevc_if.c index dc3a923..4c3cc41 100644 --- a/drivers/amvdec_ports/decoder/vdec_hevc_if.c +++ b/drivers/amvdec_ports/decoder/vdec_hevc_if.c @@ -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; diff --git a/drivers/amvdec_ports/decoder/vdec_vp9_if.c b/drivers/amvdec_ports/decoder/vdec_vp9_if.c index 30c5b3b..3b2c87b 100644 --- a/drivers/amvdec_ports/decoder/vdec_vp9_if.c +++ b/drivers/amvdec_ports/decoder/vdec_vp9_if.c @@ -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; diff --git a/drivers/frame_provider/decoder/h264_multi/vmh264.c b/drivers/frame_provider/decoder/h264_multi/vmh264.c index 7ff9f51..85ef3cc 100644 --- a/drivers/frame_provider/decoder/h264_multi/vmh264.c +++ b/drivers/frame_provider/decoder/h264_multi/vmh264.c @@ -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; diff --git a/drivers/frame_provider/decoder/h265/vh265.c b/drivers/frame_provider/decoder/h265/vh265.c index f65c125..feffe99 100644 --- a/drivers/frame_provider/decoder/h265/vh265.c +++ b/drivers/frame_provider/decoder/h265/vh265.c @@ -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) diff --git a/drivers/frame_provider/decoder/vav1/vav1.c b/drivers/frame_provider/decoder/vav1/vav1.c index 6785d23..c006e09 100644 --- a/drivers/frame_provider/decoder/vav1/vav1.c +++ b/drivers/frame_provider/decoder/vav1/vav1.c @@ -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 diff --git a/drivers/frame_provider/decoder/vp9/vvp9.c b/drivers/frame_provider/decoder/vp9/vvp9.c index 6e2a974..b6f1ac6 100644 --- a/drivers/frame_provider/decoder/vp9/vvp9.c +++ b/drivers/frame_provider/decoder/vp9/vvp9.c @@ -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);