Patchwork fix screendump

login
register
mail settings
Submitter Gerd Hoffmann
Date March 1, 2012, 7:34 a.m.
Message ID <1330587280-13038-1-git-send-email-kraxel@redhat.com>
Download mbox | patch
Permalink /patch/143944/
State New
Headers show

Comments

Gerd Hoffmann - March 1, 2012, 7:34 a.m.
Commit 45efb16124efef51de5157afc31984b5a47700f9 optimized a bit too
much.  We can skip the vga_invalidate_display() in case no console
switch happened because we don't need a full redraw then.  We can *not*
skip vga_hw_update() though, because the screen content will be stale
then in case nobody else calls vga_hw_update().

Trigger: vga textmode with vnc display and no client connected.

Reported-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/blizzard.c  |    4 +---
 hw/omap_lcdc.c |    5 ++---
 hw/vga.c       |    2 +-
 3 files changed, 4 insertions(+), 7 deletions(-)
Alon Levy - March 1, 2012, 10:45 a.m.
On Thu, Mar 01, 2012 at 08:34:40AM +0100, Gerd Hoffmann wrote:
> Commit 45efb16124efef51de5157afc31984b5a47700f9 optimized a bit too
> much.  We can skip the vga_invalidate_display() in case no console
> switch happened because we don't need a full redraw then.  We can *not*
> skip vga_hw_update() though, because the screen content will be stale
> then in case nobody else calls vga_hw_update().
> 
> Trigger: vga textmode with vnc display and no client connected.
> 

Reviewed-by: Alon Levy <alevy@redhat.com>

