From 1fc52e7df47652531a7eb034e1797d3fdaffc72d Mon Sep 17 00:00:00 2001 From: Govindaraj Rajagopal Date: Mon, 23 Sep 2019 22:55:21 +0530 Subject: [PATCH] msm: vidc: enhance eos buffer handling Eos buffer is queued to firmware and its ref is maintained using eosbufs.list. Sometimes EOS request client sent even before port_reconfig. In that case requeing same buffer which is already with firmware at start_streaming. So during handle_ebd of 2nd eos buffer, it can't find the entry at eosbufs.list. So client closes the session. Always check, if buffer is already queued, then do not queue the same buffer again, during start_streaming after reconfig. Change-Id: If934d8ce357226dee78db15ccb7b3c57103d2f12 Signed-off-by: Govindaraj Rajagopal --- msm/vidc/msm_vidc_common.c | 5 +++++ msm/vidc/msm_vidc_internal.h | 1 + 2 files changed, 6 insertions(+) diff --git a/msm/vidc/msm_vidc_common.c b/msm/vidc/msm_vidc_common.c index 83fb1a831254..ea961fe27b94 100644 --- a/msm/vidc/msm_vidc_common.c +++ b/msm/vidc/msm_vidc_common.c @@ -2363,6 +2363,7 @@ static bool is_eos_buffer(struct msm_vidc_inst *inst, u32 device_addr) list_for_each_entry_safe(temp, next, &inst->eosbufs.list, list) { if (temp->smem.device_addr == device_addr) { found = true; + temp->is_queued = 0; list_del(&temp->list); msm_comm_smem_free(inst, &temp->smem); kfree(temp); @@ -3953,6 +3954,9 @@ int msm_vidc_send_pending_eos_buffers(struct msm_vidc_inst *inst) mutex_lock(&inst->eosbufs.lock); list_for_each_entry_safe(binfo, temp, &inst->eosbufs.list, list) { + if (binfo->is_queued) + continue; + data.alloc_len = binfo->smem.size; data.device_addr = binfo->smem.device_addr; data.input_tag = 0; @@ -3969,6 +3973,7 @@ int msm_vidc_send_pending_eos_buffers(struct msm_vidc_inst *inst) rc = call_hfi_op(hdev, session_etb, inst->session, &data); + binfo->is_queued = 1; } mutex_unlock(&inst->eosbufs.lock); diff --git a/msm/vidc/msm_vidc_internal.h b/msm/vidc/msm_vidc_internal.h index ffb44f46431b..7f16fec6f21f 100644 --- a/msm/vidc/msm_vidc_internal.h +++ b/msm/vidc/msm_vidc_internal.h @@ -173,6 +173,7 @@ struct recon_buf { struct eos_buf { struct list_head list; struct msm_smem smem; + u32 is_queued; }; struct internal_buf {