qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] [RFC] Variable video ram size option


From: Trolle Selander
Subject: [Qemu-devel] [PATCH] [RFC] Variable video ram size option
Date: Fri, 09 Jan 2009 14:45:47 -0500
User-agent: Thunderbird 2.0.0.19 (X11/20090105)

These patches are "extracted" from a patch-set I made for Xen. Any xen-specific parts have been removed. The patches do away with the statically defined VGA_RAM_ SIZE and provides a new -videoram option to enable setting the amount of video ram available to the VM. Shrinking default video ram used to 4 Megs (which is all that the default Cirrus card can use, anyway - previously, there's been a "waste" of 4 megs with the statically defined 8 Megs), but allowing users to specify up to 16 Megs of vram, to support the very high resolutions such as 2560x1600x32 that are available on today's high-end displays. The vgabios patch is needed for this to work, both for the variable size video ram, and to add the new resolutions. The defines for the high resolution and wide-screen modes were taken from what is already in qemu-kvm, so getting this into qemu mainline should get qemu/kvm & xen "in sync" in this regard.

Special thanks to Stefano Stabellini for comments & constructive criticism, and some save/restore fixes on the Xen version of this patch-set.

I'll brace myself for reports of how this patch breaks all the non-x86 architectures that qemu emulates... :)

Regards,
Trolle

Signed-off-by: Trolle Selander <address@hidden <mailto:address@hidden>>
diff -uNr vgabios-orig/vbe.c vgabios/vbe.c
--- vgabios-orig/vbe.c  2008-03-02 02:47:21.000000000 -0500
+++ vgabios/vbe.c       2008-12-16 12:43:05.167692121 -0500
@@ -38,8 +38,6 @@
 #include "vbe.h"
 #include "vbetables.h"
 
-#define VBE_TOTAL_VIDEO_MEMORY_DIV_64K 
(VBE_DISPI_TOTAL_VIDEO_MEMORY_MB*1024/64)
-
 // The current OEM Software Revision of this VBE Bios
 #define VBE_OEM_SOFTWARE_REV 0x0002;
 
@@ -821,7 +819,8 @@
         vbe_info_block.VideoModePtr_Off= DI + 34;
 
         // VBE Total Memory (in 64b blocks)
-        vbe_info_block.TotalMemory = VBE_TOTAL_VIDEO_MEMORY_DIV_64K;
+        outw(VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_VIDEO_MEMORY_64K);
+        vbe_info_block.TotalMemory = inw(VBE_DISPI_IOPORT_DATA);
 
         if (vbe2_info)
        {
@@ -846,7 +845,8 @@
         do
         {
                 if ((cur_info->info.XResolution <= dispi_get_max_xres()) &&
-                    (cur_info->info.BitsPerPixel <= dispi_get_max_bpp())) {
+                    (cur_info->info.BitsPerPixel <= dispi_get_max_bpp()) &&
+                    (cur_info->info.XResolution * cur_info->info.XResolution * 
cur_info->info.BitsPerPixel <= vbe_info_block.TotalMemory << 19 )) {
 #ifdef DEBUG
                   printf("VBE found mode %x => %x\n", cur_info->mode,cur_mode);
 #endif
@@ -855,7 +855,7 @@
                   cur_ptr+=2;
                 } else {
 #ifdef DEBUG
-                  printf("VBE mode %x (xres=%x / bpp=%02x) not supported by 
display\n", 
cur_info->mode,cur_info->info.XResolution,cur_info->info.BitsPerPixel);
+                  printf("VBE mode %x (xres=%x / bpp=%02x) not supported \n", 
cur_info->mode,cur_info->info.XResolution,cur_info->info.BitsPerPixel);
 #endif
                 }
                 cur_info++;
@@ -913,7 +913,13 @@
                   info.WinFuncPtr = 0xC0000000UL;
                   *(Bit16u *)&(info.WinFuncPtr) = 
(Bit16u)(dispi_set_bank_farcall);
                 }
-                
+                outw(VBE_DISPI_IOPORT_INDEX,VBE_DISPI_INDEX_LFB_ADDRESS_H);
+                info.PhysBasePtr = inw(VBE_DISPI_IOPORT_DATA);
+                info.PhysBasePtr = info.PhysBasePtr << 16;
+#if 0                                  
+                outw(VBE_DISPI_IOPORT_INDEX,VBE_DISPI_INDEX_LFB_ADDRESS_L);
+                info.PhysBasePtr |= inw(VBE_DISPI_IOPORT_DATA);
+#endif                                                         
                 result = 0x4f;
         }
         else
diff -uNr vgabios-orig/vbe.h vgabios/vbe.h
--- vgabios-orig/vbe.h  2006-08-12 03:47:34.000000000 -0400
+++ vgabios/vbe.h       2008-12-16 12:43:05.168692173 -0500
@@ -275,39 +275,41 @@
 //        like 0xE0000000
 
 
-  #define VBE_DISPI_BANK_ADDRESS          0xA0000
-  #define VBE_DISPI_BANK_SIZE_KB          64
+  #define VBE_DISPI_BANK_ADDRESS           0xA0000
+  #define VBE_DISPI_BANK_SIZE_KB           64
   
-  #define VBE_DISPI_MAX_XRES              1024
-  #define VBE_DISPI_MAX_YRES              768
+  #define VBE_DISPI_MAX_XRES               2560
+  #define VBE_DISPI_MAX_YRES               1600
   
-  #define VBE_DISPI_IOPORT_INDEX          0x01CE
-  #define VBE_DISPI_IOPORT_DATA           0x01CF
+  #define VBE_DISPI_IOPORT_INDEX           0x01CE
+  #define VBE_DISPI_IOPORT_DATA            0x01CF
   
-  #define VBE_DISPI_INDEX_ID              0x0
-  #define VBE_DISPI_INDEX_XRES            0x1
-  #define VBE_DISPI_INDEX_YRES            0x2
-  #define VBE_DISPI_INDEX_BPP             0x3
-  #define VBE_DISPI_INDEX_ENABLE          0x4
-  #define VBE_DISPI_INDEX_BANK            0x5
-  #define VBE_DISPI_INDEX_VIRT_WIDTH      0x6
-  #define VBE_DISPI_INDEX_VIRT_HEIGHT     0x7
-  #define VBE_DISPI_INDEX_X_OFFSET        0x8
-  #define VBE_DISPI_INDEX_Y_OFFSET        0x9
-      
-  #define VBE_DISPI_ID0                   0xB0C0
-  #define VBE_DISPI_ID1                   0xB0C1
-  #define VBE_DISPI_ID2                   0xB0C2
-  #define VBE_DISPI_ID3                   0xB0C3
-  #define VBE_DISPI_ID4                   0xB0C4
-  
-  #define VBE_DISPI_DISABLED              0x00
-  #define VBE_DISPI_ENABLED               0x01
-  #define VBE_DISPI_GETCAPS               0x02
-  #define VBE_DISPI_8BIT_DAC              0x20
-  #define VBE_DISPI_LFB_ENABLED           0x40
-  #define VBE_DISPI_NOCLEARMEM            0x80
-  
-  #define VBE_DISPI_LFB_PHYSICAL_ADDRESS  0xE0000000
+  #define VBE_DISPI_INDEX_ID               0x0
+  #define VBE_DISPI_INDEX_XRES             0x1
+  #define VBE_DISPI_INDEX_YRES             0x2
+  #define VBE_DISPI_INDEX_BPP              0x3
+  #define VBE_DISPI_INDEX_ENABLE           0x4
+  #define VBE_DISPI_INDEX_BANK             0x5
+  #define VBE_DISPI_INDEX_VIRT_WIDTH       0x6
+  #define VBE_DISPI_INDEX_VIRT_HEIGHT      0x7
+  #define VBE_DISPI_INDEX_X_OFFSET         0x8
+  #define VBE_DISPI_INDEX_Y_OFFSET         0x9
+  #define VBE_DISPI_INDEX_VIDEO_MEMORY_64K 0xa
+  #define VBE_DISPI_INDEX_LFB_ADDRESS_H    0xb
+  #define VBE_DISPI_INDEX_LFB_ADDRESS_L    0xc
+
+  #define VBE_DISPI_LFB_PHYSICAL_ADDRESS   0xE0000000
+  #define VBE_DISPI_ID0                    0xB0C0
+  #define VBE_DISPI_ID1                    0xB0C1
+  #define VBE_DISPI_ID2                    0xB0C2
+  #define VBE_DISPI_ID3                    0xB0C3
+  #define VBE_DISPI_ID4                    0xB0C4
+
+  #define VBE_DISPI_DISABLED               0x00
+  #define VBE_DISPI_ENABLED                0x01
+  #define VBE_DISPI_GETCAPS                0x02
+  #define VBE_DISPI_8BIT_DAC               0x20
+  #define VBE_DISPI_LFB_ENABLED            0x40
+  #define VBE_DISPI_NOCLEARMEM             0x80
 
 #endif
diff -uNr vgabios-orig/vbetables-gen.c vgabios/vbetables-gen.c
--- vgabios-orig/vbetables-gen.c        2006-08-15 16:42:14.000000000 -0400
+++ vgabios/vbetables-gen.c     2008-12-30 20:17:22.978504086 -0500
@@ -2,7 +2,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 
-#define VBE_DISPI_TOTAL_VIDEO_MEMORY_MB 8
+#define VBE_DISPI_TOTAL_VIDEO_MEMORY_MB 16
 
 typedef struct {
     int width;
@@ -42,19 +42,40 @@
 { 1600, 1200, 24                      , 0x11F},
 
       /* BOCHS/PLE, 86 'own' mode numbers */
-{ 320, 200, 32                        , 0x140},
-{ 640, 400, 32                        , 0x141},
-{ 640, 480, 32                        , 0x142},
-{ 800, 600, 32                        , 0x143},
-{ 1024, 768, 32                       , 0x144},
-{ 1280, 1024, 32                      , 0x145},
-{ 320, 200, 8                           , 0x146},
-{ 1600, 1200, 32                      , 0x147},
-{ 1152, 864, 8                      , 0x148},
+{ 320, 200, 32                       , 0x140},
+{ 640, 400, 32                       , 0x141},
+{ 640, 480, 32                       , 0x142},
+{ 800, 600, 32                       , 0x143},
+{ 1024, 768, 32                      , 0x144},
+{ 1280, 1024, 32                     , 0x145},
+{ 320, 200, 8                        , 0x146},
+{ 1600, 1200, 32                     , 0x147},
+{ 1152, 864, 8                       , 0x148},
 { 1152, 864, 15                      , 0x149},
 { 1152, 864, 16                      , 0x14a},
 { 1152, 864, 24                      , 0x14b},
 { 1152, 864, 32                      , 0x14c},
+{ 1280, 800, 16                      , 0x178},
+{ 1280, 800, 24                      , 0x179},
+{ 1280, 800, 32                      , 0x17a},
+{ 1280, 960, 16                      , 0x17b},
+{ 1280, 960, 24                      , 0x17c},
+{ 1280, 960, 32                      , 0x17d},
+{ 1440, 900, 16                      , 0x17e},
+{ 1440, 900, 24                      , 0x17f},
+{ 1440, 900, 32                      , 0x180},
+{ 1400, 1050, 16                     , 0x181},
+{ 1400, 1050, 24                     , 0x182},
+{ 1400, 1050, 32                     , 0x183},
+{ 1680, 1050, 16                     , 0x184},
+{ 1680, 1050, 24                     , 0x185},
+{ 1680, 1050, 32                     , 0x186},
+{ 1920, 1200, 16                     , 0x187},
+{ 1920, 1200, 24                     , 0x188},
+{ 1920, 1200, 32                     , 0x189},
+{ 2560, 1600, 16                     , 0x18a},
+{ 2560, 1600, 24                     , 0x18b},
+{ 2560, 1600, 32                     , 0x18c},
 { 0, },
 };
 
Binary files vgabios-orig/VGABIOS-lgpl-latest.bin and 
vgabios/VGABIOS-lgpl-latest.bin differ
Binary files vgabios-orig/VGABIOS-lgpl-latest.cirrus.bin and 
vgabios/VGABIOS-lgpl-latest.cirrus.bin differ
Binary files vgabios-orig/VGABIOS-lgpl-latest.cirrus.debug.bin and 
vgabios/VGABIOS-lgpl-latest.cirrus.debug.bin differ
Binary files vgabios-orig/VGABIOS-lgpl-latest.debug.bin and 
vgabios/VGABIOS-lgpl-latest.debug.bin differ
diff -uNr trunk/hw/cirrus_vga.c trunk-patched/hw/cirrus_vga.c
--- trunk/hw/cirrus_vga.c       2009-01-09 12:39:16.354481456 -0500
+++ trunk-patched/hw/cirrus_vga.c       2009-01-09 14:23:32.590514137 -0500
@@ -3310,6 +3310,12 @@
 
     s = qemu_mallocz(sizeof(CirrusVGAState));
 
+    if ( vga_ram_size != 4*1024*1024 )
+    {
+        fprintf(stderr,"The -videoram option does not work with the cirrus vga 
model. Video ram set to 4M. \n");
+        vga_ram_size=4*1024*1024;
+    }
+
     vga_common_init((VGAState *)s,
                     ds, vga_ram_base, vga_ram_offset, vga_ram_size);
     cirrus_init_common(s, CIRRUS_ID_CLGD5430, 0);
@@ -3337,10 +3343,10 @@
 
     s->map_addr = s->map_end = 0;
     s->lfb_addr = addr & TARGET_PAGE_MASK;
-    s->lfb_end = ((addr + VGA_RAM_SIZE) + TARGET_PAGE_SIZE - 1) & 
TARGET_PAGE_MASK;
+    s->lfb_end = ((addr + s->vram_size) + TARGET_PAGE_SIZE - 1) & 
TARGET_PAGE_MASK;
     /* account for overflow */
-    if (s->lfb_end < addr + VGA_RAM_SIZE)
-        s->lfb_end = addr + VGA_RAM_SIZE;
+    if (s->lfb_end < addr + s->vram_size)
+        s->lfb_end = addr + s->vram_size;
 }
 
 static void cirrus_pci_mmio_map(PCIDevice *d, int region_num,
@@ -3378,6 +3384,13 @@
 
     /* setup VGA */
     s = &d->cirrus_vga;
+    
+    if ( vga_ram_size != 4*1024*1024 )
+    {
+        fprintf(stderr,"The -videoram option does not work with the cirrus vga 
model. Video ram set to 4M. \n");
+        vga_ram_size=4*1024*1024;
+    }
+    
     vga_common_init((VGAState *)s,
                     ds, vga_ram_base, vga_ram_offset, vga_ram_size);
     cirrus_init_common(s, device_id, 1);
diff -uNr trunk/hw/mips_jazz.c trunk-patched/hw/mips_jazz.c
--- trunk/hw/mips_jazz.c        2009-01-05 12:19:53.822918856 -0500
+++ trunk-patched/hw/mips_jazz.c        2009-01-09 14:23:32.591518586 -0500
@@ -292,7 +292,7 @@
     .name = "magnum",
     .desc = "MIPS Magnum",
     .init = mips_magnum_init,
-    .ram_require = MAGNUM_BIOS_SIZE + VGA_RAM_SIZE,
+    .ram_require = MAGNUM_BIOS_SIZE,
     .nodisk_ok = 1,
     .use_scsi = 1,
 };
@@ -301,7 +301,7 @@
     .name = "pica61",
     .desc = "Acer Pica 61",
     .init = mips_pica61_init,
-    .ram_require = MAGNUM_BIOS_SIZE + VGA_RAM_SIZE,
+    .ram_require = MAGNUM_BIOS_SIZE,
     .nodisk_ok = 1,
     .use_scsi = 1,
 };
diff -uNr trunk/hw/mips_malta.c trunk-patched/hw/mips_malta.c
--- trunk/hw/mips_malta.c       2008-12-16 11:57:09.859690422 -0500
+++ trunk-patched/hw/mips_malta.c       2009-01-09 14:23:32.592483085 -0500
@@ -949,6 +949,6 @@
     .name = "malta",
     .desc = "MIPS Malta Core LV",
     .init = mips_malta_init,
-    .ram_require = VGA_RAM_SIZE + BIOS_SIZE,
+    .ram_require = BIOS_SIZE,
     .nodisk_ok = 1,
 };
