Jump to content

Information on VESA modes in ATI&NVIDIA bios


  • Please log in to reply
255 replies to this topic

#1
DieBuche

DieBuche

    InsanelyMac Protégé

  • Members
  • PipPip
  • 85 posts
0. Preface
This is some preliminary work for coding a patch for Chameleon RC4/5, which will read the VBIOS of ATI (3*** HD & 4*** HD) and NVIDIA cards (nearly all models) and
modify existing VESA modes (such as 800x600) to the native resolution of the display.

For Widescreen monitors this will lead to an unstretched GUI & Spinner. If your extremely eager you can mod ur video rom right now and reflash it.; but im working on a patch similar to 915res to patch the bios on the fly...

1. Structure of VESA modes in ATI VBIOS

In ATI VBIOS'es the VESA modes are stored in a table 1064 bytes long, containing 38 Modes, each 28 bytes long.
The offset is not constant, but always around 0xA600. (There are actually two tables, but one I could identify as ComponentVideoInfo. Since this doesn't apply to us (& since i tried to patch this table w/o results) I'm concentrating on the table named above.

Here is a sample mode from an 4870HD:

20 03 00 01 58 02 19 00 10 00 50 00 01 00 03 00 00 00 00 00 00 00 00 00 6A 4B F9 15

Important for us are bytes 1, 2, 5, 6:

Bytes 1&2 (In this example 20 03) are byteflipped versions of the width in hex format. Eg: If you unflip them you get 0320 which is HEX for 800.
The same applies for bytes 5&6 ->58 02 -> Unflip them -> 0258 -> convert to DEC -> Height is 600.
This sample mode thus has the resolution 800x600.
The other bytes afterwards are for color depth, various sync times and pixel clocks

In every 3*** - 5*** HD bios there are five 800x600 modes after each other, each with different color depth, various sync times and pixel clocks.
For this fix to work we change those five modes to the resolution we want:

If native res of the display is 1680x1050, we convert those to hex, resulting in 0x0690 and 0x041A
Now we flip the bytes, resulting in 0x9006 and 0x1A04.

If we now replace the width & height in the afore mentioned five modes, we will get native 1680x1050x32, 1680x1050x16 & 1680x1050x8.

This is confirmed working on ati 3***, 4*** and 5***

I attached a small c++ tool to find the locations of those 5 modes.

2. Structure of VESA modes in NVIDIA VBIOS
In NVIDIA VBIOS'es the modes are stored in a similar byteflipped way:

Table 1
Update:
Thanks to bitrips report, i had another look at his bios & found another table in a different format.
(While ATI released some basic structures of their vbios and I could such identify the right table, NVIDIA doesn't)

This other table I found is 288bytes long, containing 32 modes á 9 bytes. The offset is again not stable.

Sample Code from 8800GT (XFX 512MB)
40 01 C8 00 28 18 08 08 05

Resolution is byte flipped again, this time byte 1&2 and 3&4 (Sample: 320x200). The modes in this table go up to 1920x1200 (80 07 B0 04)



The other mode table is 512 bytes long, containing 16 modes, each 32 byte long.

Here is a sample mode from an 8800GTS

00 04 FF 03 00 00 FF 03 17 04 9F 04 3F 05 00 03 FF 02 00 00 FF 02 02 03 08 03 25 03 00 FF 30 2A

Important for us here are bytes 1, 2, 15, 16:

Bytes 1&2 (In this example 00 04) are byteflipped versions of the width in hex format. Eg: If you unflip them you get 0400 which is HEX for 1024.
The same applies for bytes 15&16 ->00 03 -> Unflip them -> 0300 -> convert to DEC -> Height is 768.
This sample mode thus has the resolution 1024x768.

Unlike the ATI modes Table, the NVIDIA is more compact, so we only need to modify two, sometimes only one mode.
So we convert the native resolution of the display as above and replace those values.

I attached a small c++ tool to find the locations of this mode.

3. Tool to Analyse VBIOS:
0. This tool only looks at where/how many VESA tables there are. It doesn't actually change them
1. Extract VBIOS using Windows etc.
2. run in Terminal ./analyseVBIOS bios.rom
3. You'll get the location of the tables
4. Zip contains exec and sources

My thank goes to:
The xorg ati team
This post for the original cl tool
The developers of 915res

Attached Files



#2
Beerkex'd

Beerkex'd

    Content Provider

  • Members
  • PipPipPipPipPipPipPipPipPipPipPip
  • 3,000 posts
  • Gender:Male
  • Location:Belo Horizonte - Brazil
Very nice work DB!

This is going to make a lot of people happy.

#3
blackosx

blackosx

    InsanelyMacaholic

  • Coders
  • 3,163 posts
  • Gender:Male
  • Location:UK
Whoop!... this is a great find.... Top job DieBuche :)

I agree with Beerkex'd and you'll also make our lives easier by not having to try to answer questions about this subject.

#4
pirloui

pirloui

    InsanelyMac Sage

  • Members
  • PipPipPipPipPipPip
  • 402 posts
Nice project, you have my mental support. :)

