Regarding shm_pool and buffer.

Pekka Paalanen ppaalanen at gmail.com
Fri Feb 5 10:01:56 UTC 2016


On Fri, 5 Feb 2016 08:23:53 +0900
nicesj at nicesj.com wrote:

> Dear all,
> 
> I can learn many things from this mailing list, thank you very much.
> 
> I have one more doubt about relations between memory pool and buffer.
> 
> I read a doc of wayland and it explains a wl_buffer can be created from shm-pool.
> 
> but in the example code, after creates the buffer from pool, attach
> it to the surface, and then the example destroyes shm pool resources
> from the client side.
> 
> so the server will gets destroy request.
> 
> the buffer which is attached to surface, however, still in use.
> 
> If I understood correctly, the pool should not be destroyed until all
> wl-buffers are freed.
> 
> Am I understood correctly?
> 
> or does the server should keep the pool information even though the
> client destroyes it?

Hi,

all wl_shm-based wl_buffer objects keep a reference to the underlying
memory in compositors. Only after both the wl_shm_pool and all
wl_buffers created from it are destroyed, will the compositor free the
underlying memory.

See the documentation of wl_shm_pool::create_buffer
http://wayland.freedesktop.org/docs/html/apa.html#protocol-spec-wl_shm_pool


Thanks,
pq
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 811 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20160205/3f6e1901/attachment.sig>


More information about the wayland-devel mailing list