mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 11:31:16 +00:00
qemuBuildDeviceVideoStr: Move logic wrapping qemuBuildVirtioDevStr() into qemuDeviceVideoGetModel()
We want to call qemuBuildVirtioDevStr() from qemuBuildDeviceVideoStr() but only for some models (currently "virtio-gpu" and "vhost-user-gpu"), not all of them. Move this logic into qemuDeviceVideoGetModel() because this logic will be refined. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
bdb0bfe8f8
commit
96414611ef
@ -4159,11 +4159,14 @@ qemuBuildSoundCommandLine(virCommand *cmd,
|
||||
|
||||
static const char *
|
||||
qemuDeviceVideoGetModel(virQEMUCaps *qemuCaps,
|
||||
const virDomainVideoDef *video)
|
||||
const virDomainVideoDef *video,
|
||||
bool *virtio)
|
||||
{
|
||||
const char *model = NULL;
|
||||
bool primaryVga = false;
|
||||
|
||||
*virtio = false;
|
||||
|
||||
if (video->primary && qemuDomainSupportsVideoVga(video, qemuCaps))
|
||||
primaryVga = true;
|
||||
|
||||
@ -4172,10 +4175,12 @@ qemuDeviceVideoGetModel(virQEMUCaps *qemuCaps,
|
||||
* architectures there might not be such model so fallback to one
|
||||
* without VGA compatibility mode. */
|
||||
if (video->backend == VIR_DOMAIN_VIDEO_BACKEND_TYPE_VHOSTUSER) {
|
||||
if (primaryVga)
|
||||
if (primaryVga) {
|
||||
model = "vhost-user-vga";
|
||||
else
|
||||
} else {
|
||||
model = "vhost-user-gpu";
|
||||
*virtio = true;
|
||||
}
|
||||
} else {
|
||||
if (primaryVga) {
|
||||
switch ((virDomainVideoType) video->type) {
|
||||
@ -4216,6 +4221,7 @@ qemuDeviceVideoGetModel(virQEMUCaps *qemuCaps,
|
||||
break;
|
||||
case VIR_DOMAIN_VIDEO_TYPE_VIRTIO:
|
||||
model = "virtio-gpu";
|
||||
*virtio = true;
|
||||
break;
|
||||
case VIR_DOMAIN_VIDEO_TYPE_DEFAULT:
|
||||
case VIR_DOMAIN_VIDEO_TYPE_VGA:
|
||||
@ -4253,14 +4259,15 @@ qemuBuildDeviceVideoStr(const virDomainDef *def,
|
||||
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||
const char *model = NULL;
|
||||
virTristateSwitch accel3d = VIR_TRISTATE_SWITCH_ABSENT;
|
||||
bool virtio = false;
|
||||
|
||||
if (video->accel)
|
||||
accel3d = video->accel->accel3d;
|
||||
|
||||
if (!(model = qemuDeviceVideoGetModel(qemuCaps, video)))
|
||||
if (!(model = qemuDeviceVideoGetModel(qemuCaps, video, &virtio)))
|
||||
return NULL;
|
||||
|
||||
if (STREQ(model, "virtio-gpu") || STREQ(model, "vhost-user-gpu")) {
|
||||
if (virtio) {
|
||||
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_GPU_GL_PCI) &&
|
||||
accel3d == VIR_TRISTATE_SWITCH_ON &&
|
||||
STREQ(model, "virtio-gpu"))
|
||||
|
Loading…
Reference in New Issue
Block a user