spelling fixes
[qemu] / hw / vga.c
index 23695f5..2a0a9c3 100644 (file)
--- a/hw/vga.c
+++ b/hw/vga.c
@@ -190,6 +190,9 @@ static uint32_t vga_ioport_read(void *opaque, uint32_t addr)
         case 0x3c7:
             val = s->dac_state;
             break;
+       case 0x3c8:
+           val = s->dac_write_index;
+           break;
         case 0x3c9:
             val = s->palette[s->dac_read_index * 3 + s->dac_sub_index];
             if (++s->dac_sub_index == 3) {
@@ -1301,6 +1304,19 @@ static int vga_get_bpp(VGAState *s)
     return ret;
 }
 
+static void vga_get_resolution(VGAState *s, int *pwidth, int *pheight)
+{
+    int width, height;
+    
+    width = (s->cr[0x01] + 1) * 8;
+    height = s->cr[0x12] | 
+        ((s->cr[0x07] & 0x02) << 7) | 
+        ((s->cr[0x07] & 0x40) << 3);
+    height = (height + 1);
+    *pwidth = width;
+    *pheight = height;
+}
+
 void vga_invalidate_scanlines(VGAState *s, int y1, int y2)
 {
     int y;
@@ -1327,11 +1343,7 @@ static void vga_draw_graphic(VGAState *s, int full_update)
     
     full_update |= update_basic_params(s);
 
-    width = (s->cr[0x01] + 1) * 8;
-    height = s->cr[0x12] | 
-        ((s->cr[0x07] & 0x02) << 7) | 
-        ((s->cr[0x07] & 0x40) << 3);
-    height = (height + 1);
+    s->get_resolution(s, &width, &height);
     disp_width = width;
 
     shift_control = (s->gr[0x05] >> 5) & 3;
@@ -1562,6 +1574,15 @@ void vga_update_display(void)
     }
 }
 
+/* force a full display refresh */
+void vga_invalidate_display(void)
+{
+    VGAState *s = vga_state;
+    
+    s->last_width = -1;
+    s->last_height = -1;
+}
+
 static void vga_reset(VGAState *s)
 {
     memset(s, 0, sizeof(VGAState));
@@ -1723,14 +1744,14 @@ void vga_common_init(VGAState *s, DisplayState *ds, uint8_t *vga_ram_base,
     s->ds = ds;
     s->get_bpp = vga_get_bpp;
     s->get_offsets = vga_get_offsets;
+    s->get_resolution = vga_get_resolution;
     /* XXX: currently needed for display */
     vga_state = s;
 }
 
 
-int vga_initialize(DisplayState *ds, uint8_t *vga_ram_base, 
-                   unsigned long vga_ram_offset, int vga_ram_size, 
-                   int is_pci)
+int vga_initialize(PCIBus *bus, DisplayState *ds, uint8_t *vga_ram_base, 
+                   unsigned long vga_ram_offset, int vga_ram_size)
 {
     VGAState *s;
 
@@ -1786,14 +1807,13 @@ int vga_initialize(DisplayState *ds, uint8_t *vga_ram_base,
     cpu_register_physical_memory(isa_mem_base + 0x000a0000, 0x20000, 
                                  vga_io_memory);
 
-    if (is_pci) {
+    if (bus) {
         PCIDevice *d;
         uint8_t *pci_conf;
 
-        d = pci_register_device("VGA", 
+        d = pci_register_device(bus, "VGA", 
                                 sizeof(PCIDevice),
-                                0, -1, 
-                                NULL, NULL);
+                                -1, NULL, NULL);
         pci_conf = d->config;
         pci_conf[0x00] = 0x34; // dummy VGA (same as Bochs ID)
         pci_conf[0x01] = 0x12;
@@ -1875,8 +1895,7 @@ void vga_screen_dump(const char *filename)
     DisplayState *saved_ds, ds1, *ds = &ds1;
     
     /* XXX: this is a little hackish */
-    s->last_width = -1;
-    s->last_height = -1;
+    vga_invalidate_display();
     saved_ds = s->ds;
 
     memset(ds, 0, sizeof(DisplayState));