mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-30 09:53:10 +00:00
qemuBuildDeviceVideoStr: Separate out video module selection
The code that decides video card model is going to be reworked and expanded. Separate it out into a function. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
b159ff83a5
commit
614fb5546c
@ -4195,18 +4195,11 @@ qemuBuildSoundCommandLine(virCommand *cmd,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static const char *
|
||||||
static char *
|
qemuDeviceVideoGetModel(virQEMUCaps *qemuCaps,
|
||||||
qemuBuildDeviceVideoStr(const virDomainDef *def,
|
const virDomainVideoDef *video)
|
||||||
virDomainVideoDef *video,
|
|
||||||
virQEMUCaps *qemuCaps)
|
|
||||||
{
|
{
|
||||||
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
|
||||||
const char *model = NULL;
|
const char *model = NULL;
|
||||||
virTristateSwitch accel3d = VIR_TRISTATE_SWITCH_ABSENT;
|
|
||||||
|
|
||||||
if (video->accel)
|
|
||||||
accel3d = video->accel->accel3d;
|
|
||||||
|
|
||||||
/* We try to chose the best model for primary video device by preferring
|
/* We try to chose the best model for primary video device by preferring
|
||||||
* model with VGA compatibility mode. For some video devices on some
|
* model with VGA compatibility mode. For some video devices on some
|
||||||
@ -4231,6 +4224,25 @@ qemuBuildDeviceVideoStr(const virDomainDef *def,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static char *
|
||||||
|
qemuBuildDeviceVideoStr(const virDomainDef *def,
|
||||||
|
virDomainVideoDef *video,
|
||||||
|
virQEMUCaps *qemuCaps)
|
||||||
|
{
|
||||||
|
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||||
|
const char *model = NULL;
|
||||||
|
virTristateSwitch accel3d = VIR_TRISTATE_SWITCH_ABSENT;
|
||||||
|
|
||||||
|
if (video->accel)
|
||||||
|
accel3d = video->accel->accel3d;
|
||||||
|
|
||||||
|
if (!(model = qemuDeviceVideoGetModel(qemuCaps, video)))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
if (STREQ(model, "virtio-gpu") || STREQ(model, "vhost-user-gpu")) {
|
if (STREQ(model, "virtio-gpu") || STREQ(model, "vhost-user-gpu")) {
|
||||||
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_GPU_GL_PCI) &&
|
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_GPU_GL_PCI) &&
|
||||||
accel3d == VIR_TRISTATE_SWITCH_ON &&
|
accel3d == VIR_TRISTATE_SWITCH_ON &&
|
||||||
|
Loading…
Reference in New Issue
Block a user