Patchwork [09/14] vga: stop direct access to DisplaySurface fields.

login
register
mail settings
Submitter Gerd Hoffmann
Date Oct. 17, 2012, 1:29 p.m.
Message ID <1350480554-23281-10-git-send-email-kraxel@redhat.com>
Download mbox | patch
Permalink /patch/192041/
State New
Headers show

Comments

Gerd Hoffmann - Oct. 17, 2012, 1:29 p.m.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/vga.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

Patch

diff --git a/hw/vga.c b/hw/vga.c
index a0ba94d..4d34469 100644
--- a/hw/vga.c
+++ b/hw/vga.c
@@ -1718,8 +1718,13 @@  static void vga_draw_graphic(VGACommonState *s, int full_update)
         s->last_depth = depth;
         full_update = 1;
     } else if (is_buffer_shared(s->ds->surface) &&
-               (full_update || s->ds->surface->data != s->vram_ptr + (s->start_addr * 4))) {
-        s->ds->surface->data = s->vram_ptr + (s->start_addr * 4);
+               (full_update || ds_get_data(s->ds) != s->vram_ptr
+                + (s->start_addr * 4))) {
+        qemu_free_displaysurface(s->ds);
+        s->ds->surface = qemu_create_displaysurface_from(disp_width,
+                height, depth,
+                s->line_offset,
+                s->vram_ptr + (s->start_addr * 4));
         dpy_gfx_setdata(s->ds);
     }