mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-03 17:47:15 +03:00
qemu: command: Fix building of the SDL display command line
QEMU uses a shorthand '-sdl' which maps to '-display sdl'. However, if there are any options to be passed to SDL, the full command version must be used. Everything seemingly worked for us until commit 5038b300437 introduced OpenGL support for SDL and added ',gl=on/off' option which as mentioned above could have never worked with the shorthand version of the command. Indeed starting a domain with an SDL display and OpenGL enabled, QEMU produces a rather cryptic error: -sdl: Could not open 'gl=on': No such file or directory This patch provides fixes to both the SDL cmdline generation and the test suite. Signed-off-by: Erik Skultety <eskultet@redhat.com> Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
8ec7c8ce76
commit
ff767f083f
@ -7765,7 +7765,6 @@ qemuBuildGraphicsSDLCommandLine(virQEMUDriverConfigPtr cfg ATTRIBUTE_UNUSED,
|
||||
{
|
||||
int ret = -1;
|
||||
virBuffer opt = VIR_BUFFER_INITIALIZER;
|
||||
const char *optContent;
|
||||
|
||||
if (graphics->data.sdl.xauth)
|
||||
virCommandAddEnvPair(cmd, "XAUTHORITY", graphics->data.sdl.xauth);
|
||||
@ -7781,22 +7780,26 @@ qemuBuildGraphicsSDLCommandLine(virQEMUDriverConfigPtr cfg ATTRIBUTE_UNUSED,
|
||||
virCommandAddEnvPassBlockSUID(cmd, "QEMU_AUDIO_DRV", NULL);
|
||||
virCommandAddEnvPassBlockSUID(cmd, "SDL_AUDIODRIVER", NULL);
|
||||
|
||||
virCommandAddArg(cmd, "-sdl");
|
||||
virCommandAddArg(cmd, "-display");
|
||||
virBufferAddLit(&opt, "sdl");
|
||||
|
||||
if (graphics->data.sdl.gl == VIR_TRISTATE_BOOL_YES) {
|
||||
if (graphics->data.sdl.gl != VIR_TRISTATE_BOOL_ABSENT) {
|
||||
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SDL_GL)) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("This QEMU doesn't support SDL OpenGL"));
|
||||
_("OpenGL for SDL is not supported with this QEMU "
|
||||
"binary"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
virBufferAsprintf(&opt, "gl=%s",
|
||||
virBufferAsprintf(&opt, ",gl=%s",
|
||||
virTristateSwitchTypeToString(graphics->data.sdl.gl));
|
||||
|
||||
}
|
||||
|
||||
optContent = virBufferCurrentContent(&opt);
|
||||
if (optContent && STRNEQ(optContent, ""))
|
||||
virCommandAddArgBuffer(cmd, &opt);
|
||||
if (virBufferCheckError(&opt) < 0)
|
||||
goto cleanup;
|
||||
|
||||
virCommandAddArgBuffer(cmd, &opt);
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
|
@ -25,5 +25,5 @@ server,nowait \
|
||||
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
|
||||
-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
|
||||
-full-screen \
|
||||
-sdl \
|
||||
-display sdl \
|
||||
-vga cirrus
|
||||
|
@ -24,5 +24,5 @@ server,nowait \
|
||||
-usb \
|
||||
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
|
||||
-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
|
||||
-sdl \
|
||||
-display sdl \
|
||||
-vga std
|
||||
|
@ -23,6 +23,6 @@ server,nowait \
|
||||
-drive file=/var/lib/libvirt/images/QEMUGuest1,format=qcow2,if=none,\
|
||||
id=drive-ide0-0-0,cache=none \
|
||||
-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
|
||||
-sdl gl=on \
|
||||
-display sdl,gl=on \
|
||||
-device virtio-gpu-pci,id=video0,virgl=on,bus=pci.0,addr=0x2 \
|
||||
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
|
||||
|
Loading…
x
Reference in New Issue
Block a user