> Reported-by: Avi Kivity <avi@redhat.com>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  hw/blizzard.c  |    4 +---
>  hw/omap_lcdc.c |    5 ++---
>  hw/vga.c       |    2 +-
>  3 files changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/hw/blizzard.c b/hw/blizzard.c
> index c7d844d..29074c4 100644
> --- a/hw/blizzard.c
> +++ b/hw/blizzard.c
> @@ -937,9 +937,7 @@ static void blizzard_screen_dump(void *opaque, const char *filename,
>  {
>      BlizzardState *s = (BlizzardState *) opaque;
>  
> -    if (cswitch) {
> -        blizzard_update_display(opaque);
> -    }
> +    blizzard_update_display(opaque);
>      if (s && ds_get_data(s->state))
>          ppm_save(filename, s->state->surface);
>  }
> diff --git a/hw/omap_lcdc.c b/hw/omap_lcdc.c
> index f172093..4a08e9d 100644
> --- a/hw/omap_lcdc.c
> +++ b/hw/omap_lcdc.c
> @@ -267,9 +267,8 @@ static int ppm_save(const char *filename, uint8_t *data,
>  static void omap_screen_dump(void *opaque, const char *filename, bool cswitch)
>  {
>      struct omap_lcd_panel_s *omap_lcd = opaque;
> -    if (cswitch) {
> -        omap_update_display(opaque);
> -    }
> +
> +    omap_update_display(opaque);
>      if (omap_lcd && ds_get_data(omap_lcd->state))
>          ppm_save(filename, ds_get_data(omap_lcd->state),
>                  omap_lcd->width, omap_lcd->height,
> diff --git a/hw/vga.c b/hw/vga.c
> index 5994f43..16546ef 100644
> --- a/hw/vga.c
> +++ b/hw/vga.c
> @@ -2413,7 +2413,7 @@ static void vga_screen_dump(void *opaque, const char *filename, bool cswitch)
>  
>      if (cswitch) {
>          vga_invalidate_display(s);
> -        vga_hw_update();
>      }
> +    vga_hw_update();
>      ppm_save(filename, s->ds->surface);
>  }
> -- 
> 1.7.1
> 
>
Avi Kivity - March 1, 2012, 11:06 a.m.
On 03/01/2012 09:34 AM, Gerd Hoffmann wrote:
> Commit 45efb16124efef51de5157afc31984b5a47700f9 optimized a bit too
> much.  We can skip the vga_invalidate_display() in case no console
> switch happened because we don't need a full redraw then.  We can *not*
> skip vga_hw_update() though, because the screen content will be stale
> then in case nobody else calls vga_hw_update().
>
> Trigger: vga textmode with vnc display and no client connected.
>
> Reported-by: Avi Kivity <avi@redhat.com>

-and-Tested.  Thanks.

> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
>
Jan Kiszka - March 19, 2012, 4:41 p.m.
On 2012-03-01 08:34, Gerd Hoffmann wrote:
> Commit 45efb16124efef51de5157afc31984b5a47700f9 optimized a bit too
> much.  We can skip the vga_invalidate_display() in case no console
> switch happened because we don't need a full redraw then.  We can *not*
> skip vga_hw_update() though, because the screen content will be stale
> then in case nobody else calls vga_hw_update().
> 
> Trigger: vga textmode with vnc display and no client connected.
> 
> Reported-by: Avi Kivity <avi@redhat.com>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

I find this in qemu-kvm but not in upstream. Forgotten or just sleeping
in some queue?

Jan
Blue Swirl - March 24, 2012, 4:11 p.m.
Thanks, applied.

On Thu, Mar 1, 2012 at 07:34, Gerd Hoffmann <kraxel@redhat.com> wrote:
> Commit 45efb16124efef51de5157afc31984b5a47700f9 optimized a bit too
> much.  We can skip the vga_invalidate_display() in case no console
> switch happened because we don't need a full redraw then.  We can *not*
> skip vga_hw_update() though, because the screen content will be stale
> then in case nobody else calls vga_hw_update().
>
> Trigger: vga textmode with vnc display and no client connected.
>
> Reported-by: Avi Kivity <avi@redhat.com>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  hw/blizzard.c  |    4 +---
>  hw/omap_lcdc.c |    5 ++---
>  hw/vga.c       |    2 +-
>  3 files changed, 4 insertions(+), 7 deletions(-)
>
> diff --git a/hw/blizzard.c b/hw/blizzard.c
> index c7d844d..29074c4 100644
> --- a/hw/blizzard.c
> +++ b/hw/blizzard.c
> @@ -937,9 +937,7 @@ static void blizzard_screen_dump(void *opaque, const char *filename,
>  {
>     BlizzardState *s = (BlizzardState *) opaque;
>
> -    if (cswitch) {
> -        blizzard_update_display(opaque);
> -    }
> +    blizzard_update_display(opaque);
>     if (s && ds_get_data(s->state))
>         ppm_save(filename, s->state->surface);
>  }
> diff --git a/hw/omap_lcdc.c b/hw/omap_lcdc.c
> index f172093..4a08e9d 100644
> --- a/hw/omap_lcdc.c
> +++ b/hw/omap_lcdc.c
> @@ -267,9 +267,8 @@ static int ppm_save(const char *filename, uint8_t *data,
>  static void omap_screen_dump(void *opaque, const char *filename, bool cswitch)
>  {
>     struct omap_lcd_panel_s *omap_lcd = opaque;
> -    if (cswitch) {
> -        omap_update_display(opaque);
> -    }
> +
> +    omap_update_display(opaque);
>     if (omap_lcd && ds_get_data(omap_lcd->state))
>         ppm_save(filename, ds_get_data(omap_lcd->state),
>                 omap_lcd->width, omap_lcd->height,
> diff --git a/hw/vga.c b/hw/vga.c
> index 5994f43..16546ef 100644
> --- a/hw/vga.c
> +++ b/hw/vga.c
> @@ -2413,7 +2413,7 @@ static void vga_screen_dump(void *opaque, const char *filename, bool cswitch)
>
>     if (cswitch) {
>         vga_invalidate_display(s);
> -        vga_hw_update();
>     }
> +    vga_hw_update();
>     ppm_save(filename, s->ds->surface);
>  }
> --
> 1.7.1
>
>

Patch

diff --git a/hw/blizzard.c b/hw/blizzard.c
index c7d844d..29074c4 100644
--- a/hw/blizzard.c
+++ b/hw/blizzard.c
@@ -937,9 +937,7 @@  static void blizzard_screen_dump(void *opaque, const char *filename,
 {
     BlizzardState *s = (BlizzardState *) opaque;
 
-    if (cswitch) {
-        blizzard_update_display(opaque);
-    }
+    blizzard_update_display(opaque);
     if (s && ds_get_data(s->state))
         ppm_save(filename, s->state->surface);
 }
diff --git a/hw/omap_lcdc.c b/hw/omap_lcdc.c
index f172093..4a08e9d 100644
--- a/hw/omap_lcdc.c
+++ b/hw/omap_lcdc.c
@@ -267,9 +267,8 @@  static int ppm_save(const char *filename, uint8_t *data,
 static void omap_screen_dump(void *opaque, const char *filename, bool cswitch)
 {
     struct omap_lcd_panel_s *omap_lcd = opaque;
-    if (cswitch) {
-        omap_update_display(opaque);
-    }
+
+    omap_update_display(opaque);
     if (omap_lcd && ds_get_data(omap_lcd->state))
         ppm_save(filename, ds_get_data(omap_lcd->state),
                 omap_lcd->width, omap_lcd->height,
diff --git a/hw/vga.c b/hw/vga.c
index 5994f43..16546ef 100644
--- a/hw/vga.c
+++ b/hw/vga.c
@@ -2413,7 +2413,7 @@  static void vga_screen_dump(void *opaque, const char *filename, bool cswitch)
 
     if (cswitch) {
         vga_invalidate_display(s);
-        vga_hw_update();
     }
+    vga_hw_update();
     ppm_save(filename, s->ds->surface);
 }