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

Commit f13969a9 authored by Ayush Kumar's avatar Ayush Kumar
Browse files

msm: camera: isp: Avoid applying request while processing bubble recovery



If bubble recovery is enabled and bubble is encounter then do
not apply any new requests until all the buf done's completed for
the bubbled request.

Change-Id: If6c112b6edd284c7309c2cae21d798f6f725ad87
Signed-off-by: default avatarAyush Kumar <ayushkr@codeaurora.org>
parent ec12b494
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -448,6 +448,7 @@ static int __cam_isp_ctx_handle_buf_done_in_activated_state(
		req_isp->bubble_detected = false;
		list_del_init(&req->list);
		list_add(&req->list, &ctx->pending_req_list);
		atomic_set(&ctx_isp->process_bubble, 0);

		CAM_DBG(CAM_REQ,
			"Move active request %lld to pending list(cnt = %d) [bubble recovery]",
@@ -765,6 +766,7 @@ static int __cam_isp_ctx_epoch_in_applied(struct cam_isp_context *ctx_isp,
		notify.req_id = req->request_id;
		notify.error = CRM_KMD_ERR_BUBBLE;
		ctx->ctx_crm_intf->notify_err(&notify);
		atomic_set(&ctx_isp->process_bubble, 1);
		CAM_DBG(CAM_ISP, "Notify CRM about Bubble frame %lld",
			ctx_isp->frame_id);
	} else {
@@ -1198,6 +1200,14 @@ static int __cam_isp_ctx_apply_req_in_activated_state(
	 *
	 */
	ctx_isp = (struct cam_isp_context *) ctx->ctx_priv;
	if (atomic_read(&ctx_isp->process_bubble)) {
		CAM_ERR_RATE_LIMIT(CAM_ISP,
			"Processing bubble cannot apply Request Id %llu",
			apply->request_id);
		rc = -EAGAIN;
		goto end;
	}

	spin_lock_bh(&ctx->lock);
	req = list_first_entry(&ctx->pending_req_list, struct cam_ctx_request,
		list);
@@ -1406,6 +1416,7 @@ static int __cam_isp_ctx_flush_req_in_top_state(
	rc = __cam_isp_ctx_flush_req(ctx, &ctx->pending_req_list, flush_req);
	spin_unlock_bh(&ctx->lock);

	atomic_set(&ctx_isp->process_bubble, 0);
	if (flush_req->type == CAM_REQ_MGR_FLUSH_TYPE_ALL) {
		/* if active and wait list are empty, return */
		spin_lock_bh(&ctx->lock);
@@ -2436,6 +2447,7 @@ static int __cam_isp_ctx_start_dev_in_ready(struct cam_context *ctx,
	start_isp.hw_config.init_packet = 1;
	start_isp.start_only = false;

	atomic_set(&ctx_isp->process_bubble, 0);
	ctx_isp->frame_id = 0;
	ctx_isp->active_req_cnt = 0;
	ctx_isp->reported_req_id = 0;
@@ -2571,6 +2583,7 @@ static int __cam_isp_ctx_stop_dev_in_activated_unlock(
	ctx_isp->frame_id = 0;
	ctx_isp->active_req_cnt = 0;
	ctx_isp->reported_req_id = 0;
	atomic_set(&ctx_isp->process_bubble, 0);

	CAM_DBG(CAM_ISP, "Stop device success next state %d on ctx %u",
		ctx->state, ctx->ctx_id);
+4 −1
Original line number Diff line number Diff line
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -143,6 +143,8 @@ struct cam_isp_context_state_monitor {
 * @base:                      Common context object pointer
 * @frame_id:                  Frame id tracking for the isp context
 * @substate_actiavted:        Current substate for the activated state.
 * @process_bubble:            Atomic variable to check if ctx is still
 *                             processing bubble
 * @substate_machine:          ISP substate machine for external interface
 * @substate_machine_irq:      ISP substate machine for irq handling
 * @req_base:                  Common request object storage
@@ -166,6 +168,7 @@ struct cam_isp_context {

	int64_t                          frame_id;
	uint32_t                         substate_activated;
	atomic_t                         process_bubble;
	struct cam_ctx_ops              *substate_machine;
	struct cam_isp_ctx_irq_ops      *substate_machine_irq;