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

Commit 4592f1d8 authored by Abhijit Kulkarni's avatar Abhijit Kulkarni Committed by Abhijith Desai
Browse files

msm: mdss: fix secure buffer ref counting



Fix ref counting of the secure buffers. This change releases
the ref count on the secure buffers during the free operation.
This allows the buffers to be ref counted until hw has done
fetching from the buffers.

CRs-Fixed: 2012323
Change-Id: Ic24c39e75d502ed73453d0c6d78fd76448737697
Signed-off-by: default avatarAbhijit Kulkarni <kabhijit@codeaurora.org>
parent 2057d116
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -743,6 +743,7 @@ struct mdss_mdp_img_data {
	struct dma_buf *srcp_dma_buf;
	struct dma_buf_attachment *srcp_attachment;
	struct sg_table *srcp_table;
	struct ion_handle *ihandle;
};

enum mdss_mdp_data_state {
+12 −13
Original line number Diff line number Diff line
@@ -969,7 +969,9 @@ static int mdss_mdp_put_img(struct mdss_mdp_img_data *data, bool rotator,
		 * be filled due to map call which will be unmapped above.
		 *
		 */
		pr_debug("skip memory unmapping for secure display content\n");
		if (data->ihandle)
			ion_free(iclient, data->ihandle);
		pr_debug("free memory handle for secure display/camera content\n");
	} else {
		return -ENOMEM;
	}
@@ -1048,19 +1050,18 @@ static int mdss_mdp_get_img(struct msmfb_data *img,
			ret = 0;
			goto done;
		} else {
			struct ion_handle *ihandle = NULL;
			struct sg_table *sg_ptr = NULL;

			do {
				ihandle = ion_import_dma_buf_fd(iclient,
			data->ihandle = ion_import_dma_buf_fd(iclient,
					img->memory_id);
				if (IS_ERR_OR_NULL(ihandle)) {
			if (IS_ERR_OR_NULL(data->ihandle)) {
				ret = -EINVAL;
				pr_err("ion import buffer failed\n");
					break;
				data->ihandle = NULL;
				goto done;
			}

				sg_ptr = ion_sg_table(iclient, ihandle);
			do {
				sg_ptr = ion_sg_table(iclient, data->ihandle);
				if (sg_ptr == NULL) {
					pr_err("ion sg table get failed\n");
					ret = -EINVAL;
@@ -1086,8 +1087,6 @@ static int mdss_mdp_get_img(struct msmfb_data *img,
				ret = 0;
			} while (0);

			if (!IS_ERR_OR_NULL(ihandle))
				ion_free(iclient, ihandle);
			return ret;
		}
	}