|
Hermes 0.7.0
Linux game streaming host
|
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"Go to the source code of this file.
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 > ¤t, 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 ¤t_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 ¤t_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 ¤t_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 ¤t_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 ¤t_state, std::string &serial, std::string &argument) |
Build the payload that reproduces the layout in current_state. | |
| std::string | VDISPLAY::mutterInputDeviceOutputValue (const std::string ¤t_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 ¤t_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) |
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.
| #define LOAD_EVDI_FUNC | ( | name | ) |
| typedef struct evdi_device_context* VDISPLAY::evdi_handle |
Definition at line 333 of file virtual_display.cpp.
| typedef int(*) VDISPLAY::fn_evdi_add_device(void) |
Definition at line 401 of file virtual_display.cpp.
| typedef evdi_device_status(*) VDISPLAY::fn_evdi_check_device(int device) |
Definition at line 399 of file virtual_display.cpp.
| typedef void(*) VDISPLAY::fn_evdi_close(evdi_handle handle) |
Definition at line 402 of file virtual_display.cpp.
| 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.
| typedef void(*) VDISPLAY::fn_evdi_disconnect(evdi_handle handle) |
Definition at line 406 of file virtual_display.cpp.
| typedef int(*) VDISPLAY::fn_evdi_get_event_ready(evdi_handle handle) |
Definition at line 412 of file virtual_display.cpp.
| typedef void(*) VDISPLAY::fn_evdi_get_lib_version(struct evdi_lib_version *version) |
Definition at line 413 of file virtual_display.cpp.
| 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.
| typedef void(*) VDISPLAY::fn_evdi_handle_events(evdi_handle handle, struct evdi_event_context *evtctx) |
Definition at line 411 of file virtual_display.cpp.
| typedef evdi_handle(*) VDISPLAY::fn_evdi_open(int device) |
Definition at line 400 of file virtual_display.cpp.
| typedef void(*) VDISPLAY::fn_evdi_register_buffer(evdi_handle handle, struct evdi_buffer buffer) |
Definition at line 408 of file virtual_display.cpp.
| typedef bool(*) VDISPLAY::fn_evdi_request_update(evdi_handle handle, int bufferId) |
Definition at line 410 of file virtual_display.cpp.
| typedef void(*) VDISPLAY::fn_evdi_unregister_buffer(evdi_handle handle, int bufferId) |
Definition at line 409 of file virtual_display.cpp.
| using VDISPLAY::kscreen::output_t = kscreen_output_t |
Definition at line 2746 of file virtual_display.cpp.
|
strong |
Definition at line 4061 of file virtual_display.cpp.
| enum VDISPLAY::evdi_device_status |
Definition at line 335 of file virtual_display.cpp.
|
strong |
Definition at line 5051 of file virtual_display.cpp.
|
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.
|
strong |
Definition at line 4493 of file virtual_display.cpp.
|
strong |
Definition at line 4593 of file virtual_display.cpp.
|
strong |
| Enumerator | |
|---|---|
| no_device | No card node identifies itself as the hermes-kms driver. |
Definition at line 1372 of file virtual_display.cpp.
|
strong |
Definition at line 492 of file virtual_display.cpp.
| 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.
| 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.
| 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.
| 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.
| timed_out | Set to whether the command was stopped for running over. |
Definition at line 2741 of file virtual_display.cpp.
| 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.
Definition at line 2453 of file virtual_display.cpp.
| 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.
Definition at line 7790 of file virtual_display.cpp.
| 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.
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.
| 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.
Definition at line 7721 of file virtual_display.cpp.
| 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.
Definition at line 7701 of file virtual_display.cpp.
| 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.
| current_state | The GetCurrentState reply, as printed by gdbus call. |
| virtual_connector | The connector to remove, e.g. "Virtual-1". |
| serial | Receives the config serial the payload must be applied with. |
| argument | Receives the a(iiduba(ssa{sv})) argument. |
Definition at line 7685 of file virtual_display.cpp.
| 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.
Definition at line 7737 of file virtual_display.cpp.
| 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.
| 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.
| deviceName | The name of the virtual display. |
| width | The new width. |
| height | The new height. |
| refresh_rate | The new refresh rate (in mHz). |
| deadline_ms | How 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. |
Definition at line 7549 of file virtual_display.cpp.
| int VDISPLAY::changeDisplaySettings2 | ( | const char * | deviceName, |
| int | width, | ||
| int | height, | ||
| int | refresh_rate, | ||
| bool | bApplyIsolated = false ) |
Change the display settings with isolated display option.
| deviceName | The name of the virtual display. |
| width | The new width. |
| height | The new height. |
| refresh_rate | The new refresh rate (in mHz). |
| bApplyIsolated | Whether to apply isolated display settings. |
Definition at line 7640 of file virtual_display.cpp.
| void VDISPLAY::closeVDisplayDevice | ( | ) |
Close the virtual display driver.
Definition at line 6922 of file virtual_display.cpp.
| 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.
| 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.
| 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.
| 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.
| s_client_uid | The unique identifier of the client. |
| s_client_name | The name of the client. |
| width | The width of the virtual display. |
| height | The height of the virtual display. |
| fps | The refresh rate of the virtual display (in mHz). |
| guid | The GUID for the virtual display. |
| session_owner_uid | When 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. |
| layout | Where 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. |
Definition at line 7061 of file virtual_display.cpp.
| 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.
| drm_class | The sysfs DRM class directory; tests point it at a fake tree. |
| ignored_connector | A connector ("Virtual-1") to leave out of the answer, for asking whether anything else is lit. |
Definition at line 2318 of file virtual_display.cpp.
| 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.
| 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.
| wayland_display | WAYLAND_DISPLAY: a socket name under runtime_dir, or a path. |
| x_display | DISPLAY. |
| runtime_dir | XDG_RUNTIME_DIR. |
Definition at line 107 of file virtual_display.cpp.
| 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.
| void VDISPLAY::endPhysicalOutputSession | ( | ) |
Definition at line 7992 of file virtual_display.cpp.
| 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.
| bool VDISPLAY::getDisplayHDRByName | ( | const char * | displayName | ) |
Get the HDR status of a display by name.
| displayName | The name of the display. |
Definition at line 8602 of file virtual_display.cpp.
| 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.
| int VDISPLAY::getEvdiCardIndex | ( | const std::string & | displayName | ) |
Get the DRM card index for an EVDI display.
| displayName | The name of the EVDI display. |
Definition at line 8662 of file virtual_display.cpp.
| 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.
| EVDI_DIAGNOSTIC VDISPLAY::getEvdiDiagnostic | ( | ) |
Return the most specific available EVDI diagnostic for the current host.
Definition at line 6101 of file virtual_display.cpp.
| EvdiStatus VDISPLAY::getEvdiStatus | ( | ) |
Return runtime, DKMS, and frame-update details for the Audio/Video UI.
Definition at line 6175 of file virtual_display.cpp.
| 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.
| 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.
| 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.
| 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.
| 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.
| 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.
Definition at line 8730 of file virtual_display.cpp.
| 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.
| HermesKmsStatus VDISPLAY::getHermesKmsStatus | ( | ) |
Return module, DKMS, and device details for the Audio/Video UI.
Definition at line 6283 of file virtual_display.cpp.
| 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.
| std::string VDISPLAY::getPrimaryDisplay | ( | ) |
Get the primary display name.
Definition at line 8565 of file virtual_display.cpp.
| 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.
Definition at line 135 of file virtual_display.cpp.
| 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.
| 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.
| 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.
Definition at line 8974 of file virtual_display.cpp.
| 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.
| int VDISPLAY::hermesKmsOpenCapture | ( | const std::string & | display_name | ) |
Open the render node of the Hermes-KMS card behind display_name.
Definition at line 8865 of file virtual_display.cpp.
| 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.
| 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.
| 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.
| 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.
| 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.
| displayName | The name of the display to check. |
Definition at line 8634 of file virtual_display.cpp.
| 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.
| bool VDISPLAY::isHermesKmsDriverPresent | ( | ) |
Check whether a usable Hermes-KMS DRM device exists on this host.
Definition at line 8682 of file virtual_display.cpp.
| 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.
| 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.
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.
| 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.
| 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).
| output | What kscreen-doctor printed, stdout and stderr together. |
Definition at line 2642 of file virtual_display.cpp.
| 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.
| 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.
virtual_output. Definition at line 2530 of file virtual_display.cpp.
| 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.
| 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.
| std::vector< std::string > VDISPLAY::matchDisplay | ( | const std::string & | sMatch | ) |
Match displays by a given pattern.
| sMatch | The pattern to match. |
Definition at line 8613 of file virtual_display.cpp.
| 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.
| current_state | The GetCurrentState reply, as printed by gdbus call. |
| connector | The connector to locate, e.g. "Virtual-1". |
Definition at line 7802 of file virtual_display.cpp.
| 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.
Definition at line 7770 of file virtual_display.cpp.
| 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.
| 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.
| void VDISPLAY::notePhysicalCaptureOutput | ( | const std::string & | connector_name | ) |
Definition at line 7966 of file virtual_display.cpp.
| DRIVER_STATUS VDISPLAY::openVDisplayDevice | ( | ) |
Initialize the virtual display driver.
Definition at line 6820 of file virtual_display.cpp.
| 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.
| 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.
| 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.
| SessionFacts VDISPLAY::probeSessionFacts | ( | ) |
Observe the running session. Safe to call while a stream is running.
Definition at line 6125 of file virtual_display.cpp.
| std::string VDISPLAY::readinessName | ( | readiness_e | readiness | ) |
Definition at line 2012 of file virtual_display.cpp.
| 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.
| greeter_on_seat | A display manager's greeter is the session in front. |
| output_lit | The output being removed is one a compositor drives. |
| another_connector_lit | displayConnectorLit() with that output left out. |
Definition at line 2399 of file virtual_display.cpp.
| bool VDISPLAY::removeVirtualDisplay | ( | const uuid_util::uuid_t & | guid | ) |
Remove a virtual display.
| guid | The GUID of the virtual display to remove. |
Definition at line 7533 of file virtual_display.cpp.
| void VDISPLAY::restoreExclusiveVirtualDisplay | ( | ) |
Definition at line 8523 of file virtual_display.cpp.
| 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.
| bool VDISPLAY::setDisplayHDRByName | ( | const char * | displayName, |
| bool | enableAdvancedColor ) |
Set the HDR status of a display by name.
| displayName | The name of the display. |
| enableAdvancedColor | Whether to enable HDR. |
Definition at line 8608 of file virtual_display.cpp.
| bool VDISPLAY::setPrimaryDisplay | ( | const char * | primaryDeviceName | ) |
Set the primary display by name.
| primaryDeviceName | The name of the display to set as primary. |
Definition at line 8597 of file virtual_display.cpp.
| bool VDISPLAY::setRenderAdapterByName | ( | const std::string & | adapterName | ) |
Set the render adapter by name.
| adapterName | The name of the adapter to use for rendering. |
Definition at line 7048 of file virtual_display.cpp.
| bool VDISPLAY::startPingThread | ( | std::function< void()> | failCb | ) |
Start a ping thread to keep the virtual display alive.
| failCb | Callback to invoke if the watchdog fails. |
Definition at line 6968 of file virtual_display.cpp.
| 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.
| 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.
Definition at line 211 of file virtual_display.cpp.
| 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.
| 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.
| 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.
| connector | DRM connector name as the driver reports it ("Virtual-1"). |
| drm_class | The sysfs DRM class directory; tests point it at a fake tree. |
Definition at line 2411 of file virtual_display.cpp.
| 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.
Definition at line 8192 of file virtual_display.cpp.
| 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.
|
constexpr |
Definition at line 796 of file virtual_display.cpp.
|
constexpr |
Definition at line 788 of file virtual_display.cpp.
|
constexpr |
Definition at line 800 of file virtual_display.cpp.
|
constexpr |
Definition at line 787 of file virtual_display.cpp.
|
constexpr |
Definition at line 791 of file virtual_display.cpp.
|
constexpr |
Definition at line 792 of file virtual_display.cpp.
|
constexpr |
Definition at line 794 of file virtual_display.cpp.
|
constexpr |
Definition at line 793 of file virtual_display.cpp.
|
constexpr |
Definition at line 786 of file virtual_display.cpp.
|
constexpr |
Definition at line 789 of file virtual_display.cpp.
|
constexpr |
Definition at line 803 of file virtual_display.cpp.
|
constexpr |
Definition at line 790 of file virtual_display.cpp.
|
constexpr |
Definition at line 795 of file virtual_display.cpp.
|
constexpr |
Definition at line 805 of file virtual_display.cpp.
|
constexpr |
Definition at line 785 of file virtual_display.cpp.
|
constexpr |
Definition at line 804 of file virtual_display.cpp.
|
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.
|
constexpr |
Definition at line 1031 of file virtual_display.cpp.
|
constexpr |
Definition at line 1032 of file virtual_display.cpp.
|
constexpr |
Definition at line 1034 of file virtual_display.cpp.
|
constexpr |
Definition at line 1028 of file virtual_display.cpp.
|
constexpr |
Definition at line 1030 of file virtual_display.cpp.
|
constexpr |
Definition at line 1026 of file virtual_display.cpp.
|
constexpr |
Definition at line 1027 of file virtual_display.cpp.
|
constexpr |
Definition at line 1033 of file virtual_display.cpp.
|
constexpr |
Definition at line 1029 of file virtual_display.cpp.
|
constexpr |
Definition at line 809 of file virtual_display.cpp.
|
constexpr |
Definition at line 777 of file virtual_display.cpp.
|
constexpr |
Definition at line 6368 of file virtual_display.cpp.
|
constexpr |
Definition at line 1020 of file virtual_display.cpp.
|
constexpr |
Definition at line 1019 of file virtual_display.cpp.
|
constexpr |
Definition at line 1022 of file virtual_display.cpp.
|
constexpr |
Definition at line 1021 of file virtual_display.cpp.
|
constexpr |
Definition at line 1058 of file virtual_display.cpp.
|
constexpr |
Definition at line 1052 of file virtual_display.cpp.
|
constexpr |
Definition at line 1051 of file virtual_display.cpp.
|
constexpr |
Definition at line 1048 of file virtual_display.cpp.
|
constexpr |
Definition at line 1053 of file virtual_display.cpp.
|
constexpr |
Definition at line 1055 of file virtual_display.cpp.
|
constexpr |
Definition at line 1049 of file virtual_display.cpp.
|
constexpr |
Definition at line 1047 of file virtual_display.cpp.
|
constexpr |
Definition at line 1056 of file virtual_display.cpp.
|
constexpr |
Definition at line 1057 of file virtual_display.cpp.
|
constexpr |
Definition at line 1050 of file virtual_display.cpp.
|
constexpr |
Definition at line 1054 of file virtual_display.cpp.
|
constexpr |
Definition at line 1059 of file virtual_display.cpp.
|
constexpr |
Definition at line 774 of file virtual_display.cpp.
|
constexpr |
Definition at line 773 of file virtual_display.cpp.
|
constexpr |
Definition at line 783 of file virtual_display.cpp.
|
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.
|
constexpr |
Definition at line 1037 of file virtual_display.cpp.
|
constexpr |
Definition at line 1036 of file virtual_display.cpp.
|
constexpr |
Definition at line 1043 of file virtual_display.cpp.
|
constexpr |
Definition at line 1045 of file virtual_display.cpp.
|
constexpr |
Definition at line 1044 of file virtual_display.cpp.
|
constexpr |
Definition at line 1042 of file virtual_display.cpp.
|
constexpr |
Definition at line 1041 of file virtual_display.cpp.
|
constexpr |
Definition at line 776 of file virtual_display.cpp.
|
constexpr |
Definition at line 775 of file virtual_display.cpp.
|
constexpr |
Definition at line 778 of file virtual_display.cpp.
|
constexpr |
Definition at line 807 of file virtual_display.cpp.
|
constexpr |
Definition at line 808 of file virtual_display.cpp.
|
constexpr |
Definition at line 1023 of file virtual_display.cpp.
|
constexpr |
Definition at line 1025 of file virtual_display.cpp.
|
constexpr |
Definition at line 1024 of file virtual_display.cpp.