|
Hermes 0.7.0
Linux game streaming host
|
Definitions for KMS screen capture. More...
#include <array>#include <cstdio>#include <cstdlib>#include <cstring>#include <errno.h>#include <fcntl.h>#include <filesystem>#include <limits>#include <string>#include <thread>#include <unistd.h>#include <drm_fourcc.h>#include <linux/dma-buf.h>#include <linux/sync_file.h>#include <poll.h>#include <sys/capability.h>#include <sys/mman.h>#include <sys/stat.h>#include <xf86drm.h>#include <xf86drmMode.h>#include "cuda.h"#include "dmabuf_mapping.h"#include "graphics.h"#include "misc.h"#include "pyrowave.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 "virtual_display.h"#include "wayland.h"Go to the source code of this file.
Classes | |
| class | platf::kms::cap_sys_admin |
| class | platf::kms::wrapper_fb |
| struct | platf::kms::connector_t |
| struct | platf::kms::monitor_t |
| struct | platf::kms::card_descriptor_t |
| class | platf::kms::plane_it_t |
| struct | platf::kms::cursor_t |
| class | platf::kms::card_t |
| struct | platf::kms::kms_img_t |
| class | platf::kms::display_t |
| class | platf::kms::display_ram_t |
| class | platf::kms::display_evdi_t |
| class | platf::kms::display_vram_t |
| class | platf::kms::display_hermes_vram_t |
| class | platf::kms::display_hermes_ram_t |
Macros | |
| #define | _CONVERT(x, y) |
Typedefs | |
| using | platf::kms::plane_res_t = util::safe_ptr<drmModePlaneRes, drmModeFreePlaneResources> |
| using | platf::kms::encoder_t = util::safe_ptr<drmModeEncoder, drmModeFreeEncoder> |
| using | platf::kms::res_t = util::safe_ptr<drmModeRes, drmModeFreeResources> |
| using | platf::kms::plane_t = util::safe_ptr<drmModePlane, drmModeFreePlane> |
| using | platf::kms::fb_t = std::unique_ptr<wrapper_fb> |
| using | platf::kms::crtc_t = util::safe_ptr<drmModeCrtc, drmModeFreeCrtc> |
| using | platf::kms::obj_prop_t = util::safe_ptr<drmModeObjectProperties, drmModeFreeObjectProperties> |
| using | platf::kms::prop_t = util::safe_ptr<drmModePropertyRes, drmModeFreeProperty> |
| using | platf::kms::prop_blob_t = util::safe_ptr<drmModePropertyBlobRes, drmModeFreePropertyBlob> |
| using | platf::kms::version_t = util::safe_ptr<drmVersion, drmFreeVersion> |
| using | platf::kms::conn_type_count_t = std::map<std::uint32_t, std::uint32_t> |
Enumerations | |
| enum class | hermes_fence_wait_e { ready , timeout , failed , error } |
Functions | |
| void | platf::kms::accumulate_capture_metric (const char *label, long long ns) |
| std::uint32_t | platf::kms::hermes_timeout_ms (std::chrono::milliseconds timeout) |
| hermes_fence_wait_e | platf::kms::wait_hermes_frame_fence (int fd, std::chrono::steady_clock::time_point deadline) |
| capture_e | platf::kms::hermes_acquire_failure (const char *path, int acquire_errno) |
| int | platf::kms::hermes_dma_buf_sync (int fd, std::uint64_t flags) |
| std::string_view | platf::kms::plane_type (std::uint64_t val) |
| capture_e | platf::kms::refresh_hermes_cursor (int render_fd, std::chrono::steady_clock::time_point deadline, cursor_t &captured_cursor, std::uint64_t &last_cursor_sequence) |
| void | platf::kms::attach_hermes_cursor (egl::img_descriptor_t &img, bool requested, const cursor_t &captured_cursor) |
| std::string | platf::kms::hermes_fourcc_name (uint32_t fourcc) |
| "XR30" for a printable fourcc, its hex value otherwise. | |
| constexpr bool | platf::kms::hermes_ten_bit_format (uint32_t fourcc) |
| A frame word packing 10-bit R, G and B, in either channel order. | |
| constexpr bool | platf::kms::hermes_cpu_copy_format (uint32_t fourcc) |
| void | platf::kms::blend_hermes_cursor (img_t &img, const cursor_t &cursor, uint32_t fourcc=DRM_FORMAT_ARGB8888) |
| std::map< std::uint32_t, monitor_t > | platf::kms::map_crtc_to_monitor (const std::vector< connector_t > &connectors) |
| void | platf::kms::print (plane_t::pointer plane, fb_t::pointer fb, crtc_t::pointer crtc) |
| bool | platf::kms::hermes_layout_changed (std::uint64_t &recorded) |
| void | platf::kms::resolve_hermes_input_geometry (const std::string &display_name, int width, int height, int &offset_x, int &offset_y, int &env_width, int &env_height) |
| bool | platf::kms::wait_hermes_capture_size (int fd, int &width, int &height) |
| std::shared_ptr< display_t > | platf::kms_display (mem_type_e hwdevice_type, const std::string &display_name, const ::video::config_t &config) |
| void | platf::correlate_to_wayland (std::vector< kms::card_descriptor_t > &cds) |
| std::vector< std::string > | platf::kms_display_names (mem_type_e hwdevice_type) |
Definitions for KMS screen capture.
Definition in file kmsgrab.cpp.
| #define _CONVERT | ( | x, | |
| y ) |
| using platf::kms::conn_type_count_t = std::map<std::uint32_t, std::uint32_t> |
Definition at line 260 of file kmsgrab.cpp.
| using platf::kms::crtc_t = util::safe_ptr<drmModeCrtc, drmModeFreeCrtc> |
Definition at line 254 of file kmsgrab.cpp.
| using platf::kms::encoder_t = util::safe_ptr<drmModeEncoder, drmModeFreeEncoder> |
Definition at line 250 of file kmsgrab.cpp.
| using platf::kms::fb_t = std::unique_ptr<wrapper_fb> |
Definition at line 253 of file kmsgrab.cpp.
| using platf::kms::obj_prop_t = util::safe_ptr<drmModeObjectProperties, drmModeFreeObjectProperties> |
Definition at line 255 of file kmsgrab.cpp.
| using platf::kms::plane_res_t = util::safe_ptr<drmModePlaneRes, drmModeFreePlaneResources> |
Definition at line 249 of file kmsgrab.cpp.
| using platf::kms::plane_t = util::safe_ptr<drmModePlane, drmModeFreePlane> |
Definition at line 252 of file kmsgrab.cpp.
| using platf::kms::prop_blob_t = util::safe_ptr<drmModePropertyBlobRes, drmModeFreePropertyBlob> |
Definition at line 257 of file kmsgrab.cpp.
| using platf::kms::prop_t = util::safe_ptr<drmModePropertyRes, drmModeFreeProperty> |
Definition at line 256 of file kmsgrab.cpp.
| using platf::kms::res_t = util::safe_ptr<drmModeRes, drmModeFreeResources> |
Definition at line 251 of file kmsgrab.cpp.
| using platf::kms::version_t = util::safe_ptr<drmVersion, drmFreeVersion> |
Definition at line 258 of file kmsgrab.cpp.
|
strong |
Definition at line 71 of file kmsgrab.cpp.
|
inline |
Definition at line 55 of file kmsgrab.cpp.
|
inline |
Definition at line 592 of file kmsgrab.cpp.
|
inline |
Blend the premultiplied ARGB8888 cursor into a CPU-copied frame.
| fourcc | Format of the frame. In a 10-bit frame each 8-bit cursor channel is scaled to ten bits and blended into the packed word, keeping the frame's two padding bits. |
Definition at line 651 of file kmsgrab.cpp.
| 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 :(
Definition at line 3080 of file kmsgrab.cpp.
|
inline |
Definition at line 150 of file kmsgrab.cpp.
|
constexpr |
Formats the CPU-copy capture can hand to an encoder: 32-bit words of 8-bit BGRA, or of packed 10-bit RGB.
Definition at line 641 of file kmsgrab.cpp.
|
inline |
Definition at line 167 of file kmsgrab.cpp.
| std::string platf::kms::hermes_fourcc_name | ( | uint32_t | fourcc | ) |
"XR30" for a printable fourcc, its hex value otherwise.
Definition at line 619 of file kmsgrab.cpp.
|
inline |
The geometry a capture resolved at start-up is a snapshot of the compositor's layout, and the compositor can rewrite that layout at any moment - another monitor plugged in, the display panel opened, a stored configuration reapplied after a resume. When it does, the offsets absolute input is measured against are stale and the pointer goes back to landing in the wrong place, with nothing failing to say so.
Reinitialising is how the rest of this file already handles the display changing underneath it, and it re-resolves the geometry and republishes the touch port on the way through, so this needs no path of its own.
Definition at line 2183 of file kmsgrab.cpp.
|
constexpr |
A frame word packing 10-bit R, G and B, in either channel order.
Definition at line 634 of file kmsgrab.cpp.
|
inline |
Definition at line 81 of file kmsgrab.cpp.
| std::shared_ptr< display_t > platf::kms_display | ( | mem_type_e | hwdevice_type, |
| const std::string & | display_name, | ||
| const ::video::config_t & | config ) |
Definition at line 3000 of file kmsgrab.cpp.
| std::vector< std::string > platf::kms_display_names | ( | mem_type_e | hwdevice_type | ) |
Definition at line 3165 of file kmsgrab.cpp.
| std::map< std::uint32_t, monitor_t > platf::kms::map_crtc_to_monitor | ( | const std::vector< connector_t > & | connectors | ) |
Definition at line 988 of file kmsgrab.cpp.
| std::string_view platf::kms::plane_type | ( | std::uint64_t | val | ) |
Definition at line 265 of file kmsgrab.cpp.
| void platf::kms::print | ( | plane_t::pointer | plane, |
| fb_t::pointer | fb, | ||
| crtc_t::pointer | crtc ) |
Definition at line 1032 of file kmsgrab.cpp.
|
inline |
Definition at line 450 of file kmsgrab.cpp.
|
inline |
Place a Hermes-KMS output on the host desktop, for absolute input.
The client sends pointer coordinates inside the streamed display, while the uinput device Hermes injects them through spans the whole desktop. Without this display's offset and the desktop's envelope, those coordinates are measured against the wrong rectangle and the pointer lands on whichever monitor sits at the desktop origin - the physical one, on every extended desktop.
Falls back to output-local coordinates, which are only correct when the virtual display is the entire desktop.
Definition at line 2207 of file kmsgrab.cpp.
| bool platf::kms::wait_hermes_capture_size | ( | int | fd, |
| int & | width, | ||
| int & | height ) |
Definition at line 2266 of file kmsgrab.cpp.
|
inline |
Definition at line 98 of file kmsgrab.cpp.