summaryrefslogtreecommitdiff
path: root/drivers/video/fbdev
diff options
context:
space:
mode:
authorMao Flynn <Flynn@codeaurora.org>2014-11-07 15:32:26 +0800
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-23 20:38:04 -0700
commitbcba569a2983134fa762ac1463b3420f7a70a71f (patch)
tree796aff9279c98a9649e646c31c1bc6badaa9266a /drivers/video/fbdev
parent7e922f7501a928b5e2cca3555b90da862f0523a8 (diff)
msm: mdss: add a fb type for fb mmap ioctl
Using fb mmap, we can get a buffer from ion handle, or from a fixed adress physical continuous memory. Earlier if mmap is called more than once then ion handle won't be NULL and fb would allocate using physical continuous memory. Fix this to ensure the type of fb allocation is correct by storing fb map type. Conflicts: drivers/video/msm/mdss/mdss_fb.h Change-Id: I2b47b08b7fcb06f8220fcfe8852f5c2e37ade628 Signed-off-by: Mao Flynn <Flynn@codeaurora.org> Signed-off-by: Jayant Shekhar <jshekhar@codeaurora.org> Signed-off-by: Ujwal Patel <ujwalp@codeaurora.org>
Diffstat (limited to 'drivers/video/fbdev')
-rw-r--r--drivers/video/fbdev/msm/mdss_fb.c20
-rw-r--r--drivers/video/fbdev/msm/mdss_fb.h14
2 files changed, 28 insertions, 6 deletions
diff --git a/drivers/video/fbdev/msm/mdss_fb.c b/drivers/video/fbdev/msm/mdss_fb.c
index cea000d7a9fa..701537721fc8 100644
--- a/drivers/video/fbdev/msm/mdss_fb.c
+++ b/drivers/video/fbdev/msm/mdss_fb.c
@@ -1667,9 +1667,9 @@ static int mdss_fb_fbmem_ion_mmap(struct fb_info *info,
vma->vm_page_prot =
pgprot_writecombine(vma->vm_page_prot);
- pr_debug("vma=%p, addr=%x len=%ld",
+ pr_debug("vma=%p, addr=%x len=%ld\n",
vma, (unsigned int)addr, len);
- pr_cont("vm_start=%x vm_end=%x vm_page_prot=%ld\n",
+ pr_debug("vm_start=%x vm_end=%x vm_page_prot=%ld\n",
(unsigned int)vma->vm_start,
(unsigned int)vma->vm_end,
(unsigned long int)vma->vm_page_prot);
@@ -1743,13 +1743,21 @@ static int mdss_fb_physical_mmap(struct fb_info *info,
static int mdss_fb_mmap(struct fb_info *info, struct vm_area_struct *vma)
{
struct msm_fb_data_type *mfd = (struct msm_fb_data_type *)info->par;
- int rc = 0;
+ int rc = -EINVAL;
- if (!info->fix.smem_start && !mfd->fb_ion_handle)
+ if (mfd->fb_mmap_type == MDP_FB_MMAP_ION_ALLOC) {
rc = mdss_fb_fbmem_ion_mmap(info, vma);
- else
+ } else if (mfd->fb_mmap_type == MDP_FB_MMAP_PHYSICAL_ALLOC) {
rc = mdss_fb_physical_mmap(info, vma);
-
+ } else {
+ if (!info->fix.smem_start && !mfd->fb_ion_handle) {
+ rc = mdss_fb_fbmem_ion_mmap(info, vma);
+ mfd->fb_mmap_type = MDP_FB_MMAP_ION_ALLOC;
+ } else {
+ rc = mdss_fb_physical_mmap(info, vma);
+ mfd->fb_mmap_type = MDP_FB_MMAP_PHYSICAL_ALLOC;
+ }
+ }
if (rc < 0)
pr_err("fb mmap failed with rc = %d\n", rc);
diff --git a/drivers/video/fbdev/msm/mdss_fb.h b/drivers/video/fbdev/msm/mdss_fb.h
index d5d6d0d6b5ac..83be3ccf4c1f 100644
--- a/drivers/video/fbdev/msm/mdss_fb.h
+++ b/drivers/video/fbdev/msm/mdss_fb.h
@@ -107,6 +107,18 @@ enum mdp_split_mode {
MDP_PINGPONG_SPLIT,
};
+/* enum mdp_mmap_type - Lists the possible mmap type in the device
+ *
+ * @MDP_FB_MMAP_NONE: Unknown type.
+ * @MDP_FB_MMAP_ION_ALLOC: Use ION allocate a buffer for mmap
+ * @MDP_FB_MMAP_PHYSICAL_ALLOC: Use physical buffer for mmap
+ */
+enum mdp_mmap_type {
+ MDP_FB_MMAP_NONE,
+ MDP_FB_MMAP_ION_ALLOC,
+ MDP_FB_MMAP_PHYSICAL_ALLOC,
+};
+
struct disp_info_type_suspend {
int op_enable;
int panel_power_state;
@@ -294,6 +306,8 @@ struct msm_fb_data_type {
u32 wait_for_kickoff;
u32 thermal_level;
+
+ int fb_mmap_type;
};
static inline void mdss_fb_update_notify_update(struct msm_fb_data_type *mfd)