Hermes 0.7.0
Linux game streaming host
Loading...
Searching...
No Matches
virtual_display.cpp File Reference

Virtual display implementation for Linux using EVDI. More...

#include <atomic>
#include <algorithm>
#include <array>
#include <chrono>
#include <cctype>
#include <cerrno>
#include <cstdarg>
#include <cstddef>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <dlfcn.h>
#include <filesystem>
#include <fstream>
#include <limits>
#include <map>
#include <mutex>
#include <optional>
#include <set>
#include <sstream>
#include <thread>
#include <vector>
#include <nlohmann/json.hpp>
#include <csignal>
#include <fcntl.h>
#include <linux/i2c-dev.h>
#include <poll.h>
#include <sys/wait.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/sysmacros.h>
#include <sys/un.h>
#include <sys/utsname.h>
#include <unistd.h>
#include <xf86drm.h>
#include <xf86drmMode.h>
#include "bounded_command.h"
#include "card_broker.h"
#include "hermes_kms_capture.h"
#include "misc.h"
#include "src/config.h"
#include "src/logging.h"
#include "src/utility.h"
#include "virtual_display.h"
#include "window_placement.h"
#include "wayland.h"
Include dependency graph for virtual_display.cpp:

Go to the source code of this file.

Classes

struct  VDISPLAY::evdi_lib_version
struct  VDISPLAY::evdi_mode
struct  VDISPLAY::evdi_rect
struct  VDISPLAY::evdi_buffer
struct  VDISPLAY::evdi_cursor_set
struct  VDISPLAY::evdi_cursor_move
struct  VDISPLAY::evdi_ddcci_data
struct  VDISPLAY::evdi_event_context
struct  VDISPLAY::hermes_kms::version_t
struct  VDISPLAY::hermes_kms::caps_t
struct  VDISPLAY::hermes_kms::identity_t
struct  VDISPLAY::hermes_kms::select_output_t
struct  VDISPLAY::hermes_kms::set_output_t
struct  VDISPLAY::hermes_kms::acquire_frame_t
struct  VDISPLAY::hermes_kms::acquire_frame2_t
struct  VDISPLAY::hermes_kms::wait_frame_t
struct  VDISPLAY::hermes_kms::wait_update_t
struct  VDISPLAY::hermes_kms::acquire_cursor_t
struct  VDISPLAY::hermes_kms::metrics_t
struct  VDISPLAY::hermes_kms::session_access_t
struct  VDISPLAY::hermes_kms::device_t
struct  VDISPLAY::hermes_kms::probe_t
struct  VDISPLAY::VirtualDisplayInfo
struct  VDISPLAY::kscreen::layout_t
struct  VDISPLAY::mutter::logical_monitor_t
struct  VDISPLAY::mutter::mode_t
struct  VDISPLAY::mutter::monitor_t
struct  VDISPLAY::mutter::state_t
struct  VDISPLAY::mutter::layout_state_t
struct  VDISPLAY::mutter::device_settings_t
struct  VDISPLAY::mutter::input_mapping_t

Namespaces

namespace  VDISPLAY::hyprland
 Hyprland's control socket.

Macros

#define LOAD_EVDI_FUNC(name)

Typedefs

typedef struct evdi_device_context * VDISPLAY::evdi_handle
typedef evdi_device_status(*) VDISPLAY::fn_evdi_check_device(int device)
typedef evdi_handle(*) VDISPLAY::fn_evdi_open(int device)
typedef int(*) VDISPLAY::fn_evdi_add_device(void)
typedef void(*) VDISPLAY::fn_evdi_close(evdi_handle handle)
typedef void(*) VDISPLAY::fn_evdi_connect(evdi_handle handle, const unsigned char *edid, const unsigned int edid_length, const uint32_t sku_area_limit)
typedef void(*) VDISPLAY::fn_evdi_disconnect(evdi_handle handle)
typedef void(*) VDISPLAY::fn_evdi_grab_pixels(evdi_handle handle, struct evdi_rect *rects, int *num_rects)
typedef void(*) VDISPLAY::fn_evdi_register_buffer(evdi_handle handle, struct evdi_buffer buffer)
typedef void(*) VDISPLAY::fn_evdi_unregister_buffer(evdi_handle handle, int bufferId)
typedef bool(*) VDISPLAY::fn_evdi_request_update(evdi_handle handle, int bufferId)
typedef void(*) VDISPLAY::fn_evdi_handle_events(evdi_handle handle, struct evdi_event_context *evtctx)
typedef int(*) VDISPLAY::fn_evdi_get_event_ready(evdi_handle handle)
typedef void(*) VDISPLAY::fn_evdi_get_lib_version(struct evdi_lib_version *version)
using VDISPLAY::kscreen::output_t = kscreen_output_t

Enumerations

enum  evdi_device_status { EVDI_AVAILABLE , EVDI_UNRECOGNIZED , EVDI_NOT_PRESENT }
enum class  VirtualDisplayBackend { NONE , EVDI , HERMES_KMS , HYPRLAND_HEADLESS }
enum class  VDISPLAY::hermes_kms::probe_result { ok , no_device , uapi_too_old , missing_caps }
enum class  apply_method : unsigned { verify = 0 , temporary = 1 , persistent = 2 }
enum class  VDISPLAY::mutter::layout_mode_e : unsigned { logical = 1 , physical = 2 }
 Values of Mutter's "layout-mode" property. More...
enum class  VDISPLAY::mutter::layout_repair { unavailable , not_needed , unsafe , ready }
enum class  VDISPLAY::mutter::mode_push { unavailable , unsupported , already_set , ready }
enum class  VDISPLAY::mutter::layout_change { unavailable , unsupported , already_set , ready }

Functions

std::string VDISPLAY::systemdUserBusAddress (uint32_t uid)
 The standard systemd user-bus address for uid.
bool VDISPLAY::displayServerReachable (const std::string &wayland_display, const std::string &x_display, const std::string &runtime_dir)
 Whether a display server is listening where these variables point.
std::optional< bool > VDISPLAY::graphicalSessionPresent ()
 Whether this user has a session of their own, as logind sees it - graphical or not, so a "yes" does not mean a desktop is up.
bool VDISPLAY::inLoginSession ()
 Whether Hermes itself runs inside a login session - started from a terminal or over SSH - rather than as a service of the user manager.
std::optional< std::vector< std::string > > VDISPLAY::userManagerEnvironment ()
 The environment the systemd user manager hands to the units it starts, as "NAME=value" strings.
bool VDISPLAY::unlockHostSessionIfLocked ()
 Unlock the active graphical login session for the Hermes user when locked.
compositor_e VDISPLAY::compositorFromDesktopNames (const std::string &desktop_names)
 Classify a compositor from an XDG_CURRENT_DESKTOP-style value.
compositor_e VDISPLAY::sessionCompositor ()
 Classify the compositor of the running session.
std::string VDISPLAY::compositorName (compositor_e compositor)
std::string VDISPLAY::featureName (feature_e feature)
std::string VDISPLAY::readinessName (readiness_e readiness)
std::vector< FeatureReport > VDISPLAY::assessSession (const SessionFacts &facts)
 Turn observations into a per-feature verdict with remediation.
bool VDISPLAY::hermesKmsSeatIsolationActive ()
 Whether Hermes-KMS session cards carry a private DRM seat.
std::optional< bool > VDISPLAY::displayConnectorLit (const std::filesystem::path &drm_class="/sys/class/drm", const std::string &ignored_connector={})
 Whether any DRM connector is lighting a monitor right now.
bool VDISPLAY::windowSystemAttached ()
 Whether Hermes runs inside a graphical session (Wayland or X11).
bool VDISPLAY::removalStrandsGreeter (bool greeter_on_seat, bool output_lit, std::optional< bool > another_connector_lit)
 Whether removing a virtual display would leave the login greeter with nothing to draw on.
std::string VDISPLAY::parkedConnector ()
 The connector of the output being kept for the login greeter, or empty. It is lit, but it is not a monitor the host has.
bool VDISPLAY::waitForConnectorEnabled (const std::string &connector, std::chrono::milliseconds timeout, const std::filesystem::path &drm_class="/sys/class/drm")
 Wait until some compositor has bound connector to a CRTC.
std::string VDISPLAY::buildKScreenLayoutCommand (const std::string &virtual_output, const std::map< std::string, int > &enabled_before, int target_x, int target_y, int mode_width, int mode_height, int mode_refresh_hz, const std::map< std::string, kscreen_point_t > &positions_before={}, virtual_display_layout_e layout=virtual_display_layout_e::extend)
 Build the kscreen-doctor invocation that enables a virtual output, places it, and drives it at a requested mode.
kscreen_point_t VDISPLAY::kscreenVirtualOutputPosition (const std::string &virtual_output, const std::vector< kscreen_output_t > &before, const std::vector< kscreen_output_t > &current, virtual_display_layout_e layout)
 Decide where the virtual output goes, in KScreen's logical space.
bool VDISPLAY::kscreenDisplayGeometry (const std::vector< kscreen_output_t > &outputs, const std::string &output_name, int &offset_x, int &offset_y, int &environment_width, int &environment_height)
 Resolve one KScreen output inside the live desktop envelope.
std::optional< std::string > VDISPLAY::kscreenLayoutFailure (std::string_view output)
 What went wrong with a kscreen-doctor layout command, read from its output.
kscreen_mode_state_e VDISPLAY::kscreenModeState (const std::string &json_text, const std::string &output, int width, int height, int refresh_hz)
 Find a mode on one output in a kscreen-doctor -j reply.
std::optional< kscreen_hdr_state_t > VDISPLAY::kscreenHdrState (const std::string &json_text, const std::string &output)
std::optional< std::string > VDISPLAY::boundedCommandOutput (const std::string &command, std::chrono::milliseconds timeout, bool *timed_out=nullptr)
 Run a shell command and collect its standard output, waiting no longer than timeout for it.
bool VDISPLAY::needsInitialDeviceConfiguration ()
 Whether EVDI needs a device pre-created at module load time.
EVDI_DIAGNOSTIC VDISPLAY::getEvdiDiagnostic ()
SessionFacts VDISPLAY::probeSessionFacts ()
void VDISPLAY::logSessionAssessment ()
 Probe, assess and log what this session can and cannot do.
EvdiStatus VDISPLAY::getEvdiStatus ()
HERMES_KMS_DIAGNOSTIC VDISPLAY::getHermesKmsDiagnostic ()
HermesKmsStatus VDISPLAY::getHermesKmsStatus ()
DRIVER_STATUS VDISPLAY::openVDisplayDevice ()
 Initialize the virtual display driver.
