SRM  v0.10.0-1
Simple Rendering Manager
SRMDevice

Representation of an open DRM device, typically a GPU. More...

Detailed Description

Representation of an open DRM device, typically a GPU.

An SRMDevice represents a DRM device, typically a GPU, which can contain multiple connectors and a specific rendering mode (ITSELF, PRIME, DUMB or CPU).

Enumerations

enum  SRM_RENDER_MODE
 Rendering mode supported by an SRM device, listed from best to worst. More...
 

Functions

void srmDeviceSetUserData (SRMDevice *device, void *userData)
 Sets the device user data. More...
 
void * srmDeviceGetUserData (SRMDevice *device)
 Retrieves the device user data. More...
 
SRMCoresrmDeviceGetCore (SRMDevice *device)
 Get the SRMCore instance to which this device belongs. More...
 
const char * srmDeviceGetName (SRMDevice *device)
 Get the DRM device name (e.g., /dev/dri/card0) associated with this device. More...
 
Int32 srmDeviceGetFD (SRMDevice *device)
 Get the file descriptor of the DRM device associated with this device. More...
 
UInt8 srmDeviceGetClientCapStereo3D (SRMDevice *device)
 Get the client DRM driver's support for Stereo 3D capability. More...
 
UInt8 srmDeviceGetClientCapUniversalPlanes (SRMDevice *device)
 Get the client DRM driver's support for Universal Planes capability. More...
 
UInt8 srmDeviceGetClientCapAtomic (SRMDevice *device)
 Get the client DRM driver's support for Atomic API capability. More...
 
UInt8 srmDeviceGetClientCapAspectRatio (SRMDevice *device)
 Get the client DRM driver's support for Aspect Ratio capability. More...
 
UInt8 srmDeviceGetClientCapWritebackConnectors (SRMDevice *device)
 Get the client DRM driver's support for Writeback Connectors capability. More...
 
UInt8 srmDeviceGetCapDumbBuffer (SRMDevice *device)
 Get the driver's support for Dumb Buffer capability. More...
 
UInt8 srmDeviceGetCapPrimeImport (SRMDevice *device)
 Get the driver's support for Prime Import capability. More...
 
UInt8 srmDeviceGetCapPrimeExport (SRMDevice *device)
 Get the driver's support for Prime Export capability. More...
 
UInt8 srmDeviceGetCapAddFb2Modifiers (SRMDevice *device)
 Get the driver's support for Add FB2 Modifiers capability. More...
 
UInt8 srmDeviceGetCapAsyncPageFlip (SRMDevice *device)
 Get the driver's support for Async Page Flip capability. More...
 
UInt8 srmDeviceGetCapAtomicAsyncPageFlip (SRMDevice *device)
 Get the driver's support for Atomic Async Page Flip capability. More...
 
UInt8 srmDeviceGetCapTimestampMonotonic (SRMDevice *device)
 Retrieve the driver's support for monotonic timestamps. More...
 
UInt8 srmDeviceIsRenderer (SRMDevice *device)
 Check if the device can perform rendering. More...
 
SRMDevicesrmDeviceGetRendererDevice (SRMDevice *device)
 Get the device that performs rendering for this device. More...
 
SRM_RENDER_MODE srmDeviceGetRenderMode (SRMDevice *device)
 Get the rendering mode of the device. More...
 
SRMListsrmDeviceGetCrtcs (SRMDevice *device)
 Get a list of CRTCs (Cathode Ray Tube Controllers) of this device. More...
 
SRMListsrmDeviceGetEncoders (SRMDevice *device)
 Get a list of encoders of this device. More...
 
SRMListsrmDeviceGetPlanes (SRMDevice *device)
 Get a list of planes of this device. More...
 
SRMListsrmDeviceGetConnectors (SRMDevice *device)
 Get a list of connectors of this device. More...
 
SRMListsrmDeviceGetDMATextureFormats (SRMDevice *device)
 Get a list of all DMA (Direct Memory Access) texture formats supported by the device. More...
 
SRMListsrmDeviceGetDMARenderFormats (SRMDevice *device)
 Get a list of DMA (Direct Memory Access) render formats supported by the device. More...
 
SRMListsrmDeviceGetDMAExternalFormats (SRMDevice *device)
 Get a list of DMA (Direct Memory Access) external formats supported by the device. More...
 
EGLDisplay * srmDeviceGetEGLDisplay (SRMDevice *device)
 Get the EGLDisplay associated with the device. More...
 
