SDL 2.0
The wl_shm_pool interface

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 1291 of file wayland-client-protocol.h.

◆ WL_SHM_POOL_DESTROY_SINCE_VERSION

#define WL_SHM_POOL_DESTROY_SINCE_VERSION   1

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

◆ WL_SHM_POOL_RESIZE_SINCE_VERSION

#define WL_SHM_POOL_RESIZE_SINCE_VERSION   1

Definition at line 1299 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 1337 of file wayland-client-protocol.h.

1338{
1339 struct wl_proxy *id;
1340
1341 id = wl_proxy_marshal_flags((struct wl_proxy *) wl_shm_pool,
1342 WL_SHM_POOL_CREATE_BUFFER, &wl_buffer_interface, wl_proxy_get_version((struct wl_proxy *) wl_shm_pool), 0, NULL, offset, width, height, stride, format);
1343
1344 return (struct wl_buffer *) id;
1345}
GLint GLint GLsizei width
Definition: SDL_opengl.h:1572
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1572
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: SDL_opengl.h:1572
GLsizei stride
GLintptr offset
GLuint id
#define NULL
Definition: begin_code.h:167
#define WL_SHM_POOL_CREATE_BUFFER
const struct wl_interface wl_buffer_interface

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 1357 of file wayland-client-protocol.h.

1358{
1359 wl_proxy_marshal_flags((struct wl_proxy *) wl_shm_pool,
1360 WL_SHM_POOL_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) wl_shm_pool), WL_MARSHAL_FLAG_DESTROY);
1361}
#define WL_SHM_POOL_DESTROY

References NULL, and 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 1310 of file wayland-client-protocol.h.

1311{
1312 return wl_proxy_get_user_data((struct wl_proxy *) wl_shm_pool);
1313}

◆ 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 1372 of file wayland-client-protocol.h.

1373{
1374 wl_proxy_marshal_flags((struct wl_proxy *) wl_shm_pool,
1375 WL_SHM_POOL_RESIZE, NULL, wl_proxy_get_version((struct wl_proxy *) wl_shm_pool), 0, size);
1376}
GLsizeiptr size
#define WL_SHM_POOL_RESIZE

References NULL, and 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 1303 of file wayland-client-protocol.h.

1304{
1305 wl_proxy_set_user_data((struct wl_proxy *) wl_shm_pool, user_data);
1306}