#5
BiTRiP

BiTRiP

    InsanelyMac Sage

  • Donators
  • 309 posts
  • Gender:Not Telling
Thanks for getting into this.
Unfortunately it didn't change anything for me except that Mac OSX didn't boot up anymore. It did boot Chameleon fine but during boot I got KP, so I went back to my default mp8800pro.rom

Btw, I your guide you say you need to change 1,2,14,15 for NVIDIA but I guess you mean 1,2,15,16 because your example uses those bytes too (0300)

Anyway, my 8800GT had exactly the same string at starting at 0x7BBD and I changed bytes 1,2 from 00 04 to 80 07 and bytes 15,16 from 00 03 to B0 04.
This should make it 1920x1200 according your info, right?

Actually my card is working fine in OSX but I hoped it would solve the TERRIBLE delay of my 8800GT in Chameleon Boot screen (I think it's with all G92's?)
It's almost impossible to type kernel options and when choosing ignoring cache in Chameleon then reloading kexts takes ages. Also disk menu's are slow.
Any solution to that?

So, the change didn't work for me but crashed OSX and i'm back to working rom.

Thanks for your work anyway. :wacko:

BiTRiP

#6
Beerkex'd

Beerkex'd

    Content Provider

  • Members
  • PipPipPipPipPipPipPipPipPipPipPip
  • 3,000 posts
  • Gender:Male
  • Location:Belo Horizonte - Brazil

I hoped it would solve the TERRIBLE delay of my 8800GT in Chameleon Boot screen (I think it's with all G92's?)

My 9800GTX+ works fine, no delay.

#7
kocoman

kocoman

    InsanelyMac Sage

  • Members
  • PipPipPipPipPip
  • 325 posts
Can anyone tell me which 3*** ATI works in snow leopard with acceleration?

#8
DieBuche

DieBuche

    InsanelyMac Protégé

  • Members
  • PipPip
  • 85 posts

Can anyone tell me which 3*** ATI works in snow leopard with acceleration?

None, afaik. I have a 3650HD laying around, but finally gave up and bought a 4870

#9
bs0d

bs0d

    InsanelyMac Geek

  • Members
  • PipPipPip
  • 166 posts

Actually my card is working fine in OSX but I hoped it would solve the TERRIBLE delay of my 8800GT in Chameleon Boot screen (I think it's with all G92's?)
It's almost impossible to type kernel options and when choosing ignoring cache in Chameleon then reloading kexts takes ages. Also disk menu's are slow.
Any solution to that?


BitRip i guess you have an Core i5/i7 System ?

i'm guessing its because the bios is not setting up MTRR for the video ram to its optimum setting (Write Combining)

Its now left to the graphics driver to setup the MTRR where as on my Core2 system this was done wrongly or rightly by the bios.

booter can just setup the MTRR correctly and it should improve the speed.

bs0d

#10
DieBuche

DieBuche

    InsanelyMac Protégé

  • Members
  • PipPip
  • 85 posts
Hey BiTRiP, thx for trying. I managed to find another table which i had overlooked before. It should be at offset 0x4832. I updated the post will the exact specs.

Would u be willing to run another test? If so, could u attach your bios/pm it?


Thanks for getting into this.
Unfortunately it didn't change anything for me except that Mac OSX didn't boot up anymore. It did boot Chameleon fine but during boot I got KP, so I went back to my default mp8800pro.rom

Btw, I your guide you say you need to change 1,2,14,15 for NVIDIA but I guess you mean 1,2,15,16 because your example uses those bytes too (0300)

Anyway, my 8800GT had exactly the same string at starting at 0x7BBD and I changed bytes 1,2 from 00 04 to 80 07 and bytes 15,16 from 00 03 to B0 04.
This should make it 1920x1200 according your info, right?

Actually my card is working fine in OSX but I hoped it would solve the TERRIBLE delay of my 8800GT in Chameleon Boot screen (I think it's with all G92's?)
It's almost impossible to type kernel options and when choosing ignoring cache in Chameleon then reloading kexts takes ages. Also disk menu's are slow.
Any solution to that?

So, the change didn't work for me but crashed OSX and i'm back to working rom.

Thanks for your work anyway. :wacko:

BiTRiP



#11
BiTRiP

BiTRiP

    InsanelyMac Sage

  • Donators
  • 309 posts
  • Gender:Not Telling

Hey BiTRiP, thx for trying. I managed to find another table which i had overlooked before. It should be at offset 0x4832. I updated the post will the exact specs.

Would u be willing to run another test? If so, could u attach your bios/pm it?