void VDISPLAY::closeVDisplayDevice ()
 Close the virtual display driver.
bool VDISPLAY::startPingThread (std::function< void()> failCb)
 Start a ping thread to keep the virtual display alive.
bool VDISPLAY::setRenderAdapterByName (const std::string &adapterName)
 Set the render adapter by name.
std::string VDISPLAY::createVirtualDisplay (const char *s_client_uid, const char *s_client_name, uint32_t width, uint32_t height, uint32_t fps, const uuid_util::uuid_t &guid, std::optional< uid_t > session_owner_uid=std::nullopt, virtual_display_layout_e layout=virtual_display_layout_e::extend, bool isolated_session=false)
 Create a virtual display.
bool VDISPLAY::removeVirtualDisplay (const uuid_util::uuid_t &guid)
 Remove a virtual display.
int VDISPLAY::changeDisplaySettings (const char *deviceName, int width, int height, int refresh_rate, int deadline_ms=4000)
 Change the display settings of a virtual display.
int VDISPLAY::changeDisplaySettings2 (const char *deviceName, int width, int height, int refresh_rate, bool bApplyIsolated=false)
 Change the display settings with isolated display option.
std::string VDISPLAY::getEvdiConnectorName (const std::string &displayName)
std::string VDISPLAY::getHermesKmsConnectorName (const std::string &displayName)
bool VDISPLAY::buildMutterLayoutWithoutConnector (const std::string &current_state, const std::string &virtual_connector, std::string &serial, std::string &argument)
 Build the Mutter ApplyMonitorsConfig payload that drops a connector.
bool VDISPLAY::buildMutterLayoutWithMode (const std::string &current_state, const std::string &connector, uint32_t width, uint32_t height, uint32_t refresh_mhz, std::string &serial, std::string &argument)
 Build the Mutter ApplyMonitorsConfig payload that drives a connector at a requested geometry.
bool VDISPLAY::buildMutterExclusiveLayout (const std::string &current_state, const std::string &connector, std::string &serial, std::string &argument)
 Build the ApplyMonitorsConfig payload that hands the desktop to connector alone, which is how a monitor is turned off on GNOME: Mutter disables every connected monitor absent from the config.
bool VDISPLAY::buildMutterMirrorLayout (const std::string &current_state, const std::string &connector, std::string &serial, std::string &argument)
 Build the payload that clones the primary output onto connector.
bool VDISPLAY::buildMutterRestoreLayout (const std::string &current_state, std::string &serial, std::string &argument)
 Build the payload that reproduces the layout in current_state.
std::string VDISPLAY::mutterInputDeviceOutputValue (const std::string &current_state, const std::string &connector)
 The GNOME output value that binds an input device to connector.
void VDISPLAY::mutterInputDeviceSettingsTargets (std::string &touch, std::string &pen)
 The relocatable-schema targets whose output key binds Hermes' own touch and pen devices, as <schema>:<path>.
bool VDISPLAY::isHermesKWinInputDevice (const std::string &name, uint32_t vendor, uint32_t product)
 Whether a device KWin reports is one of Hermes' touch or pen devices.
std::string VDISPLAY::buildKWinInputBindingReadCommand (const std::string &device_name)
 The kreadconfig6 command that prints the output UUID a KWin input device is bound to. It prints nothing when there is none.
std::string VDISPLAY::buildKWinInputBindingRestoreCommand (const std::string &device_name, const std::string &previous_uuid)
 The kwriteconfig6 command that puts a KWin input device's binding back to previous_uuid, deleting the key when it is empty.
uint64_t VDISPLAY::displayLayoutGeneration ()
 A counter bumped whenever the desktop layout changes underneath a running session.
bool VDISPLAY::mutterDisplayGeometry (const std::string &current_state, const std::string &connector, int &offset_x, int &offset_y, int &environment_width, int &environment_height)
 Where a connector sits on a GNOME desktop, for absolute input.
std::string VDISPLAY::getHyprlandOutputName (const std::string &displayName)
 The Hyprland output name backing a virtual display, or empty.
void VDISPLAY::placeWindowsOnVirtualDisplay (const std::string &displayName, const std::vector< std::string > &windowClasses, const std::vector< std::uint32_t > &gamescopePids)
void VDISPLAY::notePhysicalCaptureOutput (const std::string &connector_name)
std::string VDISPLAY::primaryPhysicalOutputName ()
 The desktop's primary physical output ("DP-2"), or empty.
void VDISPLAY::beginPhysicalOutputSession ()
void VDISPLAY::endPhysicalOutputSession ()
bool VDISPLAY::wakeSleepingMonitor ()
 Wake a monitor the compositor has put to sleep.
bool VDISPLAY::activateVirtualDisplayOutput (const std::string &displayName)
hdr_launch_mode_t VDISPLAY::virtualDisplayHdrMode (bool requested, const kscreen_hdr_state_t &state, bool driver_reports_frame_color)
bool VDISPLAY::configureVirtualDisplayHdr (const std::string &displayName, bool hdr)
bool VDISPLAY::enableExclusiveVirtualDisplay (const std::string &displayName)
void VDISPLAY::restoreExclusiveVirtualDisplay ()
std::string VDISPLAY::getPrimaryDisplay ()
 Get the primary display name.
bool VDISPLAY::setPrimaryDisplay (const char *primaryDeviceName)
 Set the primary display by name.
bool VDISPLAY::getDisplayHDRByName (const char *displayName)
 Get the HDR status of a display by name.
bool VDISPLAY::setDisplayHDRByName (const char *displayName, bool enableAdvancedColor)
 Set the HDR status of a display by name.
std::vector< std::string > VDISPLAY::matchDisplay (const std::string &sMatch)
 Match displays by a given pattern.
bool VDISPLAY::isEvdiDisplay (const std::string &displayName)
 Check if a display name is an EVDI virtual display.
bool VDISPLAY::isHermesKmsDisplay (const std::string &displayName)
int VDISPLAY::getEvdiCardIndex (const std::string &displayName)
 Get the DRM card index for an EVDI display.
int VDISPLAY::getHermesKmsCardIndex (const std::string &displayName)
bool VDISPLAY::isHermesKmsDriverPresent ()
std::vector< std::string > VDISPLAY::listHermesKmsDisplayNames ()
std::string VDISPLAY::getHermesKmsDevicePath (const std::string &displayName)
std::string VDISPLAY::getHermesKmsSeatName (const std::string &displayName)
HermesKmsMetrics VDISPLAY::getHermesKmsMetrics ()
 Read the Hermes-KMS device metrics, if a metrics-capable device is present. It opens a short-lived render fd and binds the active generic session capability before reading protected counters.
std::shared_ptr< EvdiBuffer > VDISPLAY::getEvdiBuffer (const std::string &display_name)
int VDISPLAY::hermesKmsOpenCapture (const std::string &display_name)
bool VDISPLAY::getHermesKmsDisplayGeometry (const std::string &display_name, int &offset_x, int &offset_y, int &environment_width, int &environment_height)
bool VDISPLAY::hermesKmsCaptureSize (int render_fd, int &width, int &height, uint32_t timeout_ms)
bool VDISPLAY::hermesKmsReportsFrameColor (int render_fd)
bool VDISPLAY::hermesKmsCaptureColor (int render_fd, hermes_kms::color_t &color, uint32_t &fourcc)
bool VDISPLAY::hermesKmsAcquireFrame (int render_fd, uint64_t after_sequence, uint32_t timeout_ms, HermesKmsFrame &out, bool capture_color)
bool VDISPLAY::hermesKmsWaitUpdate (int render_fd, uint64_t after_frame_sequence, uint64_t after_cursor_sequence, uint32_t timeout_ms, HermesKmsUpdate &out)
bool VDISPLAY::hermesKmsAcquireCursor (int render_fd, bool request_buffer, HermesKmsCursor &out)

Variables

