mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
qemuBuildDeviceVideoStr: Don't overwrite @model
Now we have everything prepared so that @model doesn't have to be rewritten. The correct model can be chosen right from the beginning. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
96414611ef
commit
55ea45acc9
@ -4164,9 +4164,13 @@ qemuDeviceVideoGetModel(virQEMUCaps *qemuCaps,
|
||||
{
|
||||
const char *model = NULL;
|
||||
bool primaryVga = false;
|
||||
virTristateSwitch accel3d = VIR_TRISTATE_SWITCH_ABSENT;
|
||||
|
||||
*virtio = false;
|
||||
|
||||
if (video->accel)
|
||||
accel3d = video->accel->accel3d;
|
||||
|
||||
if (video->primary && qemuDomainSupportsVideoVga(video, qemuCaps))
|
||||
primaryVga = true;
|
||||
|
||||
@ -4197,7 +4201,11 @@ qemuDeviceVideoGetModel(virQEMUCaps *qemuCaps,
|
||||
model = "qxl-vga";
|
||||
break;
|
||||
case VIR_DOMAIN_VIDEO_TYPE_VIRTIO:
|
||||
model = "virtio-vga";
|
||||
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_VGA_GL) &&
|
||||
accel3d == VIR_TRISTATE_SWITCH_ON)
|
||||
model = "virtio-vga-gl";
|
||||
else
|
||||
model = "virtio-vga";
|
||||
break;
|
||||
case VIR_DOMAIN_VIDEO_TYPE_BOCHS:
|
||||
model = "bochs-display";
|
||||
@ -4220,7 +4228,11 @@ qemuDeviceVideoGetModel(virQEMUCaps *qemuCaps,
|
||||
model = "qxl";
|
||||
break;
|
||||
case VIR_DOMAIN_VIDEO_TYPE_VIRTIO:
|
||||
model = "virtio-gpu";
|
||||
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_GPU_GL_PCI) &&
|
||||
accel3d == VIR_TRISTATE_SWITCH_ON)
|
||||
model = "virtio-gpu-gl";
|
||||
else
|
||||
model = "virtio-gpu";
|
||||
*virtio = true;
|
||||
break;
|
||||
case VIR_DOMAIN_VIDEO_TYPE_DEFAULT:
|
||||
@ -4268,21 +4280,12 @@ qemuBuildDeviceVideoStr(const virDomainDef *def,
|
||||
return NULL;
|
||||
|
||||
if (virtio) {
|
||||
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_GPU_GL_PCI) &&
|
||||
accel3d == VIR_TRISTATE_SWITCH_ON &&
|
||||
STREQ(model, "virtio-gpu"))
|
||||
model = "virtio-gpu-gl";
|
||||
|
||||
if (qemuBuildVirtioDevStr(&buf, model, qemuCaps,
|
||||
VIR_DOMAIN_DEVICE_VIDEO, video) < 0) {
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
virBufferAsprintf(&buf, "%s", model);
|
||||
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_VGA_GL) &&
|
||||
accel3d == VIR_TRISTATE_SWITCH_ON &&
|
||||
STREQ(model, "virtio-vga"))
|
||||
virBufferAddLit(&buf, "-gl");
|
||||
}
|
||||
|
||||
virBufferAsprintf(&buf, ",id=%s", video->info.alias);
|
||||
|
Loading…
Reference in New Issue
Block a user