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

Commit 835cdfa5 authored by Depeng Shao's avatar Depeng Shao
Browse files

msm: camera: reqmgr: Fix CRM shift one req issue



Check if current link is faster than sync link
before check if current link is ready, then we
don't need to skip sync link sof if current
link is faster than sync link.
And, skip sync link next SOF just link and sync
link ready status is different to avoid skiping
needed SOF.

Change-Id: I92145bde28680538833d6d2472f200622202327a
Signed-off-by: default avatarDepeng Shao <depengs@codeaurora.org>
parent 2e671e75
Loading
Loading
Loading
Loading
+28 −14
Original line number Diff line number Diff line
@@ -893,6 +893,7 @@ static int __cam_req_mgr_check_sync_req_is_ready(
	int64_t req_id = 0;
	int sync_slot_idx = 0, sync_rd_idx = 0, rc = 0;
	int32_t sync_num_slots = 0;
	bool ready = true, sync_ready = true;

	if (!link->sync_link) {
		CAM_ERR(CAM_CRM, "Sync link null");
@@ -921,17 +922,7 @@ static int __cam_req_mgr_check_sync_req_is_ready(
		CAM_DBG(CAM_CRM,
			"Skip Process Req: %lld on link: %x",
			req_id, link->link_hdl);
		link->sync_link_sof_skip = true;
		return rc;
	}

	rc = __cam_req_mgr_check_link_is_ready(link, slot->idx, true);
	if (rc) {
		CAM_DBG(CAM_CRM,
			"Req: %lld [My link] not ready on link: %x, rc=%d",
			req_id, link->link_hdl, rc);
		link->sync_link_sof_skip = true;
		return rc;
		ready = false;
	}

	sync_slot_idx = __cam_req_mgr_find_slot_for_req(
@@ -939,8 +930,7 @@ static int __cam_req_mgr_check_sync_req_is_ready(
	if (sync_slot_idx == -1) {
		CAM_DBG(CAM_CRM, "Req: %lld not found on link: %x [other link]",
			req_id, sync_link->link_hdl);
		link->sync_link_sof_skip = true;
		return -EINVAL;
		sync_ready = false;
	}

	sync_rd_idx = sync_link->req.in_q->rd_idx;
@@ -956,14 +946,38 @@ static int __cam_req_mgr_check_sync_req_is_ready(
		return -EAGAIN;
	}

	rc = __cam_req_mgr_check_link_is_ready(link, slot->idx, true);
	if (rc) {
		CAM_DBG(CAM_CRM,
			"Req: %lld [My link] not ready on link: %x, rc=%d",
			req_id, link->link_hdl, rc);
		ready = false;
	}

	rc = __cam_req_mgr_check_link_is_ready(sync_link, sync_slot_idx, true);
	if (rc && (sync_link->req.in_q->slot[sync_slot_idx].status !=
		CRM_SLOT_STATUS_REQ_APPLIED)) {
		CAM_DBG(CAM_CRM,
			"Req: %lld not ready on [other link] link: %x, rc=%d",
			req_id, sync_link->link_hdl, rc);
		sync_ready = false;
	}

	/*
	 * If both of them are ready or not ready, then just
	 * skip this sof and don't skip sync link next SOF.
	 */
	if (sync_ready != ready) {
		CAM_DBG(CAM_CRM,
			"Req: %lld ready %d sync_ready %d, ignore sync link next SOF",
			req_id, ready, sync_ready);
		link->sync_link_sof_skip = true;
		return rc;
		return -EINVAL;
	} else if (ready == false) {
		CAM_DBG(CAM_CRM,
			"Req: %lld not ready on link: %x",
			req_id, link->link_hdl);
		return -EINVAL;
	}

	CAM_DBG(CAM_REQ,