Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b9474406 authored by Karthik Anantha Ram's avatar Karthik Anantha Ram Committed by Gerrit - the friendly Code Review server
Browse files

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: default avatarKarthik Anantha Ram <kartanan@codeaurora.org>
parent c05a3d0e
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -161,7 +161,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);
@@ -170,7 +169,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;
}
+16 −8
Original line number Diff line number Diff line
@@ -1157,7 +1157,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;
@@ -1177,8 +1177,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
@@ -1201,17 +1203,23 @@ 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;
	}