EGLContext * srmDeviceGetEGLContext (SRMDevice *device)
 Get the EGLContext associated with the device. More...
 
const SRMEGLDeviceExtensionssrmDeviceGetEGLExtensions (SRMDevice *device)
 Returns a structure with boolean variables indicating which EGL extensions the device supports. More...
 
const SRMEGLDeviceFunctionssrmDeviceGetEGLFunctions (SRMDevice *device)
 Returns a structure with pointers to many available EGL functions. More...
 
const SRMGLDeviceExtensionssrmDeviceGetGLExtensions (SRMDevice *device)
 Returns a structure with boolean variables indicating which OpenGL extensions the device supports. More...
 
void srmDeviceMakeCurrent (SRMDevice *device)
 Sets the EGL display and context for the specified device as current for the calling thread. More...
 
void srmDeviceSyncWait (SRMDevice *device)
 Ensures that all pending rendering commands are completed before continuing. More...
 

Typedef Documentation

◆ SRMDevice

typedef struct SRMDeviceStruct SRMDevice

Enumeration Type Documentation

◆ SRM_RENDER_MODE

Rendering mode supported by an SRM device, listed from best to worst.

Enumerator
SRM_RENDER_MODE_ITSELF 

The GPU can directly render into its own connectors (zero CPU involvement).

SRM_RENDER_MODE_PRIME 

Another GPU renders into a PRIME buffer, which is then imported and directly scanned out or blitted into a scannable buffer (zero CPU involvement).

SRM_RENDER_MODE_DUMB 

Another GPU renders into an offscreen buffer, which is then copied into a DUMB buffer (GPU to CPU copy).

SRM_RENDER_MODE_CPU 

Another GPU renders into an offscreen buffer, which is then copied into main memory. A renderable texture is created from the pixels and blitted into a scannable buffer (GPU to CPU + CPU to GPU copy).

Function Documentation

◆ srmDeviceSetUserData()

void srmDeviceSetUserData ( SRMDevice device,
void *  userData 
)

Sets the device user data.

◆ srmDeviceGetUserData()

void* srmDeviceGetUserData ( SRMDevice device)

Retrieves the device user data.

◆ srmDeviceGetCore()

SRMCore* srmDeviceGetCore ( SRMDevice device)

Get the SRMCore instance to which this device belongs.

Parameters
deviceA pointer to the SRMDevice instance.
Returns
A pointer to the SRMCore instance that this device belongs to.

◆ srmDeviceGetName()

const char* srmDeviceGetName ( SRMDevice device)

Get the DRM device name (e.g., /dev/dri/card0) associated with this device.

Parameters
deviceA pointer to the SRMDevice instance.
Returns
The name of the DRM device associated with this SRMDevice.

◆ srmDeviceGetFD()

Int32 srmDeviceGetFD ( SRMDevice device)

Get the file descriptor of the DRM device associated with this device.

Parameters
deviceA pointer to the SRMDevice instance.
Returns
The file descriptor of the DRM device.

◆ srmDeviceGetClientCapStereo3D()

UInt8 srmDeviceGetClientCapStereo3D ( SRMDevice device)

Get the client DRM driver's support for Stereo 3D capability.

Parameters
deviceA pointer to the SRMDevice instance.
Returns
1 if the client DRM driver supports Stereo 3D capability, 0 otherwise.

◆ srmDeviceGetClientCapUniversalPlanes()

UInt8 srmDeviceGetClientCapUniversalPlanes ( SRMDevice device)

Get the client DRM driver's support for Universal Planes capability.

Parameters
deviceA pointer to the SRMDevice instance.
Returns
1 if the client DRM driver supports Universal Planes capability, 0 otherwise.

◆ srmDeviceGetClientCapAtomic()

UInt8 srmDeviceGetClientCapAtomic ( SRMDevice device)

Get the client DRM driver's support for Atomic API capability.

Parameters
deviceA pointer to the SRMDevice instance.
Returns
1 if the client DRM driver supports Atomic API capability, 0 otherwise.
Note
Setting the SRM_FORCE_LEGACY_API environment variable to 1, disables the Atomic API.

◆ srmDeviceGetClientCapAspectRatio()

UInt8 srmDeviceGetClientCapAspectRatio ( SRMDevice device)

Get the client DRM driver's support for Aspect Ratio capability.

