aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFancy Fang <chen.fang@freescale.com>2015-10-28 17:16:01 +0800
committerFancy Fang <chen.fang@freescale.com>2015-10-30 17:11:37 +0800
commitc76a37e342369675aa9ef2efde6373d288c2f013 (patch)
treea99a4926cff7603003dd461010d426a7221f33d9
parent898cfb2a754fe93e5e251e53a73de2f3615d1292 (diff)
downloadfreescale-c76a37e342369675aa9ef2efde6373d288c2f013.tar.gz
MLK-11765 video: mxsfb: change the fb buffer managment
The previous fb buffer management has two problems: 1. After reallocate a bigger buffer and free the old buffer, user space app doesn't know this and may continue accessing the old buffer. 2. The freed buffer contents will be lost. So, this patch allocates a big enough fb buffer(32MB) from the beginning and never reallocates it. Signed-off-by: Fancy Fang <chen.fang@freescale.com>
-rw-r--r--drivers/video/mxsfb.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/drivers/video/mxsfb.c b/drivers/video/mxsfb.c
index b69ee353971..ff02dc8a946 100644
--- a/drivers/video/mxsfb.c
+++ b/drivers/video/mxsfb.c
@@ -662,6 +662,15 @@ static int mxsfb_set_par(struct fb_info *fb_info)
if (host->cur_blank != FB_BLANK_UNBLANK)
return 0;
+ line_size = fb_info->var.xres * (fb_info->var.bits_per_pixel >> 3);
+ fb_info->fix.line_length = line_size;
+ fb_size = fb_info->var.yres_virtual * line_size;
+
+ if (fb_size > fb_info->fix.smem_len) {
+ dev_err(&host->pdev->dev, "exceeds the fb buffer size limit!\n");
+ return -ENOMEM;
+ }
+
/*
* It seems, you can't re-program the controller if it is still running.
* This may lead into shifted pictures (FIFO issue?).
@@ -675,19 +684,6 @@ static int mxsfb_set_par(struct fb_info *fb_info)
/* clear the FIFOs */
writel(CTRL1_FIFO_CLEAR, host->base + LCDC_CTRL1 + REG_SET);
- line_size = fb_info->var.xres * (fb_info->var.bits_per_pixel >> 3);
- fb_info->fix.line_length = line_size;
- fb_size = fb_info->var.yres_virtual * line_size;
-
- /* Reallocate memory */
- if (!fb_info->fix.smem_start || (fb_size > fb_info->fix.smem_len)) {
- if (fb_info->fix.smem_start)
- mxsfb_unmap_videomem(fb_info);
-
- if (mxsfb_map_videomem(fb_info) < 0)
- return -ENOMEM;
- }
-
ctrl = CTRL_BYPASS_COUNT | CTRL_MASTER |
CTRL_SET_BUS_WIDTH(host->ld_intf_width);
@@ -1248,6 +1244,7 @@ static int mxsfb_init_fbinfo(struct mxsfb_info *host)
fb_info->fix.line_length =
fb_info->var.xres * (fb_info->var.bits_per_pixel >> 3);
+ fb_info->fix.smem_len = SZ_32M;
/* Memory allocation for framebuffer */
if (mxsfb_map_videomem(fb_info) < 0)