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

Commit 6e2d3ce4 authored by Benjamin Chan's avatar Benjamin Chan
Browse files

msm: sde: remove ion usage in sde rotator



ion_alloc support is deprecated, so all internal buffers allocation
in sde rotator that use dmabuf need to maintain its own dmabuf
implementation. Current dmabuf implementation is only for supporting a
small 4Kb single page memory block, which is only used for sw timestamp
support. This patch also make changes to secure camera buffer mapping
which align to ion allocation providing dmabuf fd directly, and there
is no need to perform ion handle import.

Change-Id: Ic7f7090e2d2a93645ad09263ffa66b55f5853c22
Signed-off-by: default avatarBenjamin Chan <bkchan@codeaurora.org>
parent fa87e05c
Loading
Loading
Loading
Loading
+0 −9
Original line number Diff line number Diff line
@@ -846,15 +846,6 @@ int sde_rotator_base_init(struct sde_rot_data_type **pmdata,
		goto probe_done;
	}

	mdata->iclient = msm_ion_client_create(mdata->pdev->name);
	if (IS_ERR_OR_NULL(mdata->iclient)) {
		SDEROT_ERR("msm_ion_client_create() return error (%pK)\n",
				mdata->iclient);
		mdata->iclient = NULL;
		rc = -EFAULT;
		goto probe_done;
	}

	*pmdata = mdata;

	return 0;
+0 −2
Original line number Diff line number Diff line
@@ -264,8 +264,6 @@ struct sde_rot_data_type {
	struct sde_rot_lut_cfg lut_cfg[SDE_ROT_OP_MAX];
	struct sde_rot_lut_cfg inline_lut_cfg[SDE_ROT_OP_MAX];

	struct ion_client *iclient;

	bool clk_always_on;
};

+0 −1
Original line number Diff line number Diff line
@@ -573,7 +573,6 @@ static int sde_rotator_import_buffer(struct sde_layer_buffer *buffer,
		planes[i].memory_id = buffer->planes[i].fd;
		planes[i].offset = buffer->planes[i].offset;
		planes[i].buffer = buffer->planes[i].buffer;
		planes[i].handle = buffer->planes[i].handle;
		planes[i].addr = buffer->planes[i].addr;
		planes[i].len = buffer->planes[i].len;
	}
+13 −30
Original line number Diff line number Diff line
@@ -17,8 +17,6 @@
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/regulator/consumer.h>
#include <linux/ion.h>
#include <linux/msm_ion.h>
#include <linux/delay.h>
#include <linux/wait.h>
#include <linux/of.h>
@@ -544,7 +542,6 @@ static void *sde_rotator_get_userptr(struct device *dev,
	struct sde_rotator_ctx *ctx = (struct sde_rotator_ctx *)dev;
	struct sde_rotator_device *rot_dev = ctx->rot_dev;
	struct sde_rotator_buf_handle *buf;
	struct ion_client *iclient = rot_dev->mdata->iclient;

	buf = kzalloc(sizeof(*buf), GFP_KERNEL);
	if (!buf)
@@ -554,20 +551,7 @@ static void *sde_rotator_get_userptr(struct device *dev,
	buf->secure = ctx->secure || ctx->secure_camera;
	buf->ctx = ctx;
	buf->rot_dev = rot_dev;
	if (ctx->secure_camera) {
		buf->handle = ion_import_dma_buf_fd(iclient,
				buf->fd);
		if (IS_ERR_OR_NULL(buf->handle)) {
			SDEDEV_ERR(rot_dev->dev,
				"fail get ion_handler fd:%d r:%ld\n",
				buf->fd, PTR_ERR(buf->buffer));
			goto error_buf_get;
		}
		SDEDEV_DBG(rot_dev->dev,
				"get ion_handle s:%d fd:%d buf:%pad\n",
				buf->ctx->session_id,
				buf->fd, &buf->handle);
	} else {
	buf->size = size;
	buf->buffer = dma_buf_get(buf->fd);
	if (IS_ERR_OR_NULL(buf->buffer)) {
		SDEDEV_ERR(rot_dev->dev,
@@ -579,7 +563,6 @@ static void *sde_rotator_get_userptr(struct device *dev,
			"get dmabuf s:%d fd:%d buf:%pad\n",
			buf->ctx->session_id,
			buf->fd, &buf->buffer);
	}

	return buf;
error_buf_get:
@@ -2970,15 +2953,15 @@ static int sde_rotator_process_buffers(struct sde_rotator_ctx *ctx,
	/* fill in item work structure */
	sde_rotator_get_item_from_ctx(ctx, &item);
	item.flags |= SDE_ROTATION_EXT_DMA_BUF;
	item.input.planes[0].fd = src_handle->fd;
	item.input.planes[0].buffer = src_handle->buffer;
	item.input.planes[0].handle = src_handle->handle;
	item.input.planes[0].offset = src_handle->addr;
	item.input.planes[0].stride = ctx->format_out.fmt.pix.bytesperline;
	item.input.plane_count = 1;
	item.input.fence = NULL;
	item.input.comp_ratio = vbinfo_out->comp_ratio;
	item.output.planes[0].fd = dst_handle->fd;
	item.output.planes[0].buffer = dst_handle->buffer;
	item.output.planes[0].handle = dst_handle->handle;
	item.output.planes[0].offset = dst_handle->addr;
	item.output.planes[0].stride = ctx->format_cap.fmt.pix.bytesperline;
	item.output.plane_count = 1;
+1 −4
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@
#include <linux/types.h>
#include <linux/atomic.h>
#include <linux/slab.h>
#include <linux/ion.h>
#include <linux/ktime.h>
#include <linux/iommu.h>
#include <linux/dma-buf.h>
@@ -54,17 +53,15 @@ struct sde_rotator_ctx;
 * @addr: Address of rotator mmu mapped buffer.
 * @secure: Non-secure/secure buffer.
 * @buffer: Pointer to dma buf associated with this fd.
 * @ihandle: ion handle associated with this fd
 */
struct sde_rotator_buf_handle {
	int fd;
	struct sde_rotator_device *rot_dev;
	struct sde_rotator_ctx *ctx;
	unsigned long size;
	ion_phys_addr_t addr;
	dma_addr_t addr;
	int secure;
	struct dma_buf *buffer;
	struct ion_handle *handle;
};

/*
Loading