qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] hw/display/virtio-vga: made vga memory size configurable


From: vitaly
Subject: [PATCH] hw/display/virtio-vga: made vga memory size configurable
Date: Sun, 14 Mar 2021 13:23:14 +0100

From: Vitaly Chipounov <vitaly@cyberhaven.com>

This enables higher resolutions. The default is still 8MB for
backwards compatibility with existing snapshots.

The property name "vgamem_fb" is similar to that of the other
graphic adapters.

seabios/vgasrc/svgamodes.c needs to be updated as well.
For example, adding the following line would expose
a 3840x2160 resolution to the guest.

{ 0x199, { MM_DIRECT, 3840, 2160, 32, 8, 16, SEG_GRAPH } },

Signed-off-by: Vitaly Chipounov <vitaly@cyberhaven.com>
---
 hw/display/virtio-vga.c | 3 ++-
 hw/virtio/virtio-pci.h  | 2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/hw/display/virtio-vga.c b/hw/display/virtio-vga.c
index d3c6404061..657fafc48f 100644
--- a/hw/display/virtio-vga.c
+++ b/hw/display/virtio-vga.c
@@ -118,7 +118,7 @@ static void virtio_vga_base_realize(VirtIOPCIProxy 
*vpci_dev, Error **errp)
     int i;
 
     /* init vga compat bits */
-    vga->vram_size_mb = 8;
+    vga->vram_size_mb = vpci_dev->vgamem_size_mb;
     vga_common_init(vga, OBJECT(vpci_dev));
     vga_init(vga, OBJECT(vpci_dev), pci_address_space(&vpci_dev->pci_dev),
              pci_address_space_io(&vpci_dev->pci_dev), true);
@@ -204,6 +204,7 @@ static void virtio_vga_set_big_endian_fb(Object *obj, bool 
value, Error **errp)
 
 static Property virtio_vga_base_properties[] = {
     DEFINE_VIRTIO_GPU_PCI_PROPERTIES(VirtIOPCIProxy),
+    DEFINE_PROP_UINT32("vgamem_mb", VirtIOPCIProxy, vgamem_size_mb, 8),
     DEFINE_PROP_END_OF_LIST(),
 };
 
diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h
index d7d5d403a9..8684311a8d 100644
--- a/hw/virtio/virtio-pci.h
+++ b/hw/virtio/virtio-pci.h
@@ -151,6 +151,8 @@ struct VirtIOPCIProxy {
     VirtIOIRQFD *vector_irqfd;
     int nvqs_with_notifiers;
     VirtioBusState bus;
+
+    uint32_t vgamem_size_mb;
 };
 
 static inline bool virtio_pci_modern(VirtIOPCIProxy *proxy)
-- 
2.25.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]