constexpr uint32_t VDISPLAY::hermes_kms::multi_output_uapi_version = 8
constexpr uint32_t VDISPLAY::hermes_kms::multi_device_uapi_version = 9
constexpr uint32_t VDISPLAY::hermes_kms::session_device_uapi_version = 10
constexpr uint32_t VDISPLAY::hermes_kms::session_access_uapi_version = 11
constexpr uint32_t VDISPLAY::hermes_kms::dynamic_devices_uapi_version = 12
constexpr uint32_t VDISPLAY::hermes_kms::session_lifecycle_uapi_version = 13
constexpr uint32_t VDISPLAY::hermes_kms::newest_known_uapi_version = 14
constexpr size_t VDISPLAY::hermes_kms::name_len = 32
constexpr uint64_t VDISPLAY::hermes_kms::cap_virtual_output = 1ULL << 0
constexpr uint64_t VDISPLAY::hermes_kms::cap_output_control = 1ULL << 1
constexpr uint64_t VDISPLAY::hermes_kms::cap_frame_acquire = 1ULL << 5
constexpr uint64_t VDISPLAY::hermes_kms::cap_dmabuf_export = 1ULL << 6
constexpr uint64_t VDISPLAY::hermes_kms::cap_output_identity = 1ULL << 7
constexpr uint64_t VDISPLAY::hermes_kms::cap_session_owner = 1ULL << 8
constexpr uint64_t VDISPLAY::hermes_kms::cap_frame_wait = 1ULL << 9
constexpr uint64_t VDISPLAY::hermes_kms::cap_metrics = 1ULL << 10
constexpr uint64_t VDISPLAY::hermes_kms::cap_multi_output = 1ULL << 11
constexpr uint64_t VDISPLAY::hermes_kms::cap_multi_device = 1ULL << 12
constexpr uint64_t VDISPLAY::hermes_kms::cap_session_token = 1ULL << 14
constexpr uint64_t VDISPLAY::hermes_kms::cap_cursor_capture = 1ULL << 15
constexpr uint64_t VDISPLAY::hermes_kms::cap_dynamic_devices = 1ULL << 16
constexpr uint64_t VDISPLAY::hermes_kms::cap_session_lifecycle = 1ULL << 17
constexpr uint64_t VDISPLAY::hermes_kms::cap_zero_copy_target = 1ULL << 33
constexpr uint64_t VDISPLAY::hermes_kms::cap_sync_file = 1ULL << 35
constexpr uint32_t VDISPLAY::hermes_kms::set_output_connected = 1U << 0
constexpr uint32_t VDISPLAY::hermes_kms::set_output_owner_assigned = 1U << 1
constexpr uint32_t VDISPLAY::hermes_kms::device_role_session = 2U
constexpr uint64_t VDISPLAY::hermes_kms::frame_request_dmabuf = 1ULL << 0
constexpr uint64_t VDISPLAY::hermes_kms::frame_dmabuf_valid = 1ULL << 2
constexpr uint64_t VDISPLAY::hermes_kms::frame_sync_file_valid = 1ULL << 3
constexpr uint64_t VDISPLAY::hermes_kms::frame_request_sync_file = 1ULL << 5
constexpr uint64_t VDISPLAY::hermes_kms::wait_frame_ready = 1ULL << 0
constexpr uint64_t VDISPLAY::hermes_kms::wait_update_frame_ready = 1ULL << 0
constexpr uint64_t VDISPLAY::hermes_kms::wait_update_cursor_ready = 1ULL << 1
constexpr uint64_t VDISPLAY::hermes_kms::cursor_request_dmabuf = 1ULL << 0
constexpr uint64_t VDISPLAY::hermes_kms::cursor_request_sync_file = 1ULL << 1
constexpr uint64_t VDISPLAY::hermes_kms::cursor_metadata_valid = 1ULL << 2
constexpr uint64_t VDISPLAY::hermes_kms::cursor_visible = 1ULL << 3
constexpr uint64_t VDISPLAY::hermes_kms::cursor_position_valid = 1ULL << 4
constexpr uint64_t VDISPLAY::hermes_kms::cursor_buffer_valid = 1ULL << 6
constexpr uint64_t VDISPLAY::hermes_kms::cursor_dmabuf_valid = 1ULL << 7
constexpr uint64_t VDISPLAY::hermes_kms::cursor_sync_file_valid = 1ULL << 8
constexpr uint64_t VDISPLAY::hermes_kms::cursor_geometry_valid = 1ULL << 9
constexpr uint32_t VDISPLAY::hermes_kms::session_access_get_token = 1U
constexpr uint32_t VDISPLAY::hermes_kms::session_access_bind = 2U
constexpr uint32_t VDISPLAY::hermes_kms::session_access_rotate_token = 4U
constexpr uint32_t VDISPLAY::hermes_kms::session_access_revoke_bindings = 5U
constexpr uint32_t VDISPLAY::hermes_kms::session_access_result_bound = 1U << 0
constexpr uint32_t VDISPLAY::hermes_kms::session_access_result_token_valid = 1U << 1
constexpr uint32_t VDISPLAY::hermes_kms::session_access_result_revoked = 1U << 2
constexpr unsigned long VDISPLAY::hermes_kms::ioctl_get_version = DRM_IOR(DRM_COMMAND_BASE + 0x00, version_t)
constexpr unsigned long VDISPLAY::hermes_kms::ioctl_get_caps = DRM_IOR(DRM_COMMAND_BASE + 0x01, caps_t)
constexpr unsigned long VDISPLAY::hermes_kms::ioctl_get_status = DRM_IOR(DRM_COMMAND_BASE + 0x02, status_t)
constexpr unsigned long VDISPLAY::hermes_kms::ioctl_set_output = DRM_IOWR(DRM_COMMAND_BASE + 0x03, set_output_t)
constexpr unsigned long VDISPLAY::hermes_kms::ioctl_acquire_frame2 = DRM_IOWR(DRM_COMMAND_BASE + 0x0c, acquire_frame2_t)
constexpr unsigned long VDISPLAY::hermes_kms::ioctl_acquire_frame = DRM_IOWR(DRM_COMMAND_BASE + 0x04, acquire_frame_t)
constexpr unsigned long VDISPLAY::hermes_kms::ioctl_get_identity = DRM_IOR(DRM_COMMAND_BASE + 0x05, identity_t)
constexpr unsigned long VDISPLAY::hermes_kms::ioctl_wait_frame = DRM_IOWR(DRM_COMMAND_BASE + 0x06, wait_frame_t)
constexpr unsigned long VDISPLAY::hermes_kms::ioctl_get_metrics = DRM_IOR(DRM_COMMAND_BASE + 0x07, metrics_t)
constexpr unsigned long VDISPLAY::hermes_kms::ioctl_select_output = DRM_IOWR(DRM_COMMAND_BASE + 0x08, select_output_t)
constexpr unsigned long VDISPLAY::hermes_kms::ioctl_session_access = DRM_IOWR(DRM_COMMAND_BASE + 0x09, session_access_t)
constexpr unsigned long VDISPLAY::hermes_kms::ioctl_acquire_cursor = DRM_IOWR(DRM_COMMAND_BASE + 0x0a, acquire_cursor_t)
constexpr unsigned long VDISPLAY::hermes_kms::ioctl_wait_update = DRM_IOWR(DRM_COMMAND_BASE + 0x0b, wait_update_t)
constexpr std::chrono::seconds VDISPLAY::kscreen::command_timeout {10}
constexpr int VDISPLAY::EVDI_DEVICE_SEARCH_LIMIT = 64

Detailed Description

Virtual display implementation for Linux using EVDI.

This implementation provides virtual display support on Linux using EVDI (Extensible Virtual Display Interface) for creating true virtual displays that are separate from physical monitors.

When EVDI is unavailable, virtual-display sessions are disabled rather than silently capturing an unrelated physical monitor.

Definition in file virtual_display.cpp.

Macro Definition Documentation

◆ LOAD_EVDI_FUNC