diff -uNr trunk/hw/mips_mipssim.c trunk-patched/hw/mips_mipssim.c
--- trunk/hw/mips_mipssim.c     2008-11-17 21:59:28.219467005 -0500
+++ trunk-patched/hw/mips_mipssim.c     2009-01-09 14:23:32.592483085 -0500
@@ -194,6 +194,6 @@
     .name = "mipssim",
     .desc = "MIPS MIPSsim platform",
     .init = mips_mipssim_init,
-    .ram_require = BIOS_SIZE + VGA_RAM_SIZE /* unused */,
+    .ram_require = BIOS_SIZE /* unused */,
     .nodisk_ok = 1,
 };
diff -uNr trunk/hw/mips_r4k.c trunk-patched/hw/mips_r4k.c
--- trunk/hw/mips_r4k.c 2009-01-09 12:39:16.387480753 -0500
+++ trunk-patched/hw/mips_r4k.c 2009-01-09 14:23:32.598516270 -0500
@@ -287,6 +287,6 @@
     .name = "mips",
     .desc = "mips r4k platform",
     .init = mips_r4k_init,
-    .ram_require = VGA_RAM_SIZE + BIOS_SIZE,
+    .ram_require = BIOS_SIZE,
     .nodisk_ok = 1,
 };
diff -uNr trunk/hw/pc.c trunk-patched/hw/pc.c
--- trunk/hw/pc.c       2008-12-30 17:10:53.590531452 -0500
+++ trunk-patched/hw/pc.c       2009-01-09 14:23:32.599480979 -0500
@@ -1151,7 +1151,7 @@
     .name = "pc",
     .desc = "Standard PC",
     .init = pc_init_pci,
