mdss: fb: Add page protection flag in mmap call

Add page protection flag to avoid screen corruption
in pan display path.

Change-Id: Iae57ee85fd20730f5842629c5cf8778da56a13d3
Signed-off-by: Jeevan Shriram <jshriram@codeaurora.org>
This commit is contained in:
Jeevan Shriram 2014-06-05 00:41:35 -07:00 committed by David Keitel
parent 729caedfac
commit 1a3d9ad996

View file

@ -1283,6 +1283,11 @@ static int mdss_fb_fbmem_ion_mmap(struct fb_info *info,
}
len = min(len, remainder);
if (mfd->mdp_fb_page_protection ==
MDP_FB_PAGE_PROTECTION_WRITECOMBINE)
vma->vm_page_prot =
pgprot_writecombine(vma->vm_page_prot);
pr_debug("vma=%p, addr=%x len=%ld",
vma, (unsigned int)addr, len);
pr_cont("vm_start=%x vm_end=%x vm_page_prot=%ld\n",
@ -1324,6 +1329,7 @@ static int mdss_fb_physical_mmap(struct fb_info *info,
unsigned long start = info->fix.smem_start;
u32 len = PAGE_ALIGN((start & ~PAGE_MASK) + info->fix.smem_len);
unsigned long off = vma->vm_pgoff << PAGE_SHIFT;
struct msm_fb_data_type *mfd = (struct msm_fb_data_type *)info->par;
if (!start) {
pr_warn("No framebuffer memory is allocated\n");
@ -1333,8 +1339,8 @@ static int mdss_fb_physical_mmap(struct fb_info *info,
/* Set VM flags. */
start &= PAGE_MASK;
if ((vma->vm_end <= vma->vm_start) ||
(off >= len) ||
((vma->vm_end - vma->vm_start) > (len - off)))
(off >= len) ||
((vma->vm_end - vma->vm_start) > (len - off)))
return -EINVAL;
off += start;
if (off < start)
@ -1343,10 +1349,13 @@ static int mdss_fb_physical_mmap(struct fb_info *info,
/* This is an IO map - tell maydump to skip this VMA */
vma->vm_flags |= VM_IO;
if (mfd->mdp_fb_page_protection == MDP_FB_PAGE_PROTECTION_WRITECOMBINE)
vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
/* Remap the frame buffer I/O range */
if (io_remap_pfn_range(vma, vma->vm_start, off >> PAGE_SHIFT,
vma->vm_end - vma->vm_start,
vma->vm_page_prot))
vma->vm_end - vma->vm_start,
vma->vm_page_prot))
return -EAGAIN;
return 0;