Add support for spice-app (#510)

* Add spice-app as display option

* Rework how we set the default OUTPUT
variable display is never set and display_param_check is already checked when parsing options

* enable overriding the gl param

3d acceleration is not stable on some setups (looking at you, nvidia)

Co-authored-by: Matej <spindler.matej@gmail.com>
pull/517/head
infokiller 2 years ago committed by GitHub
parent f65b8e328b
commit e8b1b7cb3e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 46
      quickemu

@ -221,7 +221,6 @@ function vm_boot() {
local HOST_CPU_SMT="" local HOST_CPU_SMT=""
local HOST_CPU_SOCKETS="" local HOST_CPU_SOCKETS=""
local HOST_CPU_VENDOR="" local HOST_CPU_VENDOR=""
local GL="on"
local GUEST_TWEAKS="" local GUEST_TWEAKS=""
local KERNEL_NAME="Unknown" local KERNEL_NAME="Unknown"
local KERNEL_NODE="" local KERNEL_NODE=""
@ -734,24 +733,32 @@ function vm_boot() {
DISPLAY_RENDER="${OUTPUT},grab-on-hover=on,zoom-to-fit=off" DISPLAY_RENDER="${OUTPUT},grab-on-hover=on,zoom-to-fit=off"
# GL is not working with GTK and virtio-vga # GL is not working with GTK and virtio-vga
if [ "${DISPLAY_DEVICE}" == "virtio-vga" ]; then if [ "${DISPLAY_DEVICE}" == "virtio-vga" ]; then
GL="off" gl="off"
fi fi
;; ;;
none|spice) none|spice)
DISPLAY_RENDER="none";; DISPLAY_RENDER="none";;
# spice-app has a bug where using spice-app,gl=off seems to enable gl, but
# if the gl param is omitted it works fine.
spice-app)
DISPLAY_RENDER="${OUTPUT}"
if [[ "${gl}" == "on" ]]; then
DISPLAY_RENDER+=",gl=on"
fi
;;
*) *)
DISPLAY_RENDER="${OUTPUT},gl=${GL}";; DISPLAY_RENDER="${OUTPUT},gl=${gl}";;
esac esac
if [ "${GL}" == "on" ] && [[ "${DISPLAY_DEVICE}" == *"virtio"* ]]; then if [ "${gl}" == "on" ] && [[ "${DISPLAY_DEVICE}" == *"virtio"* ]]; then
if [ "${QEMU_VER_SHORT}" -ge 61 ]; then if [ "${QEMU_VER_SHORT}" -ge 61 ]; then
DISPLAY_DEVICE="${DISPLAY_DEVICE}-gl" DISPLAY_DEVICE="${DISPLAY_DEVICE}-gl"
else else
DISPLAY_DEVICE="${DISPLAY_DEVICE},virgl=on" DISPLAY_DEVICE="${DISPLAY_DEVICE},virgl=on"
fi fi
echo ", GL (${GL}), VirGL (on)" echo ", GL (${gl}), VirGL (on)"
else else
echo ", GL (${GL}), VirGL (off)" echo ", GL (${gl}), VirGL (off)"
fi fi
# Build the video configuration # Build the video configuration
@ -1243,7 +1250,7 @@ function usage() {
echo " --braille : Enable braille support. Requires SDL." echo " --braille : Enable braille support. Requires SDL."
echo " --delete-disk : Delete the disk image and EFI variables" echo " --delete-disk : Delete the disk image and EFI variables"
echo " --delete-vm : Delete the entire VM and it's configuration" echo " --delete-vm : Delete the entire VM and it's configuration"
echo " --display : Select display backend. 'sdl' (default), 'gtk', 'none', or 'spice'" echo " --display : Select display backend. 'sdl' (default), 'gtk', 'none', 'spice' or 'spice-app'"
echo " --fullscreen : Starts VM in full screen mode (Ctl+Alt+f to exit)" echo " --fullscreen : Starts VM in full screen mode (Ctl+Alt+f to exit)"
echo " --ignore-msrs-always : Configure KVM to always ignore unhandled machine-specific registers" echo " --ignore-msrs-always : Configure KVM to always ignore unhandled machine-specific registers"
echo " --screen <screen> : Use specified screen to determine the window size." echo " --screen <screen> : Use specified screen to determine the window size."
@ -1274,8 +1281,7 @@ function usage() {
} }
function display_param_check() { function display_param_check() {
# @ASK: accept "spice-app" as output ? if [ "${OUTPUT}" != "gtk" ] && [ "${OUTPUT}" != "none" ] && [ "${OUTPUT}" != "sdl" ] && [ "${OUTPUT}" != "spice" ] && [ "${OUTPUT}" != "spice-app" ]; then
if [ "${OUTPUT}" != "gtk" ] && [ "${OUTPUT}" != "none" ] && [ "${OUTPUT}" != "sdl" ] && [ "${OUTPUT}" != "spice" ]; then
echo "ERROR! Requested output '${OUTPUT}' is not recognised." echo "ERROR! Requested output '${OUTPUT}' is not recognised."
exit 1 exit 1
fi fi
@ -1612,16 +1618,14 @@ if [ -n "${VM}" ] && [ -e "${VM}" ]; then
disk_size="${disk}" disk_size="${disk}"
fi fi
# Set the default OUTPUT if not provided by user
if [ -z "${OUTPUT}" ]; then if [ -z "${OUTPUT}" ]; then
# Braille support requires SDL. Override OUTPUT if braille was requested. OUTPUT="sdl"
if [ -n "${BRAILLE}" ]; then fi
OUTPUT="sdl"
elif [ -z "${display}" ]; then # Braille support requires SDL. Override OUTPUT if braille was requested.
OUTPUT="sdl" if [ -n "${BRAILLE}" ]; then
else OUTPUT="sdl"
OUTPUT="${display}"
display_param_check
fi
fi fi
if [ -z "${VIEWER}" ]; then if [ -z "${VIEWER}" ]; then
@ -1629,6 +1633,12 @@ if [ -n "${VM}" ] && [ -e "${VM}" ]; then
fi fi
viewer_param_check viewer_param_check
# Set the default 3d acceleration. Will be overridden to "off" if
# DISPLAY_DEVICE is determined to be virtio-vga since it doesn't work there.
if [ -z "${gl}" ]; then
gl="on"
fi
if [ -z "${PUBLIC}" ]; then if [ -z "${PUBLIC}" ]; then
PUBLIC="${public_dir}" PUBLIC="${public_dir}"
fi fi

Loading…
Cancel
Save