-    .ram_require = VGA_RAM_SIZE + PC_MAX_BIOS_SIZE,
+    .ram_require = PC_MAX_BIOS_SIZE,
     .max_cpus = 255,
 };
 
@@ -1159,6 +1159,6 @@
     .name = "isapc",
     .desc = "ISA-only PC",
     .init = pc_init_isa,
-    .ram_require = VGA_RAM_SIZE + PC_MAX_BIOS_SIZE,
+    .ram_require = PC_MAX_BIOS_SIZE,
     .max_cpus = 1,
 };
diff -uNr trunk/hw/pc.h trunk-patched/hw/pc.h
--- trunk/hw/pc.h       2008-12-30 17:10:53.605546746 -0500
+++ trunk-patched/hw/pc.h       2009-01-09 14:23:32.599480979 -0500
@@ -124,12 +124,6 @@
 
 extern enum vga_retrace_method vga_retrace_method;
 
-#ifndef TARGET_SPARC
-#define VGA_RAM_SIZE (8192 * 1024)
-#else
-#define VGA_RAM_SIZE (9 * 1024 * 1024)
-#endif
-
 int isa_vga_init(DisplayState *ds, uint8_t *vga_ram_base,
                  unsigned long vga_ram_offset, int vga_ram_size);
 int pci_vga_init(PCIBus *bus, DisplayState *ds, uint8_t *vga_ram_base,
diff -uNr trunk/hw/ppc_chrp.c trunk-patched/hw/ppc_chrp.c
--- trunk/hw/ppc_chrp.c 2008-11-17 21:59:28.121466857 -0500
+++ trunk-patched/hw/ppc_chrp.c 2009-01-09 14:23:32.600515738 -0500
@@ -334,6 +334,6 @@
     .name = "mac99",
     .desc = "Mac99 based PowerMAC",
     .init = ppc_core99_init,
-    .ram_require = BIOS_SIZE + VGA_RAM_SIZE,
+    .ram_require = BIOS_SIZE,
     .max_cpus = MAX_CPUS,
 };
