⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

Module dmabuf

Module dmabuf 

Source
Expand description

DMA-BUF Protocol (zwp_linux_dmabuf_v1)

Provides zero-copy buffer sharing between GPU and compositor.

On VeridianOS, DMA-BUF handles are virtio-gpu resource IDs rather than Linux file descriptors. The protocol framework remains compatible with the Wayland zwp_linux_dmabuf_v1 specification, but the underlying buffer import mechanism uses virtio-gpu resource handles instead of dmabuf fds. This allows GPU-rendered content to be composited without copying pixel data through the CPU.

§Buffer lifecycle

  1. Client calls create_params() to get a params builder
  2. Client calls add_plane() for each plane (most formats need 1)
  3. Client calls create_buffer() to finalize and import the buffer
  4. The compositor can then sample from the imported buffer directly

Modules§

fourcc
Common DRM fourcc pixel format codes.
modifiers
DRM format modifiers describe GPU-specific memory tiling layouts.

Structs§

DmaBufBuffer
Imported DMA-BUF buffer ready for compositor use.
DmaBufFormat
DMA-BUF format descriptor (fourcc + modifier pair).
DmaBufManager
DMA-BUF manager.
DmaBufParams
DMA-BUF parameter builder (corresponds to zwp_linux_buffer_params_v1).
DmaBufPlane
Single plane of a DMA-BUF.

Constants§

MAX_PLANES
Maximum number of planes per buffer
ZWP_LINUX_BUFFER_PARAMS_V1_ADD
add(fd, plane_idx, offset, stride, modifier_hi, modifier_lo)
ZWP_LINUX_BUFFER_PARAMS_V1_CREATE
create(width, height, format, flags)
ZWP_LINUX_BUFFER_PARAMS_V1_CREATED
created(buffer: new_id)
ZWP_LINUX_BUFFER_PARAMS_V1_CREATE_IMMED
create_immed(buffer_id, width, height, format, flags) – since version 2
ZWP_LINUX_BUFFER_PARAMS_V1_DESTROY
destroy
ZWP_LINUX_BUFFER_PARAMS_V1_FAILED
failed
ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_BOTTOM_FIRST
Buffer content has bottom field first
ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_INTERLACED
Buffer content is interlaced
ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_Y_INVERT
Bottom-first (y-inverted) buffer
ZWP_LINUX_DMABUF_V1
Wayland global interface name
ZWP_LINUX_DMABUF_V1_CREATE_PARAMS
create_params(id: new_id) -> zwp_linux_buffer_params_v1
ZWP_LINUX_DMABUF_V1_DESTROY
destroy
ZWP_LINUX_DMABUF_V1_FORMAT
format(format: uint) – deprecated since version 4
ZWP_LINUX_DMABUF_V1_GET_DEFAULT_FEEDBACK
get_default_feedback(id: new_id) – since version 4
ZWP_LINUX_DMABUF_V1_GET_SURFACE_FEEDBACK
get_surface_feedback(id: new_id, surface: object) – since version 4
ZWP_LINUX_DMABUF_V1_MODIFIER
modifier(format: uint, modifier_hi: uint, modifier_lo: uint) – since version 3
ZWP_LINUX_DMABUF_V1_VERSION
Protocol version