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

Commit 1f409d4b authored by Trishansh Bhardwaj's avatar Trishansh Bhardwaj
Browse files

msm: camera: reqmgr: Improve master slave sync



If link is not ready on master epoch, but it becomes ready on slave
epoch, then master skips apply and slave applies request and goes ahead
of master.
Fix this by skipping apply on slave if master slot in not in applied
state.

CRs-Fixed: 2562008
Change-Id: Ic612eedfeedf2a6ea50737a49a6f1f31a5de1dc2
Signed-off-by: default avatarTrishansh Bhardwaj <tbhardwa@codeaurora.org>
parent f697ab3b
Loading
Loading
Loading
Loading
+16 −5
Original line number Diff line number Diff line
@@ -1106,6 +1106,8 @@ static int __cam_req_mgr_check_sync_req_is_ready(
	int sync_slot_idx = 0, sync_rd_idx = 0, rc = 0;
	int32_t sync_num_slots = 0;
	uint64_t sync_frame_duration = 0;
	uint64_t sof_timestamp_delta = 0;
	uint64_t master_slave_diff = 0;
	bool ready = true, sync_ready = true;

	if (!link->sync_link) {
@@ -1139,6 +1141,11 @@ static int __cam_req_mgr_check_sync_req_is_ready(
	else
		sync_frame_duration = DEFAULT_FRAME_DURATION;

	sof_timestamp_delta =
		link->sof_timestamp >= sync_link->sof_timestamp
		? link->sof_timestamp - sync_link->sof_timestamp
		: sync_link->sof_timestamp - link->sof_timestamp;

	CAM_DBG(CAM_CRM,
		"sync link %x last frame_duration is %d ns",
		sync_link->link_hdl, sync_frame_duration);
@@ -1260,11 +1267,10 @@ static int __cam_req_mgr_check_sync_req_is_ready(
	 * difference of two SOF timestamp less than
	 * (sync_frame_duration / 5).
	 */
	do_div(sync_frame_duration, 5);
	if ((link->sof_timestamp > sync_link->sof_timestamp) &&
		(sync_link->sof_timestamp > 0) &&
		(link->sof_timestamp - sync_link->sof_timestamp <
		sync_frame_duration) &&
	master_slave_diff = sync_frame_duration;
	do_div(master_slave_diff, 5);
	if ((sync_link->sof_timestamp > 0) &&
		(sof_timestamp_delta < master_slave_diff) &&
		(sync_rd_slot->sync_mode == CAM_REQ_MGR_SYNC_MODE_SYNC)) {

		/*
@@ -1287,6 +1293,11 @@ static int __cam_req_mgr_check_sync_req_is_ready(
				"sync link %x too quickly, skip next frame of sync link",
				sync_link->link_hdl);
			link->sync_link_sof_skip = true;
		} else if (sync_link->req.in_q->slot[sync_slot_idx].status !=
			CRM_SLOT_STATUS_REQ_APPLIED) {
			CAM_DBG(CAM_CRM,
				"link %x other not applied", link->link_hdl);
			return -EAGAIN;
		}
	}