mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 15:27:47 +00:00
libxl: move video default logic to driver
The logic setting a device default should be in the post parse function of individual driver code. Signed-off-by: Rafael Fonseca <r4f4rfs@gmail.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
a11a0e6e84
commit
624f905403
@ -15716,7 +15716,6 @@ virDomainVideoDefaultType(const virDomainDef *def)
|
|||||||
{
|
{
|
||||||
switch ((virDomainVirtType)def->virtType) {
|
switch ((virDomainVirtType)def->virtType) {
|
||||||
case VIR_DOMAIN_VIRT_TEST:
|
case VIR_DOMAIN_VIRT_TEST:
|
||||||
case VIR_DOMAIN_VIRT_XEN:
|
|
||||||
if (def->os.type == VIR_DOMAIN_OSTYPE_XEN ||
|
if (def->os.type == VIR_DOMAIN_OSTYPE_XEN ||
|
||||||
def->os.type == VIR_DOMAIN_OSTYPE_LINUX)
|
def->os.type == VIR_DOMAIN_OSTYPE_LINUX)
|
||||||
return VIR_DOMAIN_VIDEO_TYPE_XEN;
|
return VIR_DOMAIN_VIDEO_TYPE_XEN;
|
||||||
@ -15737,6 +15736,7 @@ virDomainVideoDefaultType(const virDomainDef *def)
|
|||||||
return VIR_DOMAIN_VIDEO_TYPE_VGA;
|
return VIR_DOMAIN_VIDEO_TYPE_VGA;
|
||||||
else
|
else
|
||||||
return VIR_DOMAIN_VIDEO_TYPE_PARALLELS;
|
return VIR_DOMAIN_VIDEO_TYPE_PARALLELS;
|
||||||
|
case VIR_DOMAIN_VIRT_XEN:
|
||||||
case VIR_DOMAIN_VIRT_BHYVE:
|
case VIR_DOMAIN_VIRT_BHYVE:
|
||||||
case VIR_DOMAIN_VIRT_QEMU:
|
case VIR_DOMAIN_VIRT_QEMU:
|
||||||
case VIR_DOMAIN_VIRT_KQEMU:
|
case VIR_DOMAIN_VIRT_KQEMU:
|
||||||
|
@ -315,31 +315,43 @@ libxlDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
|
|||||||
pcisrc->backend = VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN;
|
pcisrc->backend = VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dev->type == VIR_DOMAIN_DEVICE_VIDEO && def->os.type == VIR_DOMAIN_OSTYPE_HVM) {
|
if (dev->type == VIR_DOMAIN_DEVICE_VIDEO) {
|
||||||
int dm_type = libxlDomainGetEmulatorType(def);
|
if (dev->data.video->type == VIR_DOMAIN_VIDEO_TYPE_DEFAULT) {
|
||||||
|
if (def->os.type == VIR_DOMAIN_OSTYPE_XEN ||
|
||||||
|
def->os.type == VIR_DOMAIN_OSTYPE_LINUX)
|
||||||
|
dev->data.video->type = VIR_DOMAIN_VIDEO_TYPE_XEN;
|
||||||
|
else if (ARCH_IS_PPC64(def->os.arch))
|
||||||
|
dev->data.video->type = VIR_DOMAIN_VIDEO_TYPE_VGA;
|
||||||
|
else
|
||||||
|
dev->data.video->type = VIR_DOMAIN_VIDEO_TYPE_CIRRUS;
|
||||||
|
}
|
||||||
|
|
||||||
switch (dev->data.video->type) {
|
if (def->os.type == VIR_DOMAIN_OSTYPE_HVM) {
|
||||||
case VIR_DOMAIN_VIDEO_TYPE_VGA:
|
int dm_type = libxlDomainGetEmulatorType(def);
|
||||||
case VIR_DOMAIN_VIDEO_TYPE_XEN:
|
|
||||||
if (dev->data.video->vram == 0) {
|
switch (dev->data.video->type) {
|
||||||
if (dm_type == LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN)
|
case VIR_DOMAIN_VIDEO_TYPE_VGA:
|
||||||
dev->data.video->vram = 16 * 1024;
|
case VIR_DOMAIN_VIDEO_TYPE_XEN:
|
||||||
else
|
if (dev->data.video->vram == 0) {
|
||||||
dev->data.video->vram = 8 * 1024;
|
if (dm_type == LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN)
|
||||||
}
|
dev->data.video->vram = 16 * 1024;
|
||||||
break;
|
else
|
||||||
case VIR_DOMAIN_VIDEO_TYPE_CIRRUS:
|
dev->data.video->vram = 8 * 1024;
|
||||||
if (dev->data.video->vram == 0) {
|
}
|
||||||
if (dm_type == LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN)
|
break;
|
||||||
dev->data.video->vram = 8 * 1024;
|
case VIR_DOMAIN_VIDEO_TYPE_CIRRUS:
|
||||||
else
|
if (dev->data.video->vram == 0) {
|
||||||
dev->data.video->vram = 4 * 1024;
|
if (dm_type == LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN)
|
||||||
|
dev->data.video->vram = 8 * 1024;
|
||||||
|
else
|
||||||
|
dev->data.video->vram = 4 * 1024;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case VIR_DOMAIN_VIDEO_TYPE_QXL:
|
||||||
|
if (dev->data.video->vram == 0)
|
||||||
|
dev->data.video->vram = 128 * 1024;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
case VIR_DOMAIN_VIDEO_TYPE_QXL:
|
|
||||||
if (dev->data.video->vram == 0)
|
|
||||||
dev->data.video->vram = 128 * 1024;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user