#define LOAD_EVDI_FUNC ( name)
Value:
evdi.name = (fn_evdi_##name)dlsym(evdi.lib_handle, "evdi_" #name); \
if (!evdi.name) { \
BOOST_LOG(error) << "[VDISPLAY] Failed to load evdi_" #name; \
dlclose(evdi.lib_handle); \
evdi.lib_handle = nullptr; \
return false; \
}

Typedef Documentation

◆ evdi_handle

typedef struct evdi_device_context* VDISPLAY::evdi_handle

Definition at line 333 of file virtual_display.cpp.

◆ fn_evdi_add_device

typedef int(*) VDISPLAY::fn_evdi_add_device(void)

Definition at line 401 of file virtual_display.cpp.

◆ fn_evdi_check_device

typedef evdi_device_status(*) VDISPLAY::fn_evdi_check_device(int device)

Definition at line 399 of file virtual_display.cpp.

◆ fn_evdi_close

typedef void(*) VDISPLAY::fn_evdi_close(evdi_handle handle)

Definition at line 402 of file virtual_display.cpp.

◆ fn_evdi_connect

typedef void(*) VDISPLAY::fn_evdi_connect(evdi_handle handle, const unsigned char *edid, const unsigned int edid_length, const uint32_t sku_area_limit)

Definition at line 403 of file virtual_display.cpp.

◆ fn_evdi_disconnect

typedef void(*) VDISPLAY::fn_evdi_disconnect(evdi_handle handle)

Definition at line 406 of file virtual_display.cpp.

◆ fn_evdi_get_event_ready

typedef int(*) VDISPLAY::fn_evdi_get_event_ready(evdi_handle handle)

Definition at line 412 of file virtual_display.cpp.

◆ fn_evdi_get_lib_version

typedef void(*) VDISPLAY::fn_evdi_get_lib_version(struct evdi_lib_version *version)

Definition at line 413 of file virtual_display.cpp.

◆ fn_evdi_grab_pixels

typedef void(*) VDISPLAY::fn_evdi_grab_pixels(evdi_handle handle, struct evdi_rect *rects, int *num_rects)

Definition at line 407 of file virtual_display.cpp.

◆ fn_evdi_handle_events

typedef void(*) VDISPLAY::fn_evdi_handle_events(evdi_handle handle, struct evdi_event_context *evtctx)

Definition at line 411 of file virtual_display.cpp.

◆ fn_evdi_open

typedef evdi_handle(*) VDISPLAY::fn_evdi_open(int device)

Definition at line 400 of file virtual_display.cpp.

◆ fn_evdi_register_buffer

typedef void(*) VDISPLAY::fn_evdi_register_buffer(evdi_handle handle, struct evdi_buffer buffer)

Definition at line 408 of file virtual_display.cpp.

◆ fn_evdi_request_update

typedef bool(*) VDISPLAY::fn_evdi_request_update(evdi_handle handle, int bufferId)

Definition at line 410 of file virtual_display.cpp.

◆ fn_evdi_unregister_buffer

typedef void(*) VDISPLAY::fn_evdi_unregister_buffer(evdi_handle handle, int bufferId)

Definition at line 409 of file virtual_display.cpp.

◆ output_t

using VDISPLAY::kscreen::output_t = kscreen_output_t

Definition at line 2746 of file virtual_display.cpp.

Enumeration Type Documentation

◆ apply_method

enum class VDISPLAY::mutter::apply_method : unsigned
strong

Definition at line 4061 of file virtual_display.cpp.

◆ evdi_device_status

enum VDISPLAY::evdi_device_status

Definition at line 335 of file virtual_display.cpp.

◆ layout_change

Enumerator
unavailable 

The reply did not parse, or the connector is not driven.

unsupported 

The change cannot be expressed on this desktop.

already_set 

The layout already is what was asked for.

ready 

argument holds the config to submit.

Definition at line 5051 of file virtual_display.cpp.

◆ layout_mode_e

enum class VDISPLAY::mutter::layout_mode_e : unsigned
strong

Values of Mutter's "layout-mode" property.

Enumerator
logical 

A logical monitor measures mode / scale.

physical 

A logical monitor measures the mode, whatever the scale.

Definition at line 4095 of file virtual_display.cpp.

◆ layout_repair

Enumerator
unavailable 

The reply did not parse; worth retrying.

not_needed 

The connector is not in Mutter's layout.

unsafe 

Dropping it would leave Mutter with nothing to drive.

ready 

argument holds the config to submit.

Definition at line 4493 of file virtual_display.cpp.

◆ mode_push

enum class VDISPLAY::mutter::mode_push
strong
Enumerator
unavailable 

Reply unusable, or Mutter has not probed the connector yet.

unsupported 

The connector does not advertise the requested geometry.

already_set 

Mutter already drives the connector at that mode.

ready 

argument holds the config to submit.

Definition at line 4593 of file virtual_display.cpp.

◆ probe_result

Enumerator
no_device 

No card node identifies itself as the hermes-kms driver.

Definition at line 1372 of file virtual_display.cpp.

◆ VirtualDisplayBackend

enum class VDISPLAY::VirtualDisplayBackend
strong

Definition at line 492 of file virtual_display.cpp.

Function Documentation

◆ activateVirtualDisplayOutput()

bool VDISPLAY::activateVirtualDisplayOutput ( const std::string & displayName)

Activate a virtual output using the current session's display protocol.

Definition at line 8228 of file virtual_display.cpp.

◆ assessSession()

std::vector< FeatureReport > VDISPLAY::assessSession ( const SessionFacts & facts)

Turn observations into a per-feature verdict with remediation.

Pure: it reads facts and nothing else, so it is the whole of Hermes' advice and can be tested for every session shape without one existing.

Definition at line 2071 of file virtual_display.cpp.

◆ beginPhysicalOutputSession()

void VDISPLAY::beginPhysicalOutputSession ( )

Touch and pen binding for sessions that stream an existing monitor rather than a virtual display. begin/end bracket the session; the KMS capture reports the connector it streams (e.g. "DP-2"), and on KWin the touch and pen devices are bound to that output until the session ends.

Definition at line 7985 of file virtual_display.cpp.

◆ boundedCommandOutput()

std::optional< std::string > VDISPLAY::boundedCommandOutput ( const std::string & command,
std::chrono::milliseconds timeout,
bool * timed_out = nullptr )

Run a shell command and collect its standard output, waiting no longer than timeout for it.

For the desktop's own tools, which Hermes calls while holding locks a session cannot start without: one that never answers must cost a feature, not the host.

Parameters
timed_outSet to whether the command was stopped for running over.
Returns
The output when the command exited with status 0; std::nullopt when it failed, could not be started, or ran over - in which case it and everything it started have been killed.

Definition at line 2741 of file virtual_display.cpp.

◆ buildKScreenLayoutCommand()

std::string VDISPLAY::buildKScreenLayoutCommand ( const std::string & virtual_output,
const std::map< std::string, int > & enabled_before,
int target_x,
int target_y,
int mode_width,
int mode_height,
int mode_refresh_hz,
const std::map< std::string, kscreen_point_t > & positions_before = {},
virtual_display_layout_e layout = virtual_display_layout_e::extend )

Build the kscreen-doctor invocation that enables a virtual output, places it, and drives it at a requested mode.

KWin adopts a hotplugged connector at whichever mode it prefers rather than the one the streaming client negotiated: Hermes-KMS marks the client's exact CVT mode preferred but still exposes the standard mode ladder, and KWin has been seen taking 1920x1080 from that ladder for an 854x480 session. Because the capture path reports the real scanout, the client then receives a full-resolution stream of a display it asked to be small, so the mode has to be pushed rather than assumed.

Every output in enabled_before is re-enabled at its own priority and the virtual output takes the next one, keeping the local displays lit. Passing a non-positive component in mode_width, mode_height or mode_refresh_hz omits the mode, which is also how the caller retries a layout that KWin rejected for the mode alone.

An output named in positions_before is also placed back where it was before the hotplug. Enabling one without saying where it goes leaves KWin free to keep the position from the setup it replayed for the new output combination, which is how a monitor came back on top of the virtual output rather than beside it.

Exposed so the invocation can be checked without a running KDE session.

Returns
the complete command line.

Definition at line 2453 of file virtual_display.cpp.

◆ buildKWinInputBindingReadCommand()

std::string VDISPLAY::buildKWinInputBindingReadCommand ( const std::string & device_name)

The kreadconfig6 command that prints the output UUID a KWin input device is bound to. It prints nothing when there is none.

Returns
the command, or an empty string for a device name that cannot be put on a command line safely.

Definition at line 7790 of file virtual_display.cpp.

◆ buildKWinInputBindingRestoreCommand()

std::string VDISPLAY::buildKWinInputBindingRestoreCommand ( const std::string & device_name,
const std::string & previous_uuid )

The kwriteconfig6 command that puts a KWin input device's binding back to previous_uuid, deleting the key when it is empty.

The command notifies KWin, which otherwise keeps serving the value it has cached to every device it adds.

Returns
the command, or an empty string when previous_uuid is not spelled like a UUID or the device name is unsafe: a value read back from the file never reaches a command line unchecked.

Definition at line 7794 of file virtual_display.cpp.

◆ buildMutterExclusiveLayout()

bool VDISPLAY::buildMutterExclusiveLayout ( const std::string & current_state,
const std::string & connector,
std::string & serial,
std::string & argument )

Build the ApplyMonitorsConfig payload that hands the desktop to connector alone, which is how a monitor is turned off on GNOME: Mutter disables every connected monitor absent from the config.

Exposed so an all-or-nothing payload can be checked without a GNOME session.

Returns
true when a config was built; false when the reply is unusable, the connector is not being driven, or it already has the desktop to itself (nothing to apply).

Definition at line 7721 of file virtual_display.cpp.

◆ buildMutterLayoutWithMode()

bool VDISPLAY::buildMutterLayoutWithMode ( const std::string & current_state,
const std::string & connector,
uint32_t width,
uint32_t height,
uint32_t refresh_mhz,
std::string & serial,
std::string & argument )

Build the Mutter ApplyMonitorsConfig payload that drives a connector at a requested geometry.

Mutter adopts a hotplugged virtual connector on its own, but at whichever mode it prefers. If that is not the mode the streaming client asked for, the compositor scans out one resolution while Hermes captures another and the client receives a black image. This selects the advertised mode that matches width x height with the closest refresh rate (refresh_mhz is in mHz, as Hermes carries it internally; Mutter reports Hz), keeping every other logical monitor as Mutter has it, and appending a logical monitor at the current right edge when Mutter adopted the connector without placing it (Mutter rejects layouts with gaps between logical monitors).

Exposed so the payload can be validated without a running GNOME session.

Returns
true when a config was built; false when the reply is unusable, the connector is absent or does not advertise the geometry, or Mutter already drives it at that mode (nothing to apply).

Definition at line 7701 of file virtual_display.cpp.

◆ buildMutterLayoutWithoutConnector()

bool VDISPLAY::buildMutterLayoutWithoutConnector ( const std::string & current_state,
const std::string & virtual_connector,
std::string & serial,
std::string & argument )

Build the Mutter ApplyMonitorsConfig payload that drops a connector.

Pure text transformation over an org.gnome.Mutter.DisplayConfig GetCurrentState reply: it keeps every logical monitor except virtual_connector, moving the primary flag to the first survivor when the dropped monitor held it. Exposed so the payload - which is submitted to a compositor as an all-or-nothing config - can be validated without GNOME.

Parameters
current_stateThe GetCurrentState reply, as printed by gdbus call.
virtual_connectorThe connector to remove, e.g. "Virtual-1".
serialReceives the config serial the payload must be applied with.
argumentReceives the a(iiduba(ssa{sv})) argument.
Returns
true when a repair config was built; false when the connector is absent from the layout, the reply is unusable, or dropping it would leave Mutter with no monitor.

Definition at line 7685 of file virtual_display.cpp.

◆ buildMutterMirrorLayout()

bool VDISPLAY::buildMutterMirrorLayout ( const std::string & current_state,
const std::string & connector,
std::string & serial,
std::string & argument )

Build the payload that clones the primary output onto connector.

Mutter refuses overlapping logical monitors, so cloning means one logical monitor holding both connectors - and it refuses that unless their modes have identical dimensions. The payload therefore exists only at a resolution the virtual output advertises.

Returns
true when a config was built; false when the reply is unusable, no shared mode size exists, or the outputs are already mirrored.

Definition at line 7737 of file virtual_display.cpp.

◆ buildMutterRestoreLayout()

bool VDISPLAY::buildMutterRestoreLayout ( const std::string & current_state,
std::string & serial,
std::string & argument )

Build the payload that reproduces the layout in current_state.

This is what a session captures before changing the layout, and submits again when it ends.

Definition at line 7753 of file virtual_display.cpp.

◆ changeDisplaySettings()

int VDISPLAY::changeDisplaySettings ( const char * deviceName,
int width,
int height,
int refresh_rate,
int deadline_ms = 4000 )

Change the display settings of a virtual display.

Parameters
deviceNameThe name of the virtual display.
widthThe new width.
heightThe new height.
refresh_rateThe new refresh rate (in mHz).
deadline_msHow long the compositor-side mode apply may poll before giving up. A hot path answering a waiting client - /resume - passes a shorter budget than a launch does.
Returns
0 on success, -1 on failure, and 1 when the driver accepted the mode but the compositor kept the previously active one. That last case is not fatal: capture reads the real scanout geometry, so the stream follows the display rather than the request.

Definition at line 7549 of file virtual_display.cpp.

◆ changeDisplaySettings2()

int VDISPLAY::changeDisplaySettings2 ( const char * deviceName,
int width,
int height,
int refresh_rate,
bool bApplyIsolated = false )

Change the display settings with isolated display option.

Parameters
deviceNameThe name of the virtual display.
widthThe new width.
heightThe new height.
refresh_rateThe new refresh rate (in mHz).
bApplyIsolatedWhether to apply isolated display settings.
Returns
0 on success, non-zero on failure.

Definition at line 7640 of file virtual_display.cpp.

◆ closeVDisplayDevice()

void VDISPLAY::closeVDisplayDevice ( )

Close the virtual display driver.

Definition at line 6922 of file virtual_display.cpp.

◆ compositorFromDesktopNames()

compositor_e VDISPLAY::compositorFromDesktopNames ( const std::string & desktop_names)

Classify a compositor from an XDG_CURRENT_DESKTOP-style value.

The variable holds a colon-separated list whose case is not guaranteed ("KDE", "Hyprland", "ubuntu:GNOME"), so it is matched token by token: a substring test would classify a desktop merely mentioning another one. A token is accepted when it equals the compositor's desktop name or is a variant of it ("GNOME-Classic").

Exposed so the classification can be tested without a session.

Definition at line 1903 of file virtual_display.cpp.

◆ compositorName()

std::string VDISPLAY::compositorName ( compositor_e compositor)

Human-readable name for a compositor class, for logs and diagnostics.

Definition at line 1976 of file virtual_display.cpp.

◆ configureVirtualDisplayHdr()

bool VDISPLAY::configureVirtualDisplayHdr ( const std::string & displayName,
bool hdr )

Match only the owned KDE virtual output to the connecting client's HDR request.

Definition at line 8390 of file virtual_display.cpp.

◆ createVirtualDisplay()

std::string VDISPLAY::createVirtualDisplay ( const char * s_client_uid,
const char * s_client_name,
uint32_t width,
uint32_t height,
uint32_t fps,
const uuid_util::uuid_t & guid,
std::optional< uid_t > session_owner_uid = std::nullopt,
virtual_display_layout_e layout = virtual_display_layout_e::extend,
bool isolated_session = false )

Create a virtual display.

Parameters
s_client_uidThe unique identifier of the client.
s_client_nameThe name of the client.
widthThe width of the virtual display.
heightThe height of the virtual display.
fpsThe refresh rate of the virtual display (in mHz).
guidThe GUID for the virtual display.
session_owner_uidWhen set, a Hermes-KMS card the broker creates for this display belongs to this uid (an isolated session's account) rather than to Hermes itself.
layoutWhere the compositor should place the output. Honoured by the KScreen (KWin) and Mutter (GNOME) activation paths; other backends keep their own behaviour. The two compositors clone differently: KWin overlaps the virtual output with the primary, while Mutter refuses overlapping monitors and clones by putting both connectors in one logical monitor - which it only accepts when they advertise the same mode size, so mirroring there runs the stream at the physical monitor's resolution.
Returns
The name of the created virtual display, or empty string on failure.

Definition at line 7061 of file virtual_display.cpp.

◆ displayConnectorLit()

std::optional< bool > VDISPLAY::displayConnectorLit ( const std::filesystem::path & drm_class = "/sys/class/drm",
const std::string & ignored_connector = {} )

Whether any DRM connector is lighting a monitor right now.

A connector counts once something is attached to it and the compositor has bound it to a CRTC - the kernel's own status and enabled attributes, so the answer does not depend on which compositor is running or whether there is one. A monitor that is unplugged, switched off far enough to drop the link, or disabled in the display settings does not count.

Parameters
drm_classThe sysfs DRM class directory; tests point it at a fake tree.
ignored_connectorA connector ("Virtual-1") to leave out of the answer, for asking whether anything else is lit.
Returns
std::nullopt when sysfs cannot answer: the directory is unreadable or lists no card, or nothing is lit and some card exposes no connector at all - a GPU driven without kernel modesetting, such as NVIDIA with modeset=0 under X11, lights monitors sysfs never sees.

Definition at line 2318 of file virtual_display.cpp.

◆ displayLayoutGeneration()

uint64_t VDISPLAY::displayLayoutGeneration ( )

A counter bumped whenever the desktop layout changes underneath a running session.

The offsets a capture resolves at start-up are a snapshot: the compositor can move outputs, change their modes or replace a temporary configuration at any time, and the geometry absolute input is measured against then goes quietly wrong. A capture records this value when it starts and reinitialises when it no longer matches, which re-resolves the geometry through the path that already exists for a resolution change.

Only the GNOME backend moves it today, and only when built with sd-bus; everywhere else it is constant and the comparison costs nothing.

Definition at line 7798 of file virtual_display.cpp.

◆ displayServerReachable()

bool VDISPLAY::displayServerReachable ( const std::string & wayland_display,
const std::string & x_display,
const std::string & runtime_dir )

Whether a display server is listening where these variables point.

Asked of the socket itself, so it holds for any compositor and any way a session was started. A Wayland name is tried first, then a local X display; an X display on another host counts as reachable untested.

Parameters
wayland_displayWAYLAND_DISPLAY: a socket name under runtime_dir, or a path.
x_displayDISPLAY.
runtime_dirXDG_RUNTIME_DIR.

Definition at line 107 of file virtual_display.cpp.

◆ enableExclusiveVirtualDisplay()

bool VDISPLAY::enableExclusiveVirtualDisplay ( const std::string & displayName)

Enable/restore exclusive layout for an EVDI virtual display.

Definition at line 8453 of file virtual_display.cpp.

◆ endPhysicalOutputSession()

void VDISPLAY::endPhysicalOutputSession ( )

Definition at line 7992 of file virtual_display.cpp.

◆ featureName()

std::string VDISPLAY::featureName ( feature_e feature)

Human-readable names, for logs, diagnostics and the Web UI.

Definition at line 1994 of file virtual_display.cpp.

◆ getDisplayHDRByName()

bool VDISPLAY::getDisplayHDRByName ( const char * displayName)

Get the HDR status of a display by name.

Parameters
displayNameThe name of the display.
Returns
true if HDR is enabled, false otherwise.

Definition at line 8602 of file virtual_display.cpp.

◆ getEvdiBuffer()

std::shared_ptr< EvdiBuffer > VDISPLAY::getEvdiBuffer ( const std::string & display_name)

Return the active CPU capture buffer for an EVDI virtual display.

Definition at line 8829 of file virtual_display.cpp.

◆ getEvdiCardIndex()

int VDISPLAY::getEvdiCardIndex ( const std::string & displayName)

Get the DRM card index for an EVDI display.

Returns
Card index, or -1 if not found.
Parameters
displayNameThe name of the EVDI display.
Returns
The card index, or -1 if not found or not an EVDI display.

Definition at line 8662 of file virtual_display.cpp.

◆ getEvdiConnectorName()

std::string VDISPLAY::getEvdiConnectorName ( const std::string & displayName)

Return the compositor-facing connector name for an EVDI display.

Definition at line 7671 of file virtual_display.cpp.

◆ getEvdiDiagnostic()

EVDI_DIAGNOSTIC VDISPLAY::getEvdiDiagnostic ( )

Return the most specific available EVDI diagnostic for the current host.

Definition at line 6101 of file virtual_display.cpp.

◆ getEvdiStatus()

EvdiStatus VDISPLAY::getEvdiStatus ( )

Return runtime, DKMS, and frame-update details for the Audio/Video UI.

Definition at line 6175 of file virtual_display.cpp.

◆ getHermesKmsCardIndex()

int VDISPLAY::getHermesKmsCardIndex ( const std::string & displayName)

Get the DRM card index for a Hermes-KMS display.

Definition at line 8672 of file virtual_display.cpp.

◆ getHermesKmsConnectorName()

std::string VDISPLAY::getHermesKmsConnectorName ( const std::string & displayName)

Return the compositor-facing connector name for a Hermes-KMS display.

Definition at line 7675 of file virtual_display.cpp.

◆ getHermesKmsDevicePath()

std::string VDISPLAY::getHermesKmsDevicePath ( const std::string & displayName)

Get the primary DRM node path assigned to a Hermes-KMS display.

Definition at line 8702 of file virtual_display.cpp.

◆ getHermesKmsDiagnostic()

HERMES_KMS_DIAGNOSTIC VDISPLAY::getHermesKmsDiagnostic ( )

Return the most specific available Hermes-KMS diagnostic for the current host.

Definition at line 6248 of file virtual_display.cpp.

◆ getHermesKmsDisplayGeometry()

bool VDISPLAY::getHermesKmsDisplayGeometry ( const std::string & display_name,
int & offset_x,
int & offset_y,
int & environment_width,
int & environment_height )

Resolve the compositor position of a Hermes-KMS output for absolute input. Returns false when the desktop integration cannot expose a geometry.

Definition at line 8913 of file virtual_display.cpp.

◆ getHermesKmsMetrics()

HermesKmsMetrics VDISPLAY::getHermesKmsMetrics ( )

Read the Hermes-KMS device metrics, if a metrics-capable device is present. It opens a short-lived render fd and binds the active generic session capability before reading protected counters.

Returns
Metrics with available=true on success; a default (available=false) value when no metrics-capable Hermes-KMS device is found.

Definition at line 8730 of file virtual_display.cpp.

◆ getHermesKmsSeatName()

std::string VDISPLAY::getHermesKmsSeatName ( const std::string & displayName)

Get the stable udev/libseat name assigned to an independent DRM card.

Definition at line 8709 of file virtual_display.cpp.

◆ getHermesKmsStatus()

HermesKmsStatus VDISPLAY::getHermesKmsStatus ( )

Return module, DKMS, and device details for the Audio/Video UI.

Definition at line 6283 of file virtual_display.cpp.

◆ getHyprlandOutputName()

std::string VDISPLAY::getHyprlandOutputName ( const std::string & displayName)

The Hyprland output name backing a virtual display, or empty.

Non-empty only for a display Hyprland created as a headless output, which is also the test for "this display works on this session": a Hermes-KMS or EVDI display in a Hyprland session cannot be composited onto.

Definition at line 7853 of file virtual_display.cpp.

◆ getPrimaryDisplay()

std::string VDISPLAY::getPrimaryDisplay ( )

Get the primary display name.

Returns
The name of the primary display.

Definition at line 8565 of file virtual_display.cpp.

◆ graphicalSessionPresent()

std::optional< bool > VDISPLAY::graphicalSessionPresent ( )

Whether this user has a session of their own, as logind sees it - graphical or not, so a "yes" does not mean a desktop is up.

Returns
std::nullopt when logind could not be asked.

Definition at line 135 of file virtual_display.cpp.

◆ hermesKmsAcquireCursor()

bool VDISPLAY::hermesKmsAcquireCursor ( int render_fd,
bool request_buffer,
HermesKmsCursor & out )

Acquire current cursor metadata and, when requested, its DMA-BUF.

Definition at line 9113 of file virtual_display.cpp.

◆ hermesKmsAcquireFrame()

bool VDISPLAY::hermesKmsAcquireFrame ( int render_fd,
uint64_t after_sequence,
uint32_t timeout_ms,
HermesKmsFrame & out,
bool capture_color )

Definition at line 8998 of file virtual_display.cpp.

◆ hermesKmsCaptureColor()

bool VDISPLAY::hermesKmsCaptureColor ( int render_fd,
hermes_kms::color_t & color,
uint32_t & fourcc )

Acquire the current scanout frame as DMA-BUFs. Blocks up to timeout_ms for a frame newer than after_sequence (pass 0 to take whatever is current). On success out owns the returned fds; the caller must call out.close() when done.

Returns
true on success.

Definition at line 8974 of file virtual_display.cpp.

◆ hermesKmsCaptureSize()

bool VDISPLAY::hermesKmsCaptureSize ( int render_fd,
int & width,
int & height,
uint32_t timeout_ms = 0 )

Query a live scanout with an available framebuffer, optionally waiting up to timeout_ms for the compositor. Never substitute the requested mode for an unready scanout. A zero timeout performs a single query. On failure dimensions are cleared and errno distinguishes EAGAIN (not ready), ETIMEDOUT, and driver errors such as EACCES (unauthorized capture).

Definition at line 8947 of file virtual_display.cpp.

◆ hermesKmsOpenCapture()

int VDISPLAY::hermesKmsOpenCapture ( const std::string & display_name)

Open the render node of the Hermes-KMS card behind display_name.

Returns
a render-node fd >= 0 on success, or -1 on failure.

Definition at line 8865 of file virtual_display.cpp.

◆ hermesKmsReportsFrameColor()

bool VDISPLAY::hermesKmsReportsFrameColor ( int render_fd)

Whether the driver behind a capture descriptor reports frame colour (UAPI 14).

Definition at line 8968 of file virtual_display.cpp.

◆ hermesKmsSeatIsolationActive()

bool VDISPLAY::hermesKmsSeatIsolationActive ( )

Whether Hermes-KMS session cards carry a private DRM seat.

Isolation has two halves and they are installed separately: Hermes' own udev rules place a session's input devices on a private seat, while the driver's 72-hermes-kms-session-seats.rules does the same for its DRM cards. With only the first installed a session still starts, still gets its own input, and shares the host compositor's screen - and every check Hermes performs today passes. This is the missing check: a card with no ID_SEAT is on seat0, where the host compositor claims it.

Definition at line 2300 of file virtual_display.cpp.

◆ hermesKmsWaitUpdate()

bool VDISPLAY::hermesKmsWaitUpdate ( int render_fd,
uint64_t after_frame_sequence,
uint64_t after_cursor_sequence,
uint32_t timeout_ms,
HermesKmsUpdate & out )

Wait until the primary frame or cursor stream advances.

Definition at line 9080 of file virtual_display.cpp.

◆ inLoginSession()

bool VDISPLAY::inLoginSession ( )

Whether Hermes itself runs inside a login session - started from a terminal or over SSH - rather than as a service of the user manager.

Definition at line 163 of file virtual_display.cpp.

◆ isEvdiDisplay()

bool VDISPLAY::isEvdiDisplay ( const std::string & displayName)

Check if a display name is an EVDI virtual display.

Check if a display is an EVDI virtual display.

Parameters
displayNameThe name of the display to check.
Returns
true if the display is an EVDI virtual display, false otherwise.

Definition at line 8634 of file virtual_display.cpp.

◆ isHermesKmsDisplay()

bool VDISPLAY::isHermesKmsDisplay ( const std::string & displayName)

Check if a display is a Hermes-KMS virtual display.

Definition at line 8648 of file virtual_display.cpp.

◆ isHermesKmsDriverPresent()

bool VDISPLAY::isHermesKmsDriverPresent ( )

Check whether a usable Hermes-KMS DRM device exists on this host.

Definition at line 8682 of file virtual_display.cpp.

◆ isHermesKWinInputDevice()

bool VDISPLAY::isHermesKWinInputDevice ( const std::string & name,
uint32_t vendor,
uint32_t product )

Whether a device KWin reports is one of Hermes' touch or pen devices.

Name, vendor and product together, so that neither a real touchscreen nor another program's device that happens to share a name is ever rebound.

Definition at line 7786 of file virtual_display.cpp.

◆ kscreenDisplayGeometry()

bool VDISPLAY::kscreenDisplayGeometry ( const std::vector< kscreen_output_t > & outputs,
const std::string & output_name,
int & offset_x,
int & offset_y,
int & environment_width,
int & environment_height )

Resolve one KScreen output inside the live desktop envelope.

Only connected, enabled outputs form the desktop. KScreen retains an output's old position when its neighbours are disabled, so the envelope has to start at the first live pixel rather than unconditionally at 0,0. Otherwise an exclusive session whose sole output remains at x=3440 is reported as 3440 pixels into a 6000-pixel desktop, and absolute input is shifted when KWin maps it over that sole output.

Exposed so layouts captured from kscreen-doctor can be checked without a running KDE session.

Returns
true when output_name names an enabled output with a usable geometry; false leaves the output arguments untouched.

Definition at line 2593 of file virtual_display.cpp.

◆ kscreenHdrState()

std::optional< kscreen_hdr_state_t > VDISPLAY::kscreenHdrState ( const std::string & json_text,
const std::string & output )

Definition at line 2718 of file virtual_display.cpp.

◆ kscreenLayoutFailure()

std::optional< std::string > VDISPLAY::kscreenLayoutFailure ( std::string_view output)

What went wrong with a kscreen-doctor layout command, read from its output.

kscreen-doctor exits 0 whatever happened: on an error it calls qApp->exit() with a code, then applies the configuration anyway and calls qApp->exit(0) (libkscreen src/doctor/doctor.cpp). Only its output tells. It stops reading the command at the first option it cannot use (an output or mode it cannot find, an invalid value) and applies the options before it, so the layout may be only partly applied; and KWin may refuse the whole configuration ("applying config failed!" and KWin's reason).

Parameters
outputWhat kscreen-doctor printed, stdout and stderr together.
Returns
The first line reporting a failure, or nothing when there was none.

Definition at line 2642 of file virtual_display.cpp.

◆ kscreenModeState()

kscreen_mode_state_e VDISPLAY::kscreenModeState ( const std::string & json_text,
const std::string & output,
int width,
int height,
int refresh_hz )

Find a mode on one output in a kscreen-doctor -j reply.

Pushing a mode blind gives the same generic failure whether KWin refused a valid request, the connector never advertised the geometry, or it was already being driven at it. Reading the reply first separates those, and the last case removes a needless kscreen-doctor call per session.

Refresh rates are compared rounded to whole Hz, which is how kscreen-doctor itself matches a WxH@R argument against the mode list: a connector advertising 89.991 Hz is driven by asking for 90.

Exposed so the reply can be interpreted without a running KDE session.

Definition at line 2677 of file virtual_display.cpp.

◆ kscreenVirtualOutputPosition()

kscreen_point_t VDISPLAY::kscreenVirtualOutputPosition ( const std::string & virtual_output,
const std::vector< kscreen_output_t > & before,
const std::vector< kscreen_output_t > & current,
virtual_display_layout_e layout )

Decide where the virtual output goes, in KScreen's logical space.

The layout to place against is the one the session is about to restore - before, sampled before the connector was hotplugged - and not the one KWin happens to be showing in current. KWin keeps a saved setup per output combination and replays it when a connector appears: a combination last used by an exclusive session comes back with the physical monitor disabled and the virtual connector at the origin. Placing against that transient state put the virtual output at 0,0 too, and re-enabling the monitor in the same transaction left both there, so the client received the physical desktop cropped to the mode it had asked for.

current is still consulted for presence: an output that has since been unplugged reserves no space. When it is empty - kscreen-doctor gave no answer - every output in before is taken as present, and when before itself yields no anchor the same rule is applied to current so a session that started without a usable snapshot still lands beside the desktop.

Exposed so the placement can be checked without a running KDE session.

Returns
the position for virtual_output.

Definition at line 2530 of file virtual_display.cpp.

◆ listHermesKmsDisplayNames()

std::vector< std::string > VDISPLAY::listHermesKmsDisplayNames ( )

List the display names of all registered Hermes-KMS virtual displays.

Definition at line 8691 of file virtual_display.cpp.

◆ logSessionAssessment()

void VDISPLAY::logSessionAssessment ( )

Probe, assess and log what this session can and cannot do.

Written for the user who only ever sees the log: a working feature is one line, and one that is not carries both the reason and the fix.

Definition at line 6154 of file virtual_display.cpp.

◆ matchDisplay()

std::vector< std::string > VDISPLAY::matchDisplay ( const std::string & sMatch)

Match displays by a given pattern.

Parameters
sMatchThe pattern to match.
Returns
A vector of matching display names.

Definition at line 8613 of file virtual_display.cpp.

◆ mutterDisplayGeometry()

bool VDISPLAY::mutterDisplayGeometry ( const std::string & current_state,
const std::string & connector,
int & offset_x,
int & offset_y,
int & environment_width,
int & environment_height )

Where a connector sits on a GNOME desktop, for absolute input.

Mutter feeds an absolute pointing device the extents of the whole stage, so a client's coordinates only land on the streamed output once they carry that output's offset within the desktop envelope. Both are read from the logical monitor layout - the space the stage is measured in - which means scale and rotation, not the mode size.

The values come back in the connector's own pixel space rather than in logical pixels, so a consumer holding coordinates in the captured mode's pixels can use them unchanged; at scale 1 the two are the same thing.

Exposed so the arithmetic can be checked against a captured GetCurrentState reply, without a running GNOME session.

Parameters
current_stateThe GetCurrentState reply, as printed by gdbus call.
connectorThe connector to locate, e.g. "Virtual-1".
Returns
true when the connector is in the layout and the envelope could be measured; false leaves the outputs untouched.

Definition at line 7802 of file virtual_display.cpp.

◆ mutterInputDeviceOutputValue()

std::string VDISPLAY::mutterInputDeviceOutputValue ( const std::string & current_state,
const std::string & connector )

The GNOME output value that binds an input device to connector.

GNOME binds a touchscreen or tablet to one monitor, matching a list of at least three strings against the monitor's EDID vendor, product and serial. The connector is appended as a fourth element, which Mutter uses to disambiguate two monitors sharing an EDID.

Returns
the value to write, or an empty string when the monitor is unknown, carries no identity at all, or spells one that cannot be put on a command line safely.

Definition at line 7770 of file virtual_display.cpp.

◆ mutterInputDeviceSettingsTargets()

void VDISPLAY::mutterInputDeviceSettingsTargets ( std::string & touch,
std::string & pen )

The relocatable-schema targets whose output key binds Hermes' own touch and pen devices, as <schema>:<path>.

Mutter derives the path from the device's vendor and product ids, so these only reach Hermes' devices while they match the ids libvirtualhid is given.

Definition at line 7781 of file virtual_display.cpp.

◆ needsInitialDeviceConfiguration()

bool VDISPLAY::needsInitialDeviceConfiguration ( )

Whether EVDI needs a device pre-created at module load time.

This occurs when the loaded module has no devices and the current Apollo process cannot write to EVDI's root-only sysfs add endpoint.

Definition at line 5935 of file virtual_display.cpp.

◆ notePhysicalCaptureOutput()

void VDISPLAY::notePhysicalCaptureOutput ( const std::string & connector_name)

Definition at line 7966 of file virtual_display.cpp.

◆ openVDisplayDevice()

DRIVER_STATUS VDISPLAY::openVDisplayDevice ( )

Initialize the virtual display driver.

Returns
DRIVER_STATUS indicating the result of initialization.

Definition at line 6820 of file virtual_display.cpp.

◆ parkedConnector()

std::string VDISPLAY::parkedConnector ( )

The connector of the output being kept for the login greeter, or empty. It is lit, but it is not a monitor the host has.

Definition at line 2406 of file virtual_display.cpp.

◆ placeWindowsOnVirtualDisplay()

void VDISPLAY::placeWindowsOnVirtualDisplay ( const std::string & displayName,
const std::vector< std::string > & windowClasses,
const std::vector< std::uint32_t > & gamescopePids = {} )

Put windows of these classes on the session's virtual output, now and as they appear, until the display is removed. KWin only; elsewhere nothing happens. For an application that reuses a window already open on a physical monitor, such as Steam switching to Big Picture. Gamescope windows must also match a launched PID; other local instances are left alone.

Definition at line 7931 of file virtual_display.cpp.

◆ primaryPhysicalOutputName()

std::string VDISPLAY::primaryPhysicalOutputName ( )

The desktop's primary physical output ("DP-2"), or empty.

KWin on Wayland only: the connected, enabled output KScreen gives priority 1, unless it is a virtual output. Empty when there is no such output or it can't be determined.

Definition at line 7972 of file virtual_display.cpp.

◆ probeSessionFacts()

SessionFacts VDISPLAY::probeSessionFacts ( )

Observe the running session. Safe to call while a stream is running.

Definition at line 6125 of file virtual_display.cpp.

◆ readinessName()

std::string VDISPLAY::readinessName ( readiness_e readiness)

Definition at line 2012 of file virtual_display.cpp.

◆ removalStrandsGreeter()

bool VDISPLAY::removalStrandsGreeter ( bool greeter_on_seat,
bool output_lit,
std::optional< bool > another_connector_lit )

Whether removing a virtual display would leave the login greeter with nothing to draw on.

SDDM's greeter exits when its last output goes away and is not started again, so a display removed before login takes the login prompt with it. When this says yes the display's Hermes-KMS output is kept connected instead, for the next session to reuse.

Parameters
greeter_on_seatA display manager's greeter is the session in front.
output_litThe output being removed is one a compositor drives.
another_connector_litdisplayConnectorLit() with that output left out.

Definition at line 2399 of file virtual_display.cpp.

◆ removeVirtualDisplay()

bool VDISPLAY::removeVirtualDisplay ( const uuid_util::uuid_t & guid)

Remove a virtual display.

Parameters
guidThe GUID of the virtual display to remove.
Returns
true if the virtual display was removed successfully, false otherwise.

Definition at line 7533 of file virtual_display.cpp.

◆ restoreExclusiveVirtualDisplay()

void VDISPLAY::restoreExclusiveVirtualDisplay ( )

Definition at line 8523 of file virtual_display.cpp.

◆ sessionCompositor()

compositor_e VDISPLAY::sessionCompositor ( )

Classify the compositor of the running session.

Reads XDG_CURRENT_DESKTOP, falls back to XDG_SESSION_DESKTOP, and finally to the sockets a compositor exports whether or not a session file named it: HYPRLAND_INSTANCE_SIGNATURE, SWAYSOCK and WAYFIRE_SOCKET. A session started from a TTY or a bare exec sway frequently leaves both desktop variables empty, which is the case that used to reach the generic path unnamed.

Definition at line 1946 of file virtual_display.cpp.

◆ setDisplayHDRByName()

bool VDISPLAY::setDisplayHDRByName ( const char * displayName,
bool enableAdvancedColor )

Set the HDR status of a display by name.

Parameters
displayNameThe name of the display.
enableAdvancedColorWhether to enable HDR.
Returns
true if the HDR status was set successfully, false otherwise.

Definition at line 8608 of file virtual_display.cpp.

◆ setPrimaryDisplay()

bool VDISPLAY::setPrimaryDisplay ( const char * primaryDeviceName)

Set the primary display by name.

Parameters
primaryDeviceNameThe name of the display to set as primary.
Returns
true if the primary display was set successfully, false otherwise.

Definition at line 8597 of file virtual_display.cpp.

◆ setRenderAdapterByName()

bool VDISPLAY::setRenderAdapterByName ( const std::string & adapterName)

Set the render adapter by name.

Parameters
adapterNameThe name of the adapter to use for rendering.
Returns
true if the adapter was set successfully, false otherwise.

Definition at line 7048 of file virtual_display.cpp.

◆ startPingThread()

bool VDISPLAY::startPingThread ( std::function< void()> failCb)

Start a ping thread to keep the virtual display alive.

Parameters
failCbCallback to invoke if the watchdog fails.
Returns
true if the ping thread was started successfully, false otherwise.

Definition at line 6968 of file virtual_display.cpp.

◆ systemdUserBusAddress()

std::string VDISPLAY::systemdUserBusAddress ( uint32_t uid)

The standard systemd user-bus address for uid.

Kept independent of the process environment because libsystemd suppresses environment-based bus discovery when Hermes' file capability sets AT_SECURE.

Definition at line 80 of file virtual_display.cpp.

◆ unlockHostSessionIfLocked()

bool VDISPLAY::unlockHostSessionIfLocked ( )

Unlock the active graphical login session for the Hermes user when locked.

Uses systemd-logind directly over D-Bus. The graphical session is selected with sd-login rather than from Hermes' own PID because Hermes normally runs as a systemd user service outside the desktop session's process tree.

Returns
true when the session was already unlocked or an unlock request was accepted; false when no graphical session could be identified or logind could not be reached.

Definition at line 211 of file virtual_display.cpp.

◆ userManagerEnvironment()

std::optional< std::vector< std::string > > VDISPLAY::userManagerEnvironment ( )

The environment the systemd user manager hands to the units it starts, as "NAME=value" strings.

A desktop publishes its display variables there at login, so this is what a Hermes started before that login would have been given had it started after it. std::nullopt when the manager could not be asked.

Definition at line 174 of file virtual_display.cpp.

◆ virtualDisplayHdrMode()

hdr_launch_mode_t VDISPLAY::virtualDisplayHdrMode ( bool requested,
const kscreen_hdr_state_t & state,
bool driver_reports_frame_color )

Stream HDR only when the output offers it and the driver reports each frame's colour, which is how capture tells PQ pixels from SDR ones. Otherwise an HDR request streams SDR, as it did before HDR capture existed, rather than refusing the session.

Definition at line 8377 of file virtual_display.cpp.

◆ waitForConnectorEnabled()

bool VDISPLAY::waitForConnectorEnabled ( const std::string & connector,
std::chrono::milliseconds timeout,
const std::filesystem::path & drm_class = "/sys/class/drm" )

Wait until some compositor has bound connector to a CRTC.

Parameters
connectorDRM connector name as the driver reports it ("Virtual-1").
drm_classThe sysfs DRM class directory; tests point it at a fake tree.
Returns
true once its enabled attribute reads "enabled", false on timeout.

Definition at line 2411 of file virtual_display.cpp.

◆ wakeSleepingMonitor()

bool VDISPLAY::wakeSleepingMonitor ( )

Wake a monitor the compositor has put to sleep.

KWin on Wayland only. Screens in power saving read as unlit, the same as no monitor at all. A DisplayPort monitor in deep sleep is woken with one read on its AUX channel and waited for, at most 8 seconds, until the compositor has lit it. Otherwise, if KScreen still lists a connected, enabled physical output, the screens are turned back on and the primary one is waited for, at most 3 seconds, until it shows a frame.

Returns
True once that output is scanning out; false if there was nothing to wake or it did not come back.

Definition at line 8192 of file virtual_display.cpp.

◆ windowSystemAttached()

bool VDISPLAY::windowSystemAttached ( )

Whether Hermes runs inside a graphical session (Wayland or X11).

False when it was started before anyone logged in - by a lingering user manager at boot - or under a session that publishes no display variables, such as gamescope-session.

Definition at line 2366 of file virtual_display.cpp.

Variable Documentation

◆ cap_cursor_capture

uint64_t VDISPLAY::hermes_kms::cap_cursor_capture = 1ULL << 15
constexpr

Definition at line 796 of file virtual_display.cpp.

◆ cap_dmabuf_export

uint64_t VDISPLAY::hermes_kms::cap_dmabuf_export = 1ULL << 6
constexpr

Definition at line 788 of file virtual_display.cpp.

◆ cap_dynamic_devices

uint64_t VDISPLAY::hermes_kms::cap_dynamic_devices = 1ULL << 16
constexpr

Definition at line 800 of file virtual_display.cpp.

◆ cap_frame_acquire

uint64_t VDISPLAY::hermes_kms::cap_frame_acquire = 1ULL << 5
constexpr

Definition at line 787 of file virtual_display.cpp.

◆ cap_frame_wait

uint64_t VDISPLAY::hermes_kms::cap_frame_wait = 1ULL << 9
constexpr

Definition at line 791 of file virtual_display.cpp.

◆ cap_metrics

uint64_t VDISPLAY::hermes_kms::cap_metrics = 1ULL << 10
constexpr

Definition at line 792 of file virtual_display.cpp.

◆ cap_multi_device

uint64_t VDISPLAY::hermes_kms::cap_multi_device = 1ULL << 12
constexpr

Definition at line 794 of file virtual_display.cpp.

◆ cap_multi_output

uint64_t VDISPLAY::hermes_kms::cap_multi_output = 1ULL << 11
constexpr

Definition at line 793 of file virtual_display.cpp.

◆ cap_output_control

uint64_t VDISPLAY::hermes_kms::cap_output_control = 1ULL << 1
constexpr

Definition at line 786 of file virtual_display.cpp.

◆ cap_output_identity

uint64_t VDISPLAY::hermes_kms::cap_output_identity = 1ULL << 7
constexpr

Definition at line 789 of file virtual_display.cpp.

◆ cap_session_lifecycle

uint64_t VDISPLAY::hermes_kms::cap_session_lifecycle = 1ULL << 17
constexpr

Definition at line 803 of file virtual_display.cpp.

◆ cap_session_owner

uint64_t VDISPLAY::hermes_kms::cap_session_owner = 1ULL << 8
constexpr

Definition at line 790 of file virtual_display.cpp.

◆ cap_session_token

uint64_t VDISPLAY::hermes_kms::cap_session_token = 1ULL << 14
constexpr

Definition at line 795 of file virtual_display.cpp.

◆ cap_sync_file

uint64_t VDISPLAY::hermes_kms::cap_sync_file = 1ULL << 35
constexpr

Definition at line 805 of file virtual_display.cpp.

◆ cap_virtual_output

uint64_t VDISPLAY::hermes_kms::cap_virtual_output = 1ULL << 0
constexpr

Definition at line 785 of file virtual_display.cpp.

◆ cap_zero_copy_target

uint64_t VDISPLAY::hermes_kms::cap_zero_copy_target = 1ULL << 33
constexpr

Definition at line 804 of file virtual_display.cpp.

◆ command_timeout

std::chrono::seconds VDISPLAY::kscreen::command_timeout {10}
constexpr

kscreen-doctor answers in tens of milliseconds, and a layout change in a second or two. It has also been seen never to answer at all, when asked while Plasma was still starting - and every caller here holds the display registry's lock while it waits.

Definition at line 2754 of file virtual_display.cpp.

◆ cursor_buffer_valid

uint64_t VDISPLAY::hermes_kms::cursor_buffer_valid = 1ULL << 6
constexpr

Definition at line 1031 of file virtual_display.cpp.

◆ cursor_dmabuf_valid

uint64_t VDISPLAY::hermes_kms::cursor_dmabuf_valid = 1ULL << 7
constexpr

Definition at line 1032 of file virtual_display.cpp.

◆ cursor_geometry_valid

uint64_t VDISPLAY::hermes_kms::cursor_geometry_valid = 1ULL << 9
constexpr

Definition at line 1034 of file virtual_display.cpp.

◆ cursor_metadata_valid

uint64_t VDISPLAY::hermes_kms::cursor_metadata_valid = 1ULL << 2
constexpr

Definition at line 1028 of file virtual_display.cpp.

◆ cursor_position_valid

uint64_t VDISPLAY::hermes_kms::cursor_position_valid = 1ULL << 4
constexpr

Definition at line 1030 of file virtual_display.cpp.

◆ cursor_request_dmabuf

uint64_t VDISPLAY::hermes_kms::cursor_request_dmabuf = 1ULL << 0
constexpr

Definition at line 1026 of file virtual_display.cpp.

◆ cursor_request_sync_file

uint64_t VDISPLAY::hermes_kms::cursor_request_sync_file = 1ULL << 1
constexpr

Definition at line 1027 of file virtual_display.cpp.

◆ cursor_sync_file_valid

uint64_t VDISPLAY::hermes_kms::cursor_sync_file_valid = 1ULL << 8
constexpr

Definition at line 1033 of file virtual_display.cpp.

◆ cursor_visible

uint64_t VDISPLAY::hermes_kms::cursor_visible = 1ULL << 3
constexpr

Definition at line 1029 of file virtual_display.cpp.

◆ device_role_session

uint32_t VDISPLAY::hermes_kms::device_role_session = 2U
constexpr

Definition at line 809 of file virtual_display.cpp.

◆ dynamic_devices_uapi_version

uint32_t VDISPLAY::hermes_kms::dynamic_devices_uapi_version = 12
constexpr

Definition at line 777 of file virtual_display.cpp.

◆ EVDI_DEVICE_SEARCH_LIMIT

int VDISPLAY::EVDI_DEVICE_SEARCH_LIMIT = 64
constexpr

Definition at line 6368 of file virtual_display.cpp.

◆ frame_dmabuf_valid

uint64_t VDISPLAY::hermes_kms::frame_dmabuf_valid = 1ULL << 2
constexpr

Definition at line 1020 of file virtual_display.cpp.

◆ frame_request_dmabuf

uint64_t VDISPLAY::hermes_kms::frame_request_dmabuf = 1ULL << 0
constexpr

Definition at line 1019 of file virtual_display.cpp.

◆ frame_request_sync_file

uint64_t VDISPLAY::hermes_kms::frame_request_sync_file = 1ULL << 5
constexpr

Definition at line 1022 of file virtual_display.cpp.

◆ frame_sync_file_valid

uint64_t VDISPLAY::hermes_kms::frame_sync_file_valid = 1ULL << 3
constexpr

Definition at line 1021 of file virtual_display.cpp.

◆ ioctl_acquire_cursor

unsigned long VDISPLAY::hermes_kms::ioctl_acquire_cursor = DRM_IOWR(DRM_COMMAND_BASE + 0x0a, acquire_cursor_t)
constexpr

Definition at line 1058 of file virtual_display.cpp.

◆ ioctl_acquire_frame

unsigned long VDISPLAY::hermes_kms::ioctl_acquire_frame = DRM_IOWR(DRM_COMMAND_BASE + 0x04, acquire_frame_t)
constexpr

Definition at line 1052 of file virtual_display.cpp.

◆ ioctl_acquire_frame2

unsigned long VDISPLAY::hermes_kms::ioctl_acquire_frame2 = DRM_IOWR(DRM_COMMAND_BASE + 0x0c, acquire_frame2_t)
constexpr

Definition at line 1051 of file virtual_display.cpp.

◆ ioctl_get_caps

unsigned long VDISPLAY::hermes_kms::ioctl_get_caps = DRM_IOR(DRM_COMMAND_BASE + 0x01, caps_t)
constexpr

Definition at line 1048 of file virtual_display.cpp.

◆ ioctl_get_identity

unsigned long VDISPLAY::hermes_kms::ioctl_get_identity = DRM_IOR(DRM_COMMAND_BASE + 0x05, identity_t)
constexpr

Definition at line 1053 of file virtual_display.cpp.

◆ ioctl_get_metrics

unsigned long VDISPLAY::hermes_kms::ioctl_get_metrics = DRM_IOR(DRM_COMMAND_BASE + 0x07, metrics_t)
constexpr

Definition at line 1055 of file virtual_display.cpp.

◆ ioctl_get_status

unsigned long VDISPLAY::hermes_kms::ioctl_get_status = DRM_IOR(DRM_COMMAND_BASE + 0x02, status_t)
constexpr

Definition at line 1049 of file virtual_display.cpp.

◆ ioctl_get_version

unsigned long VDISPLAY::hermes_kms::ioctl_get_version = DRM_IOR(DRM_COMMAND_BASE + 0x00, version_t)
constexpr

Definition at line 1047 of file virtual_display.cpp.

◆ ioctl_select_output

unsigned long VDISPLAY::hermes_kms::ioctl_select_output = DRM_IOWR(DRM_COMMAND_BASE + 0x08, select_output_t)
constexpr

Definition at line 1056 of file virtual_display.cpp.

◆ ioctl_session_access

unsigned long VDISPLAY::hermes_kms::ioctl_session_access = DRM_IOWR(DRM_COMMAND_BASE + 0x09, session_access_t)
constexpr

Definition at line 1057 of file virtual_display.cpp.

◆ ioctl_set_output

unsigned long VDISPLAY::hermes_kms::ioctl_set_output = DRM_IOWR(DRM_COMMAND_BASE + 0x03, set_output_t)
constexpr

Definition at line 1050 of file virtual_display.cpp.

◆ ioctl_wait_frame

unsigned long VDISPLAY::hermes_kms::ioctl_wait_frame = DRM_IOWR(DRM_COMMAND_BASE + 0x06, wait_frame_t)
constexpr

Definition at line 1054 of file virtual_display.cpp.

◆ ioctl_wait_update

unsigned long VDISPLAY::hermes_kms::ioctl_wait_update = DRM_IOWR(DRM_COMMAND_BASE + 0x0b, wait_update_t)
constexpr

Definition at line 1059 of file virtual_display.cpp.

◆ multi_device_uapi_version

uint32_t VDISPLAY::hermes_kms::multi_device_uapi_version = 9
constexpr

Definition at line 774 of file virtual_display.cpp.

◆ multi_output_uapi_version

uint32_t VDISPLAY::hermes_kms::multi_output_uapi_version = 8
constexpr

Definition at line 773 of file virtual_display.cpp.

◆ name_len

size_t VDISPLAY::hermes_kms::name_len = 32
constexpr

Definition at line 783 of file virtual_display.cpp.

◆ newest_known_uapi_version

uint32_t VDISPLAY::hermes_kms::newest_known_uapi_version = 14
constexpr

The newest UAPI this source is written against: ACQUIRE_FRAME2, which returns each frame's colour state, arrived in 14. Raise it together with support for whatever a later driver adds.

Definition at line 782 of file virtual_display.cpp.

◆ session_access_bind

uint32_t VDISPLAY::hermes_kms::session_access_bind = 2U
constexpr

Definition at line 1037 of file virtual_display.cpp.

◆ session_access_get_token

uint32_t VDISPLAY::hermes_kms::session_access_get_token = 1U
constexpr

Definition at line 1036 of file virtual_display.cpp.

◆ session_access_result_bound

uint32_t VDISPLAY::hermes_kms::session_access_result_bound = 1U << 0
constexpr

Definition at line 1043 of file virtual_display.cpp.

◆ session_access_result_revoked

uint32_t VDISPLAY::hermes_kms::session_access_result_revoked = 1U << 2
constexpr

Definition at line 1045 of file virtual_display.cpp.

◆ session_access_result_token_valid

uint32_t VDISPLAY::hermes_kms::session_access_result_token_valid = 1U << 1
constexpr

Definition at line 1044 of file virtual_display.cpp.

◆ session_access_revoke_bindings

uint32_t VDISPLAY::hermes_kms::session_access_revoke_bindings = 5U
constexpr

Definition at line 1042 of file virtual_display.cpp.

◆ session_access_rotate_token

uint32_t VDISPLAY::hermes_kms::session_access_rotate_token = 4U
constexpr

Definition at line 1041 of file virtual_display.cpp.

◆ session_access_uapi_version

uint32_t VDISPLAY::hermes_kms::session_access_uapi_version = 11
constexpr

Definition at line 776 of file virtual_display.cpp.

◆ session_device_uapi_version

uint32_t VDISPLAY::hermes_kms::session_device_uapi_version = 10
constexpr

Definition at line 775 of file virtual_display.cpp.

◆ session_lifecycle_uapi_version

uint32_t VDISPLAY::hermes_kms::session_lifecycle_uapi_version = 13
constexpr

Definition at line 778 of file virtual_display.cpp.

◆ set_output_connected

uint32_t VDISPLAY::hermes_kms::set_output_connected = 1U << 0
constexpr

Definition at line 807 of file virtual_display.cpp.

◆ set_output_owner_assigned

uint32_t VDISPLAY::hermes_kms::set_output_owner_assigned = 1U << 1
constexpr

Definition at line 808 of file virtual_display.cpp.

◆ wait_frame_ready

uint64_t VDISPLAY::hermes_kms::wait_frame_ready = 1ULL << 0
constexpr

Definition at line 1023 of file virtual_display.cpp.

◆ wait_update_cursor_ready

uint64_t VDISPLAY::hermes_kms::wait_update_cursor_ready = 1ULL << 1
constexpr

Definition at line 1025 of file virtual_display.cpp.

◆ wait_update_frame_ready

uint64_t VDISPLAY::hermes_kms::wait_update_frame_ready = 1ULL << 0
constexpr

Definition at line 1024 of file virtual_display.cpp.