Skip to content

wl_shm¤

wayland.wl_shm ¤

Shared memory support

A singleton global object that provides support for shared memory.

Clients can create wl_shm_pool objects using the create_pool request.

On binding the wl_shm object one or more format events are emitted to inform clients about the valid pixel formats that can be used for buffers.

Methods:

error ¤

wl_shm error values

These errors can be emitted in response to wl_shm requests.

format ¤

Pixel formats

This describes the memory layout of an individual pixel.

All renderers should support argb8888 and xrgb8888 but any other formats are optional and may not be supported by the particular renderer in use.

The drm format codes match the macros defined in drm_fourcc.h, except argb8888 and xrgb8888. The formats actually supported by the compositor will be reported by the format event.

For all wl_shm formats and unless specified in another protocol extension, pre-multiplied alpha is used for pixel values.

  • argb8888
    32-bit argb format, [31:0] a:r:g:b 8:8:8:8 little endian
  • xrgb8888
    32-bit rgb format, [31:0] x:r:g:b 8:8:8:8 little endian
  • c8
    8-bit color index format, [7:0] c
  • rgb332
    8-bit rgb format, [7:0] r:g:b 3:3:2
  • bgr233
    8-bit bgr format, [7:0] b:g:r 2:3:3
  • xrgb4444
    16-bit xrgb format, [15:0] x:r:g:b 4:4:4:4 little endian
  • xbgr4444
    16-bit xbgr format, [15:0] x:b:g:r 4:4:4:4 little endian
  • rgbx4444
    16-bit rgbx format, [15:0] r:g:b:x 4:4:4:4 little endian
  • bgrx4444
    16-bit bgrx format, [15:0] b:g:r:x 4:4:4:4 little endian
  • argb4444
    16-bit argb format, [15:0] a:r:g:b 4:4:4:4 little endian
  • abgr4444
    16-bit abgr format, [15:0] a:b:g:r 4:4:4:4 little endian
  • rgba4444
    16-bit rbga format, [15:0] r:g:b:a 4:4:4:4 little endian
  • bgra4444
    16-bit bgra format, [15:0] b:g:r:a 4:4:4:4 little endian
  • xrgb1555
    16-bit xrgb format, [15:0] x:r:g:b 1:5:5:5 little endian
  • xbgr1555
    16-bit xbgr 1555 format, [15:0] x:b:g:r 1:5:5:5 little endian
  • rgbx5551
    16-bit rgbx 5551 format, [15:0] r:g:b:x 5:5:5:1 little endian
  • bgrx5551
    16-bit bgrx 5551 format, [15:0] b:g:r:x 5:5:5:1 little endian
  • argb1555
    16-bit argb 1555 format, [15:0] a:r:g:b 1:5:5:5 little endian
  • abgr1555
    16-bit abgr 1555 format, [15:0] a:b:g:r 1:5:5:5 little endian
  • rgba5551
    16-bit rgba 5551 format, [15:0] r:g:b:a 5:5:5:1 little endian
  • bgra5551
    16-bit bgra 5551 format, [15:0] b:g:r:a 5:5:5:1 little endian
  • rgb565
    16-bit rgb 565 format, [15:0] r:g:b 5:6:5 little endian
  • bgr565
    16-bit bgr 565 format, [15:0] b:g:r 5:6:5 little endian
  • rgb888
    24-bit rgb format, [23:0] r:g:b little endian
  • bgr888
    24-bit bgr format, [23:0] b:g:r little endian
  • xbgr8888
    32-bit xbgr format, [31:0] x:b:g:r 8:8:8:8 little endian
  • rgbx8888
    32-bit rgbx format, [31:0] r:g:b:x 8:8:8:8 little endian
  • bgrx8888
    32-bit bgrx format, [31:0] b:g:r:x 8:8:8:8 little endian
  • abgr8888
    32-bit abgr format, [31:0] a:b:g:r 8:8:8:8 little endian
  • rgba8888
    32-bit rgba format, [31:0] r:g:b:a 8:8:8:8 little endian
  • bgra8888
    32-bit bgra format, [31:0] b:g:r:a 8:8:8:8 little endian
  • xrgb2101010
    32-bit xrgb format, [31:0] x:r:g:b 2:10:10:10 little endian
  • xbgr2101010
    32-bit xbgr format, [31:0] x:b:g:r 2:10:10:10 little endian
  • rgbx1010102
    32-bit rgbx format, [31:0] r:g:b:x 10:10:10:2 little endian
  • bgrx1010102
    32-bit bgrx format, [31:0] b:g:r:x 10:10:10:2 little endian
  • argb2101010
    32-bit argb format, [31:0] a:r:g:b 2:10:10:10 little endian
  • abgr2101010
    32-bit abgr format, [31:0] a:b:g:r 2:10:10:10 little endian
  • rgba1010102
    32-bit rgba format, [31:0] r:g:b:a 10:10:10:2 little endian
  • bgra1010102
    32-bit bgra format, [31:0] b:g:r:a 10:10:10:2 little endian
  • yuyv
    Packed ycbcr format, [31:0] cr0:y1:cb0:y0 8:8:8:8 little endian
  • yvyu
    Packed ycbcr format, [31:0] cb0:y1:cr0:y0 8:8:8:8 little endian
  • uyvy
    Packed ycbcr format, [31:0] y1:cr0:y0:cb0 8:8:8:8 little endian
  • vyuy
    Packed ycbcr format, [31:0] y1:cb0:y0:cr0 8:8:8:8 little endian
  • ayuv
    Packed aycbcr format, [31:0] a:y:cb:cr 8:8:8:8 little endian
  • nv12
    2 plane ycbcr cr:cb format, 2x2 subsampled cr:cb plane
  • nv21
    2 plane ycbcr cb:cr format, 2x2 subsampled cb:cr plane
  • nv16
    2 plane ycbcr cr:cb format, 2x1 subsampled cr:cb plane
  • nv61
    2 plane ycbcr cb:cr format, 2x1 subsampled cb:cr plane
  • yuv410
    3 plane ycbcr format, 4x4 subsampled cb (1) and cr (2) planes
  • yvu410
    3 plane ycbcr format, 4x4 subsampled cr (1) and cb (2) planes
  • yuv411
    3 plane ycbcr format, 4x1 subsampled cb (1) and cr (2) planes
  • yvu411
    3 plane ycbcr format, 4x1 subsampled cr (1) and cb (2) planes
  • yuv420
    3 plane ycbcr format, 2x2 subsampled cb (1) and cr (2) planes
  • yvu420
    3 plane ycbcr format, 2x2 subsampled cr (1) and cb (2) planes
  • yuv422
    3 plane ycbcr format, 2x1 subsampled cb (1) and cr (2) planes
  • yvu422
    3 plane ycbcr format, 2x1 subsampled cr (1) and cb (2) planes
  • yuv444
    3 plane ycbcr format, non-subsampled cb (1) and cr (2) planes
  • yvu444
    3 plane ycbcr format, non-subsampled cr (1) and cb (2) planes
  • r8
    [7:0] r
  • r16
    [15:0] r little endian
  • rg88
    [15:0] r:g 8:8 little endian
  • gr88
    [15:0] g:r 8:8 little endian
  • rg1616
    [31:0] r:g 16:16 little endian
  • gr1616
    [31:0] g:r 16:16 little endian
  • xrgb16161616f
    [63:0] x:r:g:b 16:16:16:16 little endian
  • xbgr16161616f
    [63:0] x:b:g:r 16:16:16:16 little endian
  • argb16161616f
    [63:0] a:r:g:b 16:16:16:16 little endian
  • abgr16161616f
    [63:0] a:b:g:r 16:16:16:16 little endian
  • xyuv8888
    [31:0] x:y:cb:cr 8:8:8:8 little endian
  • vuy888
    [23:0] cr:cb:y 8:8:8 little endian
  • vuy101010
    Y followed by u then v, 10:10:10. non-linear modifier only
  • y210
    [63:0] cr0:0:y1:0:cb0:0:y0:0 10:6:10:6:10:6:10:6 little endian per 2 y pixels
  • y212
    [63:0] cr0:0:y1:0:cb0:0:y0:0 12:4:12:4:12:4:12:4 little endian per 2 y pixels
  • y216
    [63:0] cr0:y1:cb0:y0 16:16:16:16 little endian per 2 y pixels
  • y410
    [31:0] a:cr:y:cb 2:10:10:10 little endian
  • y412
    [63:0] a:0:cr:0:y:0:cb:0 12:4:12:4:12:4:12:4 little endian
  • y416
    [63:0] a:cr:y:cb 16:16:16:16 little endian
  • xvyu2101010
    [31:0] x:cr:y:cb 2:10:10:10 little endian
  • xvyu12_16161616
    [63:0] x:0:cr:0:y:0:cb:0 12:4:12:4:12:4:12:4 little endian
  • xvyu16161616
    [63:0] x:cr:y:cb 16:16:16:16 little endian
  • y0l0
    [63:0] a3:a2:y3:0:cr0:0:y2:0:a1:a0:y1:0:cb0:0:y0:0 1:1:8:2:8:2:8:2:1:1:8:2:8:2:8:2 little endian
  • x0l0
    [63:0] x3:x2:y3:0:cr0:0:y2:0:x1:x0:y1:0:cb0:0:y0:0 1:1:8:2:8:2:8:2:1:1:8:2:8:2:8:2 little endian
  • y0l2
    [63:0] a3:a2:y3:cr0:y2:a1:a0:y1:cb0:y0 1:1:10:10:10:1:1:10:10:10 little endian
  • x0l2
    [63:0] x3:x2:y3:cr0:y2:x1:x0:y1:cb0:y0 1:1:10:10:10:1:1:10:10:10 little endian
  • yuv420_8bit
  • yuv420_10bit
  • xrgb8888_a8
  • xbgr8888_a8
  • rgbx8888_a8
  • bgrx8888_a8
  • rgb888_a8
  • bgr888_a8
  • rgb565_a8
  • bgr565_a8
  • nv24
    Non-subsampled cr:cb plane
  • nv42
    Non-subsampled cb:cr plane
  • p210
    2x1 subsampled cr:cb plane, 10 bit per channel
  • p010
    2x2 subsampled cr:cb plane 10 bits per channel
  • p012
    2x2 subsampled cr:cb plane 12 bits per channel
  • p016
    2x2 subsampled cr:cb plane 16 bits per channel
  • axbxgxrx106106106106
    [63:0] a:x:b:x:g:x:r:x 10:6:10:6:10:6:10:6 little endian
  • nv15
    2x2 subsampled cr:cb plane
  • q410
  • q401
  • xrgb16161616
    [63:0] x:r:g:b 16:16:16:16 little endian
  • xbgr16161616
    [63:0] x:b:g:r 16:16:16:16 little endian
  • argb16161616
    [63:0] a:r:g:b 16:16:16:16 little endian
  • abgr16161616
    [63:0] a:b:g:r 16:16:16:16 little endian
  • c1
    [7:0] c0:c1:c2:c3:c4:c5:c6:c7 1:1:1:1:1:1:1:1 eight pixels/byte
  • c2
    [7:0] c0:c1:c2:c3 2:2:2:2 four pixels/byte
  • c4
    [7:0] c0:c1 4:4 two pixels/byte
  • d1
    [7:0] d0:d1:d2:d3:d4:d5:d6:d7 1:1:1:1:1:1:1:1 eight pixels/byte
  • d2
    [7:0] d0:d1:d2:d3 2:2:2:2 four pixels/byte
  • d4
    [7:0] d0:d1 4:4 two pixels/byte
  • d8
    [7:0] d
  • r1
    [7:0] r0:r1:r2:r3:r4:r5:r6:r7 1:1:1:1:1:1:1:1 eight pixels/byte
  • r2
    [7:0] r0:r1:r2:r3 2:2:2:2 four pixels/byte
  • r4
    [7:0] r0:r1 4:4 two pixels/byte
  • r10
    [15:0] x:r 6:10 little endian
  • r12
    [15:0] x:r 4:12 little endian
  • avuy8888
    [31:0] a:cr:cb:y 8:8:8:8 little endian
  • xvuy8888
    [31:0] x:cr:cb:y 8:8:8:8 little endian
  • p030
    2x2 subsampled cr:cb plane 10 bits per channel packed

events

format ¤

format(format: format) -> None

Pixel format description

Informs the client about a valid pixel format that can be used for buffers. Known formats include argb8888 and xrgb8888.

Parameters:

  • format ¤

    (format) –

    Buffer pixel format

create_pool ¤

create_pool(fd: fd, size: int) -> wl_shm_pool

Create a shm pool

Create a new wl_shm_pool object.

The pool can be used to create shared memory based buffer objects. The server will mmap size bytes of the passed file descriptor, to use as backing memory for the pool.

Parameters:

  • fd ¤

    (fd) –

    File descriptor for the pool

  • size ¤

    (int) –

    Pool size, in bytes

Returns:

release ¤

release() -> None

Release the shm object

Using this request a client can tell the server that it is not going to use the shm object anymore.

Objects created via this interface remain unaffected.

on_format ¤

on_format(format: format) -> None

Pixel format description.

Override to handle wayland.wl_shm.events.format.