Ream v0.1.0-1
C++ graphics library for Linux
Loading...
Searching...
No Matches
Classes | Public Member Functions | Public Attributes | List of all members
RDevice Class Referenceabstract

A rendering device. More...

#include <RDevice.h>

+ Inheritance diagram for RDevice:

Classes

struct  Caps
 Device capabilities. More...
 

Public Member Functions

 ~RDevice () noexcept
 Destructor.
 
virtual void wait () noexcept=0
 Blocks until the device has finished all pending work.
 
int drmFd () const noexcept
 Returns the primary DRM file descriptor.
 
int drmFdReadOnly () const noexcept
 Returns the read-only DRM file descriptor.
 
void * drmUserData () const noexcept
 Returns the user data associated with the DRM device.
 
dev_t id () const noexcept
 Returns the device id (dev_t) of the DRM node.
 
const std::string & drmNode () const noexcept
 Returns the path of the DRM node.
 
const std::string & drmDriverName () const noexcept
 Returns the DRM driver name.
 
RDriver drmDriver () const noexcept
 Returns the detected DRM driver.
 
RCore & core () const noexcept
 Returns the RCore instance that owns this device.
 
RGLDevice * asGL () noexcept
 Attempts to cast this device to an RGLDevice.
 
RRSDevice * asRS () noexcept
 Attempts to cast this device to an RRSDevice.
 
RVKDevice * asVK () noexcept
 Attempts to cast this device to an RVKDevice.
 
const Caps & caps () const noexcept
 Returns the capabilities of this device.
 
- Public Member Functions inherited from RObject
 RObject ()=default
 Constructs a default RObject.
 

Public Attributes

CZLogger log { RLog }
 Logger for messages related to this device.
 

Detailed Description

A rendering device.

An RDevice represents a single GPU (or software renderer) usable for allocation and rendering. There is typically one device per DRM node; systems with multiple GPUs expose several, enabling hybrid-GPU (Prime) setups where buffers are allocated on one device and sampled on another via DMA-buf sharing.

Devices are enumerated and owned by RCore. Each exposes its capabilities (RDevice::Caps) and the texture/render/DMA formats it supports. Use RCore::mainDevice() for the primary device.


Class Documentation

◆ CZ::RDevice::Caps

struct CZ::RDevice::Caps

Device capabilities.

Class Members
bool Rendering Supports rendering (as opposed to allocation/scanout only).
bool AddFb2Modifiers Supports creating DRM framebuffers with explicit format modifiers.
bool DumbBuffer Supports allocating dumb buffers.
bool SyncCPU Supports RSync-based client-side synchronization.
bool SyncGPU Supports RSync-based host-side synchronization.
bool SyncImport Supports RSync synchronization with external devices.
bool SyncExport Supports exporting RSync fences to external devices.
bool Timeline Supports timeline (as opposed to binary) synchronization.

Constructor & Destructor Documentation

◆ ~RDevice()

~RDevice ( )
noexcept

Destructor.

Destroys the GBM device and closes the DRM file descriptors it owns.

Member Function Documentation

◆ wait()

virtual void wait ( )
pure virtualnoexcept

Blocks until the device has finished all pending work.

Implemented in RGLDevice, RRSDevice, and RVKDevice.

◆ drmFd()

int drmFd ( ) const
inlinenoexcept

Returns the primary DRM file descriptor.

Returns
The DRM fd, or -1 if none is available.

◆ drmFdReadOnly()

int drmFdReadOnly ( ) const
inlinenoexcept

Returns the read-only DRM file descriptor.

Returns
The read-only DRM fd, or -1 if none is available.

◆ drmUserData()

void * drmUserData ( ) const
inlinenoexcept

Returns the user data associated with the DRM device.

◆ id()

dev_t id ( ) const
inlinenoexcept

Returns the device id (dev_t) of the DRM node.

◆ drmNode()

const std::string & drmNode ( ) const
inlinenoexcept

Returns the path of the DRM node.

Returns
The node path (e.g. /dev/dri/card0), or an empty string if none.

◆ drmDriverName()

const std::string & drmDriverName ( ) const
inlinenoexcept

Returns the DRM driver name.

Returns
The driver name (e.g. "amdgpu"), or "Unknown" if not detected.

◆ drmDriver()

RDriver drmDriver ( ) const
inlinenoexcept

Returns the detected DRM driver.

◆ core()

RCore & core ( ) const
inlinenoexcept

Returns the RCore instance that owns this device.

◆ asGL()

RGLDevice * asGL ( )
noexcept

Attempts to cast this device to an RGLDevice.

Returns
A pointer to RGLDevice if the active API is OpenGL, or nullptr otherwise.

◆ asRS()

RRSDevice * asRS ( )
noexcept

Attempts to cast this device to an RRSDevice.

Returns
A pointer to RRSDevice if the active API is Raster, or nullptr otherwise.

◆ asVK()

RVKDevice * asVK ( )
noexcept

Attempts to cast this device to an RVKDevice.

Returns
A pointer to RVKDevice if the active API is Vulkan, or nullptr otherwise.

◆ caps()

const Caps & caps ( ) const
inlinenoexcept

Returns the capabilities of this device.

Member Data Documentation

◆ log

CZLogger log { RLog }

Logger for messages related to this device.