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

Commit 1e0cbdfb authored by Huaibin Yang's avatar Huaibin Yang Committed by Stephen Boyd
Browse files

msm_fb: display: change ion memory map for mdp mixer2 writeback



One way that mdp mixer2 gets writeback address is to get ion memory fd
from userspace, then mdp driver maps this fd in kernel. When mdp iommu
domain was not enabled, this maps to a physical address. Now after mdp
iommu domain is enabled, the map is changed to an iommu virtual addr.

Change-Id: I461a00cc93169de586565834af4fb9a43949cf95
Signed-off-by: default avatarHuaibin Yang <huaibiny@codeaurora.org>
parent d7c9e1d3
Loading
Loading
Loading
Loading
+27 −11
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@
#include <linux/delay.h>
#include <mach/hardware.h>
#include <linux/io.h>

#include <mach/iommu_domains.h>
#include <asm/system.h>
#include <asm/mach-types.h>
#include <linux/semaphore.h>
@@ -407,11 +407,10 @@ static struct msmfb_writeback_data_list *get_if_registered(
			pr_err("%s: out of memory\n", __func__);
			goto register_alloc_fail;
		}

		temp->ihdl = NULL;
		if (data->iova)
			temp->addr = (void *)(data->iova + data->offset);
#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
		else {
		else if (mfd->iclient) {
			struct ion_handle *srcp_ihdl;
			ulong len;
			srcp_ihdl = ion_import_fd(mfd->iclient,
@@ -420,22 +419,30 @@ static struct msmfb_writeback_data_list *get_if_registered(
				pr_err("%s: ion import fd failed\n", __func__);
				goto register_ion_fail;
			}
			if (ion_phys(mfd->iclient,

			if (ion_map_iommu(mfd->iclient,
					  srcp_ihdl,
					  DISPLAY_DOMAIN,
					  GEN_POOL,
					  SZ_4K,
					  0,
					  (ulong *)&temp->addr,
				     (size_t *)&len)) {
				pr_err("%s: unable to get ion phys\n",
					  (ulong *)&len,
					  0,
					  ION_IOMMU_UNMAP_DELAYED)) {
				ion_free(mfd->iclient, srcp_ihdl);
				pr_err("%s: unable to get ion mapping addr\n",
				       __func__);
				goto register_ion_fail;
			}
			temp->addr += data->offset;
			temp->ihdl = srcp_ihdl;
		}
#else
		else {
			pr_err("%s: only support ion memory\n", __func__);
			goto register_ion_fail;
		}
#endif

		memcpy(&temp->buf_info, data, sizeof(struct msmfb_data));
		if (mdp4_overlay_writeback_register_buffer(mfd, temp)) {
			pr_err("%s: error registering node\n", __func__);
@@ -514,6 +521,15 @@ int mdp4_writeback_dequeue_buffer(struct fb_info *info, struct msmfb_data *data)
		list_del(&node->active_entry);
		node->state = WITH_CLIENT;
		memcpy(data, &node->buf_info, sizeof(struct msmfb_data));
		if (!data->iova)
			if (mfd->iclient && node->ihdl) {
				ion_unmap_iommu(mfd->iclient,
						node->ihdl,
						DISPLAY_DOMAIN,
						GEN_POOL);
				ion_free(mfd->iclient,
					 node->ihdl);
			}
	} else {
		pr_err("node is NULL. Somebody else dequeued?\n");
		rc = -ENOBUFS;
+1 −0
Original line number Diff line number Diff line
@@ -60,6 +60,7 @@ struct msmfb_writeback_data_list {
	struct list_head registered_entry;
	struct list_head active_entry;
	void *addr;
	struct ion_handle *ihdl;
	struct file *pmem_file;
	struct msmfb_data buf_info;
	struct msmfb_img img;