diff -uNr trunk/hw/ppc_oldworld.c trunk-patched/hw/ppc_oldworld.c
--- trunk/hw/ppc_oldworld.c     2009-01-09 12:39:16.384481865 -0500
+++ trunk-patched/hw/ppc_oldworld.c     2009-01-09 14:23:32.601517323 -0500
@@ -385,6 +385,6 @@
     .name = "g3beige",
     .desc = "Heathrow based PowerMAC",
     .init = ppc_heathrow_init,
-    .ram_require = BIOS_SIZE + VGA_BIOS_SIZE + VGA_RAM_SIZE,
+    .ram_require = BIOS_SIZE + VGA_BIOS_SIZE,
     .max_cpus = MAX_CPUS,
 };
diff -uNr trunk/hw/ppc_prep.c trunk-patched/hw/ppc_prep.c
--- trunk/hw/ppc_prep.c 2009-01-09 12:39:16.366481689 -0500
+++ trunk-patched/hw/ppc_prep.c 2009-01-09 14:23:32.603514277 -0500
@@ -765,6 +765,6 @@
     .name = "prep",
     .desc = "PowerPC PREP platform",
     .init = ppc_prep_init,
-    .ram_require = BIOS_SIZE + VGA_RAM_SIZE,
+    .ram_require = BIOS_SIZE,
     .max_cpus = MAX_CPUS,
 };
