Browse Source

Fix displaystate (r6344) regression in blizzard

Testcase:

qemu-system-arm -M n810 -kernel /dev/null -m 130

Without this patch, we get a segfault.

Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6577 c046a42c-6fe2-441c-8c8c-71466251a162
aurel32 16 years ago
parent
commit
0921895137
2 changed files with 6 additions and 5 deletions
  1. 4 4
      hw/blizzard.c
  2. 2 1
      hw/nseries.c

+ 4 - 4
hw/blizzard.c

@@ -959,6 +959,10 @@ void *s1d13745_init(qemu_irq gpio_int)
 
 
     s->fb = qemu_malloc(0x180000);
     s->fb = qemu_malloc(0x180000);
 
 
+    s->state = graphic_console_init(blizzard_update_display,
+                                 blizzard_invalidate_display,
+                                 blizzard_screen_dump, NULL, s);
+
     switch (ds_get_bits_per_pixel(s->state)) {
     switch (ds_get_bits_per_pixel(s->state)) {
     case 0:
     case 0:
         s->line_fn_tab[0] = s->line_fn_tab[1] =
         s->line_fn_tab[0] = s->line_fn_tab[1] =
@@ -991,9 +995,5 @@ void *s1d13745_init(qemu_irq gpio_int)
 
 
     blizzard_reset(s);
     blizzard_reset(s);
 
 
-    s->state = graphic_console_init(blizzard_update_display,
-                                 blizzard_invalidate_display,
-                                 blizzard_screen_dump, NULL, s);
-
     return s;
     return s;
 }
 }

+ 2 - 1
hw/nseries.c

@@ -1273,7 +1273,7 @@ static void n8x0_init(ram_addr_t ram_size, const char *boot_device,
     struct n800_s *s = (struct n800_s *) qemu_mallocz(sizeof(*s));
     struct n800_s *s = (struct n800_s *) qemu_mallocz(sizeof(*s));
     int sdram_size = binfo->ram_size;
     int sdram_size = binfo->ram_size;
     int onenandram_size = 0x00010000;
     int onenandram_size = 0x00010000;
-    DisplayState *ds = get_displaystate();
+    DisplayState *ds;
 
 
     if (ram_size < sdram_size + onenandram_size + OMAP242X_SRAM_SIZE) {
     if (ram_size < sdram_size + onenandram_size + OMAP242X_SRAM_SIZE) {
         fprintf(stderr, "This architecture uses %i bytes of memory\n",
         fprintf(stderr, "This architecture uses %i bytes of memory\n",
@@ -1361,6 +1361,7 @@ static void n8x0_init(ram_addr_t ram_size, const char *boot_device,
     /* FIXME: We shouldn't really be doing this here.  The LCD controller
     /* FIXME: We shouldn't really be doing this here.  The LCD controller
        will set the size once configured, so this just sets an initial
        will set the size once configured, so this just sets an initial
        size until the guest activates the display.  */
        size until the guest activates the display.  */
+    ds = get_displaystate();
     ds->surface = qemu_resize_displaysurface(ds->surface, 800, 480, 32, 4 * 800);
     ds->surface = qemu_resize_displaysurface(ds->surface, 800, 480, 32, 4 * 800);
     dpy_resize(ds);
     dpy_resize(ds);
 }
 }