sway: fallback to legacy DRM interface on virtio

Some time ago, 'WLR_RENDERER=pixman' stopped working properly on virtio.
Appears that it only affects the atomic KMS and falling back to the
legacy DRM interface was enough to work around.

While legacy is a less tested codepath, I don't see any other ways to
address that :'(
This commit is contained in:
Aleksei Bavshin 2024-01-15 21:40:22 -08:00 committed by Aleksei Bavshin
commit ddf31e44d7
3 changed files with 30 additions and 10 deletions

View file

@ -41,10 +41,19 @@ chmod +x ${RUN_SCRIPT}
# Set some compatibility variables if we're in a VM
if systemd-detect-virt --quiet --vm; then
export WLR_NO_HARDWARE_CURSORS=1
case $(systemd-detect-virt --vm) in
"none"|"")
;;
"kvm")
# WLR_NO_HARDWARE_CURSORS=1 is not needed with legacy DRM interface
export WLR_RENDERER=pixman
fi
export WLR_DRM_NO_ATOMIC=1
;;
*)
# https://github.com/swaywm/sway/issues/6581
export WLR_NO_HARDWARE_CURSORS=1
;;
esac
sway --config=${CONFIG_FILE}
exit_code=$(< ${EXIT_CODE_SAVE})

View file

@ -12,9 +12,18 @@ if [ -x /usr/bin/start-sway ]; then
fi
# Set some compatibility variables in case if sway-config-fedora is not present
if systemd-detect-virt --quiet --vm; then
export WLR_NO_HARDWARE_CURSORS=1
case $(systemd-detect-virt --vm) in
"none"|"")
;;
"kvm")
# WLR_NO_HARDWARE_CURSORS=1 is not needed with legacy DRM interface
export WLR_RENDERER=pixman
fi
export WLR_DRM_NO_ATOMIC=1
;;
*)
# https://github.com/swaywm/sway/issues/6581
export WLR_NO_HARDWARE_CURSORS=1
;;
esac
exec /usr/bin/sway "$@"

View file

@ -16,8 +16,6 @@ case $(systemd-detect-virt --vm) in
"none"|"")
;;
"kvm")
# https://github.com/swaywm/sway/issues/6581
export WLR_NO_HARDWARE_CURSORS=1
# There's two drivers we can get here, depending on the 3D acceleration
# flag state: either virtio_gpu/virgl or kms_swrast/llvmpipe.
#
@ -30,6 +28,10 @@ case $(systemd-detect-virt --vm) in
#
# See also: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/2871
export WLR_RENDERER=pixman
# 'pixman' on virtio_gpu with recent kernels is glitchy. Appears that
# it only affects atomic KMS, and legacy interface works.
export WLR_DRM_NO_ATOMIC=1
# WLR_NO_HARDWARE_CURSORS=1 is not needed with legacy DRM interface
;;
*)
# https://github.com/swaywm/sway/issues/6581