• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

.gitlab-ci/H25-Nov-2021-176138

protocols/H03-May-2022-7,7706,490

src/H25-Nov-2021-13,95911,081

test/H03-May-2022-4,9583,975

.clang-formatH A D25-Nov-20212.7 KiB9795

.gitignoreH A D25-Nov-202151 87

.gitlab-ci.ymlH A D25-Nov-20211.9 KiB7664

CONTRIBUTING.mdH A D25-Nov-20212.2 KiB4938

COPYINGH A D25-Nov-20211.2 KiB2720

README.mdH A D25-Nov-20216.1 KiB130101

autoformat.shH A D25-Nov-2021134 53

meson.buildH A D03-May-20223.9 KiB113103

meson.build.nogitH A D25-Nov-20213.9 KiB113103

minimal_build.shH A D25-Nov-20211,022 2922

waypipe.scdH A D25-Nov-202110.9 KiB288217

README.md

1Waypipe
2================================================================================
3
4`waypipe` is a proxy for Wayland[0] clients. It forwards Wayland messages and
5serializes changes to shared memory buffers over a single socket. This makes
6application forwarding similar to `ssh -X` [1] feasible.
7
8[0] [https://wayland.freedesktop.org/](https://wayland.freedesktop.org/)
9[1] [https://unix.stackexchange.com/questions/12755/how-to-forward-x-over-ssh-to-run-graphics-applications-remotely](https://unix.stackexchange.com/questions/12755/how-to-forward-x-over-ssh-to-run-graphics-applications-remotely)
10
11## Usage
12
13`waypipe` should be installed on both the local and remote computers. There is
14a user-friendly command line pattern which prefixes a call to `ssh` and
15automatically sets up a reverse tunnel for protocol data. For example,
16
17    waypipe ssh user@theserver weston-terminal
18
19will run `ssh`, connect to `theserver`, and remotely run `weston-terminal`,
20using local and remote `waypipe` processes to synchronize the shared memory
21buffers used by Wayland clients between both computers. Command line arguments
22before `ssh` apply only to `waypipe`; those after `ssh` belong to `ssh`.
23
24Alternatively, one can launch the local and remote processes by hand, with the
25following set of shell commands:
26
27    /usr/bin/waypipe -s /tmp/socket-local client &
28    ssh -R /tmp/socket-remote:/tmp/socket-local -t user@theserver \
29        /usr/bin/waypipe -s /tmp/socket-remote server -- \
30        /usr/bin/weston-terminal
31    kill %1
32
33It's possible to set up the local and remote processes so that, when the
34connection between the the sockets used by each end breaks, one can create
35a new forwarded socket on the remote side and reconnect the two processes.
36For a more detailed example, see the man page.
37
38## Installing
39
40Build with meson[0]. A typical incantation is
41
42    cd /path/to/waypipe/ && cd ..
43    mkdir build-waypipe
44    meson --buildtype debugoptimized waypipe build-waypipe
45    ninja -C build-waypipe install
46
47Core build requirements:
48
49* meson (build, >= 0.47. with dependencies `ninja`, `pkg-config`, `python3`)
50* C compiler
51
52Optional dependencies:
53
54* liblz4 (for fast compression, >=1.7.0)
55* libzstd (for slower compression, >= 0.4.6)
56* libgbm (to support programs using OpenGL via DMABUFs)
57* libdrm (same as for libgbm)
58* ffmpeg (>=3.1, needs avcodec/avutil/swscale for lossy video encoding)
59* libva (for hardware video encoding and decoding)
60* scdoc (to generate a man page)
61* sys/sdt.h (to provide static tracepoints for profiling)
62* ssh (runtime, OpenSSH >= 6.7, for Unix domain socket forwarding)
63* libx264 (ffmpeg runtime, for software video decoding and encoding)
64
65[0] [https://mesonbuild.com/](https://mesonbuild.com/)
66[1] [https://git.sr.ht/~sircmpwn/scdoc](https://git.sr.ht/~sircmpwn/scdoc)
67
68## Status
69
70This program is now relatively stable, with no large changes to the
71command line interface or wire format expected. Features like video
72encoding, multiplanar and tiled DMABUFs, and support for newer Wayland
73protocols are less well tested and more likely to break between minor
74versions.
75
76Waypipe is developed at [1]; file bug reports or submit patches here.
77
78The wire format most recently changed with version 0.7.0, and is not
79compatible with earlier versions of Waypipe. Both the client and
80server sides of a connection must have a feature in order for it to work;
81for example, if the local copy of Waypipe was built without LZ4 support,
82and the remote copy has the `--compress lz4` option set, the connection
83may fail at some point.
84
85Any of the following may make waypipe crash with an error message. If
86it segfaults, file a bug report!
87
88* Different local/client and remote/server versions or capabilities
89* Differing byte orders
90* Applications using unexpected protocols that pass file descriptors; file
91  bug reports for these
92
93[0] [https://mstoeckl.com/notes/gsoc/blog.html](https://mstoeckl.com/notes/gsoc/blog.html)
94[1] [https://gitlab.freedesktop.org/mstoeckl/waypipe/](https://gitlab.freedesktop.org/mstoeckl/waypipe/)
95
96## Limitations
97
98Waypipe does not have a full view of the Wayland protocol. It includes a
99compiled form of the base protocol and several extension protocols, but is not
100able to parse all messages that the programs it connects send. Fortunately, the
101Wayland wire protocol is partially self-describing, so Waypipe can parse the
102messages it needs (those related to resources shared with file descriptors)
103while ignoring the rest. This makes Waypipe partially forward-compatible: if a
104future protocol comes out concerns details (for example, about window
105positioning) which require that file descriptors be sent, then applications
106will be able to use that protocol even with older versions of Waypipe. The
107tradeoff to allowing messages that Waypipe can not parse is that Waypipe can
108only make minor modifications to the wire protocol. In particular, adding or
109removing any Wayland protocol objects would require changing all messages that
110refer to them, including those messages that Waypipe does not parse. This
111precludes, for example, global object deduplication tricks that could reduce
112startup time for complicated applications.
113
114Shared memory buffer updates, including those for the contents of windows, are
115tracked by keeping a "mirror" copy of the buffer the represents the view which
116the opposing instance of Waypipe has. This way, Waypipe can send only the
117regions of the buffer that have changed relative to the remote copy. This is
118more efficient than resending the entire buffer on every update, which is good
119for applications with reasonably static user interfaces (like a text editor or
120email client). However, with programs with animations where the interaction
121latency matters (like games or certain audio tools), major window updates will
122unavoidably produce a lag spike. The additional memory cost of keeping mirrors
123is moderate.
124
125The video encoding option for DMABUFs currently maintains a video stream for
126each buffer that is used by a window surface. Since surfaces typically rotate
127between a small number of buffers, a video encoded window will appear to
128flicker as it switches rapidly between the underlying buffers, each of whose
129video streams has different encoding artifacts.
130