mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 11:31:16 +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 char *
|
||||
qemuBuildDeviceVideoStr(const virDomainDef *def,
|
||||
virDomainVideoDef *video,
|
||||
virQEMUCaps *qemuCaps)
|
||||
static const char *
|
||||
qemuDeviceVideoGetModel(virQEMUCaps *qemuCaps,
|
||||
const virDomainVideoDef *video)
|
||||
{
|
||||
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||
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
|
||||
* model with VGA compatibility mode. For some video devices on some
|
||||
@ -4231,6 +4224,25 @@ qemuBuildDeviceVideoStr(const virDomainDef *def,
|
||||
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 (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_GPU_GL_PCI) &&
|
||||
accel3d == VIR_TRISTATE_SWITCH_ON &&
|
||||
|
Loading…
Reference in New Issue
Block a user