Sunshine master
Self-hosted game stream host for Moonlight.
platf::kms::card_t Class Reference

DRM card, render node, and plane metadata used for KMS capture. More...

Collaboration diagram for platf::kms::card_t:
[legend]

Public Types

using connector_interal_t = util::safe_ptr<drmModeConnector, drmModeFreeConnector>
 Internal connector metadata tuple used while selecting a monitor.
 

Public Member Functions

plane_it_t begin () const
 Return an iterator to the first byte in the buffer view.
 
connector_interal_t connector (std::uint32_t id)
 Return the DRM connector object for the display.
 
std::vector< std::pair< prop_t, std::uint64_t > > connector_props (std::uint32_t id)
 Return DRM connector properties.
 
std::uint32_t count ()
 Return the number of items in the wrapped DRM collection.
 
crtc_t crtc (std::uint32_t id)
 Return the DRM CRTC object for the monitor.
 
std::vector< std::pair< prop_t, std::uint64_t > > crtc_props (std::uint32_t id)
 Return DRM CRTC properties.
 
encoder_t encoder (std::uint32_t id)
 Return the DRM encoder object for the connector.
 
plane_it_t end () const
 Return an iterator one past the final byte in the buffer view.
 
fb_t fb (plane_t::pointer plane)
 Return framebuffer metadata for the current CRTC.
 
int get_crtc_index_by_id (std::uint32_t crtc_id)
 Get crtc index by ID.
 
std::uint32_t get_panel_orientation (std::uint32_t plane_id)
 Get panel orientation.
 
file_t handleFD (std::uint32_t handle)
 Return the DRM file descriptor owned by the object.
 
int init (const char *path)
 Open a DRM connector and cache its monitor metadata.
 
bool is_cursor (std::uint32_t plane_id)
 Check whether cursor.
 
bool is_nvidia ()
 Check whether nvidia.
 
std::vector< connector_tmonitors (conn_type_count_t &conn_type_count)
 Refresh the monitor list reported by the display server.
 
plane_t operator[] (std::uint32_t index)
 Fetch DRM plane metadata by plane-list index.
 
std::vector< std::pair< prop_t, std::uint64_t > > plane_props (std::uint32_t id)
 Return DRM plane properties.
 
std::optional< std::uint64_t > prop_value_by_name (const std::vector< std::pair< prop_t, std::uint64_t > > &props, std::string_view name)
 Look up a DRM property value by property name.
 
std::vector< std::pair< prop_t, std::uint64_t > > props (std::uint32_t id, std::uint32_t type)
 Return DRM object properties for the resource.
 
res_t res ()
 Return the DRM resource list for the card.
 

Public Attributes

file_t fd
 DRM card file descriptor.
 
plane_res_t plane_res
 Plane res.
 
file_t render_fd
 Render fd.
 

Detailed Description

DRM card, render node, and plane metadata used for KMS capture.

Member Function Documentation

◆ begin()

plane_it_t platf::kms::card_t::begin ( ) const
inline

Return an iterator to the first byte in the buffer view.

Returns
Iterator to the first element.

◆ connector()

connector_interal_t platf::kms::card_t::connector ( std::uint32_t id)
inline

Return the DRM connector object for the display.

Parameters
idDRM connector ID.
Returns
Owning pointer to the DRM connector object.

◆ connector_props()

std::vector< std::pair< prop_t, std::uint64_t > > platf::kms::card_t::connector_props ( std::uint32_t id)
inline

Return DRM connector properties.

Parameters
idDRM connector ID.
Returns
Connector properties and their current values.

◆ count()

std::uint32_t platf::kms::card_t::count ( )
inline

Return the number of items in the wrapped DRM collection.

Returns
Number of DRM planes reported by the card.

◆ crtc()

crtc_t platf::kms::card_t::crtc ( std::uint32_t id)
inline

Return the DRM CRTC object for the monitor.

Parameters
idDRM CRTC ID.
Returns
Owning pointer to the DRM CRTC object.

◆ crtc_props()

