mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +00:00
qemu_command: introduce enum of secondary models for video device
There are two video devices with models without VGA compatibility mode. They are primary used as secondary video devices, but in some cases it is required to use them also as primary video devices. Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
parent
724d51786e
commit
ac987148a8
@ -114,6 +114,18 @@ VIR_ENUM_IMPL(qemuDeviceVideo, VIR_DOMAIN_VIDEO_TYPE_LAST,
|
|||||||
"", /* don't support parallels */
|
"", /* don't support parallels */
|
||||||
"virtio-vga");
|
"virtio-vga");
|
||||||
|
|
||||||
|
VIR_ENUM_DECL(qemuDeviceVideoSecondary)
|
||||||
|
|
||||||
|
VIR_ENUM_IMPL(qemuDeviceVideoSecondary, VIR_DOMAIN_VIDEO_TYPE_LAST,
|
||||||
|
"", /* no secondary device for VGA */
|
||||||
|
"", /* no secondary device for cirrus-vga */
|
||||||
|
"", /* no secondary device for vmware-svga */
|
||||||
|
"", /* don't support xen */
|
||||||
|
"", /* don't support vbox */
|
||||||
|
"qxl",
|
||||||
|
"", /* don't support parallels */
|
||||||
|
"virtio-gpu-pci");
|
||||||
|
|
||||||
VIR_ENUM_DECL(qemuSoundCodec)
|
VIR_ENUM_DECL(qemuSoundCodec)
|
||||||
|
|
||||||
VIR_ENUM_IMPL(qemuSoundCodec, VIR_DOMAIN_SOUND_CODEC_TYPE_LAST,
|
VIR_ENUM_IMPL(qemuSoundCodec, VIR_DOMAIN_SOUND_CODEC_TYPE_LAST,
|
||||||
@ -4258,19 +4270,21 @@ qemuBuildDeviceVideoStr(const virDomainDef *def,
|
|||||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||||
const char *model;
|
const char *model;
|
||||||
|
|
||||||
if (video->primary) {
|
/* We try to chose the best model for primary video device by preferring
|
||||||
|
* model with VGA compatibility mode. For some video devices on some
|
||||||
|
* architectures there might not be such model so fallback to one
|
||||||
|
* without VGA compatibility mode. */
|
||||||
|
if (video->primary && qemuDomainSupportsVideoVga(video, qemuCaps))
|
||||||
model = qemuDeviceVideoTypeToString(video->type);
|
model = qemuDeviceVideoTypeToString(video->type);
|
||||||
|
else
|
||||||
|
model = qemuDeviceVideoSecondaryTypeToString(video->type);
|
||||||
|
|
||||||
if (!model || STREQ(model, "")) {
|
if (!model || STREQ(model, "")) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("invalid model for video type '%s'"),
|
_("invalid model for video type '%s'"),
|
||||||
virDomainVideoTypeToString(video->type));
|
virDomainVideoTypeToString(video->type));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
if (!qemuDomainSupportsVideoVga(video, qemuCaps))
|
|
||||||
model = "virtio-gpu-pci";
|
|
||||||
} else {
|
|
||||||
model = "qxl";
|
|
||||||
}
|
|
||||||
|
|
||||||
virBufferAsprintf(&buf, "%s,id=%s", model, video->info.alias);
|
virBufferAsprintf(&buf, "%s,id=%s", model, video->info.alias);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user