From 0ee102dc4badeb02046495cdd44a6b6f298cd4a5 Mon Sep 17 00:00:00 2001 From: Martin Wimpress Date: Fri, 19 Aug 2022 17:56:39 +0100 Subject: [PATCH] Do not enable SPICE when GTK or SDL are the selected display. Fixes #466 QEMU 7.0 introduces a change/regression where it is not possible to use GL accerlation via GTK/SDL displays and also bring up SPICE: https://gitlab.com/qemu-project/qemu/-/issues/1036 This patch prevents Quickemu from bringing up SPICE when GTK or SDK are selected as the display. --- quickemu | 89 +++++++++++++++++++++++++++++++++----------------------- 1 file changed, 52 insertions(+), 37 deletions(-) diff --git a/quickemu b/quickemu index 4a4a9bd..cc2ab7e 100755 --- a/quickemu +++ b/quickemu @@ -806,42 +806,52 @@ function vm_boot() { done fi - local SPICE="disable-ticketing=on" - if [ -z "${SPICE_PORT}" ]; then - # Find a free port for spice - SPICE_PORT=$(get_port 5930 9) - fi + if [ "${OUTPUT}" == "none" ] || [ "${OUTPUT}" == "spice" ] || [ "${OUTPUT}" == "spice-app" ]; then + local SPICE="disable-ticketing=on" + # gl=on can be use with 'spice' too, but only over local connections (not tcp ports) + if [ "${OUTPUT}" == "spice-app" ]; then + SPICE+=",gl=${gl}" + fi - if [ -z "${SPICE_PORT}" ]; then - echo " - SPICE: All SPICE ports have been exhausted." - if [ "${OUTPUT}" == "none" ] || [ "${OUTPUT}" == "spice" ] || [ "${OUTPUT}" == "spice-app" ]; then - echo " ERROR! Requested SPICE display, but no SPICE ports are free." - exit 1 + # TODO: Don't use ports so local-only connections can be used with gl=on + if [ -z "${SPICE_PORT}" ]; then + # Find a free port for spice + SPICE_PORT=$(get_port 5930 9) fi - else - if [ "${OUTPUT}" == "spice-app" ]; then - echo " - SPICE: Enabled" + + if [ -z "${SPICE_PORT}" ]; then + echo " - SPICE: All SPICE ports have been exhausted." + if [ "${OUTPUT}" == "none" ] || [ "${OUTPUT}" == "spice" ] || [ "${OUTPUT}" == "spice-app" ]; then + echo " ERROR! Requested SPICE display, but no SPICE ports are free." + exit 1 + fi else - echo "spice,${SPICE_PORT}" >> "${VMDIR}/${VMNAME}.ports" - echo -n " - SPICE: On host: spicy --title \"${VMNAME}\" --port ${SPICE_PORT}" - if [ "${guest_os}" != "macos" ] && [ -n "${PUBLIC}" ]; then - echo -n " --spice-shared-dir ${PUBLIC}" + if [ "${OUTPUT}" == "spice-app" ]; then + echo " - SPICE: Enabled" + else + echo "spice,${SPICE_PORT}" >> "${VMDIR}/${VMNAME}.ports" + echo -n " - SPICE: On host: spicy --title \"${VMNAME}\" --port ${SPICE_PORT}" + if [ "${guest_os}" != "macos" ] && [ -n "${PUBLIC}" ]; then + echo -n " --spice-shared-dir ${PUBLIC}" + fi + echo "${FULLSPICY}" + SPICE="${SPICE},port=${SPICE_PORT},addr=127.0.0.1" fi - echo "${FULLSPICY}" - SPICE="${SPICE},port=${SPICE_PORT},addr=127.0.0.1" fi + fi - if [ -n "${PUBLIC}" ]; then - case ${guest_os} in - macos) + if [ -n "${PUBLIC}" ]; then + case ${guest_os} in + macos) + if [ "${OUTPUT}" == "none" ] || [ "${OUTPUT}" == "spice" ] || [ "${OUTPUT}" == "spice-app" ]; then # Reference: https://gitlab.gnome.org/GNOME/phodav/-/issues/5 echo " - WebDAV: On guest: build spice-webdavd (https://gitlab.gnome.org/GNOME/phodav/-/merge_requests/24)" echo " - WebDAV: On guest: Finder -> Connect to Server -> http://localhost:9843/" - ;; - *) - echo " - WebDAV: On guest: dav://localhost:9843/";; - esac - fi + fi + ;; + *) + echo " - WebDAV: On guest: dav://localhost:9843/";; + esac fi if [ "${guest_os}" != "windows" ] && [ -n "${PUBLIC}" ]; then @@ -896,16 +906,21 @@ function vm_boot() { ${VIDEO} -display ${DISPLAY_RENDER} -audiodev ${AUDIO_DEV} -device intel-hda -device hda-duplex,audiodev=audio0 - -rtc base=localtime,clock=host,driftfix=slew - -spice ${SPICE} - -device virtio-serial-pci - -chardev socket,id=agent0,path="${VMDIR}/${VMNAME}-agent.sock",server=on,wait=off - -device virtserialport,chardev=agent0,name=org.qemu.guest_agent.0 - -chardev spicevmc,id=vdagent0,name=vdagent - -device virtserialport,chardev=vdagent0,name=com.redhat.spice.0 - -chardev spiceport,id=webdav0,name=org.spice-space.webdav.0 - -device virtserialport,chardev=webdav0,name=org.spice-space.webdav.0 - -device virtio-rng-pci,rng=rng0 + -rtc base=localtime,clock=host,driftfix=slew) + + # Only enable SPICE is using SPICE display + if [ "${OUTPUT}" == "none" ] || [ "${OUTPUT}" == "spice" ] || [ "${OUTPUT}" == "spice-app" ]; then + args+=(-spice ${SPICE} + -device virtio-serial-pci + -chardev socket,id=agent0,path="${VMDIR}/${VMNAME}-agent.sock",server=on,wait=off + -device virtserialport,chardev=agent0,name=org.qemu.guest_agent.0 + -chardev spicevmc,id=vdagent0,name=vdagent + -device virtserialport,chardev=vdagent0,name=com.redhat.spice.0 + -chardev spiceport,id=webdav0,name=org.spice-space.webdav.0 + -device virtserialport,chardev=webdav0,name=org.spice-space.webdav.0) + fi + + args+=(-device virtio-rng-pci,rng=rng0 -object rng-random,id=rng0,filename=/dev/urandom -device ${USB_HOST_PASSTHROUGH_CONTROLLER},id=spicepass -chardev spicevmc,id=usbredirchardev1,name=usbredir