virt-manager/virtinst/devices/video.py
Fabiano Fidêncio 8f4c53ea96 video: Prefer "bochs" when it's supported.
Preferring "bochs" display device is the way to go when dealing with a
Linux guest using UEFI and that's quite well described here:
https://www.kraxel.org/blog/2019/09/display-devices-in-qemu/

https://bugzilla.redhat.com/show_bug.cgi?id=1753644

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-10-04 11:17:10 -04:00

54 lines
1.6 KiB
Python

#
# Copyright 2009, 2013 Red Hat, Inc.
#
# This work is licensed under the GNU GPLv2 or later.
# See the COPYING file in the top-level directory.
from .device import Device
from ..xmlbuilder import XMLProperty
class DeviceVideo(Device):
XML_NAME = "video"
_XML_PROP_ORDER = ["model", "vram", "heads", "vgamem"]
model = XMLProperty("./model/@type")
vram = XMLProperty("./model/@vram", is_int=True)
vram64 = XMLProperty("./model/@vram64", is_int=True)
ram = XMLProperty("./model/@ram", is_int=True)
heads = XMLProperty("./model/@heads", is_int=True)
vgamem = XMLProperty("./model/@vgamem", is_int=True)
accel3d = XMLProperty("./model/acceleration/@accel3d", is_yesno=True)
##################
# Default config #
##################
@staticmethod
def default_model(guest):
if not guest.os.is_hvm():
return None
if guest.os.is_pseries():
return "vga"
if guest.os.is_arm_machvirt() or guest.os.is_riscv_virt():
return "virtio"
if guest.conn.is_qemu() and guest.os.is_s390x():
return "virtio"
if guest.has_spice() and guest.os.is_x86():
if guest.has_gl():
return "virtio"
return "qxl"
if (guest.is_uefi() and
guest.lookup_domcaps().supports_video_bochs()):
return "bochs"
if guest.conn.is_qemu():
return "qxl"
return "vga"
def set_defaults(self, guest):
if not self.model:
self.model = self.default_model(guest)
if self.model == 'virtio' and guest.has_gl():
self.accel3d = True