Gerd Hoffmann a écrit :
Need a way to opt-out from vga.vram being global vmstate, for
secondary vga cards.  Add a bool parameter to vga_common_init
to support this.

Signed-off-by: Gerd Hoffmann <kra...@redhat.com>
---
 hw/display/cirrus_vga.c | 4 ++--
 hw/display/qxl.c        | 2 +-
 hw/display/vga-isa-mm.c | 2 +-
 hw/display/vga-isa.c    | 2 +-
 hw/display/vga-pci.c    | 2 +-
 hw/display/vga.c        | 4 ++--
 hw/display/vga_int.h    | 2 +-
 hw/display/vmware_vga.c | 2 +-
 8 files changed, 10 insertions(+), 10 deletions(-)

[...]

diff --git a/hw/display/vga-pci.c b/hw/display/vga-pci.c
index b3a45c8..dee180f 100644
--- a/hw/display/vga-pci.c
+++ b/hw/display/vga-pci.c
@@ -147,7 +147,7 @@ static int pci_std_vga_initfn(PCIDevice *dev)
     VGACommonState *s = &d->vga;
/* vga + console init */
-    vga_common_init(s, OBJECT(dev));
+    vga_common_init(s, OBJECT(dev), true);
     vga_init(s, OBJECT(dev), pci_address_space(dev), pci_address_space_io(dev),
              true);
diff --git a/hw/display/vga.c b/hw/display/vga.c
index 7b91d9c..fea30e5 100644
--- a/hw/display/vga.c
+++ b/hw/display/vga.c
@@ -2257,7 +2257,7 @@ static const GraphicHwOps vga_ops = {
     .text_update = vga_update_text,
 };
-void vga_common_init(VGACommonState *s, Object *obj)
+void vga_common_init(VGACommonState *s, Object *obj, bool global_vmstate)
 {
     int i, j, v, b;
@@ -2294,7 +2294,7 @@ void vga_common_init(VGACommonState *s, Object *obj) s->is_vbe_vmstate = 1;
     memory_region_init_ram(&s->vram, obj, "vga.vram", s->vram_size);
-    vmstate_register_ram_global(&s->vram);
+    vmstate_register_ram(&s->vram, global_vmstate ? NULL : DEVICE(obj));

Is it possible to do it depending of the QEMU compatibility version, or of some property, so we don't have to keep this global vmstate forever? With this, I think we can also expect to be able to specify "-device VGA" twice, and see the BIOS messages on one card or another.

Hervé

Reply via email to