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

Commit abee20f0 authored by Vikram Sharma's avatar Vikram Sharma Committed by Gerrit - the friendly Code Review server
Browse files

msm: camera: isp: Add handling for flush in flushed state



This change handles race condition in which flush is handled in
flushed state.

CRs-Fixed: 3038297
Change-Id: I8be1f8c70431c77366f8846d8ccab3414f3ede3e
Signed-off-by: default avatarVikram Sharma <vikramsa@codeaurora.org>
parent 1894a410
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -3541,6 +3541,19 @@ static int __cam_isp_ctx_dump_in_top_state(
	return rc;
}

static int __cam_isp_ctx_flush_req_in_flushed_state(
	struct cam_context               *ctx,
	struct cam_req_mgr_flush_request *flush_req)
{
	if (flush_req->type == CAM_REQ_MGR_FLUSH_TYPE_ALL) {
		CAM_INFO(CAM_ISP, "Flush in flushed state req id %lld ctx_id:%d",
			flush_req->req_id, ctx->ctx_id);
		ctx->last_flush_req = flush_req->req_id;
	}

	return 0;
}

static int __cam_isp_ctx_flush_req(struct cam_context *ctx,
	struct list_head *req_list, struct cam_req_mgr_flush_request *flush_req)
{
@@ -4637,6 +4650,14 @@ static int __cam_isp_ctx_config_dev_in_top_state(
			packet->header.request_id);
		rc = -EBADR;
		goto free_req;
	} else if ((packet_opcode == CAM_ISP_PACKET_INIT_DEV)
		&& (packet->header.request_id <= ctx->last_flush_req)
		&& ctx->last_flush_req && packet->header.request_id) {
		CAM_WARN(CAM_ISP,
			"last flushed req is %lld, config dev(init) for req %lld",
			ctx->last_flush_req, packet->header.request_id);
		rc = -EBADR;
		goto free_req;
	}

	cfg.packet = packet;
@@ -5927,6 +5948,7 @@ static struct cam_ctx_ops
		.crm_ops = {
			.unlink = __cam_isp_ctx_unlink_in_ready,
			.process_evt = __cam_isp_ctx_process_evt,
			.flush_req = __cam_isp_ctx_flush_req_in_flushed_state,
		},
		.irq_ops = NULL,
		.pagefault_ops = cam_isp_context_dump_requests,