From 3d5340d033dae3f459a777022c199daa32e4e17d Mon Sep 17 00:00:00 2001 From: Tom Date: Fri, 25 Jun 2021 13:49:20 -0600 Subject: [PATCH] Meta: Add SERENITY_SCREENS environment variable This allows specifying how many screens we should use. This also then only enables virtio-gpu if more than one display is requested. This also adds an environment variable SERENITY_QEMU_DISPLAY_BACKEND which allows overriding the default qemu display backend, as it may not be available. --- Meta/run.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Meta/run.sh b/Meta/run.sh index 5f1cfe5144b..e771290690a 100755 --- a/Meta/run.sh +++ b/Meta/run.sh @@ -53,14 +53,22 @@ SERENITY_QEMU_MIN_REQ_VERSION=5 installed_major_version=$("$SERENITY_QEMU_BIN" -version | head -n 1 | sed -E 's/QEMU emulator version ([1-9][0-9]*|0).*/\1/') [ "$installed_major_version" -lt "$SERENITY_QEMU_MIN_REQ_VERSION" ] && die "Required QEMU >= 5.0! Found $($SERENITY_QEMU_BIN -version | head -n 1)" +SERENITY_SCREENS="${SERENITY_SCREENS:-1}" +SERENITY_QEMU_DISPLAY_BACKEND="${SERENITY_QEMU_DISPLAY_BACKEND:-sdl,gl=on}" +if [ "$SERENITY_SCREENS" -gt 1 ]; then + SERENITY_QEMU_DISPLAY_DEVICE="virtio-gpu,max_outputs=$SERENITY_SCREENS " +else + SERENITY_QEMU_DISPLAY_DEVICE="VGA,vgamem_mb=64 " +fi + [ -z "$SERENITY_COMMON_QEMU_ARGS" ] && SERENITY_COMMON_QEMU_ARGS=" $SERENITY_EXTRA_QEMU_ARGS -s -m $SERENITY_RAM_SIZE -cpu $SERENITY_QEMU_CPU -d guest_errors -smp 2 --display sdl,gl=on --vga virtio +-display $SERENITY_QEMU_DISPLAY_BACKEND +-device $SERENITY_QEMU_DISPLAY_DEVICE -drive file=${SERENITY_DISK_IMAGE},format=raw,index=0,media=disk -usb -device virtio-serial @@ -83,8 +91,8 @@ $SERENITY_EXTRA_QEMU_ARGS -machine q35 -d guest_errors -smp 2 --display sdl,gl=on --vga virtio +-display $SERENITY_QEMU_DISPLAY_BACKEND +-device $SERENITY_QEMU_DISPLAY_DEVICE -device piix3-ide -drive file=${SERENITY_DISK_IMAGE},id=disk,if=none -device ahci,id=ahci