Hermes 0.7.0
Linux game streaming host
Loading...
Searching...
No Matches
wl Namespace Reference

Classes

class  display_t
class  dmabuf_t
class  frame_t
struct  img_t
struct  input_geometry_t
class  interface_t
class  monitor_t
struct  output_rect_t
struct  session_protocols_t
 Which Wayland globals the running session advertises. More...
class  wlr_ram_t
class  wlr_t
class  wlr_vram_t

Typedefs

using display_internal_t = util::safe_ptr<wl_display, wl_display_disconnect>

Functions

void logical_size (int mode_width, int mode_height, int transform, wl_fixed_t scale, int &width, int &height)
 Size of a head in the compositor's logical coordinates, the wlr counterpart of mutter::state_t::logical_size.
output_rect_t desktop_envelope (const std::vector< output_rect_t > &outputs)
 The desktop envelope: the bounding box of every output in logical coordinates, origin included. wlroots-style compositors (Hyprland, sway) spread an absolute input device across exactly this box.
input_geometry_t input_geometry (const output_rect_t &envelope, const output_rect_t &output, int mode_width, int mode_height)
 Express an output's offset within the envelope, and the envelope, in that output's own capture pixels.
bool dmabuf_capture_exhausted ()
 Whether the dmabuf capture path has failed too often to be retried.
std::string compositor_render_node (display_t &display, zwp_linux_dmabuf_v1 *dmabuf_interface)
 Ask the compositor which GPU it renders on.
std::vector< std::unique_ptr< monitor_t > > monitors (const char *display_name)
bool render_node_can_allocate (const char *node)
 Whether GBM can actually allocate a buffer on this render node.
bool configure_virtual_output (const std::string &output_name, int width, int height, int refresh_rate, bool exclusive)
bool restore_virtual_output_layout ()
bool output_management_supported ()
session_protocols_t probe_protocols ()
 Probe the session's globals in a single registry roundtrip.
int init ()

Detailed Description

The classes defined in this macro block should only be used by cpp files whose compilation depends on HERMES_BUILD_WAYLAND

Typedef Documentation

◆ display_internal_t

using wl::display_internal_t = util::safe_ptr<wl_display, wl_display_disconnect>

Definition at line 39 of file wayland.h.

Function Documentation

◆ compositor_render_node()

std::string wl::compositor_render_node ( display_t & display,
zwp_linux_dmabuf_v1 * dmabuf_interface )

Ask the compositor which GPU it renders on.

linux-dmabuf default feedback (protocol v4 and later) names the device the compositor imports buffers into; screencopy itself never says. Performs a roundtrip on the display.

Returns
The render node of that device, or an empty string when the compositor did not say or the protocol is too old.

Definition at line 820 of file wayland.cpp.

◆ configure_virtual_output()

bool wl::configure_virtual_output ( const std::string & output_name,
int width,
int height,
int refresh_rate,
bool exclusive )

Configure a virtual output through wlroots' output-management protocol. Returns false when the compositor does not expose that protocol or rejects the requested layout.

Definition at line 1760 of file wayland.cpp.

◆ desktop_envelope()

output_rect_t wl::desktop_envelope ( const std::vector< output_rect_t > & outputs)

The desktop envelope: the bounding box of every output in logical coordinates, origin included. wlroots-style compositors (Hyprland, sway) spread an absolute input device across exactly this box.

Outputs without a positive size are skipped; with none left the envelope is all zeros.

Definition at line 67 of file wayland.cpp.

◆ dmabuf_capture_exhausted()

bool wl::dmabuf_capture_exhausted ( )

Whether the dmabuf capture path has failed too often to be retried.

A frame that cannot get a buffer ends the capture in capture_e::reinit, and the reinit builds a fresh display_t around a fresh dmabuf_t - so a counter kept on the object restarts at zero on every retry and never learns that the same failure has been happening all session. That is how a capture path that cannot work stays invisible: the same error forty times a second, each one reported by a new object that believes it is the first, while the encoders keep encoding the untouched black buffers. The streak therefore lives beside the objects rather than inside them, and once it is long enough the caller is expected to give up loudly instead of retrying.

Definition at line 708 of file wayland.cpp.

◆ init()

int wl::init ( )

Definition at line 1910 of file wayland.cpp.

◆ input_geometry()

input_geometry_t wl::input_geometry ( const output_rect_t & envelope,
const output_rect_t & output,
int mode_width,
int mode_height )

Express an output's offset within the envelope, and the envelope, in that output's own capture pixels.

platf::display_t carries both that way, and the consumer forms (offset + x) / env, so scaling the logical values by mode / logical size gives the same ratio as converting x into logical space would. An output whose logical size is unknown (zero) counts as scale 1.

Parameters
outputThe streamed output's logical rectangle.
mode_widthThe streamed output's mode, i.e. capture, width.
mode_heightThe streamed output's mode, i.e. capture, height.

Definition at line 87 of file wayland.cpp.

◆ logical_size()

void wl::logical_size ( int mode_width,
int mode_height,
int transform,
wl_fixed_t scale,
int & width,
int & height )

Size of a head in the compositor's logical coordinates, the wlr counterpart of mutter::state_t::logical_size.

Head positions are logical, so anything added to them has to be logical too: the mode's pixel size divided by the scale, with the axes swapped for a rotated transform. transform & 1 covers the 90 and 270 degree rotations including their flipped variants (WL_OUTPUT_TRANSFORM_FLIPPED_90 is 5 and _FLIPPED_270 is 7). The scale arrives as 24.8 fixed point and is rounded to two decimals first: 1.6 is carried as 410/256 = 1.6015625, and 3840 divided by that rounds to 2398 where the compositor lays out 2400.

Parameters
scaleThe head's scale as wl_fixed_t; a non-positive scale counts as 1.

Definition at line 54 of file wayland.cpp.

◆ monitors()

std::vector< std::unique_ptr< monitor_t > > wl::monitors ( const char * display_name)

Definition at line 1719 of file wayland.cpp.

◆ output_management_supported()

bool wl::output_management_supported ( )

Check whether the current compositor exposes wlroots output management.

Definition at line 1846 of file wayland.cpp.

◆ probe_protocols()

session_protocols_t wl::probe_protocols ( )

Probe the session's globals in a single registry roundtrip.

Binds nothing: it records which interfaces the compositor advertises, so it is safe to call from diagnostics without disturbing a running stream.

Definition at line 1851 of file wayland.cpp.

◆ render_node_can_allocate()

bool wl::render_node_can_allocate ( const char * node)

Whether GBM can actually allocate a buffer on this render node.

Opening a render node proves nothing about whether buffers can come from it. Mesa loads a driver for whatever the node turns out to be, and where there is none to load - a proprietary-NVIDIA node has no nouveau behind it

  • it falls back to kms_swrast without complaint, which allocates through DRM_IOCTL_MODE_CREATE_DUMB and is refused by every render node. So the device looks healthy right up to the first buffer. Asking for a throwaway one is what separates the two cases.

Definition at line 1745 of file wayland.cpp.

◆ restore_virtual_output_layout()

bool wl::restore_virtual_output_layout ( )

Restore the physical output layout saved by configure_virtual_output().

Definition at line 1824 of file wayland.cpp.