提交 6794a44b 编写于 作者: D Daniel P. Berrange

Support multiple QXL video cards

QEMU crashes & burns if you try multiple Cirrus video cards, but
QXL copes fine. Adapt QEMU config code to allow multiple QXL
video cards

* src/qemu/qemu_conf.c: Support multiple QXL video cards
上级 7a696678
......@@ -3251,6 +3251,36 @@ error:
}
static char *
qemuBuildVideoDevStr(virDomainVideoDefPtr video)
{
virBuffer buf = VIR_BUFFER_INITIALIZER;
const char *model = qemuVideoTypeToString(video->type);
if (!model) {
qemuReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("invalid video model"));
goto error;
}
virBufferVSprintf(&buf, "%s", model);
virBufferVSprintf(&buf, ",id=%s", video->info.alias);
if (qemuBuildDeviceAddressStr(&buf, &video->info) < 0)
goto error;
if (virBufferError(&buf)) {
virReportOOMError();
goto error;
}
return virBufferContentAndReset(&buf);
error:
virBufferFreeAndReset(&buf);
return NULL;
}
int
qemudOpenPCIConfig(virDomainHostdevDefPtr dev)
{
......@@ -5171,13 +5201,7 @@ int qemudBuildCommandLine(virConnectPtr conn,
goto error;
}
if (def->nvideos) {
if (def->nvideos > 1) {
qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED,
"%s", _("only one video card is currently supported"));
goto error;
}
if (def->nvideos > 0) {
if (qemuCmdFlags & QEMUD_CMD_FLAG_VGA) {
if (def->videos[0]->type == VIR_DOMAIN_VIDEO_TYPE_XEN) {
/* nothing - vga has no effect on Xen pvfb */
......@@ -5223,6 +5247,32 @@ int qemudBuildCommandLine(virConnectPtr conn,
goto error;
}
}
if (def->nvideos > 1) {
if (qemuCmdFlags & QEMUD_CMD_FLAG_DEVICE) {
for (i = 1 ; i < def->nvideos ; i++) {
char *str;
if (def->videos[i]->type != VIR_DOMAIN_VIDEO_TYPE_QXL) {
qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("video type %s is only valid as primary video card"),
virDomainVideoTypeToString(def->videos[0]->type));
goto error;
}
ADD_ARG_LIT("-device");
if (!(str = qemuBuildVideoDevStr(def->videos[i])))
goto error;
ADD_ARG(str);
}
} else {
qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED,
"%s", _("only one video card is currently supported"));
goto error;
}
}
} else {
/* If we have -device, then we set -nodefault already */
if (!(qemuCmdFlags & QEMUD_CMD_FLAG_DEVICE) &&
......
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=spice /usr/bin/qemu -S -M pc -m 214 -smp 1 -nodefaults -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -usb -spice port=5903,tls-port=5904,addr=127.0.0.1,x509-dir=/etc/pki/libvirt-spice -vga qxl -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=spice /usr/bin/qemu -S -M pc -m 214 -smp 1 -nodefaults -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -usb -spice port=5903,tls-port=5904,addr=127.0.0.1,x509-dir=/etc/pki/libvirt-spice -vga qxl -device qxl,id=video1,bus=pci.0,addr=0x4 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
......@@ -25,5 +25,8 @@
<video>
<model type='qxl' vram='65536' heads='1'/>
</video>
<video>
<model type='qxl' vram='65536' heads='1'/>
</video>
</devices>
</domain>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册