shm: Allocate shm buffers through new wl_shm_pool interface
authorKristian Høgsberg <krh@bitplanet.net>
Tue, 3 Apr 2012 16:08:50 +0000 (12:08 -0400)
committerKristian Høgsberg <krh@bitplanet.net>
Tue, 3 Apr 2012 16:34:22 +0000 (12:34 -0400)
commitaa777e5b10e17d12c4bb6440f7c659d2a12191f5
tree39b06cd4207832c6bf8c18dc521855a44c00567a
parent68cf7a1a425c986304ae179a58279d43210e790f
shm: Allocate shm buffers through new wl_shm_pool interface

There's a big cost to setting up and tearing down a mmap and faulting in
the pages to back it.  For cases where we're continuously reallocating
shm wl_buffers (resizing a surface, typically) it is a big performance
improvement to be able to reuse a mmap area.  This change makes the shm
buffer allocation a two step process: first allocate a wl_shm_pool, then
allocate a buffer from the pool.  The wl_shm_pool encapsulate the shared
memory pool, and lets clients allocate wl_buffers backed by chunks of that
memory.  Buffers are allocated at an offset into the pool, so it's possible
to create multiple buffers from one pool, for example for icons or cursor
images.
protocol/wayland.xml
src/wayland-shm.c