Index: branches/prasys/i386/libsaio/vbe.c =================================================================== --- branches/prasys/i386/libsaio/vbe.c (revision 32) +++ branches/prasys/i386/libsaio/vbe.c (revision 33) @@ -74,6 +74,24 @@ return(bb.eax.r.h); } + +int getEDID( void * edidBlock, UInt8 block) +{ + bzero(&bb, sizeof(bb)); + bb.intno = 0x10; + bb.eax.rr = funcGetEDID; + bb.ebx.r.l= 0x01; + bb.edx.rr = block; + + bb.es = SEG( edidBlock ); + bb.edi.rr = OFF( edidBlock ); + + bios( &bb ); + return(bb.eax.r.h); +} + + + int getVBEModeInfo( int mode, void * minfo_p ) { bb.intno = 0x10; @@ -105,6 +123,8 @@ return(bb.eax.r.h); } + + /* * Default GTF parameter values. */ Index: branches/prasys/i386/libsaio/vbe.h =================================================================== --- branches/prasys/i386/libsaio/vbe.h (revision 32) +++ branches/prasys/i386/libsaio/vbe.h (revision 33) @@ -68,7 +68,8 @@ funcGetSetPaletteFormat = 0x4F08, funcGetSetPaletteData = 0x4F09, funcGetProtModeInterdace = 0x4F0A, - funcGetSetPixelClock = 0x4F0B + funcGetSetPixelClock = 0x4F0B, + funcGetEDID = 0x4f15 }; enum { @@ -269,6 +270,8 @@ typedef unsigned long VBEPalette[256]; extern int getVBEInfo(void *vinfo_p); +extern int getEDID( void * edidBlock, UInt8 blocks_left ); + extern int getVBEModeInfo(int mode, void *minfo_p); extern int getVBEDACFormat(unsigned char *format); extern int setVBEDACFormat(unsigned char format); Index: branches/prasys/i386/libsaio/Makefile =================================================================== --- branches/prasys/i386/libsaio/Makefile (revision 32) +++ branches/prasys/i386/libsaio/Makefile (revision 33) @@ -40,7 +40,7 @@ freq_detect.o platform.o dsdt_patcher.o \ smbios_patcher.o fake_efi.o ext2fs.o \ hpet.o spd.o usb.o pci_setup.o \ - device_inject.o nvidia.o ati.o gma.o + device_inject.o nvidia.o ati.o gma.o 915resolution.o edid.o SAIO_EXTERN_OBJS = console.o Index: branches/prasys/i386/boot2/graphics.c =================================================================== --- branches/prasys/i386/boot2/graphics.c (revision 32) +++ branches/prasys/i386/boot2/graphics.c (revision 33) @@ -182,7 +182,7 @@ // Return the VESA mode that matches the properties specified. // If a mode is not found, then return the "best" available mode. -static unsigned short +unsigned short getVESAModeWithProperties( unsigned short width, unsigned short height, unsigned char bitsPerPixel, Index: branches/prasys/i386/boot2/boot.c =================================================================== --- branches/prasys/i386/boot2/boot.c (revision 32) +++ branches/prasys/i386/boot2/boot.c (revision 33) @@ -57,6 +57,10 @@ #include "libsa.h" #include "ramdisk.h" #include "gui.h" +#include "graphics.h" +#include "vbe.h" +#include "915resolution.h" +#include "edid.h" long gBootMode; /* defaults to 0 == kBootModeNormal */ BOOL gOverrideKernel; @@ -356,6 +360,38 @@ if ( getBoolForKey(kGUIKey, &useGUI, &bootInfo->bootConfig) && !useGUI ) useGUI = FALSE; + // Before initGui, path the video bios with the correct resolution + + UInt32 x = 0, y = 0; + UInt32 bp = 0; + + getResolution(&x, &y, &bp); + + + if (x!=0 && y!=0) { + vbios_map * map; + + map = open_vbios(CT_UNKWN); + + unlock_vbios(map); + + set_mode(map, x, y, bp, 0, 0); + + relock_vbios(map); + + close_vbios(map); + + verbose("Patched first resolution mode to %dx%d.\n", x, y); + + + } + + + //printf("Press any key to continue..."); + //getc(); + + + // Try initialising the GUI unless disabled if( useGUI ) initGUI(); Index: branches/prasys/i386/boot2/graphics.h =================================================================== --- branches/prasys/i386/boot2/graphics.h (revision 32) +++ branches/prasys/i386/boot2/graphics.h (revision 33) @@ -10,6 +10,7 @@ #include "boot.h" #include "bootstruct.h" #include "graphic_utils.h" +#include "vbe.h" #ifndef __BOOT_GRAPHICS_H @@ -44,4 +45,14 @@ char *getVBEModeInfoString(); void getGraphicModeParams(unsigned long params[]); + +unsigned short getVESAModeWithProperties( unsigned short width, + unsigned short height, + unsigned char bitsPerPixel, + unsigned short attributesSet, + unsigned short attributesClear, + VBEModeInfoBlock * outModeInfo, + unsigned short * vesaVersion ); + + #endif /* !__BOOT_GRAPHICS_H */ \ No newline at end of file Index: branches/prasys/i386/boot2/gui.c =================================================================== --- branches/prasys/i386/boot2/gui.c (revision 32) +++ branches/prasys/i386/boot2/gui.c (revision 33) @@ -11,6 +11,7 @@ #include "gui.h" #include "appleboot.h" #include "vers.h" +#include "edid.h" #ifdef EMBED_THEME #include "art.h" @@ -494,9 +495,11 @@ int initGUI() { - int val, len; + int len; char dirspec[256]; + + #ifdef EMBED_THEME config_file_t *embedded = &bootInfo->themeDefault; @@ -504,12 +507,11 @@ // build xml dictionary for embedded theme.plist ParseXMLFile( (char *) __theme_plist, &embedded->dictionary); - // parse display size parameters - if(getIntForKey("screen_width", &val, &bootInfo->themeDefault)) - screen_params[0] = val; + // determine screen params form edid + getResolution(&screen_params[0], &screen_params[1], &screen_params[2]); + + - if(getIntForKey("screen_height", &val, &bootInfo->themeDefault)) - screen_params[1] = val; #else /* @@ -523,22 +525,14 @@ // Initalizing GUI strucutre. bzero(&gui, sizeof(gui_t)); - screen_params[2] = 32; // find theme name in boot.plist getValueForKey( "Theme", &theme_name, &len, &bootInfo->bootConfig ); sprintf(dirspec, "/Extra/Themes/%s/theme.plist", theme_name); - if ( !loadConfigFile(dirspec, &bootInfo->themeConfig) ) - { - // parse display size parameters - if(getIntForKey("screen_width", &val, &bootInfo->themeConfig)) - screen_params[0] = val; + loadConfigFile(dirspec, &bootInfo->themeConfig); - if(getIntForKey("screen_height", &val, &bootInfo->themeConfig)) - screen_params[1] = val; - } // find best matching vesa mode for our requested width & height getGraphicModeParams(screen_params); @@ -1707,34 +1701,27 @@ //========================================================================== // drawBootGraphics +// funciton used when starting up OS X. void drawBootGraphics() { - int pos; int length; const char *dummyVal; BOOL legacy_logo; uint16_t x, y; + /** Read default resolution from the graphics card, instead of the theme **/ + getResolution(&screen_params[0], &screen_params[1], &screen_params[2]); + + if (getBoolForKey("Legacy Logo", &legacy_logo, &bootInfo->bootConfig) && legacy_logo) usePngImage = NO; else if (bootImageData == NULL) loadBootGraphics(); - // parse screen size parameters - if(getIntForKey("boot_width", &pos, &bootInfo->themeConfig)) - screen_params[0] = pos; - else - screen_params[0] = DEFAULT_SCREEN_WIDTH; + - if(getIntForKey("boot_height", &pos, &bootInfo->themeConfig)) - screen_params[1] = pos; - else - screen_params[1] = DEFAULT_SCREEN_HEIGHT; - - screen_params[2] = 32; - gui.screen.width = screen_params[0]; gui.screen.height = screen_params[1]; Index: branches/prasys/i386/boot2/options.c =================================================================== --- branches/prasys/i386/boot2/options.c (revision 32) +++ branches/prasys/i386/boot2/options.c (revision 33) @@ -700,13 +700,15 @@ timeout = sysConfigValid?kBootTimeout:0; } - if (timeout < 0) + if (timeout < 0 || gDeviceCount <= 1) gBootMode |= kBootModeQuiet; // If the user is holding down a modifier key, - // enter safe mode. + // abort quiet mode. if ( ( readKeyboardShiftFlags() & 0x0F ) != 0 ) { - gBootMode |= kBootModeSafe; + //gBootMode |= kBootModeSafe; + gBootMode &= ~kBootModeQuiet; + firstRun = NO; } // If user typed F8, abort quiet mode, @@ -837,7 +839,7 @@ } if ( firstRun && ( timeout > 0 ) && - ( countdown("Press any key to enter startup options.", + ( countdown(""/*"Press any key to enter startup options."*/, kMenuTopRow, timeout) == 0 ) ) { // If the user is holding down a modifier key,