[Linaro-mm-sig] [PATCH] RFC: dma-buf: userspace mmap support

Marcus Lorentzon marcus.xm.lorentzon at stericsson.com
Mon Mar 19 10:10:48 PDT 2012


On 03/19/2012 05:56 PM, Alan Cox wrote:
>> display controller will be reading the front buffer, but the GPU
>> >  might also need to read that front buffer. So perhaps adding
>> >  "read-only"&  "read-write" access flags to prepare could also be
>> >  interpreted as shared&  exclusive accesses, if we went down this
>> >  route for synchronization that is.:-)
> mmap includes read/write info so probably using that works out. It also
> means that you have the stuff mapped in a way that will bus error or
> segfault anyone who goofs rather than give them the usual 'deep
> weirdness' behaviour you get with mishandling of caching bits.
>
> Alan
mmap only give you this info at time of mmap call. prepare/finish would 
give you this info for each CPU access to the buffer (assuming mmap 
lasts multiple frames). Which means that you can optimize and have zero 
cache syncs for frames where CPU doesn't touch the buffer at all. If you 
use mmap info, then you would be forced to sync cache before each GPU 
access to the buffer. For example sub texture updates in glyph caches. 
They will only rarely change, so you don't want to sync CPU cache each 
time buffer is used in GPU, just because mmap says CPU has write access.

/Marcus



More information about the dri-devel mailing list