提交 ff767f08 编写于 作者: E Erik Skultety

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 5038b300
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: NErik Skultety <eskultet@redhat.com>
Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
上级 8ec7c8ce
......@@ -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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册