diff -uNr trunk/hw/sun4u.c trunk-patched/hw/sun4u.c
--- trunk/hw/sun4u.c    2008-12-30 17:10:53.579530173 -0500
+++ trunk-patched/hw/sun4u.c    2009-01-09 14:23:32.604517608 -0500
@@ -600,7 +600,7 @@
     .name = "sun4u",
     .desc = "Sun4u platform",
     .init = sun4u_init,
-    .ram_require = PROM_SIZE_MAX + VGA_RAM_SIZE,
+    .ram_require = PROM_SIZE_MAX,
     .nodisk_ok = 1,
     .max_cpus = 1, // XXX for now
 };
@@ -609,7 +609,7 @@
     .name = "sun4v",
     .desc = "Sun4v platform",
     .init = sun4v_init,
-    .ram_require = PROM_SIZE_MAX + VGA_RAM_SIZE,
+    .ram_require = PROM_SIZE_MAX,
     .nodisk_ok = 1,
     .max_cpus = 1, // XXX for now
 };
@@ -618,7 +618,7 @@
     .name = "Niagara",
     .desc = "Sun4v platform, Niagara",
     .init = niagara_init,
-    .ram_require = PROM_SIZE_MAX + VGA_RAM_SIZE,
+    .ram_require = PROM_SIZE_MAX,
     .nodisk_ok = 1,
     .max_cpus = 1, // XXX for now
 };
