diff options
author | Sebastien Jan <s-jan@ti.com> | 2011-04-07 08:43:57 +0100 |
---|---|---|
committer | Andy Green <andy.green@linaro.org> | 2011-04-07 08:43:57 +0100 |
commit | 5406a71021a4a5dd844984f7e5d938d126d286f0 (patch) | |
tree | e1c6565313af48da626aea6737232b52ed8a6c69 | |
parent | c61875d1c1ed5adda2713384b3e50006255382c6 (diff) |
OMAPFB: re-allocate FB if needed on resize notification
Note that re-allocating can fragment vram, so to avoid re-allocation,
pre-assign FB size with kernel bootargs like:
omapfb.vram=0:8M,1:8M
Note: prevent the console accessing the FB while re-allocation is running.
Other early FB users would be an issue as well.
Signed-off-by: Sebastien Jan <s-jan@ti.com>
-rw-r--r-- | drivers/video/omap2/omapfb/omapfb-main.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/video/omap2/omapfb/omapfb-main.c b/drivers/video/omap2/omapfb/omapfb-main.c index f99e2ee16ce..2bd90ca93d6 100644 --- a/drivers/video/omap2/omapfb/omapfb-main.c +++ b/drivers/video/omap2/omapfb/omapfb-main.c @@ -1905,9 +1905,11 @@ static void omapfb_free_resources(struct omapfb2_device *fbdev) static void size_notify(struct fb_info *fbi, int w, int h) { + struct omapfb_info *ofbi = FB2OFB(fbi); struct fb_var_screeninfo var = fbi->var; struct fb_var_screeninfo saved_var = fbi->var; int orig_flags; + int new_size = (w * var.bits_per_pixel >> 3) * h; DBG("size_notify: %dx%d\n", w, h); @@ -1919,6 +1921,14 @@ static void size_notify(struct fb_info *fbi, int w, int h) console_lock(); + /* Try to increase memory allocated for FB, if needed */ + if (new_size > ofbi->region->size) { + DBG("re-allocating FB - old size: %ld - new size: %d\n", ofbi->region->size, new_size); + omapfb_get_mem_region(ofbi->region); + omapfb_realloc_fbmem(fbi, new_size, 0); + omapfb_put_mem_region(ofbi->region); + } + /* this ensures fbdev clients, like the console driver, get notified about * the change: */ |