diff options
| author | Adrian Salido-Moreno <adrianm@codeaurora.org> | 2012-08-13 16:46:01 -0700 |
|---|---|---|
| committer | David Keitel <dkeitel@codeaurora.org> | 2016-03-23 20:11:54 -0700 |
| commit | f968c63eee475a5e0a40f3b1e648c7c8631d7438 (patch) | |
| tree | 73b200b8fc86e833bfd3e17b5c65deb27234b3dc /drivers | |
| parent | 17143f49b3591bf6de1fb83147612439a093df32 (diff) | |
msm: mdss: allocate framebuffer memory from ion pool
When panel size is increased dma_alloc_coherent is not able to find
a chunk of contiguous memory big enough to hold framebuffer, this causes
framebuffer initialization to fail. Allocate buffer from ion pool which
has reserved contiguous memory at earlier stage.
Change-Id: Ibf7e3f7fc2c7ad991d69c106bbb6a9dd4c7f0e79
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/video/fbdev/msm/mdss_fb.c | 26 | ||||
| -rw-r--r-- | drivers/video/fbdev/msm/mdss_fb.h | 2 |
2 files changed, 23 insertions, 5 deletions
diff --git a/drivers/video/fbdev/msm/mdss_fb.c b/drivers/video/fbdev/msm/mdss_fb.c index 63f6fea3c55b..f297203c26a7 100644 --- a/drivers/video/fbdev/msm/mdss_fb.c +++ b/drivers/video/fbdev/msm/mdss_fb.c @@ -611,11 +611,27 @@ static int mdss_fb_alloc_fbmem(struct msm_fb_data_type *mfd) size *= mfd->fb_page; if (mfd->index == 0) { - virt = dma_alloc_coherent(NULL, size, (dma_addr_t *) &phys, - GFP_KERNEL); - if (!virt) { - pr_err("unable to alloc fb memory size=%u\n", size); - return -ENOMEM; + struct ion_client *iclient = mfd->iclient; + + if (iclient) { + mfd->ihdl = ion_alloc(iclient, size, SZ_4K, + ION_HEAP(ION_CP_MM_HEAP_ID) | + ION_HEAP(ION_SF_HEAP_ID)); + if (IS_ERR_OR_NULL(mfd->ihdl)) { + pr_err("unable to alloc fbmem from ion (%p)\n", + mfd->ihdl); + return -ENOMEM; + } + + virt = ion_map_kernel(iclient, mfd->ihdl, 0); + ion_phys(iclient, mfd->ihdl, &phys, &size); + } else { + virt = dma_alloc_coherent(NULL, size, + (dma_addr_t *) &phys, GFP_KERNEL); + if (!virt) { + pr_err("unable to alloc fbmem size=%u\n", size); + return -ENOMEM; + } } pr_info("allocating %u bytes at %p (%lx phys) for fb %d\n", diff --git a/drivers/video/fbdev/msm/mdss_fb.h b/drivers/video/fbdev/msm/mdss_fb.h index 98c967d5f558..010fe4df0dd9 100644 --- a/drivers/video/fbdev/msm/mdss_fb.h +++ b/drivers/video/fbdev/msm/mdss_fb.h @@ -75,6 +75,8 @@ struct msm_fb_data_type { struct fb_cmap *cmap); int (*do_histogram) (struct fb_info *info, struct mdp_histogram *hist); + + struct ion_handle *ihdl; void *cursor_buf; void *cursor_buf_phys; |
