mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 08:43:55 -06:00
vga: simplify screendump
The displaychangelistener isn't needed at all, we can simply save the image when vga_hw_update is done instead of hooking into the update process. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
53370b78ec
commit
9a51f5b067
1 changed files with 1 additions and 35 deletions
36
hw/vga.c
36
hw/vga.c
|
@ -163,8 +163,6 @@ static uint16_t expand2[256];
|
||||||
static uint8_t expand4to8[16];
|
static uint8_t expand4to8[16];
|
||||||
|
|
||||||
static void vga_screen_dump(void *opaque, const char *filename);
|
static void vga_screen_dump(void *opaque, const char *filename);
|
||||||
static const char *screen_dump_filename;
|
|
||||||
static DisplayChangeListener *screen_dump_dcl;
|
|
||||||
|
|
||||||
static void vga_update_memory_access(VGACommonState *s)
|
static void vga_update_memory_access(VGACommonState *s)
|
||||||
{
|
{
|
||||||
|
@ -2364,22 +2362,6 @@ void vga_init_vbe(VGACommonState *s, MemoryRegion *system_memory)
|
||||||
/********************************************************/
|
/********************************************************/
|
||||||
/* vga screen dump */
|
/* vga screen dump */
|
||||||
|
|
||||||
static void vga_save_dpy_update(DisplayState *ds,
|
|
||||||
int x, int y, int w, int h)
|
|
||||||
{
|
|
||||||
if (screen_dump_filename) {
|
|
||||||
ppm_save(screen_dump_filename, ds->surface);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void vga_save_dpy_resize(DisplayState *s)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static void vga_save_dpy_refresh(DisplayState *s)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
int ppm_save(const char *filename, struct DisplaySurface *ds)
|
int ppm_save(const char *filename, struct DisplaySurface *ds)
|
||||||
{
|
{
|
||||||
FILE *f;
|
FILE *f;
|
||||||
|
@ -2423,29 +2405,13 @@ int ppm_save(const char *filename, struct DisplaySurface *ds)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static DisplayChangeListener* vga_screen_dump_init(DisplayState *ds)
|
|
||||||
{
|
|
||||||
DisplayChangeListener *dcl;
|
|
||||||
|
|
||||||
dcl = g_malloc0(sizeof(DisplayChangeListener));
|
|
||||||
dcl->dpy_update = vga_save_dpy_update;
|
|
||||||
dcl->dpy_resize = vga_save_dpy_resize;
|
|
||||||
dcl->dpy_refresh = vga_save_dpy_refresh;
|
|
||||||
register_displaychangelistener(ds, dcl);
|
|
||||||
return dcl;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* save the vga display in a PPM image even if no display is
|
/* save the vga display in a PPM image even if no display is
|
||||||
available */
|
available */
|
||||||
static void vga_screen_dump(void *opaque, const char *filename)
|
static void vga_screen_dump(void *opaque, const char *filename)
|
||||||
{
|
{
|
||||||
VGACommonState *s = opaque;
|
VGACommonState *s = opaque;
|
||||||
|
|
||||||
if (!screen_dump_dcl)
|
|
||||||
screen_dump_dcl = vga_screen_dump_init(s->ds);
|
|
||||||
|
|
||||||
screen_dump_filename = filename;
|
|
||||||
vga_invalidate_display(s);
|
vga_invalidate_display(s);
|
||||||
vga_hw_update();
|
vga_hw_update();
|
||||||
screen_dump_filename = NULL;
|
ppm_save(filename, s->ds->surface);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue