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 *
|
static const char *
|
||||||
qemuDeviceVideoGetModel(virQEMUCaps *qemuCaps,
|
qemuDeviceVideoGetModel(virQEMUCaps *qemuCaps,
|
||||||
const virDomainVideoDef *video)
|
const virDomainVideoDef *video,
|
||||||
|
bool *virtio)
|
||||||
{
|
{
|
||||||
const char *model = NULL;
|
const char *model = NULL;
|
||||||
bool primaryVga = false;
|
bool primaryVga = false;
|
||||||
|
|
||||||
|
*virtio = false;
|
||||||
|
|
||||||
if (video->primary && qemuDomainSupportsVideoVga(video, qemuCaps))
|
if (video->primary && qemuDomainSupportsVideoVga(video, qemuCaps))
|
||||||
primaryVga = true;
|
primaryVga = true;
|
||||||
|
|
||||||
@ -4172,10 +4175,12 @@ qemuDeviceVideoGetModel(virQEMUCaps *qemuCaps,
|
|||||||
* architectures there might not be such model so fallback to one
|
* architectures there might not be such model so fallback to one
|
||||||
* without VGA compatibility mode. */
|
* without VGA compatibility mode. */
|
||||||
if (video->backend == VIR_DOMAIN_VIDEO_BACKEND_TYPE_VHOSTUSER) {
|
if (video->backend == VIR_DOMAIN_VIDEO_BACKEND_TYPE_VHOSTUSER) {
|
||||||
if (primaryVga)
|
if (primaryVga) {
|
||||||
model = "vhost-user-vga";
|
model = "vhost-user-vga";
|
||||||
else
|
} else {
|
||||||
model = "vhost-user-gpu";
|
model = "vhost-user-gpu";
|
||||||
|
*virtio = true;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (primaryVga) {
|
if (primaryVga) {
|
||||||
switch ((virDomainVideoType) video->type) {
|
switch ((virDomainVideoType) video->type) {
|
||||||
@ -4216,6 +4221,7 @@ qemuDeviceVideoGetModel(virQEMUCaps *qemuCaps,
|
|||||||
break;
|
break;
|
||||||
case VIR_DOMAIN_VIDEO_TYPE_VIRTIO:
|
case VIR_DOMAIN_VIDEO_TYPE_VIRTIO:
|
||||||
model = "virtio-gpu";
|
model = "virtio-gpu";
|
||||||
|
*virtio = true;
|
||||||
break;
|
break;
|
||||||
case VIR_DOMAIN_VIDEO_TYPE_DEFAULT:
|
case VIR_DOMAIN_VIDEO_TYPE_DEFAULT:
|
||||||
case VIR_DOMAIN_VIDEO_TYPE_VGA:
|
case VIR_DOMAIN_VIDEO_TYPE_VGA:
|
||||||
@ -4253,14 +4259,15 @@ qemuBuildDeviceVideoStr(const virDomainDef *def,
|
|||||||
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||||
const char *model = NULL;
|
const char *model = NULL;
|
||||||
virTristateSwitch accel3d = VIR_TRISTATE_SWITCH_ABSENT;
|
virTristateSwitch accel3d = VIR_TRISTATE_SWITCH_ABSENT;
|
||||||
|
bool virtio = false;
|
||||||
|
|
||||||
if (video->accel)
|
if (video->accel)
|
||||||
accel3d = video->accel->accel3d;
|
accel3d = video->accel->accel3d;
|
||||||
|
|
||||||
if (!(model = qemuDeviceVideoGetModel(qemuCaps, video)))
|
if (!(model = qemuDeviceVideoGetModel(qemuCaps, video, &virtio)))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (STREQ(model, "virtio-gpu") || STREQ(model, "vhost-user-gpu")) {
|
if (virtio) {
|
||||||
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 &&
|
||||||
STREQ(model, "virtio-gpu"))
|
STREQ(model, "virtio-gpu"))
|
||||||
|
Loading…
Reference in New Issue
Block a user