From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH 7/8] vga: fix text mode updating
Date: Mon, 15 Oct 2012 11:51:42 +0200 [thread overview]
Message-ID: <1350294703-22011-8-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1350294703-22011-1-git-send-email-kraxel@redhat.com>
With both text (curses) and graphics (vnc/sdl/spice/...) display active
vga text mode emulation fails to update both correctly. Depending on
whenever vga_update_text() or vga_draw_text() happens to be called first
only the text display or only the graphics display will see display
resolution changes and full redraws.
Fix it by calling both text/gfx resize functions in both code paths and
keep track of full screen redraws needed in VGACommonState fields.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/vga.c | 19 +++++++++++++++++++
hw/vga_int.h | 2 ++
2 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/hw/vga.c b/hw/vga.c
index 19a68ff..a0ba94d 100644
--- a/hw/vga.c
+++ b/hw/vga.c
@@ -1350,6 +1350,7 @@ static void vga_draw_text(VGACommonState *s, int full_update)
s->last_scr_width = width * cw;
s->last_scr_height = height * cheight;
qemu_console_resize(s->ds, s->last_scr_width, s->last_scr_height);
+ dpy_text_resize(s->ds, width, height);
s->last_depth = 0;
s->last_width = width;
s->last_height = height;
@@ -1363,6 +1364,14 @@ static void vga_draw_text(VGACommonState *s, int full_update)
palette = s->last_palette;
x_incr = cw * ((ds_get_bits_per_pixel(s->ds) + 7) >> 3);
+ if (full_update) {
+ s->full_update_text = 1;
+ }
+ if (s->full_update_gfx) {
+ s->full_update_gfx = 0;
+ full_update |= 1;
+ }
+
cursor_offset = ((s->cr[VGA_CRTC_CURSOR_HI] << 8) |
s->cr[VGA_CRTC_CURSOR_LO]) - s->start_addr;
if (cursor_offset != s->cursor_offset ||
@@ -2063,7 +2072,9 @@ static void vga_update_text(void *opaque, console_ch_t *chardata)
cw != s->last_cw || cheight != s->last_ch) {
s->last_scr_width = width * cw;
s->last_scr_height = height * cheight;
+ qemu_console_resize(s->ds, s->last_scr_width, s->last_scr_height);
dpy_text_resize(s->ds, width, height);
+ s->last_depth = 0;
s->last_width = width;
s->last_height = height;
s->last_ch = cheight;
@@ -2071,6 +2082,14 @@ static void vga_update_text(void *opaque, console_ch_t *chardata)
full_update = 1;
}
+ if (full_update) {
+ s->full_update_gfx = 1;
+ }
+ if (s->full_update_text) {
+ s->full_update_text = 0;
+ full_update |= 1;
+ }
+
/* Update "hardware" cursor */
cursor_offset = ((s->cr[VGA_CRTC_CURSOR_HI] << 8) |
s->cr[VGA_CRTC_CURSOR_LO]) - s->start_addr;
diff --git a/hw/vga_int.h b/hw/vga_int.h
index 330a32f..713f53f 100644
--- a/hw/vga_int.h
+++ b/hw/vga_int.h
@@ -166,6 +166,8 @@ typedef struct VGACommonState {
vga_hw_invalidate_ptr invalidate;
vga_hw_screen_dump_ptr screen_dump;
vga_hw_text_update_ptr text_update;
+ bool full_update_text;
+ bool full_update_gfx;
/* hardware mouse cursor support */
uint32_t invalidated_y_table[VGA_MAX_HEIGHT / 32];
void (*cursor_invalidate)(struct VGACommonState *s);
--
1.7.1
next prev parent reply other threads:[~2012-10-15 9:51 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-15 9:51 [Qemu-devel] [PATCH 0/8] console cleanups Gerd Hoffmann
2012-10-15 9:51 ` [Qemu-devel] [PATCH 1/8] console: QLIST-ify display change listeners Gerd Hoffmann
2012-10-15 9:51 ` [Qemu-devel] [PATCH 2/8] console: add unregister_displaychangelistener Gerd Hoffmann
2012-10-15 14:16 ` Andreas Färber
2012-10-15 9:51 ` [Qemu-devel] [PATCH 3/8] console: move set_mouse + cursor_define callbacks Gerd Hoffmann
2012-10-15 9:51 ` [Qemu-devel] [PATCH 4/8] console: s/TextConsole/QemuConsole/ Gerd Hoffmann
2012-10-15 9:51 ` [Qemu-devel] [PATCH 5/8] console: untangle gfx & txt updates Gerd Hoffmann
2012-10-15 9:51 ` [Qemu-devel] [PATCH 6/8] console: init displaychangelisteners on register Gerd Hoffmann
2012-10-15 9:51 ` Gerd Hoffmann [this message]
2012-10-15 9:51 ` [Qemu-devel] [PATCH 8/8] console: remove dpy_gfx_fill Gerd Hoffmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1350294703-22011-8-git-send-email-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).