Jump to content

Information on VESA modes in ATI&NVIDIA bios


DieBuche
 Share

261 posts in this topic

Recommended 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

AnalyseVBIOS2.zip

  • Like 4
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.fr/mp2008/mp8800gt.rom)

 

Cheers,

BiTRiP

Link to comment
Share on other sites

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.fr/mp2008/mp8800gt.rom)

 

Cheers,

BiTRiP

Link to comment
Share on other sites

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

post-511415-1266857423_thumb.gif

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Sorry for misunderstanding, DieBuche. I ran it with a rom in the first place. Just wanted to make sure if it is the app which is not working. That's why I tried it without one.

I googled a bit: it's been compiled under Snow Leo and there seems to be an issue with dynamic libraries under Leo (google gives quite a lot hits for that error, e.g.:http://discussions.apple.com/thread.jspa?threadID=2151112)

Link to comment
Share on other sites

I had noted this error, but was initally too lazy to do smt. about it; It's fixed now..

Sorry for misunderstanding, DieBuche. I ran it with a rom in the first place. Just wanted to make sure if it is the app which is not working. That's why I tried it without one.

I googled a bit: it's been compiled under Snow Leo and there seems to be an issue with dynamic libraries under Leo (google gives quite a lot hits for that error, e.g.:http://discussions.apple.com/thread.jspa?threadID=2151112)

Link to comment
Share on other sites

Hi DieBuche

 

Chameleon can read a long list of resolutions from my card and I can already use 1680x1050, which is the native resolution of my display so I don't need to make any changes to my video BIOS. But out of interest I ran through this procedure, and here are my results for reference.

 

Hardware:

Video Card: MSI NX8800GT-E 512MB OC

BIOS Version: 62.92.23.00

 

Your app (v2) gave me the following result:

Length:58880

Found 1. possible NVIDIA Mode at 0x7bd1(Decimal:31697)

Empty Table at 0x7cf1(Decimal:31985)

Empty Table at 0x7d71(Decimal:32113)

Empty Table at 0x7db1(Decimal:32177)

Correct number of finds

Mod should be working

 

32 bytes starting from offset 0x7bd1:

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

 

which is the same as the example for the 8800GTS 512MB as you have in your opening post.

Link to comment
Share on other sites

 Share

×
×
  • Create New...