|
Sunshine master
Self-hosted game stream host for Moonlight.
|
Definitions for KMS screen capture. More...
#include <errno.h>#include <fcntl.h>#include <filesystem>#include <thread>#include <unistd.h>#include <drm_fourcc.h>#include <linux/dma-buf.h>#include <sys/capability.h>#include <sys/mman.h>#include <xf86drm.h>#include <xf86drmMode.h>#include "cuda.h"#include "graphics.h"#include "src/config.h"#include "src/logging.h"#include "src/platform/common.h"#include "src/round_robin.h"#include "src/utility.h"#include "src/video.h"#include "vaapi.h"#include "vulkan_encode.h"#include "wayland.h"Classes | |
| class | platf::kms::cap_sys_admin |
| Temporarily owns CAP_SYS_ADMIN while opening DRM capture resources. More... | |
| struct | platf::kms::card_descriptor_t |
| DRM card, device path, and render-node metadata. More... | |
| class | platf::kms::card_t |
| DRM card, render node, and plane metadata used for KMS capture. More... | |
| struct | platf::kms::connector_t |
| DRM connector and mode information for one display. More... | |
| struct | platf::kms::cursor_t |
| Cursor position and visibility for the current capture frame. More... | |
| class | platf::kms::display_ram_t |
| KMS capture backend that copies frames into system memory. More... | |
| class | platf::kms::display_t |
| Base KMS display capture backend shared by RAM and VRAM paths. More... | |
| class | platf::kms::display_vram_t |
| KMS capture backend that exports frames as GPU resources. More... | |
| struct | platf::kms::kms_img_t |
| Multi-source KMS image assembled for encoding. More... | |
| struct | platf::kms::monitor_t |
| KMS monitor capture state and DRM resources. More... | |
| class | platf::kms::plane_it_t |
| Iterator over DRM planes and their associated properties. More... | |
| class | platf::kms::wrapper_fb |
| RAII wrapper for DRM framebuffer metadata and GEM handles. More... | |
Typedefs | |
| using | platf::kms::conn_type_count_t = std::map<std::uint32_t, std::uint32_t> |
| Counter map keyed by DRM connector type. | |
| using | platf::kms::crtc_t = util::safe_ptr<drmModeCrtc, drmModeFreeCrtc> |
DRM CRTC pointer released with drmModeFreeCrtc. | |
| using | platf::kms::encoder_t = util::safe_ptr<drmModeEncoder, drmModeFreeEncoder> |
DRM encoder pointer released with drmModeFreeEncoder. | |
| using | platf::kms::fb_t = std::unique_ptr<wrapper_fb> |
DRM framebuffer pointer released with drmModeFreeFB2. | |
| using | platf::kms::obj_prop_t = util::safe_ptr<drmModeObjectProperties, drmModeFreeObjectProperties> |
DRM object-property list released with drmModeFreeObjectProperties. | |
| using | platf::kms::plane_res_t = util::safe_ptr<drmModePlaneRes, drmModeFreePlaneResources> |
DRM plane resource list released with drmModeFreePlaneResources. | |
| using | platf::kms::plane_t = util::safe_ptr<drmModePlane, drmModeFreePlane> |
DRM plane pointer released with drmModeFreePlane. | |
| using | platf::kms::prop_blob_t = util::safe_ptr<drmModePropertyBlobRes, drmModeFreePropertyBlob> |
DRM property-blob pointer released with drmModeFreePropertyBlob. | |
| using | platf::kms::prop_t = util::safe_ptr<drmModePropertyRes, drmModeFreeProperty> |
DRM property pointer released with drmModeFreeProperty. | |
| using | platf::kms::res_t = util::safe_ptr<drmModeRes, drmModeFreeResources> |
DRM resource list released with drmModeFreeResources. | |
| using | platf::kms::version_t = util::safe_ptr<drmVersion, drmFreeVersion> |
DRM version pointer released with drmFreeVersion. | |
Functions | |
| void | platf::correlate_to_wayland (std::vector< kms::card_descriptor_t > &cds) |
| std::shared_ptr< display_t > | platf::kms_display (mem_type_e hwdevice_type, const std::string &display_name, const ::video::config_t &config) |
| Create a KMS display capture backend. | |
| std::vector< std::string > | platf::kms_display_names (mem_type_e hwdevice_type) |
| Enumerate display names accepted by the KMS backend. | |
| std::map< std::uint32_t, monitor_t > | platf::kms::map_crtc_to_monitor (const std::vector< connector_t > &connectors) |
| Build a lookup from DRM CRTC IDs to monitor descriptors. | |
| std::string_view | platf::kms::plane_type (std::uint64_t val) |
| Convert a DRM plane type value to a diagnostic string. | |
| void | platf::kms::print (plane_t::pointer plane, fb_t::pointer fb, crtc_t::pointer crtc) |
| Write a debug log representation of the input packet. | |
Definitions for KMS screen capture.
| void platf::correlate_to_wayland | ( | std::vector< kms::card_descriptor_t > & | cds | ) |
On Wayland, it's not possible to determine the position of the monitor on the desktop with KMS. Wayland does allow applications to query attached monitors on the desktop, however, the naming scheme is not standardized across implementations.
As a result, correlating the KMS output to the wayland outputs is guess work at best. But, it's necessary for absolute mouse coordinates to work.
This is an ugly hack :(
| cds | Capture display state used by the KMS backend. |
| std::shared_ptr< display_t > platf::kms_display | ( | mem_type_e | hwdevice_type, |
| const std::string & | display_name, | ||
| const ::video::config_t & | config ) |
Create a KMS display capture backend.
| hwdevice_type | Hardware device type requested for capture or encode. |
| display_name | Display name. |
| config | Configuration values to apply. |
| std::vector< std::string > platf::kms_display_names | ( | mem_type_e | hwdevice_type | ) |
Enumerate display names accepted by the KMS backend.
| hwdevice_type | Hardware device type requested for capture or encode. |
| std::map< std::uint32_t, monitor_t > platf::kms::map_crtc_to_monitor | ( | const std::vector< connector_t > & | connectors | ) |
Build a lookup from DRM CRTC IDs to monitor descriptors.
| connectors | DRM connector list being mapped to monitors. |
| std::string_view platf::kms::plane_type | ( | std::uint64_t | val | ) |
Convert a DRM plane type value to a diagnostic string.
| val | Value assigned to the synchronized object. |
| void platf::kms::print | ( | plane_t::pointer | plane, |
| fb_t::pointer | fb, | ||
| crtc_t::pointer | crtc ) |
Write a debug log representation of the input packet.
| plane | DRM or EGL plane index being described. |
| fb | Framebuffer object to bind or update. |
| crtc | DRM CRTC identifier to map. |