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

Commit cf0e9a35 authored by Depeng Shao's avatar Depeng Shao
Browse files

msm: camera: reqmgr: Get the index difference properly



The slot index is a cycled index, need to add the
num slots and do complementation if we want to get
difference.

Change-Id: I01a7d0d7a79ad7beea95a6ed0e259b44879ab7c3
Signed-off-by: default avatarDepeng Shao <depengs@codeaurora.org>
parent 42c58cdb
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -680,6 +680,7 @@ static int __cam_req_mgr_check_sync_for_mslave(
	struct cam_req_mgr_slot      *sync_slot = NULL;
	int sync_slot_idx = 0, prev_idx, next_idx, rd_idx, sync_rd_idx, rc = 0;
	int64_t req_id = 0, sync_req_id = 0;
	int32_t sync_num_slots = 0;

	if (!link->sync_link) {
		CAM_ERR(CAM_CRM, "Sync link null");
@@ -688,6 +689,7 @@ static int __cam_req_mgr_check_sync_for_mslave(

	sync_link = link->sync_link;
	req_id = slot->req_id;
	sync_num_slots = sync_link->req.in_q->num_slots;
	sync_rd_idx = sync_link->req.in_q->rd_idx;

	CAM_DBG(CAM_CRM,
@@ -765,7 +767,8 @@ static int __cam_req_mgr_check_sync_for_mslave(

			if ((sync_link->req.in_q->slot[sync_slot_idx].status !=
				CRM_SLOT_STATUS_REQ_APPLIED) &&
				((sync_slot_idx - rd_idx) >= 1) &&
				(((sync_slot_idx - rd_idx + sync_num_slots) %
				sync_num_slots) >= 1) &&
				(sync_link->req.in_q->slot[rd_idx].status !=
				CRM_SLOT_STATUS_REQ_APPLIED)) {
				CAM_DBG(CAM_CRM,
@@ -831,7 +834,8 @@ static int __cam_req_mgr_check_sync_for_mslave(

			if ((sync_link->req.in_q->slot[sync_slot_idx].status !=
				CRM_SLOT_STATUS_REQ_APPLIED) &&
				((sync_slot_idx - rd_idx) >= 1) &&
				(((sync_slot_idx - rd_idx + sync_num_slots) %
				sync_num_slots) >= 1) &&
				(sync_link->req.in_q->slot[rd_idx].status !=
				CRM_SLOT_STATUS_REQ_APPLIED)) {
				CAM_DBG(CAM_CRM,
@@ -888,6 +892,7 @@ static int __cam_req_mgr_check_sync_req_is_ready(
	struct cam_req_mgr_core_link *sync_link = NULL;
	int64_t req_id = 0;
	int sync_slot_idx = 0, sync_rd_idx = 0, rc = 0;
	int32_t sync_num_slots = 0;

	if (!link->sync_link) {
		CAM_ERR(CAM_CRM, "Sync link null");
@@ -896,6 +901,7 @@ static int __cam_req_mgr_check_sync_req_is_ready(

	sync_link = link->sync_link;
	req_id = slot->req_id;
	sync_num_slots = sync_link->req.in_q->num_slots;

	CAM_DBG(CAM_REQ,
		"link_hdl %x req %lld frame_skip_flag %d ",
@@ -940,7 +946,8 @@ static int __cam_req_mgr_check_sync_req_is_ready(
	sync_rd_idx = sync_link->req.in_q->rd_idx;
	if ((sync_link->req.in_q->slot[sync_slot_idx].status !=
		CRM_SLOT_STATUS_REQ_APPLIED) &&
		((sync_slot_idx - sync_rd_idx) >= 1) &&
		(((sync_slot_idx - sync_rd_idx + sync_num_slots) %
		sync_num_slots) >= 1) &&
		(sync_link->req.in_q->slot[sync_rd_idx].status !=
		CRM_SLOT_STATUS_REQ_APPLIED)) {
		CAM_DBG(CAM_CRM,