[U-Boot] [PATCH v4 5/5] bcm2835 video: Map fb as cached
Alexander Graf
agraf at suse.de
Thu Mar 24 08:33:08 CET 2016
> Am 24.03.2016 um 03:05 schrieb Stephen Warren <swarren at wwwdotorg.org>:
>
>> 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).
Yes, my bad. I'll send another version.
Alex
More information about the U-Boot
mailing list