Patchwork [02/24] hw/vmware_vga.c: fix screen resize bug introduced after console revamp

login
register
mail settings
Submitter Gerd Hoffmann
Date April 4, 2013, 7:28 a.m.
Message ID <1365060546-24638-3-git-send-email-kraxel@redhat.com>
Download mbox | patch
Permalink /patch/233651/
State New
Headers show

Comments

Gerd Hoffmann - April 4, 2013, 7:28 a.m.
From: Igor Mitsyanko <i.mitsyanko@gmail.com>

In vmsvga display update function, a pointer to DisplaySurface must be acquired
after a call to vmsvga_check_size since this function might replace current
DisplaySurface with a new one.

Signed-off-by: Igor Mitsyanko <i.mitsyanko@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/vmware_vga.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Alexandru Damian - April 5, 2013, 11:21 a.m.
+1, verified to work with both 16-bit and 32-bit depth consoles.

Alex

On Thu, Apr 04, 2013 at 09:28:44AM +0200, Gerd Hoffmann wrote:
> From: Igor Mitsyanko <i.mitsyanko@gmail.com>
> 
> In vmsvga display update function, a pointer to DisplaySurface must be acquired
> after a call to vmsvga_check_size since this function might replace current
> DisplaySurface with a new one.
> 
> Signed-off-by: Igor Mitsyanko <i.mitsyanko@gmail.com>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  hw/vmware_vga.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/vmware_vga.c b/hw/vmware_vga.c
> index 5b9ce8f..c0aac31 100644
> --- a/hw/vmware_vga.c
> +++ b/hw/vmware_vga.c
> @@ -995,7 +995,7 @@ static inline void vmsvga_check_size(struct vmsvga_state_s *s)
>  static void vmsvga_update_display(void *opaque)
>  {
>      struct vmsvga_state_s *s = opaque;
> -    DisplaySurface *surface = qemu_console_surface(s->vga.con);
> +    DisplaySurface *surface;
>      bool dirty = false;
>  
>      if (!s->enable) {
> @@ -1004,6 +1004,7 @@ static void vmsvga_update_display(void *opaque)
>      }
>  
>      vmsvga_check_size(s);
> +    surface = qemu_console_surface(s->vga.con);
>  
>      vmsvga_fifo_run(s);
>      vmsvga_update_rect_flush(s);
> -- 
> 1.7.9.7
> 
>

Patch

diff --git a/hw/vmware_vga.c b/hw/vmware_vga.c
index 5b9ce8f..c0aac31 100644
--- a/hw/vmware_vga.c
+++ b/hw/vmware_vga.c
@@ -995,7 +995,7 @@  static inline void vmsvga_check_size(struct vmsvga_state_s *s)
 static void vmsvga_update_display(void *opaque)
 {
     struct vmsvga_state_s *s = opaque;
-    DisplaySurface *surface = qemu_console_surface(s->vga.con);
+    DisplaySurface *surface;
     bool dirty = false;
 
     if (!s->enable) {
@@ -1004,6 +1004,7 @@  static void vmsvga_update_display(void *opaque)
     }
 
     vmsvga_check_size(s);
+    surface = qemu_console_surface(s->vga.con);
 
     vmsvga_fifo_run(s);
     vmsvga_update_rect_flush(s);