80#define PW_VERSION_MEMPOOL_EVENTS 0
171#define PW_MAP_RANGE_INIT (struct pw_map_range){ 0, }
176 uint32_t offset, uint32_t size,
180 range->start = offset - range->
offset;
struct pw_memmap * pw_mempool_find_tag(struct pw_mempool *pool, uint32_t tag[5], size_t size)
find a map with the given tag
Definition: mem.c:788
struct pw_memblock * pw_mempool_import(struct pw_mempool *pool, enum pw_memblock_flags flags, uint32_t type, int fd)
Import an fd into the pool.
Definition: mem.c:579
pw_memmap_flags
Definition: src/pipewire/mem.h:40
struct pw_memblock * pw_mempool_alloc(struct pw_mempool *pool, enum pw_memblock_flags flags, uint32_t type, size_t size)
Allocate a memory block from the pool.
Definition: mem.c:466
struct pw_mempool * pw_mempool_new(struct pw_properties *props)
Create a new memory pool.
Definition: mem.c:116
int pw_memmap_free(struct pw_memmap *map)
Unmap a region.
Definition: mem.c:418
int pw_mempool_remove_id(struct pw_mempool *pool, uint32_t id)
Remove a memblock for given id.
Definition: mem.c:680
struct pw_memblock * pw_mempool_import_block(struct pw_mempool *pool, struct pw_memblock *mem)
Import a block from another pool.
Definition: mem.c:616
void pw_mempool_add_listener(struct pw_mempool *pool, struct spa_hook *listener, const struct pw_mempool_events *events, void *data)
Listen for events.
Definition: mem.c:171
struct pw_memmap * pw_mempool_map_id(struct pw_mempool *pool, uint32_t id, enum pw_memmap_flags flags, uint32_t offset, uint32_t size, uint32_t tag[5])
Map a region of a memory block with id.
Definition: mem.c:403
struct pw_memmap * pw_mempool_import_map(struct pw_mempool *pool, struct pw_mempool *other, void *data, uint32_t size, uint32_t tag[5])
Definition: mem.c:627
struct pw_memblock * pw_mempool_find_fd(struct pw_mempool *pool, int fd)
Find memblock for given fd.
Definition: mem.c:776
static void pw_memblock_unref(struct pw_memblock *mem)
Unref a memblock.
Definition: src/pipewire/mem.h:131
static void pw_map_range_init(struct pw_map_range *range, uint32_t offset, uint32_t size, uint32_t page_size)
Calculate parameters to mmap() memory into range so that size bytes at offset can be mapped with mmap...
Definition: src/pipewire/mem.h:182
struct pw_memblock * pw_mempool_find_id(struct pw_mempool *pool, uint32_t id)
Find memblock for given id.
Definition: mem.c:762
struct pw_memblock * pw_mempool_find_ptr(struct pw_mempool *pool, const void *ptr)
Find memblock for given ptr.
Definition: mem.c:743
void pw_mempool_clear(struct pw_mempool *pool)
Clear a pool.
Definition: mem.c:140
void pw_memblock_free(struct pw_memblock *mem)
Free a memblock regardless of the refcount and destroy all mappings.
Definition: mem.c:703
pw_memblock_flags
Flags passed to pw_mempool_alloc()
Definition: src/pipewire/mem.h:28
void pw_mempool_destroy(struct pw_mempool *pool)
Clear and destroy a pool.
Definition: mem.c:153
struct pw_memmap * pw_memblock_map(struct pw_memblock *block, enum pw_memmap_flags flags, uint32_t offset, uint32_t size, uint32_t tag[5])
Map a region of a memory block.
Definition: mem.c:339
@ PW_MEMMAP_FLAG_LOCKED
lock the memory into RAM
Definition: src/pipewire/mem.h:47
@ PW_MEMMAP_FLAG_READ
map in read mode
Definition: src/pipewire/mem.h:42
@ PW_MEMMAP_FLAG_READWRITE
Definition: src/pipewire/mem.h:48
@ PW_MEMMAP_FLAG_WRITE
map in write mode
Definition: src/pipewire/mem.h:43
@ PW_MEMMAP_FLAG_NONE
Definition: src/pipewire/mem.h:41
@ PW_MEMMAP_FLAG_TWICE
map the same area twice after each other, creating a circular ringbuffer
Definition: src/pipewire/mem.h:44
@ PW_MEMMAP_FLAG_PRIVATE
writes will be private
Definition: src/pipewire/mem.h:46
@ PW_MEMBLOCK_FLAG_READWRITE
Definition: src/pipewire/mem.h:37
@ PW_MEMBLOCK_FLAG_MAP
mmap the fd
Definition: src/pipewire/mem.h:33
@ PW_MEMBLOCK_FLAG_DONT_NOTIFY
don't notify events
Definition: src/pipewire/mem.h:35
@ PW_MEMBLOCK_FLAG_READABLE
memory is readable
Definition: src/pipewire/mem.h:30
@ PW_MEMBLOCK_FLAG_SEAL
seal the fd
Definition: src/pipewire/mem.h:32
@ PW_MEMBLOCK_FLAG_WRITABLE
memory is writable
Definition: src/pipewire/mem.h:31
@ PW_MEMBLOCK_FLAG_NONE
Definition: src/pipewire/mem.h:29
@ PW_MEMBLOCK_FLAG_DONT_CLOSE
don't close fd
Definition: src/pipewire/mem.h:34
#define SPA_ROUND_UP_N(num, align)
Definition: defs.h:320
#define SPA_ROUND_DOWN_N(num, align)
Definition: defs.h:318
parameters to map a memory range
Definition: src/pipewire/mem.h:171
uint32_t size
page aligned offset to map
Definition: src/pipewire/mem.h:174
uint32_t offset
offset in first page with start of data
Definition: src/pipewire/mem.h:173
Memory block structure.
Definition: src/pipewire/mem.h:63
uint32_t id
unique id
Definition: src/pipewire/mem.h:65
int fd
fd
Definition: src/pipewire/mem.h:69
struct pw_mempool * pool
owner pool
Definition: src/pipewire/mem.h:64
uint32_t flags
flags for the memory block on of enum pw_memblock_flags
Definition: src/pipewire/mem.h:67
uint32_t size
size of memory
Definition: src/pipewire/mem.h:70
uint32_t type
type of the fd, one of enum spa_data_type
Definition: src/pipewire/mem.h:68
int ref
refcount
Definition: src/pipewire/mem.h:66
struct pw_memmap * map
optional map when PW_MEMBLOCK_FLAG_MAP was given
Definition: src/pipewire/mem.h:71
a mapped region of a pw_memblock
Definition: src/pipewire/mem.h:75
uint32_t offset
offset in memblock
Definition: src/pipewire/mem.h:79
void * ptr
mapped pointer
Definition: src/pipewire/mem.h:77
uint32_t flags
flags for the mapping on of enum pw_memmap_flags
Definition: src/pipewire/mem.h:78
uint32_t size
size in memblock
Definition: src/pipewire/mem.h:80
struct pw_memblock * block
owner memblock
Definition: src/pipewire/mem.h:76
uint32_t tag[5]
user tag
Definition: src/pipewire/mem.h:81
Definition: src/pipewire/mem.h:84
void(* removed)(void *data, struct pw_memblock *block)
a memory block is removed from the pool
Definition: src/pipewire/mem.h:96
void(* destroy)(void *data)
the pool is destroyed
Definition: src/pipewire/mem.h:90
void(* added)(void *data, struct pw_memblock *block)
a new memory block is added to the pool
Definition: src/pipewire/mem.h:93
uint32_t version
Definition: src/pipewire/mem.h:87
A memory pool is a collection of pw_memblocks.
Definition: src/pipewire/mem.h:57
Definition: properties.h:33
A hook, contains the structure with functions and the data passed to the functions.
Definition: hook.h:350