From 31bb5f19a06fa1b66adb233cec5929169cd11245 Mon Sep 17 00:00:00 2001 From: Chinmay Sawarkar Date: Tue, 21 May 2019 15:08:13 -0700 Subject: [PATCH] msm: vidc: Disable batching for concurrent usecase Disable decode batching for concurrent decode session. CRs-Fixed: 2457122 Change-Id: I776e9d057ae0f1a9dc0fd565b061ae48b88435e1 Signed-off-by: Chinmay Sawarkar --- msm/vidc/msm_vdec.c | 20 +++++++++++++++++++- msm/vidc/msm_vidc_buffer_calculations.c | 4 ++-- msm/vidc/msm_vidc_common.c | 2 +- msm/vidc/msm_vidc_internal.h | 1 + 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/msm/vidc/msm_vdec.c b/msm/vidc/msm_vdec.c index e4ef88c73457..d95626e3ba64 100644 --- a/msm/vidc/msm_vdec.c +++ b/msm/vidc/msm_vdec.c @@ -776,8 +776,26 @@ int msm_vdec_inst_init(struct msm_vidc_inst *inst) inst->clk_data.frame_rate = (DEFAULT_FPS << 16); inst->clk_data.operating_rate = (DEFAULT_FPS << 16); - if (core->resources.decode_batching) + if (core->resources.decode_batching) { + struct msm_vidc_inst *temp; + inst->batch.size = MAX_DEC_BATCH_SIZE; + inst->decode_batching = true; + + mutex_lock(&core->lock); + list_for_each_entry(temp, &core->instances, list) { + if (temp != inst && + temp->state != MSM_VIDC_CORE_INVALID && + is_decode_session(temp) && + !is_thumbnail_session(temp)) { + inst->decode_batching = false; + dprintk(VIDC_DBG, + "Disable decode-batching in multi sessions\n"); + break; + } + } + mutex_unlock(&core->lock); + } inst->buff_req.buffer[1].buffer_type = HAL_BUFFER_INPUT; inst->buff_req.buffer[1].buffer_count_min_host = diff --git a/msm/vidc/msm_vidc_buffer_calculations.c b/msm/vidc/msm_vidc_buffer_calculations.c index da6fc6dba86c..c000118ef4e2 100644 --- a/msm/vidc/msm_vidc_buffer_calculations.c +++ b/msm/vidc/msm_vidc_buffer_calculations.c @@ -610,7 +610,7 @@ int msm_vidc_init_buffer_count(struct msm_vidc_inst *inst) HAL_BUFFER_INPUT); fmt->count_min = input_min_count; /* batching needs minimum batch size count of input buffers */ - if (inst->core->resources.decode_batching && + if (inst->decode_batching && is_decode_session(inst) && fmt->count_min < inst->batch.size) fmt->count_min = inst->batch.size; @@ -711,7 +711,7 @@ int msm_vidc_get_extra_buff_count(struct msm_vidc_inst *inst, * batch size count of extra buffers added on output port */ if (buffer_type == HAL_BUFFER_OUTPUT) { - if (inst->core->resources.decode_batching && + if (inst->decode_batching && is_decode_session(inst) && count < inst->batch.size) count = inst->batch.size; diff --git a/msm/vidc/msm_vidc_common.c b/msm/vidc/msm_vidc_common.c index 0b161029896c..39e445312fa6 100644 --- a/msm/vidc/msm_vidc_common.c +++ b/msm/vidc/msm_vidc_common.c @@ -2787,7 +2787,7 @@ bool is_batching_allowed(struct msm_vidc_inst *inst) maxmbs = inst->capability.cap[CAP_BATCH_MAX_MB_PER_FRAME].max; maxfps = inst->capability.cap[CAP_BATCH_MAX_FPS].max; - return (inst->core->resources.decode_batching && + return (inst->decode_batching && is_decode_session(inst) && !is_thumbnail_session(inst) && !inst->clk_data.low_latency_mode && diff --git a/msm/vidc/msm_vidc_internal.h b/msm/vidc/msm_vidc_internal.h index 0dd5b8fe1f70..98707751c6d6 100644 --- a/msm/vidc/msm_vidc_internal.h +++ b/msm/vidc/msm_vidc_internal.h @@ -514,6 +514,7 @@ struct msm_vidc_inst { struct msm_vidc_codec_data *codec_data; struct hal_hdr10_pq_sei hdr10_sei_params; struct batch_mode batch; + bool decode_batching; struct msm_vidc_inst_smem_ops *smem_ops; int (*buffer_size_calculators)(struct msm_vidc_inst *inst); };