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

◆ WL_SHM_POOL_DESTROY_SINCE_VERSION

#define WL_SHM_POOL_DESTROY_SINCE_VERSION   1

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

◆ WL_SHM_POOL_RESIZE_SINCE_VERSION

#define WL_SHM_POOL_RESIZE_SINCE_VERSION   1

Definition at line 1245 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 
)
static

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

References NULL, wl_buffer_interface, and WL_SHM_POOL_CREATE_BUFFER.

1284 {
1285  struct wl_proxy *id;
1286 
1287  id = wl_proxy_marshal_constructor((struct wl_proxy *) wl_shm_pool,
1289 
1290  return (struct wl_buffer *) id;
1291 }
GLuint id
GLsizei stride
GLintptr offset
GLint GLint GLsizei width
Definition: SDL_opengl.h:1572
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: SDL_opengl.h:1572
#define WL_SHM_POOL_CREATE_BUFFER
const struct wl_interface wl_buffer_interface
#define NULL
Definition: begin_code.h:164
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1572

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

References WL_SHM_POOL_DESTROY.

1304 {
1305  wl_proxy_marshal((struct wl_proxy *) wl_shm_pool,
1307 
1308  wl_proxy_destroy((struct wl_proxy *) wl_shm_pool);
1309 }
#define 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 1256 of file wayland-client-protocol.h.

1257 {
1258  return wl_proxy_get_user_data((struct wl_proxy *) wl_shm_pool);
1259 }

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

References WL_SHM_POOL_RESIZE.

1321 {
1322  wl_proxy_marshal((struct wl_proxy *) wl_shm_pool,
1324 }
GLsizeiptr size
#define 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 1249 of file wayland-client-protocol.h.

1250 {
1251  wl_proxy_set_user_data((struct wl_proxy *) wl_shm_pool, user_data);
1252 }