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

Commit d80a8695 authored by Peter Liu's avatar Peter Liu
Browse files

msm: camera: isp: put scratch buffer on last VFE detach



Put scratch buffer and detach only when last detach comes.
This will avoid page fault on dual session operation.

Change-Id: I5dab692bf90db5a8247e875ab18f61303c54ad94
Signed-off-by: default avatarPeter Liu <pingchie@codeaurora.org>
parent 8b477bbf
Loading
Loading
Loading
Loading
+13 −10
Original line number Diff line number Diff line
@@ -1205,11 +1205,15 @@ int msm_isp_smmu_attach(struct msm_isp_buf_mgr *buf_mgr,
		if (rc)
			goto err3;
	} else {
		if (buf_mgr->attach_ref_cnt > 0)
			buf_mgr->attach_ref_cnt--;
		else
			pr_err("%s: Error! Invalid ref_cnt %d\n",
				__func__, buf_mgr->attach_ref_cnt);

		if (buf_mgr->attach_ref_cnt == 0) {
			rc = msm_isp_buf_put_scratch(buf_mgr);
		if (rc)
			goto done;
		if (buf_mgr->attach_ref_cnt == 1) {
			rc = cam_smmu_ops(buf_mgr->img_iommu_hdl,
			rc |= cam_smmu_ops(buf_mgr->img_iommu_hdl,
				CAM_SMMU_DETACH);
			rc |= cam_smmu_ops(buf_mgr->stats_iommu_hdl,
				CAM_SMMU_DETACH);
@@ -1218,14 +1222,11 @@ int msm_isp_smmu_attach(struct msm_isp_buf_mgr *buf_mgr,
					__func__, rc);
			}
		}
		if (buf_mgr->attach_ref_cnt > 0)
			buf_mgr->attach_ref_cnt--;
		else
			pr_err("%s: Error! Invalid ref_cnt\n", __func__);
	}
done:

	mutex_unlock(&buf_mgr->lock);
	return rc;

err3:
	if (cam_smmu_ops(buf_mgr->stats_iommu_hdl, CAM_SMMU_DETACH))
		pr_err("%s: stats iommu detach fail\n", __func__);
@@ -1255,6 +1256,7 @@ static int msm_isp_init_isp_buf_mgr(
		return rc;
	}
	CDBG("%s: E\n", __func__);
	buf_mgr->attach_ref_cnt = 0;

	INIT_LIST_HEAD(&buf_mgr->buffer_q);
	buf_mgr->num_buf_q = num_buf_q;
@@ -1313,6 +1315,7 @@ static int msm_isp_deinit_isp_buf_mgr(
	cam_smmu_destroy_handle(buf_mgr->img_iommu_hdl);
	cam_smmu_destroy_handle(buf_mgr->stats_iommu_hdl);

	buf_mgr->attach_ref_cnt = 0;
	mutex_unlock(&buf_mgr->lock);
	return 0;
}