msm: camera: Replace mutex lock with context spin lock

This change removes the context mutex lock for the entire
function when applying a request. With this change, the lock
window is reduced thereby improving performance.

Change-Id: Ibc387173b4da0d2c92604a01e9123572019b6469
Signed-off-by: Karthik Anantha Ram <kartanan@codeaurora.org>
This commit is contained in:
Karthik Anantha Ram 2018-08-27 16:14:56 -07:00
parent 30e626bc1b
commit 4a19905433
2 changed files with 16 additions and 10 deletions

View File

@ -163,7 +163,6 @@ int cam_context_handle_crm_apply_req(struct cam_context *ctx,
return -EINVAL;
}
mutex_lock(&ctx->ctx_mutex);
if (ctx->state_machine[ctx->state].crm_ops.apply_req) {
rc = ctx->state_machine[ctx->state].crm_ops.apply_req(ctx,
apply);
@ -172,7 +171,6 @@ int cam_context_handle_crm_apply_req(struct cam_context *ctx,
ctx->dev_hdl, ctx->state);
rc = -EPROTO;
}
mutex_unlock(&ctx->ctx_mutex);
return rc;
}

View File

@ -1158,7 +1158,7 @@ static int __cam_isp_ctx_apply_req_in_activated_state(
{
int rc = 0;
struct cam_ctx_request *req;
struct cam_ctx_request *active_req;
struct cam_ctx_request *active_req = NULL;
struct cam_isp_ctx_req *req_isp;
struct cam_isp_ctx_req *active_req_isp;
struct cam_isp_context *ctx_isp = NULL;
@ -1178,8 +1178,10 @@ static int __cam_isp_ctx_apply_req_in_activated_state(
*
*/
ctx_isp = (struct cam_isp_context *) ctx->ctx_priv;
spin_lock_bh(&ctx->lock);
req = list_first_entry(&ctx->pending_req_list, struct cam_ctx_request,
list);
spin_unlock_bh(&ctx->lock);
/*
* Check whehter the request id is matching the tip, if not, this means
@ -1202,19 +1204,25 @@ static int __cam_isp_ctx_apply_req_in_activated_state(
"Reject apply request (id %lld) due to congestion(cnt = %d)",
req->request_id,
ctx_isp->active_req_cnt);
if (!list_empty(&ctx->active_req_list)) {
spin_lock_bh(&ctx->lock);
if (!list_empty(&ctx->active_req_list))
active_req = list_first_entry(&ctx->active_req_list,
struct cam_ctx_request, list);
active_req_isp =
(struct cam_isp_ctx_req *) active_req->req_priv;
__cam_isp_ctx_handle_buf_done_fail_log(active_req_isp);
} else {
else
CAM_ERR_RATE_LIMIT(CAM_ISP,
"WARNING: should not happen (cnt = %d) but active_list empty",
ctx_isp->active_req_cnt);
spin_unlock_bh(&ctx->lock);
if (active_req) {
active_req_isp =
(struct cam_isp_ctx_req *) active_req->req_priv;
__cam_isp_ctx_handle_buf_done_fail_log(active_req_isp);
}
rc = -EFAULT;
goto end;
rc = -EFAULT;
goto end;
}
req_isp->bubble_report = apply->report_if_bubble;