提交 35596267 编写于 作者: D Daniel Henrique Barboza 提交者: Cole Robinson

qemu: command: move qemuBuildGraphicsSDLCommandLine validation to qemu_domain.c

There are validations for SDL, VNC, SPICE and EGL_HEADLESS
around several BuildGraphics*CommandLine in qemu_command.c. This
patch starts to move all of them to qemu_domain.c, inside the
existent qemuDomainDeviceDefValidateGraphics() function. This
function is called by qemuDomainDefValidate(), validating the
graphics parameters in domain define time.

In this patch we'll move the SDL validation code from
qemuBuildGraphicsSDLCommandLine(). Tests were adapted to consider
SDL validation in this earlier stage.
Reviewed-by: NCole Robinson <crobinso@redhat.com>
Signed-off-by: NDaniel Henrique Barboza <danielhb413@gmail.com>
上级 83d7dadc
......@@ -7428,19 +7428,10 @@ qemuBuildGraphicsSDLCommandLine(virQEMUDriverConfigPtr cfg G_GNUC_UNUSED,
virCommandAddArg(cmd, "-display");
virBufferAddLit(&opt, "sdl");
if (graphics->data.sdl.gl != VIR_TRISTATE_BOOL_ABSENT) {
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SDL_GL)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("OpenGL for SDL is not supported with this QEMU "
"binary"));
return -1;
}
if (graphics->data.sdl.gl != VIR_TRISTATE_BOOL_ABSENT)
virBufferAsprintf(&opt, ",gl=%s",
virTristateSwitchTypeToString(graphics->data.sdl.gl));
}
virCommandAddArgBuffer(cmd, &opt);
return 0;
......@@ -7896,9 +7887,6 @@ qemuBuildGraphicsCommandLine(virQEMUDriverConfigPtr cfg,
break;
case VIR_DOMAIN_GRAPHICS_TYPE_RDP:
case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unsupported graphics type '%s'"),
virDomainGraphicsTypeToString(graphics->type));
return -1;
case VIR_DOMAIN_GRAPHICS_TYPE_LAST:
default:
......
......@@ -7681,6 +7681,35 @@ qemuDomainDeviceDefValidateGraphics(const virDomainGraphicsDef *graphics,
}
}
switch (graphics->type) {
case VIR_DOMAIN_GRAPHICS_TYPE_SDL:
if (graphics->data.sdl.gl != VIR_TRISTATE_BOOL_ABSENT) {
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SDL_GL)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("OpenGL for SDL is not supported with this QEMU "
"binary"));
return -1;
}
}
break;
case VIR_DOMAIN_GRAPHICS_TYPE_VNC:
break;
case VIR_DOMAIN_GRAPHICS_TYPE_SPICE:
break;
case VIR_DOMAIN_GRAPHICS_TYPE_EGL_HEADLESS:
break;
case VIR_DOMAIN_GRAPHICS_TYPE_RDP:
case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unsupported graphics type '%s'"),
virDomainGraphicsTypeToString(graphics->type));
return -1;
case VIR_DOMAIN_GRAPHICS_TYPE_LAST:
default:
return -1;
}
return 0;
}
......
......@@ -1174,7 +1174,8 @@ mymain(void)
QEMU_CAPS_VIRTIO_GPU_VIRGL);
DO_TEST("video-virtio-gpu-sdl-gl",
QEMU_CAPS_DEVICE_VIRTIO_GPU,
QEMU_CAPS_VIRTIO_GPU_VIRGL);
QEMU_CAPS_VIRTIO_GPU_VIRGL,
QEMU_CAPS_SDL_GL);
DO_TEST("virtio-input",
QEMU_CAPS_VIRTIO_KEYBOARD,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册