mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +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;
|
const char *model = NULL;
|
||||||
bool primaryVga = false;
|
bool primaryVga = false;
|
||||||
|
virTristateSwitch accel3d = VIR_TRISTATE_SWITCH_ABSENT;
|
||||||
|
|
||||||
*virtio = false;
|
*virtio = false;
|
||||||
|
|
||||||
|
if (video->accel)
|
||||||
|
accel3d = video->accel->accel3d;
|
||||||
|
|
||||||
if (video->primary && qemuDomainSupportsVideoVga(video, qemuCaps))
|
if (video->primary && qemuDomainSupportsVideoVga(video, qemuCaps))
|
||||||
primaryVga = true;
|
primaryVga = true;
|
||||||
|
|
||||||
@ -4197,7 +4201,11 @@ qemuDeviceVideoGetModel(virQEMUCaps *qemuCaps,
|
|||||||
model = "qxl-vga";
|
model = "qxl-vga";
|
||||||
break;
|
break;
|
||||||
case VIR_DOMAIN_VIDEO_TYPE_VIRTIO:
|
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;
|
break;
|
||||||
case VIR_DOMAIN_VIDEO_TYPE_BOCHS:
|
case VIR_DOMAIN_VIDEO_TYPE_BOCHS:
|
||||||
model = "bochs-display";
|
model = "bochs-display";
|
||||||
@ -4220,7 +4228,11 @@ qemuDeviceVideoGetModel(virQEMUCaps *qemuCaps,
|
|||||||
model = "qxl";
|
model = "qxl";
|
||||||
break;
|
break;
|
||||||
case VIR_DOMAIN_VIDEO_TYPE_VIRTIO:
|
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;
|
*virtio = true;
|
||||||
break;
|
break;
|
||||||
case VIR_DOMAIN_VIDEO_TYPE_DEFAULT:
|
case VIR_DOMAIN_VIDEO_TYPE_DEFAULT:
|
||||||
@ -4268,21 +4280,12 @@ qemuBuildDeviceVideoStr(const virDomainDef *def,
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (virtio) {
|
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,
|
if (qemuBuildVirtioDevStr(&buf, model, qemuCaps,
|
||||||
VIR_DOMAIN_DEVICE_VIDEO, video) < 0) {
|
VIR_DOMAIN_DEVICE_VIDEO, video) < 0) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
virBufferAsprintf(&buf, "%s", model);
|
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);
|
virBufferAsprintf(&buf, ",id=%s", video->info.alias);
|
||||||
|
Loading…
Reference in New Issue
Block a user