From d807a365ffa275abc42b4708c66956b32fbc048b Mon Sep 17 00:00:00 2001 From: Kroese Date: Sun, 19 Jul 2026 03:09:35 +0200 Subject: [PATCH] feat: Added optional lossy VNC compression (#1305) --- docs/environment.md | 1 + src/display.sh | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/docs/environment.md b/docs/environment.md index 743fb7f..30019c2 100644 --- a/docs/environment.md +++ b/docs/environment.md @@ -70,6 +70,7 @@ An empty default means the variable is unset and its value is determined automat | Variable | Default | Description | |---|---|---| | `DISPLAY` | `none` | Display backend, such as `vnc`, `disabled`, or `none`. | +| `LOSSY` | `N` | Enables lossy VNC compression to reduce bandwidth usage. | | `VGA` | `none` | QEMU video adapter model. | | `GPU` | `N` | Enables Intel iGPU acceleration. | | `RENDERNODE` | `/dev/dri/renderD128` | Render node used for GPU acceleration. | diff --git a/src/display.sh b/src/display.sh index 8945a29..49e6de1 100644 --- a/src/display.sh +++ b/src/display.sh @@ -6,10 +6,12 @@ set -Eeuo pipefail : "${GPU:="N"}" # GPU passthrough : "${VGA:="virtio"}" # VGA adaptor : "${DISPLAY:="none"}" # Display type +: "${LOSSY:="N"}" # Lossy VNC compression : "${RENDERNODE:="/dev/dri/renderD128"}" # Render node # Sanitize variables VGA=$(strip "$VGA") +LOSSY=$(strip "$LOSSY") DISPLAY=$(strip "$DISPLAY") RENDERNODE=$(strip "$RENDERNODE") @@ -18,7 +20,12 @@ CPU_VENDOR=$(lscpu | awk '/Vendor ID/{print $3}') if ! enabled "$GPU" || isAmdCpu || [[ "$ARCH" != "amd64" ]]; then [[ "${DISPLAY,,}" == "none" ]] && VGA="none" - DISPLAY_OPTS="-display $DISPLAY -vga $VGA" + + if enabled "$LOSSY" && [[ "${DISPLAY,,}" == vnc=* ]]; then + DISPLAY+=",lossy=on" + fi + + DISPLAY_OPTS="-display ${DISPLAY} -vga ${VGA}" return 0 fi @@ -27,7 +34,7 @@ msg="Configuring display drivers..." html "$msg" enabled "$DEBUG" && echo "$msg" -DISPLAY_OPTS="-display egl-headless,rendernode=$RENDERNODE" +DISPLAY_OPTS="-display egl-headless,rendernode=${RENDERNODE}" DISPLAY_OPTS+=" -vga $VGA" [ ! -d /dev/dri ] && mkdir -m 755 /dev/dri @@ -49,7 +56,7 @@ if [ ! -c "$RENDERNODE" ]; then fi if [ ! -c "$RENDERNODE" ] || [ ! -r "$RENDERNODE" ] || [ ! -w "$RENDERNODE" ]; then - warn "render device '$RENDERNODE' is unavailable or inaccessible." + warn "render device '${RENDERNODE}' is unavailable or inaccessible." fi addPackage "xserver-xorg-video-intel" "Intel GPU drivers"