[U-Boot] [PATCH v4 5/5] bcm2835 video: Map fb as cached

Stephen Warren swarren at wwwdotorg.org
Thu Mar 24 03:05:57 CET 2016


On 03/23/2016 06:27 PM, Alexander Graf wrote:
> 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.

Tested-by: Stephen Warren <swarren at wwwdotorg.org>

> diff --git a/drivers/video/bcm2835.c b/drivers/video/bcm2835.c

> @@ -44,6 +44,7 @@ void lcd_ctrl_init(void *lcdbase)

> +	/* Enable dcache for the frame buffer */
> +	fb_start = ALIGN(gd->fb_base, 1 << MMU_SECTION_SHIFT);
> +	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);

Shouldn't the start be rounded down and the end be rounded up to cover 
the entire FB RAM? Normally it might be problematic to push the 
boundaries outside the relevant data block since it would affect 
adjacent memory that might not then be aware of the cache setup. 
However, since the entire FB is in the VC portion of RAM and U-Boot is 
touching nothing else there, it should be fine in this case. (And even 
if it wasn't, the two ALIGNs would still want to move in opposite 
directions; start up and end down).


More information about the U-Boot mailing list