Ream v0.1.0-1
C++ graphics library for Linux
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
RDMABufferInfo Struct Reference

Description of a DMA-BUF backed buffer. More...

#include <RDMABufferInfo.h>

Public Member Functions

bool isValid () const noexcept
 Validates the buffer description.
 
std::optional< RDMABufferInfodup () const noexcept
 Creates a copy of this DMA info, duplicating all file descriptors.
 
void closeFds () noexcept
 Closes all plane file descriptors.
 

Public Attributes

Int32 height
 Buffer dimensions in pixels.
 
RFormat format
 DRM FourCC pixel format.
 
RModifier modifier
 DRM format modifier describing the memory layout.
 
int planeCount
 Number of valid planes (1 to 4).
 
UInt32 offset [4] {}
 Byte offset of each plane within its file descriptor.
 
UInt32 stride [4] {}
 Byte stride (pitch) of each plane.
 
int fd [4] { -1, -1, -1, -1 }
 File descriptor backing each plane (-1 if unused).
 

Detailed Description

Description of a DMA-BUF backed buffer.

Holds the dimensions, DRM format/modifier and per-plane file descriptors, offsets and strides needed to import or share a buffer across APIs (e.g. GBM, EGL, DRM KMS). Supports up to 4 planes.

Member Function Documentation

◆ isValid()

bool isValid ( ) const
inlinenoexcept

Validates the buffer description.

Checks the dimensions, format, plane count and per-plane file descriptors, logging an error describing the first problem found.

Returns
true if the description is well-formed, false otherwise.

◆ dup()

std::optional< RDMABufferInfo > dup ( ) const
inlinenoexcept

Creates a copy of this DMA info, duplicating all file descriptors.

Returns
A new RDMABufferInfo with duplicated file descriptors, or std::nullopt on failure or if the buffer is invalid.

◆ closeFds()

void closeFds ( )
inlinenoexcept

Closes all plane file descriptors.

Note
Does not reset the descriptors to -1; do not reuse the struct afterwards without reinitializing.

Member Data Documentation

◆ height

Int32 height

Buffer dimensions in pixels.

◆ format

RFormat format

DRM FourCC pixel format.

◆ modifier

RModifier modifier

DRM format modifier describing the memory layout.

◆ planeCount

int planeCount

Number of valid planes (1 to 4).

◆ offset

UInt32 offset[4] {}

Byte offset of each plane within its file descriptor.

◆ stride

UInt32 stride[4] {}

Byte stride (pitch) of each plane.

◆ fd

int fd[4] { -1, -1, -1, -1 }

File descriptor backing each plane (-1 if unused).