summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeevan Shriram <jshriram@codeaurora.org>2014-03-27 10:53:40 -0700
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-23 20:31:46 -0700
commitd7580b4b6570db04212bb67d6354e1b9c8ea1047 (patch)
tree8eb174dce4aff4cd0e2547d3b581c83052d28629
parenta757da753ba245af254d14131f76fbee29d5c3cc (diff)
msm: mdss: share fb memory ion fd to userspace
Add new operation request to share ion fd to userspace for mapping to the frame buffer memory. Change-Id: I404c73c19e3fffec593ffd32c34e7b1a74a500d8 Signed-off-by: Jeevan Shriram <jshriram@codeaurora.org>
-rw-r--r--drivers/video/fbdev/msm/mdss_fb.c6
-rw-r--r--drivers/video/fbdev/msm/mdss_fb.h1
-rw-r--r--drivers/video/fbdev/msm/mdss_mdp_overlay.c10
-rw-r--r--include/uapi/linux/msm_mdp.h2
4 files changed, 18 insertions, 1 deletions
diff --git a/drivers/video/fbdev/msm/mdss_fb.c b/drivers/video/fbdev/msm/mdss_fb.c
index 1c1a45007078..7d0466f7118b 100644
--- a/drivers/video/fbdev/msm/mdss_fb.c
+++ b/drivers/video/fbdev/msm/mdss_fb.c
@@ -22,6 +22,7 @@
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/dma-mapping.h>
+#include <linux/dma-buf.h>
#include <linux/fb.h>
#include <linux/init.h>
#include <linux/ioport.h>
@@ -1176,6 +1177,7 @@ void mdss_fb_free_fb_ion_memory(struct msm_fb_data_type *mfd)
mfd->mdp.fb_mem_get_iommu_domain(), 0);
}
+ dma_buf_put(mfd->fbmem_buf);
ion_free(mfd->fb_ion_client, mfd->fb_ion_handle);
mfd->fb_ion_handle = NULL;
}
@@ -1219,9 +1221,11 @@ int mdss_fb_alloc_fb_ion_memory(struct msm_fb_data_type *mfd, size_t fb_size)
} else {
pr_err("No IOMMU Domain");
goto fb_mmap_failed;
-
}
+ mfd->fbmem_buf = ion_share_dma_buf(mfd->fb_ion_client,
+ mfd->fb_ion_handle);
+
vaddr = ion_map_kernel(mfd->fb_ion_client, mfd->fb_ion_handle);
if (IS_ERR_OR_NULL(vaddr)) {
pr_err("ION memory mapping failed - %ld\n", PTR_ERR(vaddr));
diff --git a/drivers/video/fbdev/msm/mdss_fb.h b/drivers/video/fbdev/msm/mdss_fb.h
index c9de438530a2..6b9a9246905a 100644
--- a/drivers/video/fbdev/msm/mdss_fb.h
+++ b/drivers/video/fbdev/msm/mdss_fb.h
@@ -254,6 +254,7 @@ struct msm_fb_data_type {
struct list_head proc_list;
struct ion_client *fb_ion_client;
struct ion_handle *fb_ion_handle;
+ struct dma_buf *fbmem_buf;
bool mdss_fb_split_stored;
diff --git a/drivers/video/fbdev/msm/mdss_mdp_overlay.c b/drivers/video/fbdev/msm/mdss_mdp_overlay.c
index cb3e33fc8760..a0a4bd53e9f9 100644
--- a/drivers/video/fbdev/msm/mdss_mdp_overlay.c
+++ b/drivers/video/fbdev/msm/mdss_mdp_overlay.c
@@ -13,6 +13,7 @@
#define pr_fmt(fmt) "%s: " fmt, __func__
+#include <linux/dma-buf.h>
#include <linux/dma-mapping.h>
#include <linux/errno.h>
#include <linux/kernel.h>
@@ -2672,6 +2673,15 @@ static int mdss_fb_get_metadata(struct msm_fb_data_type *mfd,
case metadata_op_get_caps:
ret = mdss_fb_get_hw_caps(mfd, &metadata->data.caps);
break;
+ case metadata_op_get_ion_fd:
+ if (mfd->fb_ion_handle) {
+ metadata->data.fbmem_ionfd =
+ dma_buf_fd(mfd->fbmem_buf, 0);
+ if (metadata->data.fbmem_ionfd < 0)
+ pr_err("fd allocation failed. fd = %d\n",
+ metadata->data.fbmem_ionfd);
+ }
+ break;
case metadata_op_crc:
if (!mfd->panel_power_on)
return -EPERM;
diff --git a/include/uapi/linux/msm_mdp.h b/include/uapi/linux/msm_mdp.h
index fc4469c7d528..beb14559d938 100644
--- a/include/uapi/linux/msm_mdp.h
+++ b/include/uapi/linux/msm_mdp.h
@@ -1000,6 +1000,7 @@ enum {
metadata_op_wb_secure,
metadata_op_get_caps,
metadata_op_crc,
+ metadata_op_get_ion_fd,
metadata_op_max
};
@@ -1033,6 +1034,7 @@ struct msmfb_metadata {
uint32_t video_info_code;
struct mdss_hw_caps caps;
uint8_t secure_en;
+ int fbmem_ionfd;
} data;
};