From 5bf834b78e77dcf2d9cc0e832b20ad6aa142fb96 Mon Sep 17 00:00:00 2001 From: Priyanka Gujjula Date: Tue, 20 Oct 2020 14:36:32 +0530 Subject: [PATCH] msm: vidc: Update num_ref calc and limit max_layer Limit max number of temporal layers to 4 if hybrid_hp is not enabled as per POR. Also, inline num_ref calculations with FW. Change-Id: Iad1deaf757a8aa3715b2dce861b1454faeed7a39 Signed-off-by: Priyanka Gujjula --- msm/vidc/msm_venc.c | 6 ++++++ msm/vidc/msm_vidc_buffer_calculations.c | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/msm/vidc/msm_venc.c b/msm/vidc/msm_venc.c index 55e05e41e5a6..b13866942db4 100644 --- a/msm/vidc/msm_venc.c +++ b/msm/vidc/msm_venc.c @@ -3809,6 +3809,12 @@ int msm_venc_set_hp_max_layer(struct msm_vidc_inst *inst) __func__); return rc; } + if (!inst->hybrid_hp && max_layer->val > 4) { + update_ctrl(max_layer, 0, inst->sid); + s_vpr_h(inst->sid, + "%s: Hier-P requested beyond max capability\n", __func__); + return 0; + } /* * We send enhancement layer count to FW, diff --git a/msm/vidc/msm_vidc_buffer_calculations.c b/msm/vidc/msm_vidc_buffer_calculations.c index 0d63bca7395d..d19ed2b32cf1 100644 --- a/msm/vidc/msm_vidc_buffer_calculations.c +++ b/msm/vidc/msm_vidc_buffer_calculations.c @@ -497,13 +497,13 @@ int msm_vidc_get_num_ref_frames(struct msm_vidc_inst *inst) codec = get_v4l2_codec(inst); /* LTR and B - frame not supported with hybrid HP */ if (inst->hybrid_hp) - num_ref = (max_layer->val - 1); + num_ref = max_layer->val >> 1; else if (codec == V4L2_PIX_FMT_HEVC) num_ref = ((max_layer->val + 1) / 2) + ltr_count; - else if ((codec == V4L2_PIX_FMT_H264) && (max_layer->val <= 4)) - num_ref = ((1 << (max_layer->val - 1)) - 1) + ltr_count; + else if ((codec == V4L2_PIX_FMT_H264) && (max_layer->val < 4)) + num_ref = (max_layer->val - 1) + ltr_count; else - num_ref = ((max_layer->val + 1) / 2) + ltr_count; + num_ref = max_layer->val + ltr_count; } if (is_hier_b_session(inst)) {