Skip to content

Nert next/wayvnc#2488

Closed
aenertia wants to merge 3 commits intoROCKNIX:nextfrom
aenertia:nert-next/wayvnc
Closed

Nert next/wayvnc#2488
aenertia wants to merge 3 commits intoROCKNIX:nextfrom
aenertia:nert-next/wayvnc

Conversation

@aenertia
Copy link
Copy Markdown
Contributor

Summary

  • What is the goal of this PR? Add wayvnc as a VNC remote desktop server for all ROCKNIX devices. Provides remote screen access on port 5900 — any VNC client connects without authentication. Includes H.264 hardware-accelerated encoding via V4L2 M2M on supported SoCs. Have been using a variant of this for several years. Very useful for debug and development. Somewhat useful for 'some' gaming. It's a tiny and low dep addition to base image that provides quite a lot of functionality. Now that all targets use sway this seems like a good addition.

New Packages

Package Version Size Description
jansson 2.15.0 ~30KB JSON C library (wayvnc dependency for IPC/config)
wayvnc 0.10-dev (477ef59) ~200KB VNC server for wlroots-based compositors
neatvnc 0.10-dev (28d902a) ~120KB VNC protocol library (built as meson subproject)
aml 1.0.0 (ce4b82d) ~15KB Async main loop library (built as meson subproject)

Total image size impact: ~365KB

Compiled Features (verified on RK3566 build)

Feature Status Backend
H.264 encoding Enabled V4L2 M2M hardware encoder (rkvenc/venus) + FFmpeg libavcodec fallback
JPEG compression Enabled libjpeg-turbo (Tight encoding)
TLS Compiled in gnutls (available but not active by default — no cert required)
WebSocket Enabled nettle (enables browser-based VNC clients like noVNC)
Screencopy DMA-BUF Enabled Zero-copy frame capture from sway compositor
Cursor rendering Enabled --render-cursor (renders cursor into VNC stream for gamepad UI)

Service Integration

Follows the existing SSH/Samba daemon pattern:

  • systemd unit: wayvnc.service with ConditionPathExists sentinel file
  • Daemon script: 003-wayvnc (setting key: vnc.enabled)
  • Network virtual package: added to PKG_DEPENDS_TARGET for all devices

How to Enable

Via SSH:

mkdir -p /storage/.cache/services
touch /storage/.cache/services/wayvnc.conf
systemctl enable wayvnc
systemctl start wayvnc

Or via user autostart script (/storage/.config/autostart/wayvnc.sh):

#!/bin/bash
mkdir -p /storage/.cache/services
touch /storage/.cache/services/wayvnc.conf
systemctl start wayvnc

To disable:

systemctl stop wayvnc && systemctl disable wayvnc
rm /storage/.cache/services/wayvnc.conf

VNC client connects to <device-ip>:5900 — no authentication, no configuration needed on the client side.

Note: An EmulationStation UI toggle (Network Settings > Enable VNC) will follow in a separate PR.

Testing

  • How was this tested? Built for RK3566 (aarch64). Full make image completed successfully. Verified compiled feature flags in neatvnc config.h confirm H.264 (V4L2 M2M + FFmpeg), JPEG, TLS, DMA-BUF screencopy all enabled. Verified installed binaries: wayvnc, wayvncctl, libneatvnc.so, libaml.so.
  • Test results: RK3566 image builds cleanly at target/ROCKNIX-RK3566.aarch64-20260329-Generic.img.gz (1.5GB). wayvnc binary links correctly against all sway/wlroots/wayland dependencies. systemd service file and daemon script follow established patterns (identical structure to openssh 001-ssh and samba 002-samba).

Additional Context

  • wayvnc attaches to the running sway session via wlroots screencopy — since all ROCKNIX devices use sway, this works universally
  • H.264 hardware encoding uses V4L2 M2M directly (not through ffmpeg's encoder infrastructure) — zero-copy on SoCs with VPU: RK3566 (rkvenc), RK3588 (rkvenc), SM8250/SM8550/SM8650 (venus). Falls back gracefully to ZRLE/Tight/JPEG encoding on SoCs without hardware encoders or when VNC clients don't negotiate H.264
  • H.265/HEVC is not available — the VNC protocol (RFB) has no widely-adopted H.265 pseudo-encoding, and neatvnc only implements H.264. H.264 at handheld resolutions (640x480 to 1920x1080) is more than adequate. h265 is a job for Sunshine server another day.
  • neatvnc and aml are built as meson subprojects of wayvnc (not separate packages) because they are tightly version-coupled — wayvnc 0.10-dev requires neatvnc >=0.10 and aml >=1.0.0
  • No firewall rules added — matches SSH and Samba which also listen without restrictions on trusted local networks

AI Usage

Did you use AI tools to help write this code? PARTIALLY

Required dependency for wayvnc VNC server (IPC/config parsing).
Lightweight (~30KB .so), zero external dependencies.

Build: cmake with shared library, docs/tests disabled.
VNC server for wlroots-based Wayland compositors. Attaches to the
running sway session via screencopy and provides remote desktop access
on port 5900 — any VNC client connects without authentication.

Build architecture:
- wayvnc (master/0.10-dev) as main package
- neatvnc + aml built as meson subprojects (tightly version-coupled)
- All dependencies already available in ROCKNIX except jansson (added)

Compiled features:
- H.264 encoding via V4L2 M2M (hardware encoder on ARM SoCs: rkvenc,
  venus) and FFmpeg libavcodec fallback
- JPEG compression via libjpeg-turbo (Tight encoding)
- TLS support via gnutls (compiled in, not active by default)
- WebSocket support via nettle (for browser-based VNC clients)
- Screencopy DMA-BUF (zero-copy frame capture)
- Cursor rendering into VNC stream (--render-cursor)

Service integration:
- systemd unit: wayvnc.service with ConditionPathExists sentinel
- Daemon script: 003-wayvnc (setting key: vnc.enabled)
- Follows exact SSH/Samba pattern for ES toggle integration
- Listens on 0.0.0.0:5900, no auth, no config file needed

Added to network virtual package for all devices (~310KB total).
Binary size: wayvnc ~200KB, wayvncctl ~80KB, libneatvnc ~120KB,
libaml ~15KB.
@github-actions github-actions bot added the ai-generated This PR was generated or assisted by AI tools label Mar 29, 2026
@aenertia
Copy link
Copy Markdown
Contributor Author

@aenertia aenertia marked this pull request as ready for review March 29, 2026 01:10
The upstream packages/ folder is protected by CI and must not be modified
in PRs. Move jansson to the ROCKNIX project packages directory where all
distribution-specific packages belong.
@loki666
Copy link
Copy Markdown
Contributor

loki666 commented Mar 29, 2026

not happening

@loki666 loki666 closed this Mar 29, 2026
@porschemad911
Copy link
Copy Markdown
Contributor

not happening

100% agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-generated This PR was generated or assisted by AI tools

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants