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

Commit c6c83b55 authored by Ayush Kumar's avatar Ayush Kumar Committed by Gerrit - the friendly Code Review server
Browse files

msm: camera: reqmgr: Stop slot reset on buf done



This change is to stop slot reset on link in case of buf done.
If slot is required for applying either next or previous request
on sync link, then stop the slot reset for the link.

Change-Id: I296e450de94e273d17b1a9bb0879d879a63414f4
Signed-off-by: default avatarAyush Kumar <ayushkr@codeaurora.org>
parent 7190233b
Loading
Loading
Loading
Loading
+48 −6
Original line number Diff line number Diff line
@@ -2218,6 +2218,42 @@ int cam_req_mgr_process_error(void *priv, void *data)
	return rc;
}

static void cam_req_mgr_process_reset_for_dual_link(
	struct cam_req_mgr_core_link *link,
	struct cam_req_mgr_trigger_notify *trigger_data)
{
	int32_t                             idx = -1;
	int32_t                             sync_idx = -1;
	struct cam_req_mgr_req_queue        *in_q = NULL;
	struct cam_req_mgr_req_queue        *sync_in_q = NULL;

	in_q = link->req.in_q;
	sync_in_q = link->sync_link->req.in_q;

	sync_idx = __cam_req_mgr_find_slot_for_req(sync_in_q,
			trigger_data->req_id);
	if (link->is_master)
		__cam_req_mgr_dec_idx(&sync_idx,
			(link->max_delay - link->sync_link->max_delay),
			sync_in_q->num_slots);
	else
		__cam_req_mgr_inc_idx(&sync_idx,
			(link->sync_link->max_delay - link->max_delay),
			sync_in_q->num_slots);
	if (sync_idx != -1 &&
		(sync_in_q->slot[sync_in_q->rd_idx].status ==
		CRM_SLOT_STATUS_REQ_APPLIED)) {
		idx = __cam_req_mgr_find_slot_for_req(in_q,
			trigger_data->req_id);
		CAM_DBG(CAM_CRM, "Reset req: %lld idx: %d link_hdl: %x",
			trigger_data->req_id, idx,
			link->link_hdl);
		if (idx == in_q->last_applied_idx)
			in_q->last_applied_idx = -1;
		__cam_req_mgr_reset_req_slot(link, idx);
	}
}

/**
 * cam_req_mgr_process_trigger()
 *
@@ -2256,6 +2292,11 @@ static int cam_req_mgr_process_trigger(void *priv, void *data)
	mutex_lock(&link->req.lock);

	if (trigger_data->trigger == CAM_TRIGGER_POINT_SOF) {
		if (link->sync_link &&
			(link->is_master || link->sync_link->is_master)) {
			cam_req_mgr_process_reset_for_dual_link(link,
				trigger_data);
		} else {
			idx = __cam_req_mgr_find_slot_for_req(in_q,
				trigger_data->req_id);
			if (idx >= 0) {
@@ -2264,6 +2305,7 @@ static int cam_req_mgr_process_trigger(void *priv, void *data)
				__cam_req_mgr_reset_req_slot(link, idx);
			}
		}
	}

	/*
	 * Check if current read index is in applied state, if yes make it free