SDL  2.0
The wl_shm_pool interface

The wl_shm_pool object encapsulates a piece of memory shared between the compositor and client. Through the wl_shm_pool object, the client can allocate shared memory wl_buffer objects. All objects created through the same pool share the same underlying mapped memory. Reusing the mapped memory avoids the setup/teardown overhead and is useful when interactively resizing a surface or for many small buffers. More...

Macros

#define WL_SHM_POOL_CREATE_BUFFER_SINCE_VERSION   1
 
#define WL_SHM_POOL_DESTROY_SINCE_VERSION   1
 
#define WL_SHM_POOL_RESIZE_SINCE_VERSION   1
 

Functions

static void wl_shm_pool_set_user_data (struct wl_shm_pool *wl_shm_pool, void *user_data)
 
static voidwl_shm_pool_get_user_data (struct wl_shm_pool *wl_shm_pool)
 
static struct wl_buffer * wl_shm_pool_create_buffer (struct wl_shm_pool *wl_shm_pool, int32_t offset, int32_t width, int32_t height, int32_t stride, uint32_t format)
 
static void wl_shm_pool_destroy (struct wl_shm_pool *wl_shm_pool)
 
static void wl_shm_pool_resize (struct wl_shm_pool *wl_shm_pool, int32_t size)
 

Detailed Description

The wl_shm_pool object encapsulates a piece of memory shared between the compositor and client. Through the wl_shm_pool object, the client can allocate shared memory wl_buffer objects. All objects created through the same pool share the same underlying mapped memory. Reusing the mapped memory avoids the setup/teardown overhead and is useful when interactively resizing a surface or for many small buffers.

Macro Definition Documentation

◆ WL_SHM_POOL_CREATE_BUFFER_SINCE_VERSION

#define WL_SHM_POOL_CREATE_BUFFER_SINCE_VERSION   1

Definition at line 1226 of file wayland-client-protocol.h.

◆ WL_SHM_POOL_DESTROY_SINCE_VERSION

#define WL_SHM_POOL_DESTROY_SINCE_VERSION   1

Definition at line 1230 of file wayland-client-protocol.h.

◆ WL_SHM_POOL_RESIZE_SINCE_VERSION

#define WL_SHM_POOL_RESIZE_SINCE_VERSION   1

Definition at line 1234 of file wayland-client-protocol.h.

Function Documentation

◆ wl_shm_pool_create_buffer()

static struct wl_buffer* wl_shm_pool_create_buffer ( struct wl_shm_pool *  wl_shm_pool,
int32_t  offset,
int32_t  width,
int32_t  height,
int32_t  stride,
uint32_t  format 
)
inlinestatic

Create a wl_buffer object from the pool.

The buffer is created offset bytes into the pool and has width and height as specified. The stride argument specifies the number of bytes from the beginning of one row to the beginning of the next. The format is the pixel format of the buffer and must be one of those advertised through the wl_shm.format event.

A buffer will keep a reference to the pool it was created from so it is valid to destroy the pool immediately after creating a buffer from it.

Definition at line 1271 of file wayland-client-protocol.h.

1272 {
1273  struct wl_proxy *id;
1274 
1275  id = wl_proxy_marshal_constructor((struct wl_proxy *) wl_shm_pool,
1277 
1278  return (struct wl_buffer *) id;
1279 }

References NULL, wl_buffer_interface, and WL_SHM_POOL_CREATE_BUFFER.

◆ wl_shm_pool_destroy()

static void wl_shm_pool_destroy ( struct wl_shm_pool *  wl_shm_pool)
inlinestatic

Destroy the shared memory pool.

The mmapped memory will be released when all buffers that have been created from this pool are gone.

Definition at line 1291 of file wayland-client-protocol.h.

1292 {
1293  wl_proxy_marshal((struct wl_proxy *) wl_shm_pool,
1295 
1296  wl_proxy_destroy((struct wl_proxy *) wl_shm_pool);
1297 }

References WL_SHM_POOL_DESTROY.

◆ wl_shm_pool_get_user_data()

static void* wl_shm_pool_get_user_data ( struct wl_shm_pool *  wl_shm_pool)
inlinestatic

Definition at line 1244 of file wayland-client-protocol.h.

1245 {
1246  return wl_proxy_get_user_data((struct wl_proxy *) wl_shm_pool);
1247 }

◆ wl_shm_pool_resize()

static void wl_shm_pool_resize ( struct wl_shm_pool *  wl_shm_pool,
int32_t  size 
)
inlinestatic

This request will cause the server to remap the backing memory for the pool from the file descriptor passed when the pool was created, but using the new size. This request can only be used to make the pool bigger.

Definition at line 1308 of file wayland-client-protocol.h.

1309 {
1310  wl_proxy_marshal((struct wl_proxy *) wl_shm_pool,
1312 }

References WL_SHM_POOL_RESIZE.

◆ wl_shm_pool_set_user_data()

static void wl_shm_pool_set_user_data ( struct wl_shm_pool *  wl_shm_pool,
void user_data 
)
inlinestatic

Definition at line 1237 of file wayland-client-protocol.h.

1238 {
1239  wl_proxy_set_user_data((struct wl_proxy *) wl_shm_pool, user_data);
1240 }
format
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: SDL_opengl.h:1572
offset
GLintptr offset
Definition: SDL_opengl_glext.h:541
NULL
#define NULL
Definition: begin_code.h:167
width
GLint GLint GLsizei width
Definition: SDL_opengl.h:1572
WL_SHM_POOL_RESIZE
#define WL_SHM_POOL_RESIZE
Definition: wayland-client-protocol.h:1219
height
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1572
wl_buffer_interface
const struct wl_interface wl_buffer_interface
Definition: wayland-protocol.c:235
size
GLsizeiptr size
Definition: SDL_opengl_glext.h:540
id
GLuint id
Definition: SDL_opengl_glext.h:531
WL_SHM_POOL_CREATE_BUFFER
#define WL_SHM_POOL_CREATE_BUFFER
Definition: wayland-client-protocol.h:1217
WL_SHM_POOL_DESTROY
#define WL_SHM_POOL_DESTROY
Definition: wayland-client-protocol.h:1218
stride
GLsizei stride
Definition: SDL_opengl_glext.h:381