Using an Android tablet as a second Hyprland monitor
I have a 13-inch Android tablet that I mostly use for PDFs, and a laptop running Hyprland where I often run out of screen space. I wanted to use the tablet as an extended display. With Wayland capture protocols and hardware encoders available, I expected the streaming part to be fairly straightforward.
I eventually got a responsive setup with Sunshine and Moonlight, after struggling with a tool made specifically for this job.
Trying a dedicated second-monitor tool
The first project I tried creates a virtual compositor output, captures it, encodes it with VA-API or NVENC, and streams it to a native Android client. It supports touch and stylus input back to the host. The project is written in Rust under GPL-3, with prebuilt APKs and signed packages for several distributions. Its Hyprland integration creates a headless output over IPC and removes it on shutdown, without root access, a kernel module, or a screen-share dialog.
Setup worked almost immediately. The virtual monitor appeared, the logs
confirmed hardware H.264 encoding on the iGPU, and ffprobe could read the
stream. I then connected the tablet.
The delay was large enough to make typing and moving windows uncomfortable.
Measuring instead of guessing
I wanted to separate two possible problems before changing settings: a low frame rate and a long delay between an action and its appearance on the tablet. Both can make a display feel slow, but they need different measurements.
For frame rate, I pulled the daemon's HTTP stream and read frame presentation timestamps:
ffprobe -v error -select_streams v:0 -show_entries frame=pts_time \
-of csv=p=0 sample.ts
The first test showed ten frames per second, with gaps of almost exactly 103 ms. But the virtual monitor had no windows on it. With no damage to repaint, the compositor was mostly idle; the test was picking up a keepalive timer.
With the laptop panel mirrored onto the virtual output and an animation running to keep it repainting, I measured 12.9 fps at 2544x1800.
I repeated the test at three resolutions:
| Resolution | MB per frame | Delivered |
|---|---|---|
| 2544x1800 | 17.5 | 10.6 fps |
| 1696x1200 | 7.8 | 12.9 fps |
| 1280x904 | 4.4 | 12.9 fps |
Reducing the data per frame by a factor of four barely changed the frame rate. That suggested a fixed delay per frame.
I had initially suspected the copying in the capture path. The code uses
wl_shm rather than dmabuf, and the encoder accepts push_frame(frame: &[u8]),
followed by copy_from_slice. Each frame passes through CPU memory and gets
copied three or four times before returning to the GPU. At 2544x1800, that is
17.5 MB per frame; at 60 fps, it would mean gigabytes per second of memory
traffic on an integrated GPU sharing bandwidth with the CPU. It looked
expensive, but did not explain the nearly constant frame rate across
resolutions.
Looking for a fixed delay led me to this timeout:
const EVENT_POLL_TIMEOUT_MS: i32 = 100;
That is the timeout on the poll() waiting for the screencopy frame-ready
event. Any frame not already pending when the poll is entered stalls up to
100 ms. Changing it to 4 and rebuilding took the stream from ~11 fps to ~30.
That was worth reporting upstream, but the display still felt slow.
Measuring latency
To measure latency, I needed to change something on screen at a known time and detect when it appeared in the stream.
I played a fullscreen black video, flipped it to white through the player's IPC
socket at a recorded timestamp, and had ffmpeg watch the stream for the
brightness jump. Six trials.
235 ms, and that is host-side only — capture, encode, mux, HTTP. It excludes the client's own buffering, which the documentation advertises at 40–120 ms.
I reduced the queues in the encoder and transport. appsrc held four frames and
appsink held sixteen; cutting both reduced measured latency by only 6%, too
little to draw a firm conclusion from those trials. The capture, CPU colour
conversion, MPEG-TS muxing, and HTTP transport still appeared to account for
most of the delay.
The project's README advertises 25–40 ms. Measured host-side alone, on hardware it explicitly supports, it was 235.
The compositor integration worked well: rootless virtual outputs over IPC, no portal dialog, and straightforward packaging. The delay might be tolerable for a reference window that rarely changes. For typing and moving windows, it was too much for me.
Trying Sunshine and Moonlight
I tried Sunshine on the host and Moonlight on the tablet next. They are designed for low-latency game streaming, but can also stream a virtual display. That gave me a way to use them as an extended desktop.
I had to resolve three problems before I could compare the results.
The AppImage fell back to software encoding. It bundles libva 1.23, while the system's radeonsi driver is built against VA-API 1.24. libva rejects the mismatch, VA-API initialization fails with "unknown libva error", and the log continues:
Found H.264 encoder: libx264 [software]
The fallback was easy to miss in the log. Removing the bundled libva so the
AppImage would use the system copy made it hang during the encoder probe. The
distribution package, which links against system libva, worked. I checked for
h264_vaapi in the log to confirm that it was using hardware encoding.
I needed an older release. The stable release I first tried had a reported
wlr-screencopy dmabuf regression on AMD with this compositor version, producing
EGL_NOT_INITIALIZED. The previous release had been confirmed to work on the
same hardware, so I installed that one.
Selecting the output by index streamed the wrong screen. The setting
output_name = 1 resolved correctly during the startup probe, but fell back to
monitor 0 when a session started. I got a mirror of the laptop panel instead of
the virtual display. Matching by name fixed it. The session log identifies the
monitor Sunshine actually selected.
With those issues resolved, Sunshine used hardware HEVC on the iGPU and dmabuf capture without a CPU roundtrip. Moonlight provides a latency overlay, so I used its reported host processing time for the comparison.
Host processing latency was 4.9 ms. That was a substantial improvement over the earlier 235 ms host-side measurement, on the same laptop, GPU, compositor, and virtual output. The measurements came from different tools, but the improvement was also immediately noticeable in use.
Finding the inbound firewall rule
Before any of that worked, the tablet could not reach the host at all. Moonlight said "connection error". Ping worked fine.
To check whether the problem was specific to Moonlight, I started python3 -m http.server on another port and tried to reach it from the tablet. That was
blocked too.
The laptop could also open a TCP connection to the tablet, while the reverse failed and ping worked both ways. That made inbound filtering on the laptop a better suspect than access-point isolation.
iptables -L showed an INPUT chain with ACCEPT policy and a single jump into a
VPN-managed chain, which was innocent. The rules were somewhere else — native
nftables, which the iptables view does not show:
chain input {
type filter hook input priority filter
policy drop
ct state {established, related} accept
ip protocol icmp accept
tcp dport ssh accept
}
Those rules matched the symptoms. ICMP was accepted, so ping worked. Established connections were accepted, so connections initiated by the laptop worked. New inbound connections were dropped, and the drop counter had climbed into the thousands.
Two rules fixed it, scoped to private address ranges so they travel to other networks without exposing anything publicly:
ip saddr { 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16 } \
tcp dport { 47984, 47989, 48010 } accept
ip saddr { 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16 } \
udp dport { 47998, 47999, 48000 } accept
I left the web configuration interface accessible only from localhost.
Wired, and why
At 1080p over Wi-Fi, the stream worked well: 6 ms network latency and no dropped frames. At the tablet’s native resolution it began to stutter and showed a “slow connection” warning. I checked the bitrate before lowering the resolution.
The client picks its bitrate automatically from resolution and frame rate. At native resolution and 120 fps it had chosen 88 Mbit/s. The radio was delivering 55. That gap is the warning.
I first reduced the frame rate from 120 fps, which was more than I needed for a desktop. I also set a bitrate cap. At a fixed cap, lowering the resolution changes how the encoder distributes the available bits, rather than directly reducing peak bandwidth. An idle desktop used about 1 Mbit/s because HEVC could encode static content well below the target; the cap mattered during motion.
The client offered fixed resolution presets, with only one matching the tablet’s 7:5 aspect ratio. The others were 16:9 and letterboxed. I matched the virtual display to the panel, then adjusted bitrate to fit the connection.
For a wired connection, I first considered adb reverse, but adb forwards TCP
while the streaming video, audio, and control channels use UDP. USB tethering
worked instead. It creates an IP link over the cable: the tablet acts as a
gateway, the laptop gets an address on that subnet, and Moonlight connects to
that address.
It has to be enabled from the tablet's settings. Setting the USB function from the host reports success and changes nothing.
The improvement was not the one I expected:
USB rtt min/avg/max/mdev = 2.078/2.366/2.829/0.266 ms
WiFi rtt min/avg/max/mdev = 6.170/67.571/115.388/50.244 ms
The main improvement was consistency. Wi-Fi latency varied from 6 to 115 ms, while USB varied within about 0.75 ms. That reduced the jitter the client needed to accommodate and made interaction feel steadier.
The cable negotiated USB 2.0. Practical throughput on the tethered interface was roughly 150–300 Mbit/s, comfortably above what the stream needed.
Final measurements
Video stream: 3392x2400 60.02 FPS
Decoder: hevc, low latency
Frames dropped by your network connection: 0.00%
Average network latency: 4 ms (variance: 1 ms)
Host processing latency min/max/average: 10.0/14.5/10.4 ms
Average decoding time: 5.55 ms
The measured pipeline total was about 20 ms. Including frame pacing, I estimated roughly 27–37 ms from the host display change to its appearance on the tablet. The stream ran at 60 fps with no reported drops. Host processing rose from 4.9 ms at 1080p to 10.4 ms at native resolution.
| Purpose-built | Game-streaming stack | |
|---|---|---|
| Resolution | 2544x1800 | 3392x2400 |
| Frame rate | 30 fps ceiling | 60.02 fps |
| Host latency | 235 ms | 10.4 ms |
| Dropped frames | — | 0.00% |
At native resolution, the reported host processing time was about 23 times lower than the first setup, while delivering a higher resolution and twice the frame rate.
What I would do differently
I chose the first tool because its design and packaging looked promising. Those things made it easy to install, but did not tell me whether it would feel responsive. Its advertised latency was 25–40 ms; I measured 235 ms on the host alone. Testing that earlier would have saved me an afternoon of configuration.
Most of the useful checks were quick. Testing three resolutions helped rule out memory copying as the main frame-rate limit. An unrelated HTTP server showed that the connection problem was outside Moonlight. The flash-timing test took more work, but gave me a latency measurement where the original tool offered none.
I now use Sunshine and Moonlight to stream a headless Hyprland output over USB tethering. It is responsive enough for the extra desktop space I wanted.