From: Trolle Selander <trolle.selander@eu.citrix.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] [RFC] Variable video ram size option - revised
Date: Wed, 21 Jan 2009 13:07:51 -0500 [thread overview]
Message-ID: <49776477.4020204@eu.citrix.com> (raw)
In-Reply-To: <4969A57D.2020708@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 518 bytes --]
Hi all,
This is an updated version of the patch after the suggestions/discussion
on the list. It also includes different handling of how the -vga option
is handled internally, replacing the multiple
independent-yet-mutually-exclusive xxx_vga_enabled variables with one
vgahw_model variable, and also includes the -vga none option added by
Stefano in the time since my last version of this patch. Further
comments & testing welcome. :)
-- Trolle
Signed-off-by: Trolle Selander <trolle.selander@eu.citrix.com>
[-- Attachment #2: qemu_variable_vram_v2.patch --]
[-- Type: text/plain, Size: 19996 bytes --]
diff -uNr trunk/hw/cirrus_vga.c trunk-patched/hw/cirrus_vga.c
--- trunk/hw/cirrus_vga.c 2009-01-19 18:04:34.402289923 -0500
+++ trunk-patched/hw/cirrus_vga.c 2009-01-19 18:12:25.593320302 -0500
@@ -3297,6 +3297,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,
vga_ram_base, vga_ram_offset, vga_ram_size);
cirrus_init_common(s, CIRRUS_ID_CLGD5430, 0);
@@ -3324,10 +3330,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,
@@ -3365,6 +3371,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,
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-19 18:04:34.482293278 -0500
+++ trunk-patched/hw/mips_jazz.c 2009-01-19 18:12:25.594322030 -0500
@@ -293,7 +293,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,
};
@@ -302,7 +302,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 2009-01-19 18:04:34.514292790 -0500
+++ trunk-patched/hw/mips_malta.c 2009-01-19 18:12:25.595322502 -0500
@@ -943,6 +943,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 2009-01-19 18:04:34.495297312 -0500
+++ trunk-patched/hw/mips_mipssim.c 2009-01-19 18:12:25.596288472 -0500
@@ -184,6 +184,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-19 18:04:34.523310792 -0500
+++ trunk-patched/hw/mips_r4k.c 2009-01-19 18:12:25.597288246 -0500
@@ -275,6 +275,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 2009-01-19 18:04:34.518294675 -0500
+++ trunk-patched/hw/pc.c 2009-01-19 18:12:25.599288142 -0500
@@ -852,29 +852,29 @@
exit(1);
}
- if (cirrus_vga_enabled || std_vga_enabled || vmsvga_enabled) {
- /* VGA BIOS load */
- if (cirrus_vga_enabled) {
- snprintf(buf, sizeof(buf), "%s/%s", bios_dir, VGABIOS_CIRRUS_FILENAME);
- } else {
- snprintf(buf, sizeof(buf), "%s/%s", bios_dir, VGABIOS_FILENAME);
- }
- vga_bios_size = get_image_size(buf);
- if (vga_bios_size <= 0 || vga_bios_size > 65536)
- goto vga_bios_error;
- vga_bios_offset = qemu_ram_alloc(65536);
-
- ret = load_image(buf, phys_ram_base + vga_bios_offset);
- if (ret != vga_bios_size) {
-vga_bios_error:
- fprintf(stderr, "qemu: could not load VGA BIOS '%s'\n", buf);
- exit(1);
- }
+ if (vgahw_model != VGAHW_NONE) {
+ /* VGA BIOS load */
+ if (vgahw_model == VGAHW_CIRRUS)
+ snprintf(buf, sizeof(buf), "%s/%s", bios_dir, VGABIOS_CIRRUS_FILENAME);
+ else
+ snprintf(buf, sizeof(buf), "%s/%s", bios_dir, VGABIOS_FILENAME);
+
+ vga_bios_size = get_image_size(buf);
+ if (vga_bios_size <= 0 || vga_bios_size > 65536)
+ goto vga_bios_error;
+ vga_bios_offset = qemu_ram_alloc(65536);
+
+ ret = load_image(buf, phys_ram_base + vga_bios_offset);
+ if (ret != vga_bios_size) {
+ vga_bios_error:
+ fprintf(stderr, "qemu: could not load VGA BIOS '%s'\n", buf);
+ exit(1);
+ }
+ }
- /* setup basic memory access */
- cpu_register_physical_memory(0xc0000, 0x10000,
+ /* setup basic memory access */
+ cpu_register_physical_memory(0xc0000, 0x10000,
vga_bios_offset | IO_MEM_ROM);
- }
/* map the last 128KB of the BIOS in ISA space */
isa_bios_size = bios_size;
@@ -943,29 +943,35 @@
register_ioport_write(0xf0, 1, 1, ioportF0_write, NULL);
- if (cirrus_vga_enabled) {
- if (pci_enabled) {
- pci_cirrus_vga_init(pci_bus,
+ switch(vgahw_model) {
+ case VGAHW_NONE:
+ break;
+ case VGAHW_CIRRUS:
+ if (pci_enabled)
+ pci_cirrus_vga_init(pci_bus,
+ phys_ram_base + vga_ram_addr,
+ vga_ram_addr, vga_ram_size);
+ else
+ isa_cirrus_vga_init(phys_ram_base + vga_ram_addr,
+ vga_ram_addr, vga_ram_size);
+ break;
+ case VGAHW_VMWARE:
+ if (pci_enabled)
+ pci_vmsvga_init(pci_bus,
phys_ram_base + vga_ram_addr,
vga_ram_addr, vga_ram_size);
- } else {
- isa_cirrus_vga_init(phys_ram_base + vga_ram_addr,
- vga_ram_addr, vga_ram_size);
- }
- } else if (vmsvga_enabled) {
- if (pci_enabled)
- pci_vmsvga_init(pci_bus, phys_ram_base + vga_ram_addr,
- vga_ram_addr, vga_ram_size);
- else
- fprintf(stderr, "%s: vmware_vga: no PCI bus\n", __FUNCTION__);
- } else if (std_vga_enabled) {
- if (pci_enabled) {
- pci_vga_init(pci_bus, phys_ram_base + vga_ram_addr,
- vga_ram_addr, vga_ram_size, 0, 0);
- } else {
- isa_vga_init(phys_ram_base + vga_ram_addr,
- vga_ram_addr, vga_ram_size);
- }
+ else
+ fprintf(stderr, "%s: vmware_vga: no PCI bus\n", __FUNCTION__);
+ break;
+ case VGAHW_STD:
+ if (pci_enabled)
+ pci_vga_init(pci_bus,
+ phys_ram_base + vga_ram_addr,
+ vga_ram_addr, vga_ram_size, 0, 0);
+ else
+ isa_vga_init(phys_ram_base + vga_ram_addr,
+ vga_ram_addr, vga_ram_size);
+ break;
}
rtc_state = rtc_init(0x70, i8259[8]);
@@ -1146,7 +1152,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,
};
@@ -1154,6 +1160,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 2009-01-19 18:04:34.518294675 -0500
+++ trunk-patched/hw/pc.h 2009-01-19 18:12:25.599288142 -0500
@@ -126,12 +126,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(uint8_t *vga_ram_base,
unsigned long vga_ram_offset, int vga_ram_size);
int pci_vga_init(PCIBus *bus, uint8_t *vga_ram_base,
diff -uNr trunk/hw/ppc_chrp.c trunk-patched/hw/ppc_chrp.c
--- trunk/hw/ppc_chrp.c 2009-01-19 18:04:34.414289295 -0500
+++ trunk-patched/hw/ppc_chrp.c 2009-01-19 18:12:25.600286867 -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-19 18:04:34.505293366 -0500
+++ trunk-patched/hw/ppc_oldworld.c 2009-01-19 18:12:25.601287409 -0500
@@ -383,6 +383,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-19 18:04:34.430293137 -0500
+++ trunk-patched/hw/ppc_prep.c 2009-01-19 18:12:25.602286553 -0500
@@ -760,6 +760,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 2009-01-19 18:04:34.486295094 -0500
+++ trunk-patched/hw/sun4u.c 2009-01-19 18:12:25.603302111 -0500
@@ -644,7 +644,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
};
@@ -653,7 +653,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
};
@@ -662,7 +662,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-19 18:04:34.484284722 -0500
+++ trunk-patched/hw/vga.c 2009-01-19 18:12:25.605321282 -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,
@@ -2246,10 +2251,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);
}
@@ -2509,6 +2524,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-19 18:04:34.421284633 -0500
+++ trunk-patched/hw/vga_int.h 2009-01-19 18:12:25.606286414 -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/sysemu.h trunk-patched/sysemu.h
--- trunk/sysemu.h 2009-01-19 18:04:55.735316222 -0500
+++ trunk-patched/sysemu.h 2009-01-19 18:12:25.608286519 -0500
@@ -81,10 +81,12 @@
/* SLIRP */
void do_info_slirp(void);
+typedef enum {
+ VGAHW_NONE, VGAHW_CIRRUS, VGAHW_STD, VGAHW_VMWARE
+} VGAHardwareModel;
+
+extern VGAHardwareModel vgahw_model;
extern int bios_size;
-extern int cirrus_vga_enabled;
-extern int std_vga_enabled;
-extern int vmsvga_enabled;
extern int graphic_width;
extern int graphic_height;
extern int graphic_depth;
diff -uNr trunk/vl.c trunk-patched/vl.c
--- trunk/vl.c 2009-01-19 18:04:55.701293559 -0500
+++ trunk-patched/vl.c 2009-01-19 18:12:25.613287760 -0500
@@ -185,7 +185,8 @@
to store the VM snapshots */
DriveInfo drives_table[MAX_DRIVES+1];
int nb_drives;
-static int vga_ram_size;
+static int vga_ram_size = 0;
+VGAHardwareModel vgahw_model = VGAHW_CIRRUS;
enum vga_retrace_method vga_retrace_method = VGA_RETRACE_DUMB;
static DisplayState *display_state;
int nographic;
@@ -3874,7 +3875,10 @@
" use -soundhw ? to get the list of supported cards\n"
" use -soundhw all to enable all of them\n"
#endif
+#if !defined(TARGET_SPARC) || defined(TARGET_SPARC64)
"-vga [std|cirrus|vmware|none]\n"
+ "-videoram set amount of memory available to virtual video adapter\n"
+#endif
" select video card type\n"
"-localtime set the real time clock to local time [default=utc]\n"
"-full-screen start in full screen\n"
@@ -4062,6 +4066,7 @@
QEMU_OPTION_localtime,
QEMU_OPTION_g,
QEMU_OPTION_vga,
+ QEMU_OPTION_videoram,
QEMU_OPTION_echr,
QEMU_OPTION_monitor,
QEMU_OPTION_serial,
@@ -4174,6 +4179,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 },
@@ -4410,21 +4416,13 @@
const char *opts;
if (strstart(p, "std", &opts)) {
- std_vga_enabled = 1;
- cirrus_vga_enabled = 0;
- vmsvga_enabled = 0;
+ vgahw_model = VGAHW_STD;
} else if (strstart(p, "cirrus", &opts)) {
- cirrus_vga_enabled = 1;
- std_vga_enabled = 0;
- vmsvga_enabled = 0;
+ vgahw_model = VGAHW_CIRRUS;
} else if (strstart(p, "vmware", &opts)) {
- cirrus_vga_enabled = 0;
- std_vga_enabled = 0;
- vmsvga_enabled = 1;
+ vgahw_model = VGAHW_VMWARE;
} else if (strstart(p, "none", &opts)) {
- cirrus_vga_enabled = 0;
- std_vga_enabled = 0;
- vmsvga_enabled = 0;
+ vgahw_model = VGAHW_NONE;
} else {
invalid_vga:
fprintf(stderr, "Unknown vga type: %s\n", p);
@@ -4571,7 +4569,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;
@@ -4933,6 +4930,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;
@@ -5361,7 +5365,30 @@
exit(1);
/* init the memory */
- phys_ram_size = machine->ram_require & ~RAMSIZE_FIXED;
+
+ /* Set defaults according to model, if -videoram has not been used. */
+#if !defined(TARGET_SPARC) || defined(TARGET_SPARC64)
+ if (vga_ram_size && vgahw_model == VGAHW_NONE) {
+ fprintf(stderr, "Nonsensical options: -vga none & -videoram used together. \n");
+ vga_ram_size = 0;
+ } else if (!vga_ram_size && vgahw_model != VGAHW_NONE) {
+ switch(vgahw_model) {
+ case VGAHW_CIRRUS:
+ vga_ram_size=4 * 1024 * 1024;
+ break;
+ case VGAHW_STD:
+ vga_ram_size=8 * 1024 * 1024;
+ break;
+ case VGAHW_VMWARE:
+ vga_ram_size=8 * 1024 * 1024;
+ break;
+ }
+ }
+#else
+ vga_ram_size = 9 * 1024 * 1024;
+#endif
+
+ phys_ram_size = (machine->ram_require + vga_ram_size) & ~RAMSIZE_FIXED;
if (machine->ram_require & RAMSIZE_FIXED) {
if (ram_size > 0) {
next prev parent reply other threads:[~2009-01-21 18:08 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-09 19:45 [Qemu-devel] [PATCH] [RFC] Variable video ram size option Trolle Selander
2009-01-10 0:02 ` Paul Brook
2009-01-10 1:26 ` Trolle Selander
2009-01-10 6:45 ` Blue Swirl
[not found] ` <4967E7D7.4040605@eu.citrix.com>
[not found] ` <200901091716.00827.paul@codesourcery.com>
2009-01-10 1:27 ` Trolle Selander
[not found] ` <4967ECA7.6040809@eu.citrix.com>
[not found] ` <200901091747.06462.paul@codesourcery.com>
2009-01-10 1:28 ` Trolle Selander
2009-01-10 1:47 ` Jamie Lokier
2009-01-11 7:53 ` Avi Kivity
2009-01-12 17:43 ` Trolle Selander
2009-01-21 18:07 ` Trolle Selander [this message]
2009-01-21 18:23 ` [Qemu-devel] [PATCH] [RFC] Variable video ram size option - revised Daniel P. Berrange
2009-01-21 21:51 ` Anthony Liguori
2009-01-21 21:21 ` [Qemu-devel] " Trolle Selander
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=49776477.4020204@eu.citrix.com \
--to=trolle.selander@eu.citrix.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.