Tuesday, November 23, 2010

android pmem and ashmem

1.pmem -- allocation code in kernel but used at usermode
ensures that memory is returned as
PAGE_SIZE,offset,len ... PAGE_SIZE,0,len, PAGE_SIZE,0,len
2.ashmem
named memory block that is shared between processes and kernel is allowed to free. ker is not allowed to free standard shared memory.
http://cs736-android.pbworks.com/w/page/5834465/ASHMEM

surfaceflinger has a total of 8mb heap,it shares this heap with all processes for their surfaces.
when a process requests space,it allocates from this heap,but returns a pointer to the allocated chunk.once process is out of focus pointer is nulled
This is not for surface data ...but for surface control.control contains pointer to 2 data buffers

Each layer has a corresponding surface
layerbuffer doesnt have one
each surface has 2 buffers
these 2 can be from ashmem or pmem

a canvas can be over layer
a canvas can be associated with multile bitmaps

it seems that surfaceflinger allocater uses pmem and/or normal-memory.some activities use pmem heap and some use normal heap.surface flinger passes this buffer down in two different ioctls to fb driver.

No comments:

Post a Comment