From de608c6c6c3a3647cf76ccae4c2032bfe7b8edb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oscar=20S=C3=B6derlund?= Date: Fri, 23 Oct 2026 13:08:08 +0200 Subject: [PATCH] revert(kwin): drop RA24 workaround, LG now on iGPU The KWin environment workaround from 31671cdb did not stop the RA24 atomic commit failures, and a patched amdgpu.ko was too heavy to maintain. Moving the LG to the iGPU HDMI port avoids the amdgpu plane bug entirely. - Drop KWIN_USE_OVERLAYS and KWIN_DRM_NO_DIRECT_SCANOUT from env.sh. - Drop the plasma-login greeter drop-in and its setup task. - Drop kwin/verify-amdgpu-ra24.sh. --- env.sh | 14 --- kwin/plasma-login-kwin-amdgpu.conf | 13 --- kwin/setup-greeter-dropin.sh | 42 --------- kwin/verify-amdgpu-ra24.sh | 140 ----------------------------- mise/conf.d/kwin.toml | 6 +- 5 files changed, 1 insertion(+), 214 deletions(-) delete mode 100644 kwin/plasma-login-kwin-amdgpu.conf delete mode 100755 kwin/setup-greeter-dropin.sh delete mode 100755 kwin/verify-amdgpu-ra24.sh diff --git a/env.sh b/env.sh index 0a2fdf7e..936a0809 100644 --- a/env.sh +++ b/env.sh @@ -84,19 +84,5 @@ if command -v lspci >/dev/null 2>&1 && export ODSOD_HAS_RADEON_DGPU=1 fi -# kwin — amdgpu advertises DRM_FORMAT_RGBA8888 in rgb_formats[] and -# overlay_formats[], but fill_plane_buffer_attributes() has no case for it, so -# the atomic commit fails with "Unsupported screen format RA24" and KWin -# retries until the desktop wedges. Forcing overlays on keeps KWin on the -# primary plane. KWin parses these as "value == 1", so 0 is not false, it is -# unset; the greeter's own unit sets 0 for that reason. Direct scanout stays -# enabled on purpose: it is what lets fullscreen video and games bypass the -# compositor, and the overlay path above already covers this bug. -# Gated on the Radeon dGPU so laptops and Intel-only machines are untouched. -# Drop this when upstream adds the missing case. -if [ "$XDG_CURRENT_DESKTOP" = "KDE" ] && [ "${ODSOD_HAS_RADEON_DGPU:-0}" = "1" ]; then - export KWIN_USE_OVERLAYS=1 -fi - # machine export PATH="$HOME/.local/share/mise/shims:$HOME/.local/bin:$PATH" diff --git a/kwin/plasma-login-kwin-amdgpu.conf b/kwin/plasma-login-kwin-amdgpu.conf deleted file mode 100644 index c78e8c23..00000000 --- a/kwin/plasma-login-kwin-amdgpu.conf +++ /dev/null @@ -1,13 +0,0 @@ -[Service] -# amdgpu advertises DRM_FORMAT_RGBA8888 (RA24) in rgb_formats[] and -# overlay_formats[] but fill_plane_buffer_attributes() has no case for it, so -# the atomic commit fails and KWin retries until it wedges. The login greeter -# runs its own KWin as user plasmalogin, outside the session's env.sh, so it -# needs the same workaround here. Overlays on keeps KWin on the primary plane. -# -# Upstream ships Environment="KWIN_USE_OVERLAYS=0" in this unit, but KWin -# parses that variable as "value == 1", so 0 means unset, not off. A drop-in -# Environment= line replaces it. -# -# Drop this drop-in when upstream adds the missing case. -Environment="KWIN_USE_OVERLAYS=1" diff --git a/kwin/setup-greeter-dropin.sh b/kwin/setup-greeter-dropin.sh deleted file mode 100755 index fba45a63..00000000 --- a/kwin/setup-greeter-dropin.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -REPO_DIR="$(cd "$(dirname "$0")/.." && pwd)" -DROPIN_DIR=/etc/systemd/user/plasma-login-kwin_wayland.service.d -DROPIN="$DROPIN_DIR/50-amdgpu-ra24.conf" -SOURCE="$REPO_DIR/kwin/plasma-login-kwin-amdgpu.conf" - -# Detect the GPU here rather than sourcing env.sh. env.sh returns early when -# ODSOD_MACHINE is already exported, which would leave ODSOD_HAS_RADEON_DGPU -# stale or unset and silently defeat this gate. Override with -# ODSOD_HAS_RADEON_DGPU=0/1 to force either branch. -has_radeon_dgpu() { - if [ -n "${ODSOD_HAS_RADEON_DGPU:-}" ]; then - [ "$ODSOD_HAS_RADEON_DGPU" = "1" ] - return - fi - command -v lspci >/dev/null 2>&1 || return 1 - lspci -nn -d 1002: 2>/dev/null | - grep -Eqi '(VGA compatible controller|3D controller|Display controller).*(Radeon RX|Radeon PRO|Radeon VII|Radeon Instinct)' -} - -# Only machines whose Radeon dGPU advertises the broken RGBA8888 plane format -# need this. Laptops and Intel-only machines keep the vendor unit untouched. -if ! has_radeon_dgpu; then - echo "[kwin] Skipping greeter drop-in: no dedicated Radeon GPU detected" - if [ -e "$DROPIN" ]; then - echo "[kwin] Removing stale drop-in $DROPIN" - sudo rm -f "$DROPIN" - sudo rmdir --ignore-fail-on-non-empty "$DROPIN_DIR" 2>/dev/null || true - fi - exit 0 -fi - -if [ ! -r "$SOURCE" ]; then - echo "[kwin] Missing $SOURCE" >&2 - exit 1 -fi - -echo "[kwin] Installing greeter drop-in $DROPIN" -sudo install -d -o root -g root -m 0755 "$DROPIN_DIR" -sudo install -o root -g root -m 0644 "$SOURCE" "$DROPIN" diff --git a/kwin/verify-amdgpu-ra24.sh b/kwin/verify-amdgpu-ra24.sh deleted file mode 100755 index 00fbb42e..00000000 --- a/kwin/verify-amdgpu-ra24.sh +++ /dev/null @@ -1,140 +0,0 @@ -#!/bin/sh -# Verify the amdgpu RA24 / KWin atomic-commit fix. -# -# Root cause: amdgpu advertises DRM_FORMAT_RGBA8888 in rgb_formats[] and -# overlay_formats[] (amdgpu_dm_plane.c) but fill_plane_buffer_attributes() -# has no case for it (amdgpu_dm.c), so the atomic commit fails with -# "Unsupported screen format RA24" and KWin retries until the desktop wedges. -# -# Fix in place: -# session KWin - KWIN_USE_OVERLAYS=1 via ~/.config/plasma-workspace/env/ -# odsod-machine.sh (env.sh in the machine repo) -# login greeter - KWIN_USE_OVERLAYS=1 via the drop-in at -# /etc/systemd/user/plasma-login-kwin_wayland.service.d/ -# -# Run this after logging in with the LG HDMI monitor connected and ENABLED. -# A connected-but-disabled output proves nothing: nothing scans out to it. - -set -u - -pass=0 -fail=0 - -ok() { - printf ' ok %s\n' "$1" - pass=$((pass + 1)) -} - -bad() { - printf ' FAIL %s\n' "$1" - fail=$((fail + 1)) -} - -note() { - printf ' note %s\n' "$1" -} - -# Detect the GPU directly. Sourcing env.sh is unreliable here because it -# returns early when ODSOD_MACHINE is already exported, leaving -# ODSOD_HAS_RADEON_DGPU stale. Override with ODSOD_HAS_RADEON_DGPU=0/1. -if [ -z "${ODSOD_HAS_RADEON_DGPU:-}" ]; then - ODSOD_HAS_RADEON_DGPU=0 - if command -v lspci >/dev/null 2>&1 && - lspci -nn -d 1002: 2>/dev/null | - grep -Eqi '(VGA compatible controller|3D controller|Display controller).*(Radeon RX|Radeon PRO|Radeon VII|Radeon Instinct)'; then - ODSOD_HAS_RADEON_DGPU=1 - fi -fi -export ODSOD_HAS_RADEON_DGPU - -echo "== 1. Session KWin has overlays forced on (Radeon dGPU machines only) ==" -env_out=$(systemctl --user show-environment 2>/dev/null) -val=$(printf '%s\n' "$env_out" | sed -n 's/^KWIN_USE_OVERLAYS=//p' | head -1) -if [ "${ODSOD_HAS_RADEON_DGPU:-0}" = "1" ]; then - if [ "$val" = "1" ]; then - ok "KWIN_USE_OVERLAYS=1" - else - bad "KWIN_USE_OVERLAYS is '${val:-unset}', expected 1" - fi -else - if [ -n "$val" ]; then - bad "KWIN_USE_OVERLAYS=$val set on a machine without a Radeon dGPU" - else - ok "KWIN_USE_OVERLAYS unset, correct for this hardware" - fi -fi - -echo -echo "== 2. Greeter KWin drop-in installed (Radeon dGPU machines only) ==" -dropin=/etc/systemd/user/plasma-login-kwin_wayland.service.d/50-amdgpu-ra24.conf -if [ "${ODSOD_HAS_RADEON_DGPU:-0}" = "1" ]; then - if [ -r "$dropin" ] && grep -q 'KWIN_USE_OVERLAYS=1' "$dropin"; then - ok "drop-in present with KWIN_USE_OVERLAYS=1" - else - bad "drop-in missing or lacks KWIN_USE_OVERLAYS=1" - fi -else - if [ -e "$dropin" ]; then - bad "drop-in present on a machine without a Radeon dGPU - run kwin:greeter-dropin" - else - ok "no drop-in, correct for this hardware" - fi -fi - -echo -echo "== 3. HDMI output ENABLED, not merely connected ==" -enabled_out="" -connected_out="" -for c in /sys/class/drm/card*-HDMI-A-*; do - [ -e "$c" ] || continue - name=$(basename "$c") - if [ "$(cat "$c/status" 2>/dev/null)" = "connected" ]; then - connected_out=$name - if [ "$(cat "$c/enabled" 2>/dev/null)" = "enabled" ]; then - enabled_out=$name - fi - fi -done -if [ -n "$enabled_out" ]; then - ok "HDMI output enabled and scanning out: $enabled_out" -elif [ -n "$connected_out" ]; then - bad "$connected_out is connected but DISABLED - nothing scans out, test is void" -else - bad "no HDMI output connected - plug the LG in to test" -fi - -echo -echo "== 4. No RA24 errors this boot ==" -n=$(journalctl -k -b 0 --no-pager 2>/dev/null | grep -c 'Unsupported screen format RA24' || true) -if [ "${n:-0}" -eq 0 ]; then - ok "0 RA24 errors" -else - bad "$n RA24 errors" - journalctl -k -b 0 --no-pager 2>/dev/null | - grep 'Unsupported screen format RA24' | tail -3 | sed 's/^/ /' -fi - -echo -echo "== 5. No KWin atomic commit failures this boot ==" -n=$(journalctl -b 0 --no-pager 2>/dev/null | - grep -c 'Atomic modeset commit failed' || true) -if [ "${n:-0}" -eq 0 ]; then - ok "0 atomic commit failures" -else - bad "$n atomic commit failures" - journalctl -b 0 --no-pager 2>/dev/null | - grep 'Atomic modeset commit failed' | tail -3 | sed 's/^/ /' -fi - -echo -echo "== 6. EDID readable on HDMI ==" -n=$(journalctl -b 0 --no-pager 2>/dev/null | grep -c 'Could not find edid' || true) -if [ "${n:-0}" -eq 0 ]; then - ok "0 EDID read failures" -else - bad "$n EDID read failures - check the cable and Ultra HD Deep Colour" -fi - -echo -printf 'summary: %s passed, %s failed\n' "$pass" "$fail" -[ "$fail" -eq 0 ] diff --git a/mise/conf.d/kwin.toml b/mise/conf.d/kwin.toml index 92b8c85d..ec73927c 100644 --- a/mise/conf.d/kwin.toml +++ b/mise/conf.d/kwin.toml @@ -4,13 +4,9 @@ [tasks."kwin:install"] description = "Install KWin script package and configure" -depends = ["kwin:install-package", "kwin:enable-plugin", "kwin:configure", "kwin:greeter-dropin"] +depends = ["kwin:install-package", "kwin:enable-plugin", "kwin:configure"] run = "echo '[kwin] Done'" -[tasks."kwin:greeter-dropin"] -description = "Install greeter KWin RA24 workaround on Radeon dGPU machines only" -run = 'exec "$REPO_DIR/kwin/setup-greeter-dropin.sh"' - [tasks."kwin:install-package"] description = "Install Plasma KWin script package" run = """