diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2013-03-13 14:04:18 +0100 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2013-04-16 09:03:49 +0200 |
commit | 380cd056ec0e7fc8bbd553cdcb061d3ca612bb82 (patch) | |
tree | e8097697817029ca6d545b8f68ba9761fb0f8164 /hw/display/vmware_vga.c | |
parent | 27be55872dd747c733a42a3d90864d9f59272d26 (diff) |
console: add GraphicHwOps
Pass a single GraphicHwOps struct pointer to graphic_console_init,
instead of a bunch of function pointers.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/display/vmware_vga.c')
-rw-r--r-- | hw/display/vmware_vga.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c index 61d8c15367..263bf0915e 100644 --- a/hw/display/vmware_vga.c +++ b/hw/display/vmware_vga.c @@ -913,7 +913,7 @@ static void vmsvga_value_write(void *opaque, uint32_t address, uint32_t value) case SVGA_REG_ENABLE: s->enable = !!value; s->invalidated = 1; - s->vga.invalidate(&s->vga); + s->vga.hw_ops->invalidate(&s->vga); if (s->enable && s->config) { vga_dirty_log_stop(&s->vga); } else { @@ -1058,7 +1058,7 @@ static void vmsvga_update_display(void *opaque) bool dirty = false; if (!s->enable) { - s->vga.update(&s->vga); + s->vga.hw_ops->gfx_update(&s->vga); return; } @@ -1112,7 +1112,7 @@ static void vmsvga_invalidate_display(void *opaque) { struct vmsvga_state_s *s = opaque; if (!s->enable) { - s->vga.invalidate(&s->vga); + s->vga.hw_ops->invalidate(&s->vga); return; } @@ -1123,8 +1123,8 @@ static void vmsvga_text_update(void *opaque, console_ch_t *chardata) { struct vmsvga_state_s *s = opaque; - if (s->vga.text_update) { - s->vga.text_update(&s->vga, chardata); + if (s->vga.hw_ops->text_update) { + s->vga.hw_ops->text_update(&s->vga, chardata); } } @@ -1179,15 +1179,19 @@ static const VMStateDescription vmstate_vmware_vga = { } }; +static const GraphicHwOps vmsvga_ops = { + .invalidate = vmsvga_invalidate_display, + .gfx_update = vmsvga_update_display, + .text_update = vmsvga_text_update, +}; + static void vmsvga_init(struct vmsvga_state_s *s, MemoryRegion *address_space, MemoryRegion *io) { s->scratch_size = SVGA_SCRATCH_SIZE; s->scratch = g_malloc(s->scratch_size * 4); - s->vga.con = graphic_console_init(vmsvga_update_display, - vmsvga_invalidate_display, - vmsvga_text_update, s); + s->vga.con = graphic_console_init(&vmsvga_ops, s); s->fifo_size = SVGA_FIFO_SIZE; memory_region_init_ram(&s->fifo_ram, "vmsvga.fifo", s->fifo_size); |