From 2efb0193b30dcbbe4f0cb9cf0c606bbe5ce60dfe Mon Sep 17 00:00:00 2001 From: Chinmay Sawarkar Date: Thu, 17 Sep 2020 14:35:54 -0700 Subject: [PATCH] msm: vidc: Force nominal for high bitrate decode usecases Force the clocks to NOM if bitrate nears or exceeds maximum supported for VP9 usecases. Signed-off-by: Chinmay Sawarkar Change-Id: I917b0f6c624837403fd9f1499a68812acb00b568 --- msm/vidc/msm_vidc_clocks.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/msm/vidc/msm_vidc_clocks.c b/msm/vidc/msm_vidc_clocks.c index 9a4716ef16eb..13a3bf130977 100644 --- a/msm/vidc/msm_vidc_clocks.c +++ b/msm/vidc/msm_vidc_clocks.c @@ -679,6 +679,7 @@ static unsigned long msm_vidc_calc_freq_iris2(struct msm_vidc_inst *inst, u32 operating_rate, vsp_factor_num = 1, vsp_factor_den = 1; u32 base_cycles = 0; u32 codec = 0; + u64 bitrate = 0; core = inst->core; dcvs = &inst->clk_data; @@ -768,7 +769,8 @@ static unsigned long msm_vidc_calc_freq_iris2(struct msm_vidc_inst *inst, codec = get_v4l2_codec(inst); base_cycles = inst->has_bframe ? 80 : inst->clk_data.entry->vsp_cycles; - vsp_cycles = fps * filled_len * 8; + bitrate = fps * filled_len * 8; + vsp_cycles = bitrate; if (codec == V4L2_PIX_FMT_VP9) { vsp_cycles = div_u64(vsp_cycles * 170, 100); @@ -786,6 +788,11 @@ static unsigned long msm_vidc_calc_freq_iris2(struct msm_vidc_inst *inst, vsp_cycles += mbs_per_second * base_cycles; + if (codec == V4L2_PIX_FMT_VP9 && + inst->clk_data.work_mode == HFI_WORKMODE_2 && + inst->clk_data.work_route == 4 && + bitrate > 90000000) + vsp_cycles = msm_vidc_max_freq(inst->core, inst->sid); } else { s_vpr_e(inst->sid, "%s: Unknown session type\n", __func__); return msm_vidc_max_freq(inst->core, inst->sid);