aboutsummaryrefslogtreecommitdiffstats
path: root/hw/cirrus_vga.c
diff options
context:
space:
mode:
authoraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>2009-04-05 18:41:18 +0000
committeraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>2009-04-05 18:41:18 +0000
commit9586fefefe383a9aa25ad99bde9a6b240309ca33 (patch)
tree2c4444ed6e8edf5b072a240e8b25fc1fd8dd2001 /hw/cirrus_vga.c
parentb9e82a5946d902af445a53727c69b4851b1b20ff (diff)
Fix display breakage when resizing the screen (v2) (Avi Kivity)
When the vga resolution changes, a new display surface is not allocated immediately; instead that is deferred until the next update. However, if we're running without a display client attached, that won't happen and the next bitblt is likely to cause a segfault by overflowing the display surface. Fix by reallocating the display immediately when the resolution changes. Tested with (Windows|Linux) x (cirrus|std) x (curses|sdl). Changes from v1: - fix segfault when switching virtual consoles with curses Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6989 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/cirrus_vga.c')
-rw-r--r--hw/cirrus_vga.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/hw/cirrus_vga.c b/hw/cirrus_vga.c
index 08fd4c29a..223008e0f 100644
--- a/hw/cirrus_vga.c
+++ b/hw/cirrus_vga.c
@@ -1392,6 +1392,8 @@ cirrus_hook_write_sr(CirrusVGAState * s, unsigned reg_index, int reg_value)
break;
}
+ vga_update_resolution((VGAState *)s);
+
return CIRRUS_HOOK_HANDLED;
}
@@ -1419,6 +1421,7 @@ static void cirrus_write_hidden_dac(CirrusVGAState * s, int reg_value)
#endif
}
s->cirrus_hidden_dac_lockindex = 0;
+ vga_update_resolution((VGAState *)s);
}
/***************************************
@@ -1705,6 +1708,8 @@ cirrus_hook_write_cr(CirrusVGAState * s, unsigned reg_index, int reg_value)
break;
}
+ vga_update_resolution((VGAState *)s);
+
return CIRRUS_HOOK_HANDLED;
}
@@ -2830,6 +2835,7 @@ static void vga_ioport_write(void *opaque, uint32_t addr, uint32_t val)
if (s->ar_flip_flop == 0) {
val &= 0x3f;
s->ar_index = val;
+ vga_update_resolution((VGAState *)s);
} else {
index = s->ar_index & 0x1f;
switch (index) {
@@ -2923,6 +2929,7 @@ static void vga_ioport_write(void *opaque, uint32_t addr, uint32_t val)
/* can always write bit 4 of CR7 */
if (s->cr_index == 7)
s->cr[7] = (s->cr[7] & ~0x10) | (val & 0x10);
+ vga_update_resolution((VGAState *)s);
return;
}
switch (s->cr_index) {
@@ -2951,6 +2958,7 @@ static void vga_ioport_write(void *opaque, uint32_t addr, uint32_t val)
s->update_retrace_info((VGAState *) s);
break;
}
+ vga_update_resolution((VGAState *)s);
break;
case 0x3ba:
case 0x3da:
@@ -3157,7 +3165,8 @@ static int cirrus_vga_load(QEMUFile *f, void *opaque, int version_id)
cirrus_update_memory_access(s);
/* force refresh */
- s->graphic_mode = -1;
+ vga_update_resolution((VGAState *)s);
+ s->want_full_update = 1;
cirrus_update_bank_ptr(s, 0);
cirrus_update_bank_ptr(s, 1);
return 0;