Go to index / Go to protocols

wlr_export_dmabuf_unstable_v1 ↗

a protocol for low overhead screen content capturing

An interface to capture surfaces in an efficient way by exporting DMA-BUFs.

Warning! The protocol described in this file is experimental and backward incompatible changes may be made. Backward compatible changes may be added together with the corresponding interface version bump. Backward incompatible changes are done by bumping the version number in the protocol and interface names and resetting the interface version. Once the protocol is to be declared stable, the 'z' prefix and the version number in the protocol and interface names are removed and the interface version number is reset.

wlr_export_dmabuf_unstable_v1
zwlr_export_dmabuf_manager_v1

Version 1
Compositor Support
Version 1
cage 0.3.0
labwc 0.20.2
phoc 0.55
river 0.3.13
sway 1.11
wayfire 0.9.0

manager to inform clients and begin capturing

This object is a manager with which to start capturing from sources.

zwlr_export_dmabuf_manager_v1
request capture_output(
    frame: new_id<zwlr_export_dmabuf_frame_v1>,
    overlay_cursor: int,
    output: object<wl_output>,
)
  • overlay_cursor — include custom client hardware cursor on top of the frame

capture a frame from an output

Capture the next frame of an entire output.

zwlr_export_dmabuf_manager_v1
request destroy()
Destructor

    destroy the manager

    All objects created by the manager will still remain valid, until their appropriate destroy request has been called.

    wlr_export_dmabuf_unstable_v1
    zwlr_export_dmabuf_frame_v1

    Version 1

    a DMA-BUF frame

    This object represents a single DMA-BUF frame.

    If the capture is successful, the compositor will first send a "frame" event, followed by one or several "object". When the frame is available for readout, the "ready" event is sent.

    If the capture failed, the "cancel" event is sent. This can happen anytime before the "ready" event.

    Once either a "ready" or a "cancel" event is received, the client should destroy the frame. Once an "object" event is received, the client is responsible for closing the associated file descriptor.

    All frames are read-only and may not be written into or altered.

    zwlr_export_dmabuf_frame_v1
    enum flags {
        transient = 0x1,
    }
    • transient — clients should copy frame before processing

    frame flags

    Special flags that should be respected by the client.

    zwlr_export_dmabuf_frame_v1
    event frame(
        width: uint,
        height: uint,
        offset_x: uint,
        offset_y: uint,
        buffer_flags: uint,
        flags: uint<flags>,
        format: uint,
        mod_high: uint,
        mod_low: uint,
        num_objects: uint,
    )
    • width — frame width in pixels
    • height — frame height in pixels
    • offset_x — crop offset for the x axis
    • offset_y — crop offset for the y axis
    • buffer_flags — flags which indicate properties (invert, interlacing), has the same values as zwp_linux_buffer_params_v1:flags
    • flags — indicates special frame features
    • format — format of the frame (DRM_FORMAT_*)
    • mod_high — drm format modifier, high
    • mod_low — drm format modifier, low
    • num_objects — indicates how many objects (FDs) the frame has (max 4)

    a frame description

    Main event supplying the client with information about the frame. If the capture didn't fail, this event is always emitted first before any other events.

    This event is followed by a number of "object" as specified by the "num_objects" argument.

    zwlr_export_dmabuf_frame_v1
    event object(
        index: uint,
        fd: fd,
        size: uint,
        offset: uint,
        stride: uint,
        plane_index: uint,
    )
    • index — index of the current object
    • fd — fd of the current object
    • size — size in bytes for the current object
    • offset — starting point for the data in the object's fd
    • stride — line size in bytes
    • plane_index — index of the plane the data in the object applies to

    an object description

    Event which serves to supply the client with the file descriptors containing the data for each object.

    After receiving this event, the client must always close the file descriptor as soon as they're done with it and even if the frame fails.

    zwlr_export_dmabuf_frame_v1
    event ready(
        tv_sec_hi: uint,
        tv_sec_lo: uint,
        tv_nsec: uint,
    )
    • tv_sec_hi — high 32 bits of the seconds part of the timestamp
    • tv_sec_lo — low 32 bits of the seconds part of the timestamp
    • tv_nsec — nanoseconds part of the timestamp

    indicates frame is available for reading

    This event is sent as soon as the frame is presented, indicating it is available for reading. This event includes the time at which presentation happened at.

    The timestamp is expressed as tv_sec_hi, tv_sec_lo, tv_nsec triples, each component being an unsigned 32-bit value. Whole seconds are in tv_sec which is a 64-bit value combined from tv_sec_hi and tv_sec_lo, and the additional fractional part in tv_nsec as nanoseconds. Hence, for valid timestamps tv_nsec must be in [0, 999999999]. The seconds part may have an arbitrary offset at start.

    After receiving this event, the client should destroy this object.

    zwlr_export_dmabuf_frame_v1
    enum cancel_reason {
        temporary = 0,
        permanent = 1,
        resizing = 2,
    }
    • temporary — temporary error, source will produce more frames
    • permanent — fatal error, source will not produce frames
    • resizing — temporary error, source will produce more frames

    cancel reason

    Indicates reason for cancelling the frame.

    zwlr_export_dmabuf_frame_v1
    event cancel(
        reason: uint<cancel_reason>,
    )
    • reason — indicates a reason for cancelling this frame capture

    indicates the frame is no longer valid

    If the capture failed or if the frame is no longer valid after the "frame" event has been emitted, this event will be used to inform the client to scrap the frame.

    If the failure is temporary, the client may capture again the same source. If the failure is permanent, any further attempts to capture the same source will fail again.

    After receiving this event, the client should destroy this object.

    zwlr_export_dmabuf_frame_v1
    request destroy()
    Destructor

      delete this object, used or not

      Unreferences the frame. This request must be called as soon as it's no longer used.

      It can be called at any time by the client. The client will still have to close any FDs it has been given.