[U-Boot] [PATCH] video: cfb_console: flush dcache for frame buffer in DRAM

Marek Vasut marex at denx.de
Mon Apr 30 17:21:51 CEST 2012


Dear Anatolij Gustschin,

> Hi,
> 
> On Mon, 30 Apr 2012 04:25:50 +0200
> Marek Vasut <marex at denx.de> wrote:
> ...
> 
> > > observed with cfb on beageboard and N900 when running with data
> > > cache enabled.
> > 
> > beagleboard ;-)
> 
> Thanks for catching that!!
> 
> ...
> 
> > > @@ -553,6 +557,8 @@ static void video_drawchars(int xx, int yy,
> > > unsigned char *s, int count) SWAP32((video_font_draw_table32
> > > 
> > >  						[bits & 15][3] & eorx) ^ bgx);
> > >  			
> > >  			}
> > > 
> > > +			if (cfb_do_flush_cache)
> > > +				flush_cache((ulong)dest0, 32);
> > 
> > flush_dcache_range() ?
> 
> I would have to calculate the end address, then. flush_cache() already
> does it for me :-)

Well ... that's correct. Maybe someone should rename it to flush_dcache_size() 
or something ...

> 
> ...
> 
> > > @@ -1651,6 +1661,29 @@ static void *video_logo(void)
> > > 
> > >  }
> > >  #endif
> > > 
> > > +static int cfb_fb_is_in_dram(void)
> > > +{
> > > +	bd_t *bd = gd->bd;
> > > +	ulong start, end;
> > > +	int i;
> > > +
> > > +	for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
> > > +#if defined(CONFIG_ARM) || defined(CONFIG_AVR32) ||
> > > defined(COFNIG_NDS32)
> > > 
> > > || \ +defined(CONFIG_SANDBOX) || defined(CONFIG_X86)
> > > 
> > > +		start = bd->bi_dram[i].start;
> > > +		end = bd->bi_dram[i].start + bd->bi_dram[i].size - 1;
> > > +#else
> > > +		start = bd->bi_memstart;
> > > +		end = bd->bi_memsize;
> > > +#endif
> > > +
> > > +		if ((ulong)video_fb_address >= start &&
> > > +		    (ulong)video_fb_address < end)
> > > +			return 1;
> > > +	}
> > > +	return 0;
> > > +}
> > 
> > Can't you have SRAM cached too? ;-)
> 
> I do not know. But who will put the framebuffer into SRAM?
> It is not big enough.

Someone who has small LCD and wants to save dram bandwidth (oh, this sentence 
sounds stupid on its own). But maybe if you want to use LCD in SPL?
> 
> Thanks,
> Anatolij

Best regards,
Marek Vasut


More information about the U-Boot mailing list