Files
ultix/12-fix-rdp-bigres.sh
T
mrcharles 30e4d502a6 max_bpp=24: the real color-bars fix at 5160 wide (#611)
5160px x 4Bpp = 20640 bytes overflows xrdp's 16K bitmap-row buffer ->
"decompressed size too big" -> dropped tiles -> Jump paints bars. 24bpp
rows (15480) fit. Script part 4; live config already applied.

Details: https://projects.knownelement.com/issues/611
2026-09-01 17:05:48 -05:00

112 lines
5.0 KiB
Bash
Executable File

#!/bin/bash
# 12-fix-rdp-bigres.sh — xrdp EGFX big-resolution fix (Redmine #611)
#
# Symptom: Jump Desktop from iPad -> big external monitor (5160x2160)
# showed color bars / cut sides. Root cause candidate: default EGFX
# compressed-frame budget truncates large frames at this width.
# freerdp UAT at 5160x2160 (all codecs + mid-session resize) is clean;
# this mitigation raises the budget for the Jump client path.
#
# Idempotent: run as root on ultix-streaming.
set -euo pipefail
DROPIN=/etc/systemd/system/xrdp.service.d/bigres.conf
mkdir -p "$(dirname "$DROPIN")"
cat > "$DROPIN" <<'EOF'
[Service]
Environment=XRDP_GFX_MAX_COMPRESSED_BYTES=33554432
Environment=XRDP_GFX_FRAMES_IN_FLIGHT=2
EOF
systemctl daemon-reload
# bounce only when nobody is connected: check for active RDP sessions first
ACTIVE=$(pgrep -c -f 'Xorg.*xrdp/xorg.conf' || true)
if [ "${ACTIVE:-0}" -gt 0 ]; then
echo "Active RDP X sessions: $ACTIVE — NOT restarting; apply at next bounce with:"
echo " systemctl restart xrdp-sesman xrdp"
else
systemctl restart xrdp-sesman xrdp
sleep 2
systemctl is-active xrdp xrdp-sesman
fi
grep -q XRDP_GFX_MAX_COMPRESSED_BYTES "$DROPIN" && echo "drop-in present: $DROPIN"
###############################################################################
# Part 2 — kwin_x11 black-screen fix (root-caused 2026-09-01, #611)
#
# Symptom: RDP login -> KDE spinner -> BLACK screen. Server-side bisect
# showed display :10 rendering pure black (colors=1): kwin_x11 was
# crash-looping (plasma-kwin_x11.service "start operation timed out",
# restart counter 12+). Cause: software-GL compositing init under
# xorgxrdp (no DRI) at 5160x2160 never finishes inside the unit's
# start timeout; systemd kills kwin -> no desktop. The "spinner" the
# user sees is KSplash firing on every kwin restart.
#
# Fix: disable X11 compositing for the RDP accounts (kwin runs
# uncomposited = instant, no GL) and give the kwin unit start-time
# headroom. Wayland console session unaffected (Compositing/Enabled is
# an X11-only key). Verified with the freerdp harness on rdptest:
# fresh 1408x945 / fresh 5160x2160 / resize up mid-session / resize
# down on reconnect — all render real desktops.
###############################################################################
for ACCOUNT in reachableceo reachableceo-offstage; do
runuser -u "$ACCOUNT" -- kwriteconfig6 --file kwinrc \
--group Compositing --key Enabled false
echo "kwinrc Compositing=false: $ACCOUNT"
done
mkdir -p /etc/systemd/user/plasma-kwin_x11.service.d
cat > /etc/systemd/user/plasma-kwin_x11.service.d/bigres-timeout.conf <<'EOF'
[Service]
# big-res xorgxrdp sessions: software-GL init is slow; give kwin room
# instead of kill+crashloop (#611)
TimeoutStartSec=300
EOF
systemctl daemon-reload
###############################################################################
# Part 3 — EGFX off for all clients (drdynvc=false), 2026-09-01 evening
#
# Final piece of #611: with the server rendering CLEAN at 5160x2160
# (verified by band-analysis of live captures + freerdp harness on every
# codec), Jump Desktop still painted color bars down the side — its
# decode of xrdp's EGFX large frames is broken regardless of the
# compressed-frame budget. EGFX rides the drdynvc channel; blocking it
# server-side makes every client (Jump included) fall back to the
# classic codecs, which render this monitor fine. Clipboard (cliprdr)
# and audio (rdpsnd) are separate channels and survive.
###############################################################################
sed -i 's/^drdynvc=true/drdynvc=false/' /etc/xrdp/xrdp.ini
grep -q '^drdynvc=false' /etc/xrdp/xrdp.ini || { echo "drdynvc line missing; check /etc/xrdp/xrdp.ini" >&2; exit 1; }
###############################################################################
# Part 4 — max_bpp=24: the actual color-bars root cause (2026-09-01 night)
#
# With EGFX off, Jump's fallback is classic bitmap tiles — and xrdp's
# bitmap path DROPS tiles with "libxrdp_send_bitmap: error, decompressed
# size too big: 20640 bytes" because 5160 px * 4 Bpp overflows the 16K
# row buffer. Jump paints the dropped tiles as bars. At 24bpp the row
# is 15480 bytes and fits. (freerdp never hit this: it negotiates
# NSCodec/planar after EGFX goes away.)
###############################################################################
sed -i 's/^max_bpp=.*/max_bpp=24/' /etc/xrdp/xrdp.ini
grep -q '^max_bpp=24' /etc/xrdp/xrdp.ini || { echo "max_bpp line missing; check /etc/xrdp/xrdp.ini" >&2; exit 1; }
ACTIVE=$(pgrep -c -f 'Xorg.*xrdp/xorg.conf' || true)
if [ "${ACTIVE:-0}" -gt 0 ]; then
echo "Active RDP X sessions: $ACTIVE — xrdp listener restart will blip clients;"
echo "sessions survive (sesman untouched). Apply with: systemctl restart xrdp"
else
systemctl restart xrdp
fi
echo "EGFX disabled (drdynvc=false) — clients now negotiate classic codecs."
echo "kwin unit override: /etc/systemd/user/plasma-kwin_x11.service.d/bigres-timeout.conf"
echo
echo "If a session is currently black: loginctl terminate-session <id> (or"
echo "loginctl terminate-user <user> for their RDP sessions) and reconnect."