[U-Boot] [PATCH RESEND] video:cache:fix: Buffer alignment and dcache flush for lcd subsystem

Wolfgang Denk wd at denx.de
Sun Jan 6 21:21:00 CET 2013


Dear Lukasz & Simon,

In message
<CAPnjgZ3tfvRJO-16ncwE43hPptdMEtOmPEK7pfeLkrMn-rVrgw at mail.gmail.com>
Simon Glass wrote:
> 
> >> > -       dst = malloc(CONFIG_SYS_VIDEO_LOGO_MAX_SIZE);
> >> > +       dst = memalign(CONFIG_SYS_CACHELINE_SIZE, len);
> >>
> >> Why do you need to align this one? It is just returned to the caller,
> >> isn't it?
> >
> > Yes, it is returned to the caller, but afterwards lcd_display_bitmap
> > takes this pointer (and thereof probably unaligned buffer) and works on
> > it. (At least in the case of trats the bmp is gzipped).
> 
> OK, so it is directly used as a frame buffer? In that case it looks
> right to me. I doubt you want to be able to control the cache features
> for this area, since you only write it once. But if you did, then the
> memory would currently need to be section-aligned.

I don't think this is as it should be.  Any frame buffer that actually
gets used as such should be located in the memory area specifically
allocated for this purpose using lcd_setmem().  This is especially
important when you load a splash screen image and intend to display it
flicker-free when booting an OS.  If you use malloc() or memalign(),
it will be memory in the malloc arena, which gets overwritten when an
OS boots, resulting in a corrupted display.

Note: I added Anatolij, our video custodian to the Cc: list.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
If you think the problem is bad now, just wait until we've solved it.
                                                        Epstein's Law


More information about the U-Boot mailing list