diff -uNr trunk/hw/vga.c trunk-patched/hw/vga.c
--- trunk/hw/vga.c      2009-01-09 12:39:16.383481956 -0500
+++ trunk-patched/hw/vga.c      2009-01-09 14:23:32.606480689 -0500
@@ -36,6 +36,11 @@
 
 //#define DEBUG_BOCHS_VBE
 
+// PCI 0x04: command(word), 0x06(word): status
+#define PCI_COMMAND_IOACCESS                0x0001
+#define PCI_COMMAND_MEMACCESS               0x0002
+#define PCI_COMMAND_BUSMASTER               0x0004
+
 /* force some bits to zero */
 const uint8_t sr_mask[8] = {
     (uint8_t)~0xfc,
@@ -2219,10 +2224,20 @@
         cpu_register_physical_memory(addr, s->bios_size, s->bios_offset);
     } else {
         cpu_register_physical_memory(addr, s->vram_size, s->vram_offset);
+        s->lfb_addr = addr;
+        s->lfb_end = addr + size;
+#ifdef CONFIG_BOCHS_VBE
+        s->vbe_regs[VBE_DISPI_INDEX_LFB_ADDRESS_H] = s->lfb_addr >> 16;
+        s->vbe_regs[VBE_DISPI_INDEX_LFB_ADDRESS_L] = s->lfb_addr & 0xFFFF;
+        s->vbe_regs[VBE_DISPI_INDEX_VIDEO_MEMORY_64K] = s->vram_size >> 16;
+#endif
+
+        if (size != s->vram_size)
+            fprintf(stderr, "vga map with size %x != %x\n", size, 
s->vram_size);
     }
 
     s->map_addr = addr;
-    s->map_end = addr + VGA_RAM_SIZE;
+    s->map_end = addr + s->vram_size;
 
     vga_dirty_log_start(s);
 }