std::vector< std::pair< prop_t, std::uint64_t > > platf::kms::card_t::crtc_props ( std::uint32_t id)
inline

Return DRM CRTC properties.

Parameters
idDRM CRTC ID.
Returns
CRTC properties and their current values.

◆ encoder()

encoder_t platf::kms::card_t::encoder ( std::uint32_t id)
inline

Return the DRM encoder object for the connector.

Parameters
idDRM encoder ID.
Returns
Owning pointer to the DRM encoder object.

◆ end()

plane_it_t platf::kms::card_t::end ( ) const
inline

Return an iterator one past the final byte in the buffer view.

Returns
Iterator one past the last element.

◆ fb()

fb_t platf::kms::card_t::fb ( plane_t::pointer plane)
inline

Return framebuffer metadata for the current CRTC.

Parameters
planeDRM or EGL plane index being described.
Returns
Framebuffer metadata wrapper, or nullptr when the framebuffer cannot be read.

◆ get_crtc_index_by_id()

int platf::kms::card_t::get_crtc_index_by_id ( std::uint32_t crtc_id)
inline

Get crtc index by ID.

Parameters
crtc_idCrtc ID.
Returns
Zero-based CRTC index, or -1 when the CRTC ID is unknown.

◆ get_panel_orientation()

std::uint32_t platf::kms::card_t::get_panel_orientation ( std::uint32_t plane_id)
inline

Get panel orientation.

Parameters
plane_idPlane ID.
Returns
DRM rotation bitmask for the panel orientation.

◆ handleFD()

file_t platf::kms::card_t::handleFD ( std::uint32_t handle)
inline

Return the DRM file descriptor owned by the object.

Parameters
handleGEM handle exported by the DRM framebuffer.
Returns
DMA-BUF file descriptor for the GEM handle.

◆ init()

int platf::kms::card_t::init ( const char * path)
inline

Open a DRM connector and cache its monitor metadata.

Parameters
pathFilesystem path for the DRM device or resource.
Returns
0 on success; nonzero or negative platform status on failure.

◆ is_cursor()

bool platf::kms::card_t::is_cursor ( std::uint32_t plane_id)
inline

Check whether cursor.

Parameters
plane_idPlane ID.
Returns
True when the DRM plane is a cursor plane.

◆ is_nvidia()

bool platf::kms::card_t::is_nvidia ( )
inline

Check whether nvidia.

Returns
True when the DRM device appears to be driven by NVIDIA.

◆ monitors()

std::vector< connector_t > platf::kms::card_t::monitors ( conn_type_count_t & conn_type_count)
inline

Refresh the monitor list reported by the display server.

Parameters
conn_type_countConn type count.
Returns
Connector descriptors for monitors known to the DRM card.

◆ operator[]()

plane_t platf::kms::card_t::operator[] ( std::uint32_t index)
inline

Fetch DRM plane metadata by plane-list index.

Parameters
indexZero-based index into the DRM plane resource list.
Returns
Plane metadata for the requested DRM plane.

◆ plane_props()

std::vector< std::pair< prop_t, std::uint64_t > > platf::kms::card_t::plane_props ( std::uint32_t id)
inline

Return DRM plane properties.

Parameters
idDRM plane ID.
Returns
Plane properties and their current values.

◆ prop_value_by_name()

std::optional< std::uint64_t > platf::kms::card_t::prop_value_by_name ( const std::vector< std::pair< prop_t, std::uint64_t > > & props,
std::string_view name )
inline

Look up a DRM property value by property name.

Parameters
propsDRM property collection to inspect.
nameDRM property name to search for.
Returns
Property value when the property exists.

◆ props()

std::vector< std::pair< prop_t, std::uint64_t > > platf::kms::card_t::props ( std::uint32_t id,
std::uint32_t type )
inline

Return DRM object properties for the resource.

Parameters
idDRM object ID.
typeDRM object type.
Returns
DRM properties and their current values.

◆ res()

res_t platf::kms::card_t::res ( )
inline

Return the DRM resource list for the card.

Returns
DRM card resource list.

The documentation for this class was generated from the following file: