diff options
author | Sebastien Jan <s-jan@ti.com> | 2011-05-03 12:18:44 +0800 |
---|---|---|
committer | Ricardo Salveti de Araujo <ricardo.salveti@canonical.com> | 2011-05-16 22:42:13 -0300 |
commit | 438b6af89efd97a7d218db48508ac228abbddc62 (patch) | |
tree | fbedc5bcfc042ea7a0ab6bb994c5dce580b80244 /drivers/video/omap2/omapfb/omapfb-main.c | |
parent | 17fe32fa959d510576cfc4dceda751e85070bb14 (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>
Diffstat (limited to 'drivers/video/omap2/omapfb/omapfb-main.c')
-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: */ |