Np problem mate.
Should I try with only changing offset 0x4832 or should I change both?
Please remember you talk about decimal 14 and 15 while it's 15 and 16.
Just to avoid people gonna change wrong values.
Or am I wrong?

Btw, I have a XFX 8800GT that is flash with a Mac bios of 8800GT.
(http://a.mondit.free...08/mp8800gt.rom)

Cheers,
BiTRiP

#12
DieBuche

DieBuche

    InsanelyMac Protégé

  • Members
  • PipPip
  • 85 posts
You're right about the 15&16, it's fixed now.
In your rom you have 3 modes after each other starting with 40 01 C8 00 at offset 0x4832. Could u patch them all for 1920x1200?
Please make also sure that in your theme.plist file screen_width/screen_height and boot_width/boot_height are set to 1920x1200 as well.

Cheers,
DieBuche

Np problem mate.
Should I try with only changing offset 0x4832 or should I change both?
Please remember you talk about decimal 14 and 15 while it's 15 and 16.
Just to avoid people gonna change wrong values.
Or am I wrong?

Btw, I have a XFX 8800GT that is flash with a Mac bios of 8800GT.
(http://a.mondit.free...08/mp8800gt.rom)

Cheers,
BiTRiP



#13
shishank

shishank

    InsanelyMac Protégé

  • Just Joined
  • Pip
  • 2 posts
Hi

Can you pls guide me step by step to change the values

How to find the vbios rom?

Used gpuz and saved a G92.bin file. Is this the video bios rom?

Am not sure how to proceed

Had built a perfect 'Mac' except for the boot screen, it has a black border (using 1280x800x32)

My LCD res is 1920x1080




------------------------------------------------------------------------------------
Snow Leopard 10.6.2
Intel DP55WG MainBoard/ Intel Core i5-750 Processor
512 MB XFX nVidia 9800GT card/ 22" Dell S2209W Display

Attached Files

  • Attached File  scr.gif   18.97KB   400 downloads


#14
jinnggoff

jinnggoff

    InsanelyMac Geek

  • Members
  • PipPipPip
  • 133 posts
  • Gender:Male
  • Location:hackintosh
Wow...I got native resolution (1366x768) at apple boot , many thanks DieBuche :(
Im so happy with this :D

sorry DieBuche, it seems like chameleon support for 1366x768 resolution....coz I tried to my Nvidia 9600 gt, I got never work.
But its still nice info :D

#15
eberts

eberts

    InsanelyMac Geek

  • Members
  • PipPipPip
  • 138 posts
I agree, would be great to have some more detailed instructions where to change those values.

Btw, I'm getting:
dyld: unknown required load command 0x80000022
Trace/BPT trap

(Running 10.5.8) :wacko:

Great find, DieBuche, looking forward to get this sorted, finally (an issue that bothered me since 4 years already :( )
Thx a lot!

#16
DieBuche

DieBuche

    InsanelyMac Protégé

  • Members
  • PipPip
  • 85 posts
Cool! Which card did u use?

Wow...I got native resolution (1366x768) at apple boot , many thanks DieBuche :P
Im so happy with this :D


I'm gonna put up a guide soon, but please note that, while I could test the patch on many ati cards, the NVIDIA might still throw up weird errors...

@eberts Are those errors showing up after u patched the card?

I agree, would be great to have some more detailed instructions where to change those values.

Btw, I'm getting:
dyld: unknown required load command 0x80000022
Trace/BPT trap



#17
hiqu

hiqu

    InsanelyMac Protégé

  • Members
  • PipPip
  • 91 posts
I get the following when I ran using FX570.ROM

Attempting to open FX570.ROM
Length:59392
Found 1. NVIDIA Mode at 0x8425
Correct number of finds
Mod should be working


What this means? (Mod should be working)?

#18
eberts

eberts

    InsanelyMac Geek

  • Members
  • PipPipPip
  • 138 posts

@eberts Are those errors showing up after u patched the card?


I am getting the error running the app (./AnalyseVBIOS)

#19
jinnggoff

jinnggoff

    InsanelyMac Geek

  • Members
  • PipPipPip
  • 133 posts
  • Gender:Male
  • Location:hackintosh

Cool! Which card did u use?

I use the Nvidia G105M card.
And for vga dump bios rom, I found it by Lavalys Everest program.

#20
DieBuche

DieBuche

    InsanelyMac Protégé

  • Members
  • PipPip
  • 85 posts
U have to run it with an Rom. Eg. type ./AnalyseBIOS then drag your rom file into the terminal, hit enter

I am getting the error running the app (./AnalyseVBIOS)







0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

© 2014 InsanelyMac  |   News  |   Forum  |   Downloads  |   OSx86 Wiki  |   Mac Netbook  |   PHP hosting by CatN  |   Designed by Ed Gain  |   Logo by irfan  |   Privacy Policy