summaryrefslogtreecommitdiffstats
path: root/hw/display/vga.c
diff options
context:
space:
mode:
authorGerd Hoffmann2014-08-26 14:16:30 +0200
committerGerd Hoffmann2014-09-04 08:22:48 +0200
commit54a85d462447c1cb8a1638578a7fd086350b4d2d (patch)
tree0fa270ba99f627e5c4ffba1996b58c837c397357 /hw/display/vga.c
parentMerge remote-tracking branch 'remotes/spice/tags/pull-spice-20140902-1' into ... (diff)
downloadqemu-54a85d462447c1cb8a1638578a7fd086350b4d2d.tar.gz
qemu-54a85d462447c1cb8a1638578a7fd086350b4d2d.tar.xz
qemu-54a85d462447c1cb8a1638578a7fd086350b4d2d.zip
vbe: make bochs dispi interface return the correct memory size with qxl
VgaState->vram_size is the size of the pci bar. In case of qxl not the whole pci bar can be used as vga framebuffer. Add a new variable vbe_size to handle that case. By default (if unset) it equals vram_size, but qxl can set vbe_size to something else. This makes sure VBE_DISPI_INDEX_VIDEO_MEMORY_64K returns correct results and sanity checks are done with the correct size too. Cc: qemu-stable@nongnu.org Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Diffstat (limited to 'hw/display/vga.c')
-rw-r--r--hw/display/vga.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/hw/display/vga.c b/hw/display/vga.c
index 65dab8dbed..99251d7698 100644
--- a/hw/display/vga.c
+++ b/hw/display/vga.c
@@ -610,7 +610,7 @@ uint32_t vbe_ioport_read_data(void *opaque, uint32_t addr)
val = s->vbe_regs[s->vbe_index];
}
} else if (s->vbe_index == VBE_DISPI_INDEX_VIDEO_MEMORY_64K) {
- val = s->vram_size / (64 * 1024);
+ val = s->vbe_size / (64 * 1024);
} else {
val = 0;
}
@@ -749,7 +749,7 @@ void vbe_ioport_write_data(void *opaque, uint32_t addr, uint32_t val)
line_offset = w >> 1;
else
line_offset = w * ((s->vbe_regs[VBE_DISPI_INDEX_BPP] + 7) >> 3);
- h = s->vram_size / line_offset;
+ h = s->vbe_size / line_offset;
/* XXX: support weird bochs semantics ? */
if (h < s->vbe_regs[VBE_DISPI_INDEX_YRES])
return;
@@ -2285,6 +2285,9 @@ void vga_common_init(VGACommonState *s, Object *obj, bool global_vmstate)
s->vram_size <<= 1;
}
s->vram_size_mb = s->vram_size >> 20;
+ if (!s->vbe_size) {
+ s->vbe_size = s->vram_size;
+ }
s->is_vbe_vmstate = 1;
memory_region_init_ram(&s->vram, obj, "vga.vram", s->vram_size);