aboutsummaryrefslogtreecommitdiff
path: root/hw/display/vga.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2014-08-19 13:00:57 +0100
committerPeter Maydell <peter.maydell@linaro.org>2014-08-19 13:00:57 +0100
commit0e4a77370594c91dd126f9872893ed473374cc72 (patch)
tree821715343d4c22b6e71d98676b51e63d59466c55 /hw/display/vga.c
parent8e6e2c2ae7a81f625cf1cb320891d5270e277548 (diff)
parentf54bb15f9d373877954e44db3a8bb368aff45b42 (diff)
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging
SCSI changes that enable sending vendor-specific commands via virtio-scsi. Memory changes for QOMification and automatic tracking of MR lifetime. # gpg: Signature made Mon 18 Aug 2014 13:03:09 BST using RSA key ID 9B4D86F2 # gpg: Good signature from "Paolo Bonzini <pbonzini@redhat.com>" # gpg: aka "Paolo Bonzini <bonzini@gnu.org>" * remotes/bonzini/tags/for-upstream: mtree: remove write-only field memory: Use canonical path component as the name memory: Use memory_region_name for name access memory: constify memory_region_name exec: Abstract away ref to memory region names loader: Abstract away ref to memory region names tpm_tis: remove instance_finalize callback memory: remove memory_region_destroy memory: convert memory_region_destroy to object_unparent ioport: split deletion and destruction nic: do not destroy memory regions in cleanup functions vga: do not dynamically allocate chain4_alias sysbus: remove unused function sysbus_del_io qom: object: move unparenting to the child property's release callback qom: object: delete properties before calling instance_finalize virtio-scsi: implement parse_cdb scsi-block, scsi-generic: implement parse_cdb scsi-block: extract scsi_block_is_passthrough scsi-bus: introduce parse_cdb in SCSIDeviceClass and SCSIBusInfo scsi-bus: prepare scsi_req_new for introduction of parse_cdb Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/display/vga.c')
-rw-r--r--hw/display/vga.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/hw/display/vga.c b/hw/display/vga.c
index 4b089a36ae..65dab8dbed 100644
--- a/hw/display/vga.c
+++ b/hw/display/vga.c
@@ -168,15 +168,18 @@ static uint8_t expand4to8[16];
static void vga_update_memory_access(VGACommonState *s)
{
- MemoryRegion *region, *old_region = s->chain4_alias;
hwaddr base, offset, size;
if (s->legacy_address_space == NULL) {
return;
}
- s->chain4_alias = NULL;
-
+ if (s->has_chain4_alias) {
+ memory_region_del_subregion(s->legacy_address_space, &s->chain4_alias);
+ object_unparent(OBJECT(&s->chain4_alias));
+ s->has_chain4_alias = false;
+ s->plane_updated = 0xf;
+ }
if ((s->sr[VGA_SEQ_PLANE_WRITE] & VGA_SR02_ALL_PLANES) ==
VGA_SR02_ALL_PLANES && s->sr[VGA_SEQ_MEMORY_MODE] & VGA_SR04_CHN_4M) {
offset = 0;
@@ -201,18 +204,11 @@ static void vga_update_memory_access(VGACommonState *s)
break;
}
base += isa_mem_base;
- region = g_malloc(sizeof(*region));
- memory_region_init_alias(region, memory_region_owner(&s->vram),
+ memory_region_init_alias(&s->chain4_alias, memory_region_owner(&s->vram),
"vga.chain4", &s->vram, offset, size);
memory_region_add_subregion_overlap(s->legacy_address_space, base,
- region, 2);
- s->chain4_alias = region;
- }
- if (old_region) {
- memory_region_del_subregion(s->legacy_address_space, old_region);
- memory_region_destroy(old_region);
- g_free(old_region);
- s->plane_updated = 0xf;
+ &s->chain4_alias, 2);
+ s->has_chain4_alias = true;
}
}
@@ -1321,7 +1317,7 @@ static void vga_draw_text(VGACommonState *s, int full_update)
s->font_offsets[1] = offset;
full_update = 1;
}
- if (s->plane_updated & (1 << 2) || s->chain4_alias) {
+ if (s->plane_updated & (1 << 2) || s->has_chain4_alias) {
/* if the plane 2 was modified since the last display, it
indicates the font may have been modified */
s->plane_updated = 0;