Blame waypipe.1

Olivier Fourdan 0877ab
.\" Generated by scdoc 1.11.1
Olivier Fourdan 0877ab
.\" Complete documentation for this program is not available as a GNU info page
Olivier Fourdan 0877ab
.ie \n(.g .ds Aq \(aq
Olivier Fourdan 0877ab
.el       .ds Aq '
Olivier Fourdan 0877ab
.nh
Olivier Fourdan 0877ab
.ad l
Olivier Fourdan 0877ab
.\" Begin generated content:
Olivier Fourdan 0877ab
.TH "waypipe" "1" "2021-02-19"
Olivier Fourdan 0877ab
.P
Olivier Fourdan 0877ab
.SH NAME
Olivier Fourdan 0877ab
.P
Olivier Fourdan 0877ab
waypipe - A transparent proxy for Wayland applications
Olivier Fourdan 0877ab
.P
Olivier Fourdan 0877ab
.SH SYNOPSIS
Olivier Fourdan 0877ab
.P
Olivier Fourdan 0877ab
\fBwaypipe\fR [options.\&.\&.\&] client
Olivier Fourdan 0877ab
.br
Olivier Fourdan 0877ab
\fBwaypipe\fR [options.\&.\&.\&] server -- \fIcommand.\&.\&.\&\fR
Olivier Fourdan 0877ab
.br
Olivier Fourdan 0877ab
\fBwaypipe\fR [options.\&.\&.\&] recon \fIcontrol_pipe\fR \fInew_socket_path\fR
Olivier Fourdan 0877ab
.br
Olivier Fourdan 0877ab
\fBwaypipe\fR [options.\&.\&.\&] ssh .\&.\&.\&
Olivier Fourdan 0877ab
.br
Olivier Fourdan 0877ab
\fBwaypipe\fR [options.\&.\&.\&] bench \fIbandwidth\fR
Olivier Fourdan 0877ab
.P
Olivier Fourdan 0877ab
.SH DESCRIPTION
Olivier Fourdan 0877ab
.P
Olivier Fourdan 0877ab
waypipe is a proxy for Wayland clients, with the aim of supporting behavior
Olivier Fourdan 0877ab
like \fBssh -X\fR.\&
Olivier Fourdan 0877ab
.P
Olivier Fourdan 0877ab
When run as \fBwaypipe client\fR, it will open a socket (by default at
Olivier Fourdan 0877ab
\fI/tmp/waypipe-client.\&sock\fR) and will connect to the local Wayland compositor
Olivier Fourdan 0877ab
and forward all Wayland applications which were linked to it over the socket
Olivier Fourdan 0877ab
by a matching \fBwaypipe server\fR instance.\&
Olivier Fourdan 0877ab
.P
Olivier Fourdan 0877ab
When run as \fBwaypipe server\fR, it will run the command that follows in its
Olivier Fourdan 0877ab
command line invocation, set up its own Wayland compositor socket, and
Olivier Fourdan 0877ab
try to connect to its matching \fBwaypipe client\fR socket (by default
Olivier Fourdan 0877ab
\fI/tmp/waypipe-server.\&sock\fR) and try to forward all the Wayland clients
Olivier Fourdan 0877ab
that connect to fake compositor socket to the matching \fBwaypipe client\fR.\&
Olivier Fourdan 0877ab
.P
Olivier Fourdan 0877ab
The \fBwaypipe recon\fR mode is used to reconnect a \fBwaypipe server\fR instance
Olivier Fourdan 0877ab
which has had a control pipe (option \fB--control\fR) set.\& The new socket path
Olivier Fourdan 0877ab
should indicate a Unix socket whose connections are forwarded to the \fBwaypipe
Olivier Fourdan 0877ab
client\fR that the \fBwaypipe server\fR was initially connected to.\&
Olivier Fourdan 0877ab
.P
Olivier Fourdan 0877ab
Next, prefixing an \fBssh .\&.\&.\&\fR command to become \fBwaypipe ssh .\&.\&.\&\fR will
Olivier Fourdan 0877ab
automatically set up local and remote copies of \fBwaypipe\fR, as well as
Olivier Fourdan 0877ab
forwarding between their sockets, so that Wayland applications run remotely
Olivier Fourdan 0877ab
will be displayed locally.\&
Olivier Fourdan 0877ab
.P
Olivier Fourdan 0877ab
Finally, the \fBwaypipe bench\fR mode can be used to estimate, given a specific
Olivier Fourdan 0877ab
connection \fIbandwidth\fR in MB/sec, which compression options produce the
Olivier Fourdan 0877ab
lowest latency.\& It tests two synthetic images, one made to be roughly as
Olivier Fourdan 0877ab
compressible as images containing text, and one made to be roughly as
Olivier Fourdan 0877ab
compressible as images containing pictures.\&
Olivier Fourdan 0877ab
.P
Olivier Fourdan 0877ab
.SH OPTIONS
Olivier Fourdan 0877ab
.P
Olivier Fourdan 0877ab
\fB-c C, --compress C\fR
Olivier Fourdan 0877ab
.RS 4
Olivier Fourdan 0877ab
Select the compression method applied to data transfers.\& Options are
Olivier Fourdan 0877ab
\fInone\fR (for high-bandwidth networks), \fIlz4\fR (intermediate), \fIzstd\fR
Olivier Fourdan 0877ab
(slow connection).\& The default compression is \fInone\fR.\& The compression
Olivier Fourdan 0877ab
level can be chosen by appending = followed by a number.\& For example,
Olivier Fourdan 0877ab
if \fBC\fR is \fIzstd=7\fR, waypipe will use level 7 Zstd compression.\&
Olivier Fourdan 0877ab
.P
Olivier Fourdan 0877ab
.RE
Olivier Fourdan 0877ab
\fB-d, --debug\fR
Olivier Fourdan 0877ab
.RS 4
Olivier Fourdan 0877ab
Print debug log messages.\&
Olivier Fourdan 0877ab
.P
Olivier Fourdan 0877ab
.RE
Olivier Fourdan 0877ab
\fB-h, --help\fR
Olivier Fourdan 0877ab
.RS 4
Olivier Fourdan 0877ab
Show help message and quit.\&
Olivier Fourdan 0877ab
.P
Olivier Fourdan 0877ab
.RE
Olivier Fourdan 0877ab
\fB-n, --no-gpu\fR
Olivier Fourdan 0877ab
.RS 4
Olivier Fourdan 0877ab
Block protocols like wayland-drm and linux-dmabuf which require access
Olivier Fourdan 0877ab
to e.\&g.\& render nodes.\&
Olivier Fourdan 0877ab
.P
Olivier Fourdan 0877ab
.RE
Olivier Fourdan 0877ab
\fB-o, --oneshot\fR
Olivier Fourdan 0877ab
.RS 4
Olivier Fourdan 0877ab
Only permit a single connection, and exit when it is closed.\&
Olivier Fourdan 0877ab
.P
Olivier Fourdan 0877ab
.RE
Olivier Fourdan 0877ab
\fB-s S, --socket S\fR
Olivier Fourdan 0877ab
.RS 4
Olivier Fourdan 0877ab
Use \fBS\fR as the path for the Unix socket.\& The default socket path for
Olivier Fourdan 0877ab
server mode is \fI/tmp/waypipe-server.\&sock\fR; for client mode, it is
Olivier Fourdan 0877ab
\fI/tmp/waypipe-client.\&sock\fR; and in ssh mode, \fBS\fR gives the prefix used by
Olivier Fourdan 0877ab
both the client and the server for their socket paths.\&
Olivier Fourdan 0877ab
.P
Olivier Fourdan 0877ab
.RE
Olivier Fourdan 0877ab
\fB-v, --version\fR
Olivier Fourdan 0877ab
.RS 4
Olivier Fourdan 0877ab
Print the version number and quit.\&
Olivier Fourdan 0877ab
.P
Olivier Fourdan 0877ab
.RE
Olivier Fourdan 0877ab
\fB--allow-tiled\fR
Olivier Fourdan 0877ab
.RS 4
Olivier Fourdan 0877ab
By default, waypipe filters out all advertised DMABUF formats which have
Olivier Fourdan 0877ab
format layout modifiers, as CPU access to these formats may be very slow.\&
Olivier Fourdan 0877ab
Setting this flag disables the filtering.\& Since tiled images often permit
Olivier Fourdan 0877ab
faster GPU operations, most OpenGL applications will select tiling modifiers
Olivier Fourdan 0877ab
when they are available.\&
Olivier Fourdan 0877ab
.P
Olivier Fourdan 0877ab
.RE
Olivier Fourdan 0877ab
\fB--control C\fR
Olivier Fourdan 0877ab
.RS 4
Olivier Fourdan 0877ab
For server or ssh mode, provide the path to the "control pipe" that will
Olivier Fourdan 0877ab
be created the the server.\& Writing (with \fBwaypipe recon C T\fR, or
Olivier Fourdan 0877ab
'echo -n T > C') a new socket path to this pipe will make the server
Olivier Fourdan 0877ab
instance replace all running connections with connections to the new
Olivier Fourdan 0877ab
Unix socket.\& The new socket should ultimately forward data to the same
Olivier Fourdan 0877ab
waypipe client that the server was connected to before.\&
Olivier Fourdan 0877ab
.P
Olivier Fourdan 0877ab
.RE
Olivier Fourdan 0877ab
\fB--display D\fR
Olivier Fourdan 0877ab
.RS 4
Olivier Fourdan 0877ab
For server or ssh mode, provide \fIWAYLAND_DISPLAY\fR and let waypipe configure
Olivier Fourdan 0877ab
its Wayland display socket to have a matching path.\& (If \fBD\fR is not an
Olivier Fourdan 0877ab
absolute path, the socket will be created in the folder given by the
Olivier Fourdan 0877ab
environment variable \fIXDG_RUNTIME_DIR\fR.\&)
Olivier Fourdan 0877ab
.P
Olivier Fourdan 0877ab
.RE
Olivier Fourdan 0877ab
\fB--drm-node R\fR
Olivier Fourdan 0877ab
.RS 4
Olivier Fourdan 0877ab
Specify the path \fBR\fR to the drm device that this instance of waypipe should
Olivier Fourdan 0877ab
use and (in server mode) notify connecting applications about.\&
Olivier Fourdan 0877ab
.P
Olivier Fourdan 0877ab
.RE
Olivier Fourdan 0877ab
\fB--remote-node R\fR
Olivier Fourdan 0877ab
.RS 4
Olivier Fourdan 0877ab
In ssh mode, specify the path \fBR\fR to the drm device that the remote instance
Olivier Fourdan 0877ab
of waypipe (running in server mode) should use.\&
Olivier Fourdan 0877ab
.P
Olivier Fourdan 0877ab
.RE
Olivier Fourdan 0877ab
\fB--remote-bin R\fR
Olivier Fourdan 0877ab
.RS 4
Olivier Fourdan 0877ab
In ssh mode, specify the path \fBR\fR to the waypipe binary on the remote
Olivier Fourdan 0877ab
computer, or its name if it is available in \fIPATH\fR.\& It defaults to
Olivier Fourdan 0877ab
\fBwaypipe\fR if this option isn’t passed.\&
Olivier Fourdan 0877ab
.P
Olivier Fourdan 0877ab
.RE
Olivier Fourdan 0877ab
\fB--login-shell\fR
Olivier Fourdan 0877ab
.RS 4
Olivier Fourdan 0877ab
Only for server mode; if no command is being run, open a login shell.\&
Olivier Fourdan 0877ab
.P
Olivier Fourdan 0877ab
.RE
Olivier Fourdan 0877ab
\fB--threads T\fR
Olivier Fourdan 0877ab
.RS 4
Olivier Fourdan 0877ab
Set the number of total threads (including the main thread) which a \fBwaypipe\fR
Olivier Fourdan 0877ab
instance will create.\& These threads will be used to parallelize compression
Olivier Fourdan 0877ab
operations.\& This flag is passed on to \fBwaypipe server\fR when given to \fBwaypipe
Olivier Fourdan 0877ab
ssh\fR.\& The flag also controls the thread count for \fBwaypipe bench\fR.\&
Olivier Fourdan 0877ab
.P
Olivier Fourdan 0877ab
.RE
Olivier Fourdan 0877ab
\fB--unlink-socket\fR
Olivier Fourdan 0877ab
.RS 4
Olivier Fourdan 0877ab
Only for server mode; on shutdown, unlink the Unix socket that waypipe connects to.\&
Olivier Fourdan 0877ab
.P
Olivier Fourdan 0877ab
.RE
Olivier Fourdan 0877ab
\fB--video\fR
Olivier Fourdan 0877ab
.RS 4
Olivier Fourdan 0877ab
Compress specific DMABUF formats using a lossy video codec.\& Opaque, 10-bit, and
Olivier Fourdan 0877ab
multiplanar formats, among others, are not supported.\&
Olivier Fourdan 0877ab
.P
Olivier Fourdan 0877ab
.RE
Olivier Fourdan 0877ab
\fB--hwvideo\fR
Olivier Fourdan 0877ab
.RS 4
Olivier Fourdan 0877ab
Sets the \fB--video\fR option, and also specifies that hardware video encoding and decoding
Olivier Fourdan 0877ab
should be used if possible.\& Whether this option improves bandwidth use and latency
Olivier Fourdan 0877ab
is hardware dependent.\&
Olivier Fourdan 0877ab
.P
Olivier Fourdan 0877ab
.P
Olivier Fourdan 0877ab
.RE
Olivier Fourdan 0877ab
.SH EXAMPLE 
Olivier Fourdan 0877ab
.P
Olivier Fourdan 0877ab
The following \fBwaypipe ssh\fR subcommand will attempt to run \fBweston-flower\fR on
Olivier Fourdan 0877ab
the server \fIexserv\fR, displaying the result on the local system.\&
Olivier Fourdan 0877ab
.P
Olivier Fourdan 0877ab
.nf
Olivier Fourdan 0877ab
.RS 4
Olivier Fourdan 0877ab
	waypipe ssh user@exserv weston-flower
Olivier Fourdan 0877ab
.fi
Olivier Fourdan 0877ab
.RE
Olivier Fourdan 0877ab
.P
Olivier Fourdan 0877ab
One can obtain similar behavior by explicitly running waypipe and ssh:
Olivier Fourdan 0877ab
.P
Olivier Fourdan 0877ab
.nf
Olivier Fourdan 0877ab
.RS 4
Olivier Fourdan 0877ab
	waypipe --socket /tmp/socket-client client  &
Olivier Fourdan 0877ab
	ssh -R /tmp/socket-server:/tmp/socket-client user@exserv \\
Olivier Fourdan 0877ab
		waypipe --socket /tmp/socket-server server -- weston-flower
Olivier Fourdan 0877ab
	kill %1
Olivier Fourdan 0877ab
.fi
Olivier Fourdan 0877ab
.RE
Olivier Fourdan 0877ab
.P
Olivier Fourdan 0877ab
Waypipe may be run locally without an ssh connection by specifying matching
Olivier Fourdan 0877ab
socket paths.\& For example:
Olivier Fourdan 0877ab
.P
Olivier Fourdan 0877ab
.nf
Olivier Fourdan 0877ab
.RS 4
Olivier Fourdan 0877ab
	waypipe --socket /tmp/waypipe\&.sock client &
Olivier Fourdan 0877ab
	waypipe --socket /tmp/waypipe\&.sock server weston-simple-dmabuf-egl
Olivier Fourdan 0877ab
	kill %1
Olivier Fourdan 0877ab
	rm /tmp/waypipe\&.sock
Olivier Fourdan 0877ab
.fi
Olivier Fourdan 0877ab
.RE
Olivier Fourdan 0877ab
.P
Olivier Fourdan 0877ab
Many applications require specific environment variables to use Wayland instead
Olivier Fourdan 0877ab
of X11.\& If ssh isn't configured to support loading \fI~/.\&ssh/environment\fR,
Olivier Fourdan 0877ab
one can use \fIenv\fR to set the needed variables each time; or run waypipe without
Olivier Fourdan 0877ab
a command, to use the login shell environment.\&
Olivier Fourdan 0877ab
.P
Olivier Fourdan 0877ab
.nf
Olivier Fourdan 0877ab
.RS 4
Olivier Fourdan 0877ab
	 waypipe ssh user@host env XDG_SESSION_TYPE=wayland dolphin
Olivier Fourdan 0877ab
.fi
Olivier Fourdan 0877ab
.RE
Olivier Fourdan 0877ab
.P
Olivier Fourdan 0877ab
Waypipe has support for reconnecting a \fBwaypipe client\fR and a \fBwaypipe server\fR
Olivier Fourdan 0877ab
instance when whatever was used to transfer data between their sockets fails.\&
Olivier Fourdan 0877ab
For this to work, waypipe must still be running on both sides of the connection.\&
Olivier Fourdan 0877ab
As the \fBwaypipe ssh\fR wrapper will automatically close both the \fBwaypipe client\fR
Olivier Fourdan 0877ab
and the \fBwaypipe server\fR when the connection fails, the client and server modes
Olivier Fourdan 0877ab
must be run seprately.\& For example, to persistently forward applications running
Olivier Fourdan 0877ab
on server \fIrserv\fR to a local Wayland compositor running on \fIlserv\fR, one would
Olivier Fourdan 0877ab
first set up a waypipe client instance on \fIlserv\fR,
Olivier Fourdan 0877ab
.P
Olivier Fourdan 0877ab
.nf
Olivier Fourdan 0877ab
.RS 4
Olivier Fourdan 0877ab
	waypipe -s /tmp/waypipe\&.sock client &
Olivier Fourdan 0877ab
.fi
Olivier Fourdan 0877ab
.RE
Olivier Fourdan 0877ab
.P
Olivier Fourdan 0877ab
and on server \fIrserv\fR, establish socket forwarding and run the server
Olivier Fourdan 0877ab
.P
Olivier Fourdan 0877ab
.nf
Olivier Fourdan 0877ab
.RS 4
Olivier Fourdan 0877ab
	ssh -fN -L /tmp/waypipe-lserv\&.sock:/tmp/waypipe\&.sock user@lserv
Olivier Fourdan 0877ab
	waypipe -s /tmp/waypipe-lserv\&.sock --control /tmp/ctrl-lserv\&.pipe \\
Olivier Fourdan 0877ab
		--display wayland-lserv server -- sleep inf &
Olivier Fourdan 0877ab
.fi
Olivier Fourdan 0877ab
.RE
Olivier Fourdan 0877ab
.P
Olivier Fourdan 0877ab
then set \fIWAYLAND_DISPLAY=wayland-lserv\fR and run the desired applications.\&
Olivier Fourdan 0877ab
When the ssh forwarding breaks, on \fIrserv\fR, reconnect with
Olivier Fourdan 0877ab
.P
Olivier Fourdan 0877ab
.nf
Olivier Fourdan 0877ab
.RS 4
Olivier Fourdan 0877ab
	ssh -fN -L /tmp/waypipe-lserv-2\&.sock:/tmp/waypipe\&.sock user@lserv
Olivier Fourdan 0877ab
	waypipe recon /tmp/ctrl-lserv\&.pipe /tmp/waypipe-lserv-2\&.sock
Olivier Fourdan 0877ab
.fi
Olivier Fourdan 0877ab
.RE
Olivier Fourdan 0877ab
.P
Olivier Fourdan 0877ab
.SH ENVIRONMENT
Olivier Fourdan 0877ab
.P
Olivier Fourdan 0877ab
When running as a server, by default \fIWAYLAND_DISPLAY\fR will be set for the
Olivier Fourdan 0877ab
invoked process.\&
Olivier Fourdan 0877ab
.P
Olivier Fourdan 0877ab
If the \fB--oneshot\fR flag is set, waypipe will instead set \fIWAYLAND_SOCKET\fR and
Olivier Fourdan 0877ab
inherit an already connected socketpair file descriptor to the invoked (child)
Olivier Fourdan 0877ab
process.\& Some programs open and close a Wayland connection repeatedly as part
Olivier Fourdan 0877ab
of their initialization, and will not work correctly with this flag.\&
Olivier Fourdan 0877ab
.P
Olivier Fourdan 0877ab
.SH EXIT STATUS
Olivier Fourdan 0877ab
.P
Olivier Fourdan 0877ab
\fBwaypipe ssh\fR will exit with the exit status code from the remote command, or
Olivier Fourdan 0877ab
with return code 1 if there has been an error.\&
Olivier Fourdan 0877ab
.P
Olivier Fourdan 0877ab
.SH SEE ALSO
Olivier Fourdan 0877ab
.P
Olivier Fourdan 0877ab
\fBweston\fR(1), \fBssh\fR(1)