From 0bca035ef74fcce443ef372aa0d8061b44f77942 Mon Sep 17 00:00:00 2001 From: Chinmay Sawarkar Date: Mon, 17 Aug 2020 13:24:28 -0700 Subject: [PATCH] msm: vidc: Update cycle count requirement of B frames. Decoder base cycle requirement of B frames has increased to 80. Also, updated cycle count requirement for Encoder HIER B usecase. Change-Id: Iec1bee89be6bb6c18235c2903080025c312bef2d Signed-off-by: Chinmay Sawarkar --- msm/vidc/msm_vidc.c | 1 + msm/vidc/msm_vidc_clocks.c | 12 +++++++++--- msm/vidc/msm_vidc_common.c | 1 + msm/vidc/msm_vidc_internal.h | 1 + 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/msm/vidc/msm_vidc.c b/msm/vidc/msm_vidc.c index 7f78071d585d..fc479e961e64 100644 --- a/msm/vidc/msm_vidc.c +++ b/msm/vidc/msm_vidc.c @@ -1534,6 +1534,7 @@ void *msm_vidc_open(int core_id, int session_type) inst->bse_vpp_delay = DEFAULT_BSE_VPP_DELAY; inst->first_reconfig_done = 0; inst->active = true; + inst->has_bframe = 0; for (i = SESSION_MSG_INDEX(SESSION_MSG_START); i <= SESSION_MSG_INDEX(SESSION_MSG_END); i++) { diff --git a/msm/vidc/msm_vidc_clocks.c b/msm/vidc/msm_vidc_clocks.c index 0af709fe2d36..7fab1d9ab821 100644 --- a/msm/vidc/msm_vidc_clocks.c +++ b/msm/vidc/msm_vidc_clocks.c @@ -701,9 +701,14 @@ static unsigned long msm_vidc_calc_freq_iris2(struct msm_vidc_inst *inst, vpp_cycles = mbs_per_second * vpp_cycles_per_mb / inst->clk_data.work_route; - /* 1.25 factor for IbP GOP structure */ - if (msm_comm_g_ctrl_for_id(inst, V4L2_CID_MPEG_VIDEO_B_FRAMES)) + /* Factor 1.25 for IbP and 1.375 for I1B2b1P GOP structure */ + if (is_hier_b_session(inst)) { + vpp_cycles += (vpp_cycles / 4) + (vpp_cycles / 8); + } else if (msm_comm_g_ctrl_for_id(inst, + V4L2_CID_MPEG_VIDEO_B_FRAMES)) { vpp_cycles += vpp_cycles / 4; + } + /* 21 / 20 is minimum overhead factor */ vpp_cycles += max(div_u64(vpp_cycles, 20), fw_vpp_cycles); /* 1.01 is multi-pipe overhead */ @@ -758,7 +763,8 @@ static unsigned long msm_vidc_calc_freq_iris2(struct msm_vidc_inst *inst, /* VSP */ codec = get_v4l2_codec(inst); - base_cycles = inst->clk_data.entry->vsp_cycles; + base_cycles = inst->has_bframe ? + 80 : inst->clk_data.entry->vsp_cycles; vsp_cycles = fps * filled_len * 8; if (codec == V4L2_PIX_FMT_VP9) { diff --git a/msm/vidc/msm_vidc_common.c b/msm/vidc/msm_vidc_common.c index 652334c646c4..7b4602af6d92 100644 --- a/msm/vidc/msm_vidc_common.c +++ b/msm/vidc/msm_vidc_common.c @@ -2650,6 +2650,7 @@ static void handle_fbd(enum hal_command_response cmd, void *data) break; case HFI_PICTURE_TYPE_B: mbuf->vvb.flags |= V4L2_BUF_FLAG_BFRAME; + inst->has_bframe = 1; break; case HFI_FRAME_NOTCODED: case HFI_UNUSED_PICT: diff --git a/msm/vidc/msm_vidc_internal.h b/msm/vidc/msm_vidc_internal.h index e04ac940ace2..f2ba25f90463 100644 --- a/msm/vidc/msm_vidc_internal.h +++ b/msm/vidc/msm_vidc_internal.h @@ -574,6 +574,7 @@ struct msm_vidc_inst { u32 first_reconfig_done; u64 last_qbuf_time_ns; bool active; + bool has_bframe; }; extern struct msm_vidc_drv *vidc_driver;