From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:35497) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TUBYh-0006gz-4T for qemu-devel@nongnu.org; Fri, 02 Nov 2012 03:20:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TUBYd-0007lb-8K for qemu-devel@nongnu.org; Fri, 02 Nov 2012 03:20:51 -0400 Received: from mout.web.de ([212.227.17.11]:55430) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TUBYc-0007kt-MI for qemu-devel@nongnu.org; Fri, 02 Nov 2012 03:20:47 -0400 Message-ID: <50937447.2030306@web.de> Date: Fri, 02 Nov 2012 08:20:39 +0100 From: Jan Kiszka MIME-Version: 1.0 References: <1351775057-3938-1-git-send-email-kraxel@redhat.com> <1351775057-3938-6-git-send-email-kraxel@redhat.com> In-Reply-To: <1351775057-3938-6-git-send-email-kraxel@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig1C832BAF2E500FCBF47267FF" Subject: Re: [Qemu-devel] [PATCH 05/22] console: untangle gfx & txt updates List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig1C832BAF2E500FCBF47267FF Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable On 2012-11-01 14:04, Gerd Hoffmann wrote: > Stop abusing displaysurface fields for text mode displays. > (bpp =3D 0, width =3D cols, height =3D lines). >=20 > Add flags to displaystate indicating whenever text mode display > (curses) or gfx mode displays (sdl, vnc, ...) are present. >=20 > Add separate displaychangelistener callbacks for text / gfx mode > resize & updates. >=20 > This allows to enable gfx and txt diplays at the same time and also > paves the way for more cleanups in the future. Breaks building xenfb.c. Jan >=20 > Signed-off-by: Gerd Hoffmann > --- > console.c | 59 +++++++++++++++++++++------------------- > console.h | 74 +++++++++++++++++++++++++++++++++++-------= -------- > hw/blizzard.c | 4 +- > hw/exynos4210_fimd.c | 2 +- > hw/g364fb.c | 7 +++-- > hw/jazz_led.c | 4 +- > hw/milkymist-vgafb.c | 2 +- > hw/musicpal.c | 2 +- > hw/nseries.c | 2 +- > hw/omap_lcdc.c | 2 +- > hw/palm.c | 2 +- > hw/pl110.c | 2 +- > hw/pxa2xx_lcd.c | 8 +++--- > hw/qxl-render.c | 10 +++--- > hw/qxl.c | 4 +- > hw/sm501.c | 4 +- > hw/ssd0303.c | 2 +- > hw/ssd0323.c | 2 +- > hw/tc6393xb.c | 4 +- > hw/tcx.c | 16 +++++----- > hw/vga.c | 34 ++++++++++------------- > hw/vmware_vga.c | 4 +- > ui/curses.c | 21 +++++--------- > ui/sdl.c | 12 ++++---- > ui/spice-display.c | 4 +- > ui/vnc.c | 8 +++--- > vl.c | 14 ++++++++- > 27 files changed, 171 insertions(+), 138 deletions(-) >=20 > diff --git a/console.c b/console.c > index b53dc1b..61812c7 100644 > --- a/console.c > +++ b/console.c > @@ -638,30 +638,33 @@ static void console_refresh(QemuConsole *s) > =20 > if (s !=3D active_console) > return; > - if (!ds_get_bits_per_pixel(s->ds)) { > + > + if (s->ds->have_text) { > s->text_x[0] =3D 0; > s->text_y[0] =3D 0; > s->text_x[1] =3D s->width - 1; > s->text_y[1] =3D s->height - 1; > s->cursor_invalidate =3D 1; > - return; > } > =20 > - vga_fill_rect(s->ds, 0, 0, ds_get_width(s->ds), ds_get_height(s->d= s), > - color_table[0][COLOR_BLACK]); > - y1 =3D s->y_displayed; > - for(y =3D 0; y < s->height; y++) { > - c =3D s->cells + y1 * s->width; > - for(x =3D 0; x < s->width; x++) { > - vga_putcharxy(s->ds, x, y, c->ch, > - &(c->t_attrib)); > - c++; > + if (s->ds->have_gfx) { > + vga_fill_rect(s->ds, 0, 0, ds_get_width(s->ds), ds_get_height(= s->ds), > + color_table[0][COLOR_BLACK]); > + y1 =3D s->y_displayed; > + for (y =3D 0; y < s->height; y++) { > + c =3D s->cells + y1 * s->width; > + for (x =3D 0; x < s->width; x++) { > + vga_putcharxy(s->ds, x, y, c->ch, > + &(c->t_attrib)); > + c++; > + } > + if (++y1 =3D=3D s->total_height) { > + y1 =3D 0; > + } > } > - if (++y1 =3D=3D s->total_height) > - y1 =3D 0; > + console_show_cursor(s, 1); > + dpy_gfx_update(s->ds, 0, 0, ds_get_width(s->ds), ds_get_height= (s->ds)); > } > - console_show_cursor(s, 1); > - dpy_update(s->ds, 0, 0, ds_get_width(s->ds), ds_get_height(s->ds))= ; > } > =20 > static void console_scroll(int ydelta) > @@ -1094,17 +1097,17 @@ void console_select(unsigned int index) > qemu_del_timer(active_console->cursor_timer); > } > active_console =3D s; > - if (ds_get_bits_per_pixel(s->ds)) { > + if (ds->have_gfx) { > ds->surface =3D qemu_resize_displaysurface(ds, s->g_width,= s->g_height); > - } else { > - s->ds->surface->width =3D s->width; > - s->ds->surface->height =3D s->height; > + dpy_gfx_resize(ds); > + } > + if (ds->have_text) { > + dpy_text_resize(ds, s->width, s->height); > } > if (s->cursor_timer) { > qemu_mod_timer(s->cursor_timer, > qemu_get_clock_ms(rt_clock) + CONSOLE_CURSOR_PERIOD= / 2); > } > - dpy_resize(s->ds); > vga_hw_invalidate(); > } > } > @@ -1123,10 +1126,10 @@ static int console_puts(CharDriverState *chr, c= onst uint8_t *buf, int len) > console_putchar(s, buf[i]); > } > console_show_cursor(s, 1); > - if (ds_get_bits_per_pixel(s->ds) && s->update_x0 < s->update_x1) {= > - dpy_update(s->ds, s->update_x0, s->update_y0, > - s->update_x1 - s->update_x0, > - s->update_y1 - s->update_y0); > + if (s->ds->have_gfx && s->update_x0 < s->update_x1) { > + dpy_gfx_update(s->ds, s->update_x0, s->update_y0, > + s->update_x1 - s->update_x0, > + s->update_y1 - s->update_y0); > } > return len; > } > @@ -1234,8 +1237,8 @@ static void text_console_update(void *opaque, con= sole_ch_t *chardata) > (s->cells[src].t_attrib.fgcol << 12) |= > (s->cells[src].t_attrib.bgcol << 8) | > (s->cells[src].t_attrib.bold << 21)); > - dpy_update(s->ds, s->text_x[0], s->text_y[0], > - s->text_x[1] - s->text_x[0], i - s->text_y[0]); > + dpy_text_update(s->ds, s->text_x[0], s->text_y[0], > + s->text_x[1] - s->text_x[0], i - s->text_y[0])= ; > s->text_x[0] =3D s->width; > s->text_y[0] =3D s->height; > s->text_x[1] =3D 0; > @@ -1596,7 +1599,7 @@ void qemu_console_resize(DisplayState *ds, int wi= dth, int height) > s->g_height =3D height; > if (is_graphic_console()) { > ds->surface =3D qemu_resize_displaysurface(ds, width, height);= > - dpy_resize(ds); > + dpy_gfx_resize(ds); > } > } > =20 > @@ -1604,7 +1607,7 @@ void qemu_console_copy(DisplayState *ds, int src_= x, int src_y, > int dst_x, int dst_y, int w, int h) > { > if (is_graphic_console()) { > - dpy_copy(ds, src_x, src_y, dst_x, dst_y, w, h); > + dpy_gfx_copy(ds, src_x, src_y, dst_x, dst_y, w, h); > } > } > =20 > diff --git a/console.h b/console.h > index fb38ce9..00e2f03 100644 > --- a/console.h > +++ b/console.h > @@ -154,15 +154,19 @@ struct DisplayChangeListener { > int idle; > uint64_t gui_timer_interval; > =20 > - void (*dpy_update)(struct DisplayState *s, int x, int y, int w, in= t h); > - void (*dpy_resize)(struct DisplayState *s); > - void (*dpy_setdata)(struct DisplayState *s); > void (*dpy_refresh)(struct DisplayState *s); > - void (*dpy_copy)(struct DisplayState *s, int src_x, int src_y, > - int dst_x, int dst_y, int w, int h); > - void (*dpy_fill)(struct DisplayState *s, int x, int y, > - int w, int h, uint32_t c); > + > + void (*dpy_gfx_update)(struct DisplayState *s, int x, int y, int w= , int h); > + void (*dpy_gfx_resize)(struct DisplayState *s); > + void (*dpy_gfx_setdata)(struct DisplayState *s); > + void (*dpy_gfx_copy)(struct DisplayState *s, int src_x, int src_y,= > + int dst_x, int dst_y, int w, int h); > + void (*dpy_gfx_fill)(struct DisplayState *s, int x, int y, > + int w, int h, uint32_t c); > + > void (*dpy_text_cursor)(struct DisplayState *s, int x, int y); > + void (*dpy_text_resize)(struct DisplayState *s, int w, int h); > + void (*dpy_text_update)(struct DisplayState *s, int x, int y, int = w, int h); > =20 > void (*dpy_mouse_set)(struct DisplayState *s, int x, int y, int on= ); > void (*dpy_cursor_define)(struct DisplayState *s, QEMUCursor *curs= or); > @@ -180,6 +184,8 @@ struct DisplayState { > struct DisplaySurface *surface; > void *opaque; > struct QEMUTimer *gui_timer; > + bool have_gfx; > + bool have_text; > =20 > struct DisplayAllocator* allocator; > QLIST_HEAD(, DisplayChangeListener) listeners; > @@ -244,28 +250,32 @@ static inline void unregister_displaychangelisten= er(DisplayState *ds, > gui_setup_refresh(ds); > } > =20 > -static inline void dpy_update(DisplayState *s, int x, int y, int w, in= t h) > +static inline void dpy_gfx_update(DisplayState *s, int x, int y, int w= , int h) > { > struct DisplayChangeListener *dcl; > QLIST_FOREACH(dcl, &s->listeners, next) { > - dcl->dpy_update(s, x, y, w, h); > + if (dcl->dpy_gfx_update) { > + dcl->dpy_gfx_update(s, x, y, w, h); > + } > } > } > =20 > -static inline void dpy_resize(DisplayState *s) > +static inline void dpy_gfx_resize(DisplayState *s) > { > struct DisplayChangeListener *dcl; > QLIST_FOREACH(dcl, &s->listeners, next) { > - dcl->dpy_resize(s); > + if (dcl->dpy_gfx_resize) { > + dcl->dpy_gfx_resize(s); > + } > } > } > =20 > -static inline void dpy_setdata(DisplayState *s) > +static inline void dpy_gfx_setdata(DisplayState *s) > { > struct DisplayChangeListener *dcl; > QLIST_FOREACH(dcl, &s->listeners, next) { > - if (dcl->dpy_setdata) { > - dcl->dpy_setdata(s); > + if (dcl->dpy_gfx_setdata) { > + dcl->dpy_gfx_setdata(s); > } > } > } > @@ -280,26 +290,26 @@ static inline void dpy_refresh(DisplayState *s) > } > } > =20 > -static inline void dpy_copy(struct DisplayState *s, int src_x, int src= _y, > +static inline void dpy_gfx_copy(struct DisplayState *s, int src_x, int= src_y, > int dst_x, int dst_y, int w, int h) > { > struct DisplayChangeListener *dcl; > QLIST_FOREACH(dcl, &s->listeners, next) { > - if (dcl->dpy_copy) { > - dcl->dpy_copy(s, src_x, src_y, dst_x, dst_y, w, h); > + if (dcl->dpy_gfx_copy) { > + dcl->dpy_gfx_copy(s, src_x, src_y, dst_x, dst_y, w, h); > } else { /* TODO */ > - dcl->dpy_update(s, dst_x, dst_y, w, h); > + dcl->dpy_gfx_update(s, dst_x, dst_y, w, h); > } > } > } > =20 > -static inline void dpy_fill(struct DisplayState *s, int x, int y, > - int w, int h, uint32_t c) > +static inline void dpy_gfx_fill(struct DisplayState *s, int x, int y, > + int w, int h, uint32_t c) > { > struct DisplayChangeListener *dcl; > QLIST_FOREACH(dcl, &s->listeners, next) { > - if (dcl->dpy_fill) { > - dcl->dpy_fill(s, x, y, w, h, c); > + if (dcl->dpy_gfx_fill) { > + dcl->dpy_gfx_fill(s, x, y, w, h, c); > } > } > } > @@ -314,6 +324,26 @@ static inline void dpy_text_cursor(struct DisplayS= tate *s, int x, int y) > } > } > =20 > +static inline void dpy_text_update(DisplayState *s, int x, int y, int = w, int h) > +{ > + struct DisplayChangeListener *dcl; > + QLIST_FOREACH(dcl, &s->listeners, next) { > + if (dcl->dpy_text_update) { > + dcl->dpy_text_update(s, x, y, w, h); > + } > + } > +} > + > +static inline void dpy_text_resize(DisplayState *s, int w, int h) > +{ > + struct DisplayChangeListener *dcl; > + QLIST_FOREACH(dcl, &s->listeners, next) { > + if (dcl->dpy_text_resize) { > + dcl->dpy_text_resize(s, w, h); > + } > + } > +} > + > static inline void dpy_mouse_set(struct DisplayState *s, int x, int y,= int on) > { > struct DisplayChangeListener *dcl; > diff --git a/hw/blizzard.c b/hw/blizzard.c > index 06e19b3..1b57eb5 100644 > --- a/hw/blizzard.c > +++ b/hw/blizzard.c > @@ -921,8 +921,8 @@ static void blizzard_update_display(void *opaque) > for (; y < s->my[1]; y ++, src +=3D bypl, dst +=3D bypl) > memcpy(dst, src, bwidth); > =20 > - dpy_update(s->state, s->mx[0], s->my[0], > - s->mx[1] - s->mx[0], y - s->my[0]); > + dpy_gfx_update(s->state, s->mx[0], s->my[0], > + s->mx[1] - s->mx[0], y - s->my[0]); > =20 > s->mx[0] =3D s->x; > s->mx[1] =3D 0; > diff --git a/hw/exynos4210_fimd.c b/hw/exynos4210_fimd.c > index 7cb2c31..f2443ca 100644 > --- a/hw/exynos4210_fimd.c > +++ b/hw/exynos4210_fimd.c > @@ -1307,7 +1307,7 @@ static void exynos4210_fimd_update(void *opaque) > fimd_copy_line_toqemu(global_width, s->ifb + global_width = * line * > RGBA_SIZE, d + global_width * line * bpp); > } > - dpy_update(s->console, 0, 0, global_width, global_height); > + dpy_gfx_update(s->console, 0, 0, global_width, global_height);= > } > s->invalidate =3D false; > s->vidintcon[1] |=3D FIMD_VIDINT_INTFRMPEND; > diff --git a/hw/g364fb.c b/hw/g364fb.c > index f7b4bf5..8192baf 100644 > --- a/hw/g364fb.c > +++ b/hw/g364fb.c > @@ -197,7 +197,8 @@ static void g364fb_draw_graphic8(G364State *s) > reset_dirty(s, page_min, page_max); > page_min =3D (ram_addr_t)-1; > page_max =3D 0; > - dpy_update(s->ds, xmin, ymin, xmax - xmin + 1, ymax - = ymin + 1); > + dpy_gfx_update(s->ds, xmin, ymin, > + xmax - xmin + 1, ymax - ymin + 1); > xmin =3D s->width; > xmax =3D 0; > ymin =3D s->height; > @@ -216,7 +217,7 @@ static void g364fb_draw_graphic8(G364State *s) > =20 > done: > if (page_min !=3D (ram_addr_t)-1) { > - dpy_update(s->ds, xmin, ymin, xmax - xmin + 1, ymax - ymin + 1= ); > + dpy_gfx_update(s->ds, xmin, ymin, xmax - xmin + 1, ymax - ymin= + 1); > reset_dirty(s, page_min, page_max); > } > } > @@ -238,7 +239,7 @@ static void g364fb_draw_blank(G364State *s) > d +=3D ds_get_linesize(s->ds); > } > =20 > - dpy_update(s->ds, 0, 0, s->width, s->height); > + dpy_gfx_update(s->ds, 0, 0, s->width, s->height); > s->blanked =3D 1; > } > =20 > diff --git a/hw/jazz_led.c b/hw/jazz_led.c > index 853bf6d..640e75e 100644 > --- a/hw/jazz_led.c > +++ b/hw/jazz_led.c > @@ -196,7 +196,7 @@ static void jazz_led_update_display(void *opaque) > } > =20 > s->state =3D REDRAW_NONE; > - dpy_update(ds, 0, 0, ds_get_width(ds), ds_get_height(ds)); > + dpy_gfx_update(ds, 0, 0, ds_get_width(ds), ds_get_height(ds)); > } > =20 > static void jazz_led_invalidate_display(void *opaque) > @@ -218,7 +218,7 @@ static void jazz_led_text_update(void *opaque, cons= ole_ch_t *chardata) > console_write_ch(chardata++, 0x00200100 | buf[0]); > console_write_ch(chardata++, 0x00200100 | buf[1]); > =20 > - dpy_update(s->ds, 0, 0, 2, 1); > + dpy_text_update(s->ds, 0, 0, 2, 1); > } > =20 > static int jazz_led_post_load(void *opaque, int version_id) > diff --git a/hw/milkymist-vgafb.c b/hw/milkymist-vgafb.c > index 8d36bc1..833881c 100644 > --- a/hw/milkymist-vgafb.c > +++ b/hw/milkymist-vgafb.c > @@ -134,7 +134,7 @@ static void vgafb_update_display(void *opaque) > &first, &last); > =20 > if (first >=3D 0) { > - dpy_update(s->ds, 0, first, s->regs[R_HRES], last - first + 1)= ; > + dpy_gfx_update(s->ds, 0, first, s->regs[R_HRES], last - first = + 1); > } > s->invalidate =3D 0; > } > diff --git a/hw/musicpal.c b/hw/musicpal.c > index beec76b..e0c57c8 100644 > --- a/hw/musicpal.c > +++ b/hw/musicpal.c > @@ -526,7 +526,7 @@ static void lcd_refresh(void *opaque) > ds_get_bits_per_pixel(s->ds)); > } > =20 > - dpy_update(s->ds, 0, 0, 128*3, 64*3); > + dpy_gfx_update(s->ds, 0, 0, 128*3, 64*3); > } > =20 > static void lcd_invalidate(void *opaque) > diff --git a/hw/nseries.c b/hw/nseries.c > index 9306aa1..26d5e35 100644 > --- a/hw/nseries.c > +++ b/hw/nseries.c > @@ -1376,7 +1376,7 @@ static void n8x0_init(ram_addr_t ram_size, const = char *boot_device, > size until the guest activates the display. */ > ds =3D get_displaystate(); > ds->surface =3D qemu_resize_displaysurface(ds, 800, 480); > - dpy_resize(ds); > + dpy_gfx_resize(ds); > } > =20 > static struct arm_boot_info n800_binfo =3D { > diff --git a/hw/omap_lcdc.c b/hw/omap_lcdc.c > index bf177c2..d7ae303 100644 > --- a/hw/omap_lcdc.c > +++ b/hw/omap_lcdc.c > @@ -219,7 +219,7 @@ static void omap_update_display(void *opaque) > draw_line, omap_lcd->palette, > &first, &last); > if (first >=3D 0) { > - dpy_update(omap_lcd->state, 0, first, width, last - first + 1)= ; > + dpy_gfx_update(omap_lcd->state, 0, first, width, last - first = + 1); > } > omap_lcd->invalidate =3D 0; > } > diff --git a/hw/palm.c b/hw/palm.c > index d263051..6f6f414 100644 > --- a/hw/palm.c > +++ b/hw/palm.c > @@ -273,7 +273,7 @@ static void palmte_init(QEMUMachineInitArgs *args) > will set the size once configured, so this just sets an initial= > size until the guest activates the display. */ > ds->surface =3D qemu_resize_displaysurface(ds, 320, 320); > - dpy_resize(ds); > + dpy_gfx_resize(ds); > } > =20 > static QEMUMachine palmte_machine =3D { > diff --git a/hw/pl110.c b/hw/pl110.c > index 82486b0..79a3f82 100644 > --- a/hw/pl110.c > +++ b/hw/pl110.c > @@ -239,7 +239,7 @@ static void pl110_update_display(void *opaque) > fn, s->palette, > &first, &last); > if (first >=3D 0) { > - dpy_update(s->ds, 0, first, s->cols, last - first + 1); > + dpy_gfx_update(s->ds, 0, first, s->cols, last - first + 1); > } > s->invalidate =3D 0; > } > diff --git a/hw/pxa2xx_lcd.c b/hw/pxa2xx_lcd.c > index 38c3889..b53dfaf 100644 > --- a/hw/pxa2xx_lcd.c > +++ b/hw/pxa2xx_lcd.c > @@ -871,20 +871,20 @@ static void pxa2xx_update_display(void *opaque) > if (miny >=3D 0) { > switch (s->orientation) { > case 0: > - dpy_update(s->ds, 0, miny, s->xres, maxy - miny + 1); > + dpy_gfx_update(s->ds, 0, miny, s->xres, maxy - miny + 1); > break; > case 90: > - dpy_update(s->ds, miny, 0, maxy - miny + 1, s->xres); > + dpy_gfx_update(s->ds, miny, 0, maxy - miny + 1, s->xres); > break; > case 180: > maxy =3D s->yres - maxy - 1; > miny =3D s->yres - miny - 1; > - dpy_update(s->ds, 0, maxy, s->xres, miny - maxy + 1); > + dpy_gfx_update(s->ds, 0, maxy, s->xres, miny - maxy + 1); > break; > case 270: > maxy =3D s->yres - maxy - 1; > miny =3D s->yres - miny - 1; > - dpy_update(s->ds, maxy, 0, miny - maxy + 1, s->xres); > + dpy_gfx_update(s->ds, maxy, 0, miny - maxy + 1, s->xres); > break; > } > } > diff --git a/hw/qxl-render.c b/hw/qxl-render.c > index e8cf29e..47eb8b4 100644 > --- a/hw/qxl-render.c > +++ b/hw/qxl-render.c > @@ -123,17 +123,17 @@ static void qxl_render_update_area_unlocked(PCIQX= LDevice *qxl) > qxl->guest_primary.surface.width, > qxl->guest_primary.surface.height); > } > - dpy_resize(vga->ds); > + dpy_gfx_resize(vga->ds); > } > for (i =3D 0; i < qxl->num_dirty_rects; i++) { > if (qemu_spice_rect_is_empty(qxl->dirty+i)) { > break; > } > qxl_blit(qxl, qxl->dirty+i); > - dpy_update(vga->ds, > - qxl->dirty[i].left, qxl->dirty[i].top, > - qxl->dirty[i].right - qxl->dirty[i].left, > - qxl->dirty[i].bottom - qxl->dirty[i].top); > + dpy_gfx_update(vga->ds, > + qxl->dirty[i].left, qxl->dirty[i].top, > + qxl->dirty[i].right - qxl->dirty[i].left, > + qxl->dirty[i].bottom - qxl->dirty[i].top); > } > qxl->num_dirty_rects =3D 0; > } > diff --git a/hw/qxl.c b/hw/qxl.c > index d54daf6..1f56fcd 100644 > --- a/hw/qxl.c > +++ b/hw/qxl.c > @@ -1864,8 +1864,8 @@ static void display_refresh(struct DisplayState *= ds) > } > =20 > static DisplayChangeListener display_listener =3D { > - .dpy_update =3D display_update, > - .dpy_resize =3D display_resize, > + .dpy_gfx_update =3D display_update, > + .dpy_gfx_resize =3D display_resize, > .dpy_refresh =3D display_refresh, > }; > =20 > diff --git a/hw/sm501.c b/hw/sm501.c > index 4aafe49..50324cd 100644 > --- a/hw/sm501.c > +++ b/hw/sm501.c > @@ -1351,7 +1351,7 @@ static void sm501_draw_crt(SM501State * s) > } else { > if (y_start >=3D 0) { > /* flush to display */ > - dpy_update(s->ds, 0, y_start, width, y - y_start); > + dpy_gfx_update(s->ds, 0, y_start, width, y - y_start);= > y_start =3D -1; > } > } > @@ -1362,7 +1362,7 @@ static void sm501_draw_crt(SM501State * s) > =20 > /* complete flush to display */ > if (y_start >=3D 0) > - dpy_update(s->ds, 0, y_start, width, y - y_start); > + dpy_gfx_update(s->ds, 0, y_start, width, y - y_start); > =20 > /* clear dirty flags */ > if (page_min !=3D ~0l) { > diff --git a/hw/ssd0303.c b/hw/ssd0303.c > index 4e1ee6e..d7fd828 100644 > --- a/hw/ssd0303.c > +++ b/hw/ssd0303.c > @@ -252,7 +252,7 @@ static void ssd0303_update_display(void *opaque) > } > } > s->redraw =3D 0; > - dpy_update(s->ds, 0, 0, 96 * MAGNIFY, 16 * MAGNIFY); > + dpy_gfx_update(s->ds, 0, 0, 96 * MAGNIFY, 16 * MAGNIFY); > } > =20 > static void ssd0303_invalidate_display(void * opaque) > diff --git a/hw/ssd0323.c b/hw/ssd0323.c > index 9c42d64..4098830 100644 > --- a/hw/ssd0323.c > +++ b/hw/ssd0323.c > @@ -260,7 +260,7 @@ static void ssd0323_update_display(void *opaque) > } > } > s->redraw =3D 0; > - dpy_update(s->ds, 0, 0, 128 * MAGNIFY, 64 * MAGNIFY); > + dpy_gfx_update(s->ds, 0, 0, 128 * MAGNIFY, 64 * MAGNIFY); > } > =20 > static void ssd0323_invalidate_display(void * opaque) > diff --git a/hw/tc6393xb.c b/hw/tc6393xb.c > index 31d4f26..f032027 100644 > --- a/hw/tc6393xb.c > +++ b/hw/tc6393xb.c > @@ -454,7 +454,7 @@ static void tc6393xb_draw_graphic(TC6393xbState *s,= int full_update) > return; > } > =20 > - dpy_update(s->ds, 0, 0, s->scr_width, s->scr_height); > + dpy_gfx_update(s->ds, 0, 0, s->scr_width, s->scr_height); > } > =20 > static void tc6393xb_draw_blank(TC6393xbState *s, int full_update) > @@ -472,7 +472,7 @@ static void tc6393xb_draw_blank(TC6393xbState *s, i= nt full_update) > d +=3D ds_get_linesize(s->ds); > } > =20 > - dpy_update(s->ds, 0, 0, s->scr_width, s->scr_height); > + dpy_gfx_update(s->ds, 0, 0, s->scr_width, s->scr_height); > } > =20 > static void tc6393xb_update_display(void *opaque) > diff --git a/hw/tcx.c b/hw/tcx.c > index 7abe865..7aee2a9 100644 > --- a/hw/tcx.c > +++ b/hw/tcx.c > @@ -268,8 +268,8 @@ static void tcx_update_display(void *opaque) > } else { > if (y_start >=3D 0) { > /* flush to display */ > - dpy_update(ts->ds, 0, y_start, > - ts->width, y - y_start); > + dpy_gfx_update(ts->ds, 0, y_start, > + ts->width, y - y_start); > y_start =3D -1; > } > d +=3D dd * 4; > @@ -278,8 +278,8 @@ static void tcx_update_display(void *opaque) > } > if (y_start >=3D 0) { > /* flush to display */ > - dpy_update(ts->ds, 0, y_start, > - ts->width, y - y_start); > + dpy_gfx_update(ts->ds, 0, y_start, > + ts->width, y - y_start); > } > /* reset modified pages */ > if (page_max >=3D page_min) { > @@ -344,8 +344,8 @@ static void tcx24_update_display(void *opaque) > } else { > if (y_start >=3D 0) { > /* flush to display */ > - dpy_update(ts->ds, 0, y_start, > - ts->width, y - y_start); > + dpy_gfx_update(ts->ds, 0, y_start, > + ts->width, y - y_start); > y_start =3D -1; > } > d +=3D dd * 4; > @@ -356,8 +356,8 @@ static void tcx24_update_display(void *opaque) > } > if (y_start >=3D 0) { > /* flush to display */ > - dpy_update(ts->ds, 0, y_start, > - ts->width, y - y_start); > + dpy_gfx_update(ts->ds, 0, y_start, > + ts->width, y - y_start); > } > /* reset modified pages */ > if (page_max >=3D page_min) { > diff --git a/hw/vga.c b/hw/vga.c > index f3256cb..dc8ddde 100644 > --- a/hw/vga.c > +++ b/hw/vga.c > @@ -1456,8 +1456,8 @@ static void vga_draw_text(VGACommonState *s, int = full_update) > ch_attr_ptr++; > } > if (cx_max !=3D -1) { > - dpy_update(s->ds, cx_min * cw, cy * cheight, > - (cx_max - cx_min + 1) * cw, cheight); > + dpy_gfx_update(s->ds, cx_min * cw, cy * cheight, > + (cx_max - cx_min + 1) * cw, cheight); > } > dest +=3D linesize * cheight; > line1 =3D line + cheight; > @@ -1688,7 +1688,7 @@ static void vga_draw_graphic(VGACommonState *s, i= nt full_update) > #if defined(HOST_WORDS_BIGENDIAN) !=3D defined(TARGET_WORDS_BIGENDIAN)= > s->ds->surface->pf =3D qemu_different_endianness_pixelform= at(depth); > #endif > - dpy_resize(s->ds); > + dpy_gfx_resize(s->ds); > } else { > qemu_console_resize(s->ds, disp_width, height); > } > @@ -1702,7 +1702,7 @@ static void vga_draw_graphic(VGACommonState *s, i= nt full_update) > } else if (is_buffer_shared(s->ds->surface) && > (full_update || s->ds->surface->data !=3D s->vram_ptr += (s->start_addr * 4))) { > s->ds->surface->data =3D s->vram_ptr + (s->start_addr * 4); > - dpy_setdata(s->ds); > + dpy_gfx_setdata(s->ds); > } > =20 > s->rgb_to_pixel =3D > @@ -1807,8 +1807,8 @@ static void vga_draw_graphic(VGACommonState *s, i= nt full_update) > } else { > if (y_start >=3D 0) { > /* flush to display */ > - dpy_update(s->ds, 0, y_start, > - disp_width, y - y_start); > + dpy_gfx_update(s->ds, 0, y_start, > + disp_width, y - y_start); > y_start =3D -1; > } > } > @@ -1828,8 +1828,8 @@ static void vga_draw_graphic(VGACommonState *s, i= nt full_update) > } > if (y_start >=3D 0) { > /* flush to display */ > - dpy_update(s->ds, 0, y_start, > - disp_width, y - y_start); > + dpy_gfx_update(s->ds, 0, y_start, > + disp_width, y - y_start); > } > /* reset modified pages */ > if (page_max >=3D page_min) { > @@ -1863,8 +1863,8 @@ static void vga_draw_blank(VGACommonState *s, int= full_update) > memset(d, val, w); > d +=3D ds_get_linesize(s->ds); > } > - dpy_update(s->ds, 0, 0, > - s->last_scr_width, s->last_scr_height); > + dpy_gfx_update(s->ds, 0, 0, > + s->last_scr_width, s->last_scr_height); > } > =20 > #define GMODE_TEXT 0 > @@ -2052,9 +2052,7 @@ static void vga_update_text(void *opaque, console= _ch_t *chardata) > cw !=3D s->last_cw || cheight !=3D s->last_ch) { > s->last_scr_width =3D width * cw; > s->last_scr_height =3D height * cheight; > - s->ds->surface->width =3D width; > - s->ds->surface->height =3D height; > - dpy_resize(s->ds); > + dpy_text_resize(s->ds, width, height); > s->last_width =3D width; > s->last_height =3D height; > s->last_ch =3D cheight; > @@ -2087,7 +2085,7 @@ static void vga_update_text(void *opaque, console= _ch_t *chardata) > for (i =3D 0; i < size; src ++, dst ++, i ++) > console_write_ch(dst, VMEM2CHTYPE(le32_to_cpu(*src)));= > =20 > - dpy_update(s->ds, 0, 0, width, height); > + dpy_text_update(s->ds, 0, 0, width, height); > } else { > c_max =3D 0; > =20 > @@ -2110,7 +2108,7 @@ static void vga_update_text(void *opaque, console= _ch_t *chardata) > =20 > if (c_min <=3D c_max) { > i =3D TEXTMODE_Y(c_min); > - dpy_update(s->ds, 0, i, width, TEXTMODE_Y(c_max) - i += 1); > + dpy_text_update(s->ds, 0, i, width, TEXTMODE_Y(c_max) = - i + 1); > } > } > =20 > @@ -2136,9 +2134,7 @@ static void vga_update_text(void *opaque, console= _ch_t *chardata) > s->last_width =3D 60; > s->last_height =3D height =3D 3; > dpy_text_cursor(s->ds, -1, -1); > - s->ds->surface->width =3D s->last_width; > - s->ds->surface->height =3D height; > - dpy_resize(s->ds); > + dpy_text_resize(s->ds, s->last_width, height); > =20 > for (dst =3D chardata, i =3D 0; i < s->last_width * height; i ++) > console_write_ch(dst ++, ' '); > @@ -2149,7 +2145,7 @@ static void vga_update_text(void *opaque, console= _ch_t *chardata) > for (i =3D 0; i < size; i ++) > console_write_ch(dst ++, 0x00200100 | msg_buffer[i]); > =20 > - dpy_update(s->ds, 0, 0, s->last_width, height); > + dpy_text_update(s->ds, 0, 0, s->last_width, height); > } > =20 > static uint64_t vga_mem_read(void *opaque, hwaddr addr, > diff --git a/hw/vmware_vga.c b/hw/vmware_vga.c > index dc92790..34532e5 100644 > --- a/hw/vmware_vga.c > +++ b/hw/vmware_vga.c > @@ -321,14 +321,14 @@ static inline void vmsvga_update_rect(struct vmsv= ga_state_s *s, > for (; line > 0; line --, src +=3D bypl, dst +=3D bypl) > memcpy(dst, src, width); > =20 > - dpy_update(s->vga.ds, x, y, w, h); > + dpy_gfx_update(s->vga.ds, x, y, w, h); > } > =20 > static inline void vmsvga_update_screen(struct vmsvga_state_s *s) > { > memcpy(ds_get_data(s->vga.ds), s->vga.vram_ptr, > s->bypp * s->width * s->height); > - dpy_update(s->vga.ds, 0, 0, s->width, s->height); > + dpy_gfx_update(s->vga.ds, 0, 0, s->width, s->height); > } > =20 > static inline void vmsvga_update_rect_delayed(struct vmsvga_state_s *s= , > diff --git a/ui/curses.c b/ui/curses.c > index c2be2c6..b40b223 100644 > --- a/ui/curses.c > +++ b/ui/curses.c > @@ -95,17 +95,16 @@ static void curses_calc_pad(void) > } > } > =20 > -static void curses_resize(DisplayState *ds) > +static void curses_resize(DisplayState *ds, int width, int height) > { > - if (ds_get_width(ds) =3D=3D gwidth && ds_get_height(ds) =3D=3D ghe= ight) > + if (width =3D=3D gwidth && height =3D=3D gheight) { > return; > + } > =20 > - gwidth =3D ds_get_width(ds); > - gheight =3D ds_get_height(ds); > + gwidth =3D width; > + gheight =3D height; > =20 > curses_calc_pad(); > - ds->surface->width =3D width * FONT_WIDTH; > - ds->surface->height =3D height * FONT_HEIGHT; > } > =20 > #ifndef _WIN32 > @@ -167,8 +166,6 @@ static void curses_refresh(DisplayState *ds) > clear(); > refresh(); > curses_calc_pad(); > - ds->surface->width =3D FONT_WIDTH * width; > - ds->surface->height =3D FONT_HEIGHT * height; > vga_hw_invalidate(); > invalidate =3D 0; > } > @@ -195,8 +192,6 @@ static void curses_refresh(DisplayState *ds) > refresh(); > curses_calc_pad(); > curses_update(ds, 0, 0, width, height); > - ds->surface->width =3D FONT_WIDTH * width; > - ds->surface->height =3D FONT_HEIGHT * height; > continue; > } > #endif > @@ -355,13 +350,11 @@ void curses_display_init(DisplayState *ds, int fu= ll_screen) > #endif > =20 > dcl =3D (DisplayChangeListener *) g_malloc0(sizeof(DisplayChangeLi= stener)); > - dcl->dpy_update =3D curses_update; > - dcl->dpy_resize =3D curses_resize; > + dcl->dpy_text_update =3D curses_update; > + dcl->dpy_text_resize =3D curses_resize; > dcl->dpy_refresh =3D curses_refresh; > dcl->dpy_text_cursor =3D curses_cursor_position; > register_displaychangelistener(ds, dcl); > - qemu_free_displaysurface(ds); > - ds->surface =3D qemu_create_displaysurface_from(640, 400, 0, 0, (u= int8_t*) screen); > =20 > invalidate =3D 1; > } > diff --git a/ui/sdl.c b/ui/sdl.c > index f8ead93..fac1a47 100644 > --- a/ui/sdl.c > +++ b/ui/sdl.c > @@ -553,7 +553,7 @@ static void sdl_scale(DisplayState *ds, int width, = int height) > if (!is_buffer_shared(ds->surface)) { > ds->surface =3D qemu_resize_displaysurface(ds, ds_get_width(ds= ), > ds_get_height(ds)); > - dpy_resize(ds); > + dpy_gfx_resize(ds); > } > } > =20 > @@ -1020,11 +1020,11 @@ void sdl_display_init(DisplayState *ds, int ful= l_screen, int no_frame) > } > =20 > dcl =3D g_malloc0(sizeof(DisplayChangeListener)); > - dcl->dpy_update =3D sdl_update; > - dcl->dpy_resize =3D sdl_resize; > + dcl->dpy_gfx_update =3D sdl_update; > + dcl->dpy_gfx_resize =3D sdl_resize; > dcl->dpy_refresh =3D sdl_refresh; > - dcl->dpy_setdata =3D sdl_setdata; > - dcl->dpy_fill =3D sdl_fill; > + dcl->dpy_gfx_setdata =3D sdl_setdata; > + dcl->dpy_gfx_fill =3D sdl_fill; > dcl->dpy_mouse_set =3D sdl_mouse_warp; > dcl->dpy_cursor_define =3D sdl_mouse_define; > register_displaychangelistener(ds, dcl); > @@ -1034,7 +1034,7 @@ void sdl_display_init(DisplayState *ds, int full_= screen, int no_frame) > da->resize_displaysurface =3D sdl_resize_displaysurface; > da->free_displaysurface =3D sdl_free_displaysurface; > if (register_displayallocator(ds, da) =3D=3D da) { > - dpy_resize(ds); > + dpy_gfx_resize(ds); > } > =20 > mouse_mode_notifier.notify =3D sdl_mouse_mode_change; > diff --git a/ui/spice-display.c b/ui/spice-display.c > index 5779fa8..fb99148 100644 > --- a/ui/spice-display.c > +++ b/ui/spice-display.c > @@ -571,8 +571,8 @@ static void display_refresh(struct DisplayState *ds= ) > } > =20 > static DisplayChangeListener display_listener =3D { > - .dpy_update =3D display_update, > - .dpy_resize =3D display_resize, > + .dpy_gfx_update =3D display_update, > + .dpy_gfx_resize =3D display_resize, > .dpy_refresh =3D display_refresh, > }; > =20 > diff --git a/ui/vnc.c b/ui/vnc.c > index 1b70db7..0ae1c74 100644 > --- a/ui/vnc.c > +++ b/ui/vnc.c > @@ -2753,10 +2753,10 @@ void vnc_display_init(DisplayState *ds) > qemu_mutex_init(&vs->mutex); > vnc_start_worker_thread(); > =20 > - dcl->dpy_copy =3D vnc_dpy_copy; > - dcl->dpy_update =3D vnc_dpy_update; > - dcl->dpy_resize =3D vnc_dpy_resize; > - dcl->dpy_setdata =3D vnc_dpy_setdata; > + dcl->dpy_gfx_copy =3D vnc_dpy_copy; > + dcl->dpy_gfx_update =3D vnc_dpy_update; > + dcl->dpy_gfx_resize =3D vnc_dpy_resize; > + dcl->dpy_gfx_setdata =3D vnc_dpy_setdata; > dcl->dpy_mouse_set =3D vnc_mouse_set; > dcl->dpy_cursor_define =3D vnc_dpy_cursor_define; > register_displaychangelistener(ds, dcl); > diff --git a/vl.c b/vl.c > index 4c45b02..8716fc0 100644 > --- a/vl.c > +++ b/vl.c > @@ -1375,11 +1375,18 @@ void gui_setup_refresh(DisplayState *ds) > { > DisplayChangeListener *dcl; > bool need_timer =3D false; > + bool have_gfx =3D false; > + bool have_text =3D false; > =20 > QLIST_FOREACH(dcl, &ds->listeners, next) { > if (dcl->dpy_refresh !=3D NULL) { > need_timer =3D true; > - break; > + } > + if (dcl->dpy_gfx_update !=3D NULL) { > + have_gfx =3D true; > + } > + if (dcl->dpy_text_update !=3D NULL) { > + have_text =3D true; > } > } > =20 > @@ -1392,6 +1399,9 @@ void gui_setup_refresh(DisplayState *ds) > qemu_free_timer(ds->gui_timer); > ds->gui_timer =3D NULL; > } > + > + ds->have_gfx =3D have_gfx; > + ds->have_text =3D have_text; > } > =20 > struct vm_change_state_entry { > @@ -3866,7 +3876,7 @@ int main(int argc, char **argv, char **envp) > #endif > =20 > /* display setup */ > - dpy_resize(ds); > + dpy_gfx_resize(ds); > text_consoles_set_display(ds); > =20 > if (foreach_device_config(DEV_GDB, gdbserver_start) < 0) { >=20 --------------enig1C832BAF2E500FCBF47267FF Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://www.enigmail.net/ iEYEARECAAYFAlCTdEsACgkQitSsb3rl5xQseQCg6a+hoHH0ddwJn9ZCjPnvUnsQ hzwAnjhQ+44X4N+ecK0O2md0jHbNisSH =8ZfQ -----END PGP SIGNATURE----- --------------enig1C832BAF2E500FCBF47267FF--