nVidia Injection [guide]


First about display-cfg. It describes what type of screen is attached.

The last two bytes are made up as following:
If some condition (unknown yet, we thought it had to do with if a screen is attached to that output, which it had not) is met we get:
BYTE: Display-Number
BYTE
: I2C Read Offset
BYTE
: 0xFF
BYTE
: 0xFF

If the unknown condition above is not met its build up as following regarding the type of screen attached.

For ANALOG:
BYTE: Display-Number
BYTE
: I2C Read Offset
BYTE
: 0xFF
BYTE
: 0x00

For TV:
BYTE: Display-Number
BYTE
: I2C Read Offset
BYTE
: 0xFF
BYTE
: 0x01

And for everything else like LVDS, TMDS and Display-Port
BYTE: Display-Number
BYTE
: I2C Read Offset
BYTE
: DCB Entry OR (guessing)
BYTE
: 0x03

There is one display-cfg for each screen. Here an example (note we have to swap bytes to inject):

ANALOG
@0,display-cfg <00FFXX00>  XX = I2C Read Offset
@1,display-cfg <00FFXX01>  XX = I2C Read Offset
TV
@0,display-cfg <01FFXX00>  XX = I2C Read Offset
@1,display-cfg <01FFXX01>  XX = I2C Read Offset
ELSE
@0,display-cfg <03YYXX00>  XX = I2C Read Offset; YY = DCB ENTRY OR VALUE (guessing)
@1,display-cfg <03YYXX01>  XX = I2C Read Offset; YY = DCB ENTRY OR VALUE (guessing)

Now about NVCAP: It describes which outputs can be used simultaneously and the following:
BYTE: NVCAP_VERSION (hardcoded, goes from 0 to 5)
BYTE
: HAS_CLAM_SHELL (lid)
BYTE
: UNKNOWN (most built-in cards and MacPro 7300GT have that set to 1)
BYTE
: UNKNOWN (most built-in cards have that set to 1. something about backlight?)
WORD
: OUTPUT GROUP 3 (guessing, it describes what outputs are usable together with S-Video out)
WORD
: OUTPUT GROUP 1 (describes what outputs are grouped to Display-A)
WORD
: OUTPUT GROUP 2 (describes what outputs are grouped to Display-B)
BYTE
:
BYTE
:
BYTE
:
BYTE
:
BYTE
: BUILT-IN (guessing, built-in cards apart from 7300GO (AppleTV) have this set to 1)
BYTE
: UNKNOWN (hardcoded value)
BYTE
: EDID_MANUFACTURER_RESERVED_TIMINGS (BYTE 0x25 of the primary screens EDID)
BYTE
:
BYTE
:
BYTE
: UNKNOWN (MacBookPro 8600MGT (15") 128MB Vram has this set to 1)

About the Output groups, they are generated like following. It all depends on the DCB table in your video bios. You can find your DCB table by looking at offset 0x36 of a nvidia bios. You byte swap the word at 0x36, thats the address of the DCB table.

In the DCB table we have entries describing what type of connection can be used for a physical output, like ANALOG, ANALOG/DVI etc. Let's take an example DCB (iMac 7600GT).
DCB ENTRY 0: ANALOG
DCB ENTRY
1: LVDS
DCB ENTRY
2: TMDS
DCB ENTRY
3: TV

In this case we have LVDS at index 1 (so we set bit 1), it is always alone on an output group. So OUTPUT GROUP 1 would be
hex: 0x0002
binary
: 0000 0000 0000 0010

All the other entries will be grouped to OUTPUT GROUP 2, so we have DCB ENTRY 0,2 and 3 (so we set bit 0,2 and 3) grouped which would be
0x000D
binary
0000 0000 0000 1101

As you can see we set bit X (X is the DCB ENTRY INDEX) to group an entry to an output group.

The same is done for OUTPUT GROUP 3, it's just generated when we have a TV entry in our DCB. It would be of big help if somebody with iMac 7600GT an tell us what outputs do work simultaneously with an S-Video adapter since iMac 7600GT is the only one having just the TV entry in this output group.

Now about NVMT: it describes the capabilities of the primary screen:
BYTE: NVMT_VERSION
BYTE
: DISPLAY_TYPE (0 = ANALOG, 1 = TV, 3 = the rest)
BYTE
: UNKNOWN
BYTE
: UNKNOWN
WORD
: EDID_MANUFACTURER
WORD
: EDID_PRODUCT_CODE
WORD
: SCREEN WIDTH
WORD
: SCREEN HEIGHT
WORD
: SCREEN WIDTH + SOME VALUE
WORD
: SCREEN WIDTH + SOME VALUE
WORD
: SCREEN WIDTH + SOME VALUE
WORD
: ZEROED
WORD
: SCREEN HEIGHT + SOME VALUE
WORD
: SCREEN HEIGHT + SOME VALUE
WORD
: SCREEN HEIGHT + SOME VALUE
WORD
: ZEROED
DWORD
: SOME VALUE * 10000
WORD
:
BYTE
:
BYTE
:
--BYTE:
BYTE
:
BYTE
:
7 DWORDS: ZEROED
BYTE
: 0xFF HARDCODED
BYTE
: 0xFF HARDCODED6 BYTES: ZEROED
DWORD
:
BYTE
:
BYTE
:
6 BYTES: ZEROED
BYTE
:
BYTE
:
BYTE
:
BYTE
:
--WORD: the --BYTE is this value >> 8
BYTE
:
BYTE
:

Looking at NVMT is quite a mess, too much is unknown yet. If somebody has any further info for instance how to calculate the screen width/height values please help.

NVDA,Features:
according to 8800GT Efi driver it is:
SUBSYSTEM_ID << 16 | 0x02FF
built-in
injected when the card is built-in. To check with: REGISTER STRAP_INFO_2 & 0x10
device-type
"NVDA,Parent" (HARDCODED)
Ext_Present
injected when there is a second screen available at boot.
@X,built-in@X,use-backlight-blanking
injected when the attached screen is fixed and not removable (LVDS)
@0,AAPL,boot-display
injected for the primary screen
@X,backlight-control
injected with the value of AAPL,backlight-control
@0,name
"NVDA,Display-A" (HARDCODED)
@1,name
"NVDA,Display-B" (HARDCODED)
@X,device-type
"display" (HARDCODED)
@X,compatible
"NVDA,NVMac" (HARDCODED)