List VESA graphics videomodes when vesafb is present
PATCH 1/1 List VESA graphics videomodes when vesafb is present
Hello,
I had something like this in video.S for years, so it is probably time
to try to push it upstream... Besides other problems it confirmed that when I connect HDTV to my nVidia, BIOS decides that 640x480 is largest possible resolution, as it is largest standard resolution smaller than non-interlaced 1920x540, and apparently BIOS I have does not believe that interlaced modes exist.
Thanks,
Petr Vandrovec
List VESA videomodes when vesafb is available
There is no CONFIG_VIDEO_VESA option, so code to retrieve VESA modes (even text ones) was always disabled - it was introduced by conversion, old video.S had #define CONFIG_VIDEO_VESA at the beginning.
Modify video-vesa.c to list graphics videomodes when vesafb is built in and videomode is acceptable.
Because there is lot of videomodes in some VESA BIOSes, list them in three columns (should be good for anybody - videocards with more than ~70 videomodes cannot be used with some OSes, so vendors usually try to not cross more than 60 videomodes reported by VESA). Which unfortunately means that card_name for "BIOS (scanned)" needs to be made shorter.
And display color depth for videomodes. To avoid confusion depth is shown only if non-text videomodes are present in the list.
---
commit 9453a2a4afee6cadb020838d0a35c2d11af25aa6
tree 5903315f7fd62db34f22107e63ec37a24bbf8075
parent 5de7fc0bf0e2e36a8dcf619e95576219dcc13d70
author Petr Vandrovec <[email protected]> Sun, 22 Jul 2007 23:54:34 -0700 committer Petr Vandrovec <[email protected]> Sun, 22 Jul 2007 23:54:34 -0700
arch/i386/boot/video-bios.c | 3 ++- arch/i386/boot/video-vesa.c | 48 +++++++++++++++++++++++++++++++++++-------- arch/i386/boot/video-vga.c | 20 +++++++++--------- arch/i386/boot/video.c | 39 ++++++++++++++++++++++++++++++++--- arch/i386/boot/video.h | 3 ++- 5 files changed, 89 insertions(+), 24 deletions(-)
arch/i386/boot/video-bios.c +2 -1
@@ -104,6 +104,7 @@ static int bios_probe(void) mi = GET_HEAP(struct mode_info, 1); mi->mode =VIDEO_FIRST_BIOS +mode; + mi->depth =0 ;/* text */ mi->x =rdfs16 (0x44a ); mi->y =rdfs8 (0x484 )+1 ; nmodes++;
@@ -116,7 +117,7 @@ static int bios_probe(void)__videocard video_bios = { - .card_name ="BIOS (scanned)" , + .card_name ="BIOS" , .probe = bios_probe, .set_mode = bios_set_mode, .unsafe =1 ,
arch/i386/boot/video-vesa.c +39 -9
80 lines not on this page · raw message
arch/i386/boot/video-vga.c +10 -10
@@ -18,22 +18,22 @@#include "video.h" static struct mode_info vga_modes[] = { - { VIDEO_80x25,80 ,25 }, - {VIDEO_8POINT ,80 ,50 }, - { VIDEO_80x43,80 ,43 }, - { VIDEO_80x28,80 ,28 }, - { VIDEO_80x30,80 ,30 }, - { VIDEO_80x34,80 ,34 }, - { VIDEO_80x60,80 ,60 }, + { VIDEO_80x25,0 ,80 ,25 }, + {VIDEO_8POINT ,0 ,80 ,50 }, + { VIDEO_80x43,0 ,80 ,43 }, + { VIDEO_80x28,0 ,80 ,28 }, + { VIDEO_80x30,0 ,80 ,30 }, + { VIDEO_80x34,0 ,80 ,34 }, + { VIDEO_80x60,0 ,80 ,60 }, };static struct mode_info ega_modes[] = { - { VIDEO_80x25,80 ,25 }, - {VIDEO_8POINT ,80 ,43 }, + { VIDEO_80x25,0 ,80 ,25 }, + {VIDEO_8POINT ,0 ,80 ,43 }, };static struct mode_info cga_modes[] = { - { VIDEO_80x25,80 ,25 }, + { VIDEO_80x25,0 ,80 ,25 }, };__videocard video_vga;
arch/i386/boot/video.c +36 -3
@@ -33,6 +33,11 @@ int force_x, force_y; /* Don't query the BIOS for cols/rows */int do_restore =0 ;/* Screen contents changed during mode flip */ int graphic_mode;/* Graphic mode with linear frame buffer */ +static const char depth_text[8 ][4 ] = { +"/TX" ,"/8" ,"/16" ,"/24" , +"/32" ,"/15" ,"/4" ,"/GR" +}; +static void store_cursor_position (void ) {u16 curpos;
@@ -287,9 +292,28 @@ static void display_menu(void)struct mode_info *mi;char ch;int i; +int nmodes; +int modes_per_line; +int col; +int depths =0 ; + + nmodes =0 ; +for (card = video_cards; card < video_cards_end; card++) { + mi = card->modes; +for (i =0 ; i < card->nmodes; i++, mi++) + depths |= mi->depth; + nmodes += card->nmodes; + } + + modes_per_line =1 ; +if (nmodes >=20 ) + modes_per_line =3 ; -puts ("Mode: COLSxROWS:\n" ); +for (col =0 ; col < modes_per_line; col++) +puts ("Mode: COLSxROWS: " ); +putchar ('\n' ); + col =0 ; ch ='0' ;for (card = video_cards; card < video_cards_end; card++) { mi = card->modes;
@@ -301,8 +325,15 @@ static void display_menu(void)if (!visible)continue ;/* Hidden mode */ -printf ("%c %04X %3dx%-3d %s\n" , - ch, mode_id, mi->x, mi->y, card->card_name); +printf ("%c %04X %3dx%-3d%-4s%-7s" , + ch, mode_id, mi->x, mi->y, + depths ? depth_text[mi->depth] :"" , + card->card_name); + col++; +if (col >= modes_per_line) { +putchar ('\n' ); + col =0 ; + }if (ch =='9' ) ch ='a' ;
@@ -312,6 +343,8 @@ static void display_menu(void) ch++; } } +if (col) +putchar ('\n' ); }#define H (x) ((x)-'a'+10)
arch/i386/boot/video.h +2 -1
@@ -82,7 +82,8 @@ void store_screen(void);*/ struct mode_info { -u16 mode;/* Mode number (vga= style) */ +u16 mode:12 ;/* Mode number (vga= style) */ +u16 depth:4 ;u8 x, y;/* Width, height */ };