Lines Matching full:pool
44 struct wl_shm_pool *pool; member
54 struct shm_pool *pool; in shm_pool_create() local
56 pool = malloc(sizeof *pool); in shm_pool_create()
57 if (!pool) in shm_pool_create()
60 pool->fd = os_create_anonymous_file(size); in shm_pool_create()
61 if (pool->fd < 0) in shm_pool_create()
64 pool->data = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, in shm_pool_create()
65 pool->fd, 0); in shm_pool_create()
67 if (pool->data == MAP_FAILED) in shm_pool_create()
70 pool->pool = wl_shm_create_pool(shm, pool->fd, size); in shm_pool_create()
71 pool->size = size; in shm_pool_create()
72 pool->used = 0; in shm_pool_create()
74 return pool; in shm_pool_create()
77 close(pool->fd); in shm_pool_create()
79 free(pool); in shm_pool_create()
84 shm_pool_resize(struct shm_pool *pool, int size) in shm_pool_resize() argument
86 if (ftruncate(pool->fd, size) < 0) in shm_pool_resize()
90 errno = posix_fallocate(pool->fd, 0, size); in shm_pool_resize()
95 wl_shm_pool_resize(pool->pool, size); in shm_pool_resize()
97 munmap(pool->data, pool->size); in shm_pool_resize()
99 pool->data = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, in shm_pool_resize()
100 pool->fd, 0); in shm_pool_resize()
101 if (pool->data == (void *)-1) in shm_pool_resize()
103 pool->size = size; in shm_pool_resize()
109 shm_pool_allocate(struct shm_pool *pool, int size) in shm_pool_allocate() argument
113 if (pool->used + size > pool->size) in shm_pool_allocate()
114 if (!shm_pool_resize(pool, 2 * pool->size + size)) in shm_pool_allocate()
117 offset = pool->used; in shm_pool_allocate()
118 pool->used += size; in shm_pool_allocate()
124 shm_pool_destroy(struct shm_pool *pool) in shm_pool_destroy() argument
126 munmap(pool->data, pool->size); in shm_pool_destroy()
127 wl_shm_pool_destroy(pool->pool); in shm_pool_destroy()
128 close(pool->fd); in shm_pool_destroy()
129 free(pool); in shm_pool_destroy()
137 struct shm_pool *pool; member
146 int offset; /* data offset of this image in the shm pool */
168 wl_shm_pool_create_buffer(theme->pool->pool, in wl_cursor_image_get_buffer()
238 image->offset = shm_pool_allocate(theme->pool, size); in wl_cursor_create_from_data()
243 memcpy(theme->pool->data + image->offset, in wl_cursor_create_from_data()
323 image->offset = shm_pool_allocate(theme->pool, size); in wl_cursor_create_from_xcursor_images()
329 /* copy pixels to shm pool */ in wl_cursor_create_from_xcursor_images()
330 memcpy(theme->pool->data + image->offset, in wl_cursor_create_from_xcursor_images()
407 theme->pool = shm_pool_create(shm, size * size * 4); in wl_cursor_theme_load()
408 if (!theme->pool) in wl_cursor_theme_load()
437 shm_pool_destroy(theme->pool); in wl_cursor_theme_destroy()