# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1231930318 0
# Node ID d400a51a2f46a3fc3c23a0fa65fa23d410ccc899
# Parent 4f6a2bbdff3fea7db13979ffccb1ae5403ca79c8
x86, hvm: stdvga improvements
* enables linear framebuffer and VBE 3.0 extensions.
* add a number of new resolutions, up to 2560x1600, and including
* widescreen modes common to modern displays.
* Introduce configurable video ram size through the "videoram" config
* file option, shrinking default video ram used to 4 Megs (thus
* eliminating 4 wasted megs/VM that have been the case until now), but
* allowing users to specify up to 16 Megs of vram, to support the
* extreme high resolutions such as 2560x1600x32.
Signed-off-by: Trolle Selander <trolle.selander@xxxxxxxxxxxxx>
Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
---
tools/firmware/vgabios/vbe.c | 18 ++++++---
tools/firmware/vgabios/vbe.h | 64 +++++++++++++++++----------------
tools/firmware/vgabios/vbetables-gen.c | 41 +++++++++++++++------
tools/firmware/vgabios/vgabios.c | 6 +--
tools/libxc/xc_hvm_build.c | 2 -
tools/python/xen/xend/XendConfig.py | 1
tools/python/xen/xend/image.py | 13 ++++--
tools/python/xen/xm/create.py | 8 ++--
8 files changed, 94 insertions(+), 59 deletions(-)
diff -r 4f6a2bbdff3f -r d400a51a2f46 tools/firmware/vgabios/vbe.c
--- a/tools/firmware/vgabios/vbe.c Tue Jan 13 15:53:47 2009 +0000
+++ b/tools/firmware/vgabios/vbe.c Wed Jan 14 10:51:58 2009 +0000
@@ -37,8 +37,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 @@ Bit16u *AX;Bit16u ES;Bit16u DI;
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 @@ Bit16u *AX;Bit16u ES;Bit16u DI;
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 @@ Bit16u *AX;Bit16u ES;Bit16u DI;
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 @@ Bit16u *AX;Bit16u CX; Bit16u ES;Bit16u D
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 -r 4f6a2bbdff3f -r d400a51a2f46 tools/firmware/vgabios/vbe.h
--- a/tools/firmware/vgabios/vbe.h Tue Jan 13 15:53:47 2009 +0000
+++ b/tools/firmware/vgabios/vbe.h Wed Jan 14 10:51:58 2009 +0000
@@ -275,39 +275,41 @@ typedef struct ModeInfoListItem
// 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 -r 4f6a2bbdff3f -r d400a51a2f46 tools/firmware/vgabios/vbetables-gen.c
--- a/tools/firmware/vgabios/vbetables-gen.c Tue Jan 13 15:53:47 2009 +0000
+++ b/tools/firmware/vgabios/vbetables-gen.c Wed Jan 14 10:51:58 2009 +0000
@@ -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 @@ ModeInfo modes[] = {
{ 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, },
};
diff -r 4f6a2bbdff3f -r d400a51a2f46 tools/firmware/vgabios/vgabios.c
--- a/tools/firmware/vgabios/vgabios.c Tue Jan 13 15:53:47 2009 +0000
+++ b/tools/firmware/vgabios/vgabios.c Wed Jan 14 10:51:58 2009 +0000
@@ -3811,9 +3811,9 @@ void printf(s)
for (i=0; i<format_width; i++) {
nibble = (arg >> (4 * digit)) & 0x000f;
if (nibble <= 9)
- outb(0x0500, nibble + '0');
+ outb(0xe9, nibble + '0');
else
- outb(0x0500, (nibble - 10) + 'A');
+ outb(0xe9, (nibble - 10) + 'A');
digit--;
}
in_format = 0;
@@ -3823,7 +3823,7 @@ void printf(s)
// }
}
else {
- outb(0x0500, c);
+ outb(0xe9, c);
}
s ++;
}
diff -r 4f6a2bbdff3f -r d400a51a2f46 tools/libxc/xc_hvm_build.c
--- a/tools/libxc/xc_hvm_build.c Tue Jan 13 15:53:47 2009 +0000
+++ b/tools/libxc/xc_hvm_build.c Wed Jan 14 10:51:58 2009 +0000
@@ -28,7 +28,7 @@
#define SPECIALPAGE_IDENT_PT 3
#define SPECIALPAGE_SHINFO 4
#define NR_SPECIAL_PAGES 5
-#define special_pfn(x) (0x100000u - NR_SPECIAL_PAGES + (x))
+#define special_pfn(x) (0xff000u - NR_SPECIAL_PAGES + (x))
static void build_hvm_info(void *hvm_info_page, uint64_t mem_size)
{
diff -r 4f6a2bbdff3f -r d400a51a2f46 tools/python/xen/xend/XendConfig.py
--- a/tools/python/xen/xend/XendConfig.py Tue Jan 13 15:53:47 2009 +0000
+++ b/tools/python/xen/xend/XendConfig.py Wed Jan 14 10:51:58 2009 +0000
@@ -149,6 +149,7 @@ XENAPI_PLATFORM_CFG_TYPES = {
'opengl': int,
'soundhw': str,
'stdvga': int,
+ 'videoram': int,
'usb': int,
'usbdevice': str,
'hpet': int,
diff -r 4f6a2bbdff3f -r d400a51a2f46 tools/python/xen/xend/image.py
--- a/tools/python/xen/xend/image.py Tue Jan 13 15:53:47 2009 +0000
+++ b/tools/python/xen/xend/image.py Wed Jan 14 10:51:58 2009 +0000
@@ -264,6 +264,10 @@ class ImageHandler:
# skip vnc init if nographic is set
ret.append('-nographic')
return ret
+
+ vram = str(vmConfig['platform'].get('videoram',4))
+ ret.append('-videoram')
+ ret.append(vram)
vnc_config = {}
has_vnc = int(vmConfig['platform'].get('vnc', 0)) != 0
@@ -833,6 +837,7 @@ class IA64_HVM_ImageHandler(HVMImageHand
def configure(self, vmConfig):
HVMImageHandler.configure(self, vmConfig)
self.vhpt = int(vmConfig['platform'].get('vhpt', 0))
+ self.vramsize = int(vmConfig['platform'].get('videoram',4)) * 1024
def buildDomain(self):
xc.nvram_init(self.vm.getName(), self.vm.getDomid())
@@ -847,8 +852,8 @@ class IA64_HVM_ImageHandler(HVMImageHand
# buffer io page, buffer pio page and memmap info page
extra_pages = 1024 + 5
mem_kb += extra_pages * page_kb
- # Add 8 MiB overhead for QEMU's video RAM.
- return mem_kb + 8192
+ mem_kb += self.vramsize
+ return mem_kb
def getRequiredInitialReservation(self):
return self.vm.getMemoryTarget()
@@ -882,6 +887,7 @@ class X86_HVM_ImageHandler(HVMImageHandl
def configure(self, vmConfig):
HVMImageHandler.configure(self, vmConfig)
self.pae = int(vmConfig['platform'].get('pae', 0))
+ self.vramsize = int(vmConfig['platform'].get('videoram',4)) * 1024
def buildDomain(self):
xc.hvm_set_param(self.vm.getDomid(), HVM_PARAM_PAE_ENABLED, self.pae)
@@ -890,8 +896,7 @@ class X86_HVM_ImageHandler(HVMImageHandl
return rc
def getRequiredAvailableMemory(self, mem_kb):
- # Add 8 MiB overhead for QEMU's video RAM.
- return mem_kb + 8192
+ return mem_kb + self.vramsize
def getRequiredInitialReservation(self):
return self.vm.getMemoryTarget()
diff -r 4f6a2bbdff3f -r d400a51a2f46 tools/python/xen/xm/create.py
--- a/tools/python/xen/xm/create.py Tue Jan 13 15:53:47 2009 +0000
+++ b/tools/python/xen/xm/create.py Wed Jan 14 10:51:58 2009 +0000
@@ -526,9 +526,9 @@ gopts.var('vncunused', val='',
use="""Try to find an unused port for the VNC server.
Only valid when vnc=1.""")
-gopts.var('videoram', val='',
- fn=set_value, default=None,
- use="""Maximum amount of videoram PV guest can allocate
+gopts.var('videoram', val='MEMORY',
+ fn=set_int, default=4,
+ use="""Maximum amount of videoram a guest can allocate
for frame buffer.""")
gopts.var('sdl', val='',
@@ -884,7 +884,7 @@ def configure_hvm(config_image, vals):
"""Create the config for HVM devices.
"""
args = [ 'device_model', 'pae', 'vcpus', 'boot', 'fda', 'fdb',
'timer_mode',
- 'localtime', 'serial', 'stdvga', 'isa', 'nographic', 'soundhw',
+ 'localtime', 'serial', 'stdvga', 'videoram', 'isa', 'nographic',
'soundhw',
'vnc', 'vncdisplay', 'vncunused', 'vncconsole', 'vnclisten',
'sdl', 'display', 'xauthority', 'rtc_timeoffset', 'monitor',
'acpi', 'apic', 'usb', 'usbdevice', 'keymap', 'pci', 'hpet',
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|