From patchwork Fri Jun 18 10:37:54 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 56171 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 1A35DB7D85 for ; Fri, 18 Jun 2010 20:56:14 +1000 (EST) Received: from localhost ([127.0.0.1]:51616 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OPZF5-0004K2-65 for incoming@patchwork.ozlabs.org; Fri, 18 Jun 2010 06:56:11 -0400 Received: from [140.186.70.92] (port=35941 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OPZ5H-0007vZ-7X for qemu-devel@nongnu.org; Fri, 18 Jun 2010 06:46:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OPZ1N-00037M-OI for qemu-devel@nongnu.org; Fri, 18 Jun 2010 06:42:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56568) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OPZ0o-00030u-7s for qemu-devel@nongnu.org; Fri, 18 Jun 2010 06:42:01 -0400 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o5IAcVs2004500 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 18 Jun 2010 06:39:40 -0400 Received: from rincewind.home.kraxel.org (vpn1-6-66.ams2.redhat.com [10.36.6.66]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o5IAbw6p022032; Fri, 18 Jun 2010 06:37:59 -0400 Received: by rincewind.home.kraxel.org (Postfix, from userid 500) id 7562F415DB; Fri, 18 Jun 2010 12:37:57 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 18 Jun 2010 12:37:54 +0200 Message-Id: <1276857477-14201-3-git-send-email-kraxel@redhat.com> In-Reply-To: <1276857477-14201-1-git-send-email-kraxel@redhat.com> References: <1276857477-14201-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.18 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: Volker Ruppert Subject: [Qemu-devel] [PATCH 2/5] - added support for a lot more non-standard VBE modes (e.g. widescreen modes) - requires latest Bochs VBE code (16 MB video memory, VBE_DISPI_ID5, VRAM size in 64k pages stored in VBE register) - check if VBE mode is supported with current VRAM size X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Volker Ruppert --- vbe.c | 31 ++++++++++++++++++------ vbe.h | 70 ++++++++++++++++++++++++++++-------------------------- vbetables-gen.c | 43 +++++++++++++++++++++++++-------- 3 files changed, 91 insertions(+), 53 deletions(-) diff --git a/vbe.c b/vbe.c index 92e3d0d..ecff90d 100644 --- a/vbe.c +++ b/vbe.c @@ -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; @@ -715,7 +713,7 @@ vbe_init: mov [bx], al pop bx pop ds - mov ax, # VBE_DISPI_ID4 + mov ax, # VBE_DISPI_ID5 call dispi_set_id no_vbe_interface: #if defined(USE_BX_INFO) || defined(DEBUG) @@ -742,7 +740,19 @@ no_vbe_flag: mov ds, ax mov si, #_no_vbebios_info_string jmp _display_string -ASM_END + +; helper function for memory size calculation + +lmulul: + and eax, #0x0000FFFF + shl ebx, #16 + or eax, ebx + SEG SS + mul eax, dword ptr [di] + mov ebx, eax + shr ebx, #16 + ret +ASM_END /** Function 00h - Return VBE Controller Information * @@ -765,6 +775,7 @@ Bit16u *AX;Bit16u ES;Bit16u DI; Bit16u vbe2_info; Bit16u cur_mode=0; Bit16u cur_ptr=34; + Bit16u size_64k; ModeInfoListItem *cur_info=&mode_info_list; status = read_word(ss, AX); @@ -820,8 +831,9 @@ Bit16u *AX;Bit16u ES;Bit16u DI; vbe_info_block.VideoModePtr_Seg= ES ; vbe_info_block.VideoModePtr_Off= DI + 34; - // VBE Total Memory (in 64b blocks) - vbe_info_block.TotalMemory = VBE_TOTAL_VIDEO_MEMORY_DIV_64K; + // VBE Total Memory (in 64k blocks) + outw(VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_VIDEO_MEMORY_64K); + vbe_info_block.TotalMemory = inw(VBE_DISPI_IOPORT_DATA); if (vbe2_info) { @@ -845,8 +857,11 @@ Bit16u *AX;Bit16u ES;Bit16u DI; do { + size_64k = (Bit16u)((Bit32u)cur_info->info.XResolution * cur_info->info.XResolution * cur_info->info.BitsPerPixel) >> 19; + 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()) && + (size_64k <= vbe_info_block.TotalMemory)) { #ifdef DEBUG printf("VBE found mode %x => %x\n", cur_info->mode,cur_mode); #endif @@ -855,7 +870,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++; diff --git a/vbe.h b/vbe.h index 60434ac..72cb045 100644 --- a/vbe.h +++ b/vbe.h @@ -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_MAX_XRES 1024 - #define VBE_DISPI_MAX_YRES 768 - - #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_BANK_ADDRESS 0xA0000 + #define VBE_DISPI_BANK_SIZE_KB 64 + + #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_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_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_ID5 0xB0C5 + + #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 #endif diff --git a/vbetables-gen.c b/vbetables-gen.c index 7014a16..550935a 100644 --- a/vbetables-gen.c +++ b/vbetables-gen.c @@ -2,7 +2,7 @@ #include #include -#define VBE_DISPI_TOTAL_VIDEO_MEMORY_MB 8 +#define VBE_DISPI_TOTAL_VIDEO_MEMORY_MB 16 typedef struct { int width; @@ -41,20 +41,41 @@ ModeInfo modes[] = { { 1600, 1200, 16 , 0x11E}, { 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}, + /* BOCHS/PLEX86 '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}, { 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, }, };