From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:55650) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S0VTr-0002tP-4G for qemu-devel@nongnu.org; Thu, 23 Feb 2012 05:01:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S0VTl-0001Ha-Ek for qemu-devel@nongnu.org; Thu, 23 Feb 2012 05:00:55 -0500 Received: from mx1.redhat.com ([209.132.183.28]:11926) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S0VTl-0001HP-81 for qemu-devel@nongnu.org; Thu, 23 Feb 2012 05:00:49 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q1NA0kdf020845 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 23 Feb 2012 05:00:46 -0500 Date: Thu, 23 Feb 2012 12:00:38 +0200 From: Alon Levy Message-ID: <20120223100038.GD6175@garlic.tlv.redhat.com> References: <1329988958-14103-1-git-send-email-kraxel@redhat.com> <1329988958-14103-2-git-send-email-kraxel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1329988958-14103-2-git-send-email-kraxel@redhat.com> Subject: Re: [Qemu-devel] [PATCH 1/2] vga: simplify screendump List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: qemu-devel@nongnu.org On Thu, Feb 23, 2012 at 10:22:37AM +0100, Gerd Hoffmann wrote: > 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. ACK. > --- > hw/vga.c | 36 +----------------------------------- > 1 files changed, 1 insertions(+), 35 deletions(-) > > diff --git a/hw/vga.c b/hw/vga.c > index c1029db..f8f30f8 100644 > --- a/hw/vga.c > +++ b/hw/vga.c > @@ -163,8 +163,6 @@ static uint16_t expand2[256]; > static uint8_t expand4to8[16]; > > 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) > { > @@ -2364,22 +2362,6 @@ void vga_init_vbe(VGACommonState *s, MemoryRegion *system_memory) > /********************************************************/ > /* 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) > { > FILE *f; > @@ -2423,29 +2405,13 @@ int ppm_save(const char *filename, struct DisplaySurface *ds) > 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 > available */ > static void vga_screen_dump(void *opaque, const char *filename) > { > 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_hw_update(); > - screen_dump_filename = NULL; > + ppm_save(filename, s->ds->surface); > } > -- > 1.7.1 > >