Parameters
deviceA pointer to the SRMDevice instance.
Returns
1 if the client DRM driver supports Aspect Ratio capability, 0 otherwise.

◆ srmDeviceGetClientCapWritebackConnectors()

UInt8 srmDeviceGetClientCapWritebackConnectors ( SRMDevice device)

Get the client DRM driver's support for Writeback Connectors capability.

Parameters
deviceA pointer to the SRMDevice instance.
Returns
1 if the client DRM driver supports Writeback Connectors capability, 0 otherwise.

◆ srmDeviceGetCapDumbBuffer()

UInt8 srmDeviceGetCapDumbBuffer ( SRMDevice device)

Get the driver's support for Dumb Buffer capability.

Parameters
deviceA pointer to the SRMDevice instance.
Returns
1 if the DRM device driver supports Dumb Buffer capability, 0 otherwise.

◆ srmDeviceGetCapPrimeImport()

UInt8 srmDeviceGetCapPrimeImport ( SRMDevice device)

Get the driver's support for Prime Import capability.

Parameters
deviceA pointer to the SRMDevice instance.
Returns
1 if the DRM device driver supports Prime Import capability, 0 otherwise.

◆ srmDeviceGetCapPrimeExport()

UInt8 srmDeviceGetCapPrimeExport ( SRMDevice device)

Get the driver's support for Prime Export capability.

Parameters
deviceA pointer to the SRMDevice instance.
Returns
1 if the DRM device driver supports Prime Export capability, 0 otherwise.

◆ srmDeviceGetCapAddFb2Modifiers()

UInt8 srmDeviceGetCapAddFb2Modifiers ( SRMDevice device)

Get the driver's support for Add FB2 Modifiers capability.

Parameters
deviceA pointer to the SRMDevice instance.
Returns
1 if the DRM device driver supports Add FB2 Modifiers capability, 0 otherwise.

◆ srmDeviceGetCapAsyncPageFlip()

UInt8 srmDeviceGetCapAsyncPageFlip ( SRMDevice device)

Get the driver's support for Async Page Flip capability.

Note
This specifically indicates support for the legacy API, no the atomic API
See also
srmDeviceGetCapAtomicAsyncPageFlip().
Parameters
deviceA pointer to the SRMDevice instance.
Returns
1 if the DRM device driver supports Async Page Flip capability, 0 otherwise.

◆ srmDeviceGetCapAtomicAsyncPageFlip()

UInt8 srmDeviceGetCapAtomicAsyncPageFlip ( SRMDevice device)

Get the driver's support for Atomic Async Page Flip capability.

Note
Atomic async page flips are supported since Linux 6.8.
Parameters
deviceA pointer to the SRMDevice instance.
Returns
1 if the DRM device driver supports Atomic Async Page Flip capability, 0 otherwise.

◆ srmDeviceGetCapTimestampMonotonic()

UInt8 srmDeviceGetCapTimestampMonotonic ( SRMDevice device)

Retrieve the driver's support for monotonic timestamps.

See also
srmConnectorGetPresentationClock()
srmConnectorGetPresentationTime()
Parameters
deviceA pointer to the SRMDevice instance.
Returns
1 if the DRM device reports vblank timestamps with CLOCK_MONOTONIC, 0 if it uses CLOCK_REALTIME.

◆ srmDeviceIsRenderer()

UInt8 srmDeviceIsRenderer ( SRMDevice device)

Check if the device can perform rendering.

This function returns true when the device can import buffers from the allocator device, which also means it can perform rendering for other non-rendering devices.

Parameters
deviceA pointer to the SRMDevice instance.
Returns
1 if the device is capable of rendering, 0 otherwise.

◆ srmDeviceGetRendererDevice()

SRMDevice* srmDeviceGetRendererDevice ( SRMDevice device)

Get the device that performs rendering for this device.

The rendering device is equal to this device only when the ITSELF rendering mode is used.

Parameters
deviceA pointer to the SRMDevice instance.
Returns
A pointer to the SRMDevice that performs rendering for this device.

◆ srmDeviceGetRenderMode()

SRM_RENDER_MODE srmDeviceGetRenderMode ( SRMDevice device)

Get the rendering mode of the device.

If the rendering device is equal to this device, then the rendering mode is ITSELF.

Parameters
deviceA pointer to the SRMDevice instance.
Returns
The rendering mode of the device (SRM_RENDER_MODE).

◆ srmDeviceGetCrtcs()

SRMList* srmDeviceGetCrtcs ( SRMDevice device)

Get a list of CRTCs (Cathode Ray Tube Controllers) of this device.

Parameters
deviceA pointer to the SRMDevice instance.
Returns
A list of pointers to the CRTCs (SRMCrtc) associated with this device.

◆ srmDeviceGetEncoders()

SRMList* srmDeviceGetEncoders ( SRMDevice device)

Get a list of encoders of this device.

Parameters
deviceA pointer to the SRMDevice instance.
Returns
A list of pointers to the encoders (SRMEncoder) associated with this device.

◆ srmDeviceGetPlanes()

SRMList* srmDeviceGetPlanes ( SRMDevice device)

Get a list of planes of this device.

Parameters
deviceA pointer to the SRMDevice instance.
Returns
A list of pointers to the planes (SRMPlane) associated with this device.

◆ srmDeviceGetConnectors()

SRMList* srmDeviceGetConnectors ( SRMDevice device)

Get a list of connectors of this device.

Parameters
deviceA pointer to the SRMDevice instance.
Returns
A list of pointers to the connectors (SRMConnector) associated with this device.

◆ srmDeviceGetDMATextureFormats()

SRMList* srmDeviceGetDMATextureFormats ( SRMDevice device)

Get a list of all DMA (Direct Memory Access) texture formats supported by the device.

Note
This list includes both render and external formats.
Parameters
deviceA pointer to the SRMDevice instance.
Returns
A list of DMA texture formats supported by the device.

◆ srmDeviceGetDMARenderFormats()

SRMList* srmDeviceGetDMARenderFormats ( SRMDevice device)

Get a list of DMA (Direct Memory Access) render formats supported by the device.

Note
Render formats have the GL_TEXTURE_2D target.
Parameters
deviceA pointer to the SRMDevice instance.
Returns
A list of DMA render formats supported by the device.

◆ srmDeviceGetDMAExternalFormats()

SRMList* srmDeviceGetDMAExternalFormats ( SRMDevice device)

Get a list of DMA (Direct Memory Access) external formats supported by the device.

Note
External formats have the GL_TEXTURE_EXTERNAL_OES target.
Parameters
deviceA pointer to the SRMDevice instance.
Returns
A list of DMA external formats supported by the device.

◆ srmDeviceGetEGLDisplay()

EGLDisplay* srmDeviceGetEGLDisplay ( SRMDevice device)

Get the EGLDisplay associated with the device.

Parameters
deviceA pointer to the SRMDevice instance.
Returns
A pointer to the EGLDisplay associated with the device.

◆ srmDeviceGetEGLContext()

EGLContext* srmDeviceGetEGLContext ( SRMDevice device)

Get the EGLContext associated with the device.

Parameters
deviceA pointer to the SRMDevice instance.
Returns
A pointer to the EGLContext associated with the device.

◆ srmDeviceGetEGLExtensions()

const SRMEGLDeviceExtensions* srmDeviceGetEGLExtensions ( SRMDevice device)

Returns a structure with boolean variables indicating which EGL extensions the device supports.

Parameters
deviceA pointer to the SRMDevice instance.
Returns
A pointer to the SRMEGLDeviceExtensions structure indicating the supported EGL extensions.

◆ srmDeviceGetEGLFunctions()

const SRMEGLDeviceFunctions* srmDeviceGetEGLFunctions ( SRMDevice device)

Returns a structure with pointers to many available EGL functions.

Parameters
deviceA pointer to the SRMDevice instance.
Returns
A pointer to the SRMEGLDeviceFunctions structure containing pointers to avaliable EGL functions.

◆ srmDeviceGetGLExtensions()

const SRMGLDeviceExtensions* srmDeviceGetGLExtensions ( SRMDevice device)

Returns a structure with boolean variables indicating which OpenGL extensions the device supports.

Parameters
deviceA pointer to the SRMDevice instance.
Returns
A pointer to the SRMGLDeviceExtensions structure indicating the supported OpenGL extensions.

◆ srmDeviceMakeCurrent()

void srmDeviceMakeCurrent ( SRMDevice device)

Sets the EGL display and context for the specified device as current for the calling thread.

If no existing EGL context is associated with the calling thread, a new one is created and made current.

Parameters
devicePointer to the SRMDevice whose EGL context should be made current.

◆ srmDeviceSyncWait()

void srmDeviceSyncWait ( SRMDevice device)

Ensures that all pending rendering commands are completed before continuing.