From c2b12cd496bbe5eff6a48bc669fe6b0c56f2b3d9 Mon Sep 17 00:00:00 2001 From: Jonathan Corbet Date: Fri, 23 Apr 2010 10:31:13 -0600 Subject: viafb: Reserve framebuffer memory for the upcoming camera driver The camera engine captures to framebuffer memory, so we need to set some aside for that purpose. There is no proper memory allocator for fbmem; instead, accel.c just trims some space off the top. Alas, without creating that proper memory allocator, the only way to make this work is to hack it into the same bit of code in accel.c. The allocation must happen *after* the others (some code, including user-space XV stuff, makes assumptions on where the cursor space is), and before the rest of the framebuffer is set up. Cc: ScottFang@viatech.com.cn Cc: JosephChan@via.com.tw Cc: Harald Welte Acked-by: Florian Tobias Schandinat Signed-off-by: Jonathan Corbet --- drivers/video/via/accel.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'drivers/video/via/accel.c') diff --git a/drivers/video/via/accel.c b/drivers/video/via/accel.c index e777468..189aba4 100644 --- a/drivers/video/via/accel.c +++ b/drivers/video/via/accel.c @@ -370,6 +370,22 @@ int viafb_init_engine(struct fb_info *info) viapar->shared->vq_vram_addr = viapar->fbmem_free; viapar->fbmem_used += VQ_SIZE; +#if defined(CONFIG_FB_VIA_CAMERA) || defined(CONFIG_FB_VIA_CAMERA_MODULE) + /* + * Set aside a chunk of framebuffer memory for the camera + * driver. Someday this driver probably needs a proper allocator + * for fbmem; for now, we just have to do this before the + * framebuffer initializes itself. + * + * As for the size: the engine can handle three frames, + * 16 bits deep, up to VGA resolution. + */ + viapar->shared->vdev->camera_fbmem_size = 3*VGA_HEIGHT*VGA_WIDTH*2; + viapar->fbmem_free -= viapar->shared->vdev->camera_fbmem_size; + viapar->fbmem_used += viapar->shared->vdev->camera_fbmem_size; + viapar->shared->vdev->camera_fbmem_offset = viapar->fbmem_free; +#endif + /* Init AGP and VQ regs */ switch (chip_name) { case UNICHROME_K8M890: -- cgit v1.1