bcm2835 video: Map fb as cached
authorAlexander Graf <agraf@suse.de>
Thu, 24 Mar 2016 09:31:11 +0000 (10:31 +0100)
committerTom Rini <trini@konsulko.com>
Sun, 27 Mar 2016 13:12:19 +0000 (09:12 -0400)
The bcm2835 frame buffer is in RAM, so we can easily map it as cached and gain
all the glorious performance boost that brings with it.

Signed-off-by: Alexander Graf <agraf@suse.de>
Tested-by: Stephen Warren <swarren@wwwdotorg.org>
Acked-by: Stephen Warren <swarren@wwwdotorg.org>
drivers/video/bcm2835.c

index bff1fcb9eaf7eb9ed293b0a752051b9740dbf95e..cd605e632cb606c84754c24b6ca1590db9a22ab7 100644 (file)
@@ -44,6 +44,7 @@ void lcd_ctrl_init(void *lcdbase)
        ALLOC_CACHE_ALIGN_BUFFER(struct msg_setup, msg_setup, 1);
        int ret;
        u32 w, h;
+       u32 fb_start, fb_end;
 
        debug("bcm2835: Query resolution...\n");
 
@@ -106,6 +107,14 @@ void lcd_ctrl_init(void *lcdbase)
 
        gd->fb_base = bus_to_phys(
                msg_setup->allocate_buffer.body.resp.fb_address);
+
+       /* Enable dcache for the frame buffer */
+       fb_start = gd->fb_base & ~(MMU_SECTION_SIZE - 1);
+       fb_end = gd->fb_base + msg_setup->allocate_buffer.body.resp.fb_size;
+       fb_end = ALIGN(fb_end, 1 << MMU_SECTION_SHIFT);
+       mmu_set_region_dcache_behaviour(fb_start, fb_end - fb_start,
+               DCACHE_WRITEBACK);
+       lcd_set_flush_dcache(1);
 }
 
 void lcd_enable(void)