Skip to contentSkip to conversation

vga: Fix text mode screendumps

PATCH Applied Jan Kiszka 3 participants 3 messages Sep 15, 2011 – Sep 23, 2011

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 vga: Fix text mode screendumps

From: Jan Kiszka <[email protected]>

In text mode, even a full refresh of the screen takes multiple updates. As we reset the dump file pointer after the first call, we only wrote the first line.

---
 hw/vga.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)
hw/vga.c +3 -4
index 0a0c5a6..f9a6014 100644
@@ -149,7 +149,7 @@ static uint16_t expand2[256];
 static uint8_t expand4to8[16];
 
 static void vga_screen_dump(void *opaque, const char *filename);
-static char *screen_dump_filename;
+static const char *screen_dump_filename;
 static DisplayChangeListener *screen_dump_dcl;
 
 static void vga_update_memory_access(VGACommonState *s)
@@ -2319,7 +2319,6 @@ static void vga_save_dpy_update(DisplayState *ds,
 {
     if (screen_dump_filename) {
         ppm_save(screen_dump_filename, ds->surface);
-        screen_dump_filename = NULL;
     }
 }
 
@@ -2397,8 +2396,8 @@ static void vga_screen_dump(void *opaque, const char *filename)
     if (!screen_dump_dcl)
         screen_dump_dcl = vga_screen_dump_init(s->ds);
 
-    screen_dump_filename = (char *)filename;
+    screen_dump_filename = filename;
     vga_invalidate_display(s);
     vga_hw_update();
+    screen_dump_filename = NULL;
 }
-
#1 lore raw

on 16/09/2011 01:47 Jan Kiszka said the following:

Quoted 5 lines

From: Jan Kiszka <[email protected]>

In text mode, even a full refresh of the screen takes multiple updates. As we reset the dump file pointer after the first call, we only wrote the first line.

Thank you very much!
I can confirm that with the patch I get a complete screen dump.

Quoted 37 lines
---
 hw/vga.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)
hw/vga.c +3 -4
index 0a0c5a6..f9a6014 100644
@@ -149,7 +149,7 @@ static uint16_t expand2[256];
 static uint8_t expand4to8[16];
 
 static void vga_screen_dump(void *opaque, const char *filename);
-static char *screen_dump_filename;
+static const char *screen_dump_filename;
 static DisplayChangeListener *screen_dump_dcl;
 
 static void vga_update_memory_access(VGACommonState *s)
@@ -2319,7 +2319,6 @@ static void vga_save_dpy_update(DisplayState *ds,
 {
     if (screen_dump_filename) {
         ppm_save(screen_dump_filename, ds->surface);
-        screen_dump_filename = NULL;
     }
 }
 
@@ -2397,8 +2396,8 @@ static void vga_screen_dump(void *opaque, const char *filename)
     if (!screen_dump_dcl)
         screen_dump_dcl = vga_screen_dump_init(s->ds);
 
-    screen_dump_filename = (char *)filename;
+    screen_dump_filename = filename;
     vga_invalidate_display(s);
     vga_hw_update();
+    screen_dump_filename = NULL;
 }
-
Signature · 1 line
Andriy Gapon
#2 lore raw
In reply to Jan Kiszka
Quoted 7 lines · Jan Kiszka

From: Jan Kiszka<[email protected]>

In text mode, even a full refresh of the screen takes multiple updates. As we reset the dump file pointer after the first call, we only wrote the first line.

Applied. Thanks.

Regards,

Anthony Liguori

Quoted 38 lines
---
  hw/vga.c |    7 +++----
  1 files changed, 3 insertions(+), 4 deletions(-)
hw/vga.c +3 -4
index 0a0c5a6..f9a6014 100644
@@ -149,7 +149,7 @@ static uint16_t expand2[256];
  static uint8_t expand4to8[16];
 
  static void vga_screen_dump(void *opaque, const char *filename);
-static char *screen_dump_filename;
+static const char *screen_dump_filename;
  static DisplayChangeListener *screen_dump_dcl;
 
  static void vga_update_memory_access(VGACommonState *s)
@@ -2319,7 +2319,6 @@ static void vga_save_dpy_update(DisplayState *ds,
  {
      if (screen_dump_filename) {
          ppm_save(screen_dump_filename, ds->surface);
-        screen_dump_filename = NULL;
      }
  }
 
@@ -2397,8 +2396,8 @@ static void vga_screen_dump(void *opaque, const char *filename)
      if (!screen_dump_dcl)
          screen_dump_dcl = vga_screen_dump_init(s->ds);
 
-    screen_dump_filename = (char *)filename;
+    screen_dump_filename = filename;
      vga_invalidate_display(s);
      vga_hw_update();
+    screen_dump_filename = NULL;
  }
-