Commit 7b17d41e968bd0826b914ec7ed036cf9c6a51615

Authored by bellard
1 parent d6bfa22f

Cirrus VGA display fix


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@893 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 11 additions and 5 deletions
hw/vga.c
@@ -147,7 +147,7 @@ static uint32_t expand4[256]; @@ -147,7 +147,7 @@ static uint32_t expand4[256];
147 static uint16_t expand2[256]; 147 static uint16_t expand2[256];
148 static uint8_t expand4to8[16]; 148 static uint8_t expand4to8[16];
149 149
150 -VGAState vga_state; 150 +VGAState *vga_state;
151 int vga_io_memory; 151 int vga_io_memory;
152 152
153 static uint32_t vga_ioport_read(void *opaque, uint32_t addr) 153 static uint32_t vga_ioport_read(void *opaque, uint32_t addr)
@@ -1507,7 +1507,7 @@ static void vga_draw_blank(VGAState *s, int full_update) @@ -1507,7 +1507,7 @@ static void vga_draw_blank(VGAState *s, int full_update)
1507 1507
1508 void vga_update_display(void) 1508 void vga_update_display(void)
1509 { 1509 {
1510 - VGAState *s = &vga_state; 1510 + VGAState *s = vga_state;
1511 int full_update, graphic_mode; 1511 int full_update, graphic_mode;
1512 1512
1513 if (s->ds->depth == 0) { 1513 if (s->ds->depth == 0) {
@@ -1674,7 +1674,7 @@ static int vga_load(QEMUFile *f, void *opaque, int version_id) @@ -1674,7 +1674,7 @@ static int vga_load(QEMUFile *f, void *opaque, int version_id)
1674 static void vga_map(PCIDevice *pci_dev, int region_num, 1674 static void vga_map(PCIDevice *pci_dev, int region_num,
1675 uint32_t addr, uint32_t size, int type) 1675 uint32_t addr, uint32_t size, int type)
1676 { 1676 {
1677 - VGAState *s = &vga_state; 1677 + VGAState *s = vga_state;
1678 1678
1679 cpu_register_physical_memory(addr, s->vram_size, s->vram_offset); 1679 cpu_register_physical_memory(addr, s->vram_size, s->vram_offset);
1680 } 1680 }
@@ -1715,6 +1715,8 @@ void vga_common_init(VGAState *s, DisplayState *ds, uint8_t *vga_ram_base, @@ -1715,6 +1715,8 @@ void vga_common_init(VGAState *s, DisplayState *ds, uint8_t *vga_ram_base,
1715 s->ds = ds; 1715 s->ds = ds;
1716 s->get_bpp = vga_get_bpp; 1716 s->get_bpp = vga_get_bpp;
1717 s->get_offsets = vga_get_offsets; 1717 s->get_offsets = vga_get_offsets;
  1718 + /* XXX: currently needed for display */
  1719 + vga_state = s;
1718 } 1720 }
1719 1721
1720 1722
@@ -1722,7 +1724,11 @@ int vga_initialize(DisplayState *ds, uint8_t *vga_ram_base, @@ -1722,7 +1724,11 @@ int vga_initialize(DisplayState *ds, uint8_t *vga_ram_base,
1722 unsigned long vga_ram_offset, int vga_ram_size, 1724 unsigned long vga_ram_offset, int vga_ram_size,
1723 int is_pci) 1725 int is_pci)
1724 { 1726 {
1725 - VGAState *s = &vga_state; 1727 + VGAState *s;
  1728 +
  1729 + s = qemu_mallocz(sizeof(VGAState));
  1730 + if (!s)
  1731 + return -1;
1726 1732
1727 vga_common_init(s, ds, vga_ram_base, vga_ram_offset, vga_ram_size); 1733 vga_common_init(s, ds, vga_ram_base, vga_ram_offset, vga_ram_size);
1728 1734
@@ -1857,7 +1863,7 @@ static int ppm_save(const char *filename, uint8_t *data, @@ -1857,7 +1863,7 @@ static int ppm_save(const char *filename, uint8_t *data,
1857 available */ 1863 available */
1858 void vga_screen_dump(const char *filename) 1864 void vga_screen_dump(const char *filename)
1859 { 1865 {
1860 - VGAState *s = &vga_state; 1866 + VGAState *s = vga_state;
1861 DisplayState *saved_ds, ds1, *ds = &ds1; 1867 DisplayState *saved_ds, ds1, *ds = &ds1;
1862 1868
1863 /* XXX: this is a little hackish */ 1869 /* XXX: this is a little hackish */