@@ -2469,6 +2484,12 @@
     if (!d)
         return -1;
     s = &d->vga_state;
+    
+    if ( vga_ram_size > 16*1024*1024 )
+    {
+        fprintf(stderr,"The stdvga/VBE device model currently has no use for 
more than 16 Megs of vram. Video ram reduced to 16M. \n");
+        vga_ram_size = 16*1024*1024;
+    }
 
     vga_common_init(s, ds, vga_ram_base, vga_ram_offset, vga_ram_size);
     vga_init(s);
@@ -2483,6 +2504,7 @@
     pci_conf[0x01] = 0x12;
     pci_conf[0x02] = 0x11;
     pci_conf[0x03] = 0x11;
+    pci_conf[0x04] = PCI_COMMAND_IOACCESS | PCI_COMMAND_MEMACCESS /* | 
PCI_COMMAND_BUSMASTER */;
     pci_conf[0x0a] = 0x00; // VGA controller
     pci_conf[0x0b] = 0x03;
     pci_conf[0x0e] = 0x00; // header_type
diff -uNr trunk/hw/vga_int.h trunk-patched/hw/vga_int.h
--- trunk/hw/vga_int.h  2009-01-09 12:39:16.363481753 -0500
+++ trunk-patched/hw/vga_int.h  2009-01-09 14:23:32.606480689 -0500
@@ -30,36 +30,39 @@
 /* bochs VBE support */
 #define CONFIG_BOCHS_VBE
 
-#define VBE_DISPI_MAX_XRES              1600
-#define VBE_DISPI_MAX_YRES              1200
-#define VBE_DISPI_MAX_BPP               32
-
-#define VBE_DISPI_INDEX_ID              0x0
-#define VBE_DISPI_INDEX_XRES            0x1
-#define VBE_DISPI_INDEX_YRES            0x2
-#define VBE_DISPI_INDEX_BPP             0x3
-#define VBE_DISPI_INDEX_ENABLE          0x4
-#define VBE_DISPI_INDEX_BANK            0x5
-#define VBE_DISPI_INDEX_VIRT_WIDTH      0x6
-#define VBE_DISPI_INDEX_VIRT_HEIGHT     0x7
-#define VBE_DISPI_INDEX_X_OFFSET        0x8
-#define VBE_DISPI_INDEX_Y_OFFSET        0x9
-#define VBE_DISPI_INDEX_NB              0xa
-
-#define VBE_DISPI_ID0                   0xB0C0
-#define VBE_DISPI_ID1                   0xB0C1
-#define VBE_DISPI_ID2                   0xB0C2
-#define VBE_DISPI_ID3                   0xB0C3
-#define VBE_DISPI_ID4                   0xB0C4
-
-#define VBE_DISPI_DISABLED              0x00
-#define VBE_DISPI_ENABLED               0x01
-#define VBE_DISPI_GETCAPS               0x02
-#define VBE_DISPI_8BIT_DAC              0x20
-#define VBE_DISPI_LFB_ENABLED           0x40
-#define VBE_DISPI_NOCLEARMEM            0x80
+#define VBE_DISPI_MAX_XRES               2560
+#define VBE_DISPI_MAX_YRES               1600
+#define VBE_DISPI_MAX_BPP                32
+
+#define VBE_DISPI_INDEX_ID               0x0
+#define VBE_DISPI_INDEX_XRES             0x1
+#define VBE_DISPI_INDEX_YRES             0x2
+#define VBE_DISPI_INDEX_BPP              0x3
+#define VBE_DISPI_INDEX_ENABLE           0x4
+#define VBE_DISPI_INDEX_BANK             0x5
+#define VBE_DISPI_INDEX_VIRT_WIDTH       0x6
+#define VBE_DISPI_INDEX_VIRT_HEIGHT      0x7
+#define VBE_DISPI_INDEX_X_OFFSET         0x8
+#define VBE_DISPI_INDEX_Y_OFFSET         0x9
+#define VBE_DISPI_INDEX_VIDEO_MEMORY_64K 0xa
+#define VBE_DISPI_INDEX_LFB_ADDRESS_H    0xb
+#define VBE_DISPI_INDEX_LFB_ADDRESS_L    0xc
+#define VBE_DISPI_INDEX_NB               0xd
+
+#define VBE_DISPI_ID0                    0xB0C0
+#define VBE_DISPI_ID1                    0xB0C1
+#define VBE_DISPI_ID2                    0xB0C2
+#define VBE_DISPI_ID3                    0xB0C3
+#define VBE_DISPI_ID4                    0xB0C4
+
+#define VBE_DISPI_DISABLED               0x00
+#define VBE_DISPI_ENABLED                0x01
+#define VBE_DISPI_GETCAPS                0x02
+#define VBE_DISPI_8BIT_DAC               0x20
+#define VBE_DISPI_LFB_ENABLED            0x40
+#define VBE_DISPI_NOCLEARMEM             0x80
 
-#define VBE_DISPI_LFB_PHYSICAL_ADDRESS  0xE0000000
+#define VBE_DISPI_LFB_PHYSICAL_ADDRESS   0xE0000000
 
 #ifdef CONFIG_BOCHS_VBE
 
diff -uNr trunk/vl.c trunk-patched/vl.c
--- trunk/vl.c  2009-01-09 12:39:16.740479241 -0500
+++ trunk-patched/vl.c  2009-01-09 14:23:32.608510538 -0500
@@ -178,7 +178,7 @@
    to store the VM snapshots */
 DriveInfo drives_table[MAX_DRIVES+1];
 int nb_drives;
-static int vga_ram_size;
+static int vga_ram_size = 4 * 1024 * 1024;
 enum vga_retrace_method vga_retrace_method = VGA_RETRACE_DUMB;
 DisplayState display_state;
 int nographic;
@@ -3872,6 +3872,7 @@
            "                use -soundhw all to enable all of them\n"
 #endif
            "-vga [std|cirrus|vmware]\n"
+           "-videoram       set amount of memory available to virtual video 
adapter\n"           
            "                select video card type\n"
            "-localtime      set the real time clock to local time 
[default=utc]\n"
            "-full-screen    start in full screen\n"
@@ -4058,6 +4059,7 @@
     QEMU_OPTION_localtime,
     QEMU_OPTION_g,
     QEMU_OPTION_vga,
+    QEMU_OPTION_videoram,    
     QEMU_OPTION_echr,
     QEMU_OPTION_monitor,
     QEMU_OPTION_serial,
@@ -4167,6 +4169,7 @@
 #endif
     { "localtime", 0, QEMU_OPTION_localtime },
     { "vga", HAS_ARG, QEMU_OPTION_vga },
+    { "videoram", HAS_ARG, QEMU_OPTION_videoram },    
     { "echr", HAS_ARG, QEMU_OPTION_echr },
     { "monitor", HAS_ARG, QEMU_OPTION_monitor },
     { "serial", HAS_ARG, QEMU_OPTION_serial },
@@ -4551,7 +4554,6 @@
     cpu_model = NULL;
     initrd_filename = NULL;
     ram_size = 0;
-    vga_ram_size = VGA_RAM_SIZE;
 #ifdef CONFIG_GDBSTUB
     use_gdbstub = 0;
     gdbstub_port = DEFAULT_GDBSTUB_PORT;
@@ -4908,6 +4910,13 @@
             case QEMU_OPTION_vga:
                 select_vgahw (optarg);
                 break;
+            case QEMU_OPTION_videoram:
+                {
+                    char *ptr;
+                    vga_ram_size = strtol(optarg,&ptr,10);
+                    vga_ram_size *= 1024 * 1024;
+                }
+                break;
             case QEMU_OPTION_g:
                 {
                     const char *p;
@@ -5320,7 +5329,12 @@
             exit(1);
 
     /* init the memory */
-    phys_ram_size = machine->ram_require & ~RAMSIZE_FIXED;
+    
+#ifdef TARGET_SPARC
+    vga_ram_size += (1024 * 1024);
+#endif
+
+    phys_ram_size = (machine->ram_require + vga_ram_size) & ~RAMSIZE_FIXED;
 
     if (machine->ram_require & RAMSIZE_FIXED) {
         if (ram_size > 0) {

reply via email to

[Prev in Thread] Current Thread [Next in Thread]