From 967b2f6bcb6949b44ef41cb8872bd8c7bb277573 Mon Sep 17 00:00:00 2001 From: Vikash Garodia Date: Mon, 20 May 2019 19:59:38 +0530 Subject: [PATCH] msm: vidc: Decide DCVS after session configuration DCVS feature depends on multiple client configurations. Low latency, thumbnail mode, etc are few among them. DCVS is now decided before the session starts streaming i.e after all configuration are inplace. CRs-Fixed: 2457035 Change-Id: I4a42ae6bafdc852e81794b69d117f5821af4841f Signed-off-by: Vikash Garodia Signed-off-by: Chinmay Sawarkar --- msm/vidc/msm_vdec.c | 1 - msm/vidc/msm_vidc.c | 3 ++- msm/vidc/msm_vidc_clocks.c | 7 +++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/msm/vidc/msm_vdec.c b/msm/vidc/msm_vdec.c index cc6dc12d9617..e4ef88c73457 100644 --- a/msm/vidc/msm_vdec.c +++ b/msm/vidc/msm_vdec.c @@ -848,7 +848,6 @@ int msm_vdec_s_ctrl(struct msm_vidc_inst *inst, struct v4l2_ctrl *ctrl) if (ctrl->val) inst->flags |= VIDC_THUMBNAIL; - msm_dcvs_try_enable(inst); rc = msm_vidc_set_buffer_count_for_thumbnail(inst); if (rc) { dprintk(VIDC_ERR, "Failed to set buffer count\n"); diff --git a/msm/vidc/msm_vidc.c b/msm/vidc/msm_vidc.c index 7c98269cf103..28080d6d30c7 100644 --- a/msm/vidc/msm_vidc.c +++ b/msm/vidc/msm_vidc.c @@ -918,6 +918,8 @@ static inline int start_streaming(struct msm_vidc_inst *inst) __func__, inst->batch.enable ? "enabled" : "disabled", inst, hash32_ptr(inst->session)); + msm_dcvs_try_enable(inst); + /* * For seq_changed_insufficient, driver should set session_continue * to firmware after the following sequence @@ -1570,7 +1572,6 @@ void *msm_vidc_open(int core_id, int session_type) goto fail_init; } - msm_dcvs_try_enable(inst); if (msm_comm_check_for_inst_overload(core)) { dprintk(VIDC_ERR, "Instance count reached Max limit, rejecting session"); diff --git a/msm/vidc/msm_vidc_clocks.c b/msm/vidc/msm_vidc_clocks.c index a1905a13246b..0ce353c33547 100644 --- a/msm/vidc/msm_vidc_clocks.c +++ b/msm/vidc/msm_vidc_clocks.c @@ -1030,15 +1030,18 @@ int msm_comm_scale_clocks_and_bus(struct msm_vidc_inst *inst) int msm_dcvs_try_enable(struct msm_vidc_inst *inst) { - if (!inst) { + if (!inst || !inst->core) { dprintk(VIDC_ERR, "%s: Invalid args: %p\n", __func__, inst); return -EINVAL; } if (msm_vidc_clock_voting || + !inst->core->resources.dcvs || inst->flags & VIDC_THUMBNAIL || inst->clk_data.low_latency_mode || - inst->batch.enable) { + inst->batch.enable || + inst->rc_type == V4L2_MPEG_VIDEO_BITRATE_MODE_CQ || + inst->grid_enable) { dprintk(VIDC_PROF, "DCVS disabled: %pK\n", inst); inst->clk_data.dcvs_mode = false; return false;