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

Commit e7d56fc8 authored by Junzhe Zou's avatar Junzhe Zou Committed by Alok Pandey
Browse files

msm: camera: isp: manage wait list properly



Manage the request transition in lists properly in multiple
location.

Change-Id: Ifcf115b77bd663a22b95a4a5468a545df875e3d3
Signed-off-by: default avatarJunzhe Zou <jnzhezou@codeaurora.org>
parent 7ee922fa
Loading
Loading
Loading
Loading
+26 −26
Original line number Diff line number Diff line
@@ -686,24 +686,16 @@ static int __cam_isp_ctx_reg_upd_in_sof(struct cam_isp_context *ctx_isp,
	 * This is for the first update. The initial setting will
	 * cause the reg_upd in the first frame.
	 */
	if (!list_empty(&ctx->pending_req_list)) {
		req = list_first_entry(&ctx->pending_req_list,
	if (!list_empty(&ctx->wait_req_list)) {
		req = list_first_entry(&ctx->wait_req_list,
			struct cam_ctx_request, list);
		list_del_init(&req->list);
		req_isp = (struct cam_isp_ctx_req *) req->req_priv;
		if (req_isp->num_fence_map_out == req_isp->num_acked) {
		if (req_isp->num_fence_map_out == req_isp->num_acked)
			list_add_tail(&req->list, &ctx->free_req_list);
		} else {
			/* need to handle the buf done */
			list_add_tail(&req->list, &ctx->active_req_list);
			ctx_isp->active_req_cnt++;
			CAM_DBG(CAM_REQ,
				"move request %lld to active list(cnt = %d)",
				 req->request_id,
				ctx_isp->active_req_cnt);
			ctx_isp->substate_activated =
				CAM_ISP_CTX_ACTIVATED_EPOCH;
		}
		else
			CAM_ERR(CAM_ISP,
				"receive rup in unexpected state");
	}
	if (req != NULL) {
		__cam_isp_ctx_update_state_monitor_array(ctx_isp,
@@ -727,7 +719,7 @@ static int __cam_isp_ctx_epoch_in_applied(struct cam_isp_context *ctx_isp,
		 * If no wait req in epoch, this is an error case.
		 * The recovery is to go back to sof state
		 */
		CAM_ERR(CAM_ISP, "No pending request");
		CAM_ERR(CAM_ISP, "No wait request");
		ctx_isp->substate_activated = CAM_ISP_CTX_ACTIVATED_SOF;

		/* Send SOF event as empty frame*/
@@ -829,8 +821,10 @@ static int __cam_isp_ctx_sof_in_epoch(struct cam_isp_context *ctx_isp,

	req = list_last_entry(&ctx->active_req_list,
		struct cam_ctx_request, list);
	if (req)
		__cam_isp_ctx_update_state_monitor_array(ctx_isp,
		CAM_ISP_STATE_CHANGE_TRIGGER_SOF, ctx->req_list->request_id);
			CAM_ISP_STATE_CHANGE_TRIGGER_SOF,
			ctx->req_list->request_id);
	CAM_DBG(CAM_ISP, "next substate %d",
		ctx_isp->substate_activated);

@@ -872,7 +866,7 @@ static int __cam_isp_ctx_epoch_in_bubble_applied(
	 * transition to BUBBLE state again.
	 */

	if (list_empty(&ctx->pending_req_list)) {
	if (list_empty(&ctx->wait_req_list)) {
		/*
		 * If no pending req in epoch, this is an error case.
		 * Just go back to the bubble state.
@@ -885,14 +879,16 @@ static int __cam_isp_ctx_epoch_in_bubble_applied(
		goto end;
	}

	req = list_first_entry(&ctx->pending_req_list, struct cam_ctx_request,
	req = list_first_entry(&ctx->wait_req_list, struct cam_ctx_request,
		list);
	req_isp = (struct cam_isp_ctx_req *)req->req_priv;
	list_del_init(&req->list);

	if (req_isp->bubble_report && ctx->ctx_crm_intf &&
		ctx->ctx_crm_intf->notify_err) {
		struct cam_req_mgr_error_notify notify;

		list_add(&req->list, &ctx->pending_req_list);
		notify.link_hdl = ctx->link_hdl;
		notify.dev_hdl = ctx->dev_hdl;
		notify.req_id = req->request_id;
@@ -906,7 +902,6 @@ static int __cam_isp_ctx_epoch_in_bubble_applied(
		 * If we can not report bubble, then treat it as if no bubble
		 * report. Just move the req to active list.
		 */
		list_del_init(&req->list);
		list_add_tail(&req->list, &ctx->active_req_list);
		ctx_isp->active_req_cnt++;
		CAM_DBG(CAM_ISP, "move request %lld to active list(cnt = %d)",
@@ -932,6 +927,7 @@ static int __cam_isp_ctx_epoch_in_bubble_applied(
end:
	req = list_last_entry(&ctx->active_req_list, struct cam_ctx_request,
		list);
	if (req)
		__cam_isp_ctx_update_state_monitor_array(ctx_isp,
			CAM_ISP_STATE_CHANGE_TRIGGER_EPOCH, req->request_id);
	return 0;
@@ -1753,11 +1749,11 @@ static int __cam_isp_ctx_rdi_only_reg_upd_in_bubble_applied_state(
	ctx_isp->substate_activated = CAM_ISP_CTX_ACTIVATED_EPOCH;
	/* notify reqmgr with sof signal*/
	if (ctx->ctx_crm_intf && ctx->ctx_crm_intf->notify_trigger) {
		if (list_empty(&ctx->pending_req_list)) {
			CAM_ERR(CAM_ISP, "Reg upd ack with no pending request");
		if (list_empty(&ctx->wait_req_list)) {
			CAM_ERR(CAM_ISP, "Reg upd ack with no waiting request");
			goto error;
		}
		req = list_first_entry(&ctx->pending_req_list,
		req = list_first_entry(&ctx->wait_req_list,
				struct cam_ctx_request, list);
		list_del_init(&req->list);

@@ -2402,9 +2398,13 @@ static int __cam_isp_ctx_start_dev_in_ready(struct cam_context *ctx,
	}
	CAM_DBG(CAM_ISP, "start device success ctx %u", ctx->ctx_id);

	if (req_isp->num_fence_map_out) {
	list_del_init(&req->list);

	if (req_isp->num_fence_map_out) {
		list_add_tail(&req->list, &ctx->active_req_list);
		ctx_isp->active_req_cnt++;
	} else {
		list_add_tail(&req->list, &ctx->wait_req_list);
	}
end:
	return rc;