All of lore.kernel.org
 help / color / mirror / Atom feed
From: Trolle Selander <trolle.selander@eu.citrix.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [PATCH] [RFC] Variable video ram size option - revised
Date: Wed, 21 Jan 2009 16:21:40 -0500	[thread overview]
Message-ID: <497791E4.5010701@eu.citrix.com> (raw)
In-Reply-To: <49776477.4020204@eu.citrix.com>

[-- Attachment #1: Type: text/plain, Size: 744 bytes --]

Trolle Selander wrote:
> 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>
>
Forgot to include the vgabios patch - it remains the same as for the 
previous version of this patch, but I'll attach it to this thread as 
well to make things easier.

-- Trolle

[-- Attachment #2: vgabios_variable_vram_size.patch --]
[-- Type: text/plain, Size: 8500 bytes --]

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

      parent reply	other threads:[~2009-01-21 21:21 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   ` [Qemu-devel] [PATCH] [RFC] Variable video ram size option - revised Trolle Selander
2009-01-21 18:23     ` Daniel P. Berrange
2009-01-21 21:51       ` Anthony Liguori
2009-01-21 21:21     ` Trolle Selander [this message]

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=497791E4.5010701@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.