diff options
author | Sebastien Jan <s-jan@ti.com> | 2011-06-22 20:40:28 +0100 |
---|---|---|
committer | Andy Green <andy.green@linaro.org> | 2011-06-22 20:40:28 +0100 |
commit | 4697f515974c5ab07ec9f5b5641e65e8b83e4372 (patch) | |
tree | d22781bff9d6b0901db05f91bf5f2e43741c6e0a /drivers | |
parent | 1f476b5dd902edcd7c8997d5aa89af952734b341 (diff) |
Subject: [PATCH 17/19] 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')
-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 65b9ecd7685..4f4e022fec8 100644 --- a/drivers/video/omap2/omapfb/omapfb-main.c +++ b/drivers/video/omap2/omapfb/omapfb-main.c @@ -1872,9 +1872,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); @@ -1886,6 +1888,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: */ |