Help - Search - Members - Calendar
Full Version: Nvidia Injection
Project OS X Forums > OS X 10.6 (Snow Leopard) > Hardware Information > Graphics
fassl
Hey guys, i wanted to share the current stuff we know about the various properties mac nvidia efi drivers set to get the graphics card working properly in mac os x. Also if somebody can help disassembling those drivers you are welcome to help here if you want. And if you already know some bits please post them, so we can get this going as soon as possible. Also with 10.6.3 it seems the drivers got pickier from what i've read so far so i thought now is the best time to get into it.

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:

CODE
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:

CODE
BYTE: Display-Number
BYTE: I2C Read Offset
BYTE: 0xFF
BYTE: 0x00


For TV:

CODE
BYTE: Display-Number
BYTE: I2C Read Offset
BYTE: 0xFF
BYTE: 0x01


And for everything else like LVDS, TMDS and Display-Port

CODE
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
CODE
@0,display-cfg <00FFXX00>  XX = I2C Read Offset
@1,display-cfg <00FFXX01>  XX = I2C Read Offset

TV
CODE
@0,display-cfg <01FFXX00>  XX = I2C Read Offset
@1,display-cfg <01FFXX01>  XX = I2C Read Offset

ELSE
CODE
@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:

CODE
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).

CODE
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
CODE
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
CODE
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:

CODE
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 HARDCODED
6 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:
CODE
SUBSYSTEM_ID << 16 | 0x02FF

built-in
injected when the card is built-in. To check with: REGISTER STRAP_INFO_2 & 0x10

device-type
CODE
"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
CODE
"NVDA,Display-A" (HARDCODED)

@1,name
CODE
"NVDA,Display-B" (HARDCODED)

@X,device-type
CODE
"display" (HARDCODED)

@X,compatible
CODE
"NVDA,NVMac" (HARDCODED)


As you see there is still much left to investigate, if somebody has some hints or wants to help you are welcome to join this thread here. Also for easing your investigation i created a small app (based on the great work of the guys at nouveau project) attached at this thread. Note it just parses the bios, it can't save any changes you make.

Also if you happen to have real macs, it would be great if you can provide us an ioreg dump and your nVidia bios.

Click to view attachment

greets fassl
Slice
NVPM - seems to be NVidia PowerManagement aka GPU Speedstep.
CODE
                              "NVPM",
                                Buffer ()
                                {
                                    /* 0000 */    0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                                    /* 0008 */    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                                    /* 0010 */    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                                    /* 0018 */    0x00, 0x00, 0x00, 0x00
                                },

With these values GPU Core Speed changes dynamically.
Random values leads to unpredictable results.
aikidoka25
QUOTE (Slice @ Jul 29 2010, 05:09 AM) *
NVPM - seems to be NVidia PowerManagement aka GPU Speedstep.
CODE
                              "NVPM",
                                Buffer ()
                                {
                                    /* 0000 */    0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                                    /* 0008 */    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                                    /* 0010 */    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                                    /* 0018 */    0x00, 0x00, 0x00, 0x00
                                },

With these values GPU Core Speed changes dynamically.
Random values leads to unpredictable results.


slice,
thank you for the tip, i added this into the DSDT with Buffer(0x1C) ... is this correct?

also, is there a way to verify the GPU PM is working?
i tried with nvclock -i, but it seems there is no change on GPU clock.
THe KiNG
Time for a bump here, since with 10.6.5 boot time increased on my notebook I started to investigate what is wrong and haunting for info...

What I found so far about AAPL01,T1-T7 property, seems is related to POWER SEQUENCE TABLE as you can see in attached pic.
Rest of AAPL01xyz entry's like AAPL01,InverterFrequency, I have no idea yet from where they come...

Click to view attachment
Slice
It is not only for nVidia. X3100FB also uses such properties
CODE
HacBook:ASM slice$ cat AppleIntelGMAX3100FB.txt | grep AAPL
0000304a c7442404cc1d0100 movl $0x00011dcc,0x04(%esp) AAPL01,DualLink
000030a9 c7442404dc1d0100 movl $0x00011ddc,0x04(%esp) AAPL01,T0
000030ff c7442404e81d0100 movl $0x00011de8,0x04(%esp) AAPL01,T1
0000314d c7442404f41d0100 movl $0x00011df4,0x04(%esp) AAPL01,T2
0000319b c7442404001e0100 movl $0x00011e00,0x04(%esp) AAPL01,T3
000031e9 c74424040c1e0100 movl $0x00011e0c,0x04(%esp) AAPL01,T4
00003237 c7442404181e0100 movl $0x00011e18,0x04(%esp) AAPL01,T5
00003285 c7442404241e0100 movl $0x00011e24,0x04(%esp) AAPL01,T6
000032cc c7442404301e0100 movl $0x00011e30,0x04(%esp) AAPL01,T7
00003348 c74424043c1e0100 movl $0x00011e3c,0x04(%esp) AAPL01,PixelFormat
0000344f c7442404501e0100 movl $0x00011e50,0x04(%esp) AAPL01,InverterFrequency
000034d5 c7442404981e0100 movl $0x00011e98,0x04(%esp) AAPL01,BacklightIntensity
00008615 c744240434200100 movl $0x00012034,0x04(%esp) AAPL00,override-no-connect
000086b9 c744240450200100 movl $0x00012050,0x04(%esp) AAPL01,override-no-connect
00008757 c74424046c200100 movl $0x0001206c,0x04(%esp) AAPL00,override-has-edid
000087f5 c744240488200100 movl $0x00012088,0x04(%esp) AAPL01,override-has-edid
00008893 c7442404a4200100 movl $0x000120a4,0x04(%esp) AAPL00,override-no-edid
00008931 c7442404bc200100 movl $0x000120bc,0x04(%esp) AAPL01,override-no-edid
000089cf c7442404d4200100 movl $0x000120d4,0x04(%esp) AAPL00,override-has-edid-digital
00008a6d c7442404f8200100 movl $0x000120f8,0x04(%esp) AAPL01,override-has-edid-digital
00008b0b c74424041c210100 movl $0x0001211c,0x04(%esp) AAPL00,no-hotplug-support
00008b44 c744240438210100 movl $0x00012138,0x04(%esp) AAPL01,no-hotplug-support
0000c74e c7442404682f0100 movl $0x00012f68,0x04(%esp) AAPL,HasPanel
0000c7ac c7442404782f0100 movl $0x00012f78,0x04(%esp) AAPL,HasLid
0000c7fe c7442404842f0100 movl $0x00012f84,0x04(%esp) AAPL,NumFramebuffers
0000cc41 c7442404e82f0100 movl $0x00012fe8,0x04(%esp) AAPL,NumDisplays
0000cc89 c7442404fc2f0100 movl $0x00012ffc,0x04(%esp) AAPL,DisplayConfig
0000ccbc c744240410300100 movl $0x00013010,0x04(%esp) AAPL00,CurrentDisplay
0000cda6 c744240428300100 movl $0x00013028,0x04(%esp) AAPL00,IODisplayMode
0000cdf8 c744240440300100 movl $0x00013040,0x04(%esp) AAPL00,Pipe
0000cebd c74424044c300100 movl $0x0001304c,0x04(%esp) AAPL00,BootDisplay
0000cef0 c744240460300100 movl $0x00013060,0x04(%esp) AAPL00,Depth
0000cf42 c744240470300100 movl $0x00013070,0x04(%esp) AAPL00,Width
0000cf94 c744240480300100 movl $0x00013080,0x04(%esp) AAPL00,Height
0000cfe6 c744240490300100 movl $0x00013090,0x04(%esp) AAPL00,Interlace
0000d02a c7442404a4300100 movl $0x000130a4,0x04(%esp) AAPL00,Refresh
0000d1c2 c7442404bc300100 movl $0x000130bc,0x04(%esp) AAPL01,CurrentDisplay
0000d2b2 c7442404d4300100 movl $0x000130d4,0x04(%esp) AAPL01,IODisplayMode
0000d304 c7442404ec300100 movl $0x000130ec,0x04(%esp) AAPL01,Pipe
0000d3c9 c7442404f8300100 movl $0x000130f8,0x04(%esp) AAPL01,BootDisplay
0000d3fc c74424040c310100 movl $0x0001310c,0x04(%esp) AAPL01,Depth
0000d44e c74424041c310100 movl $0x0001311c,0x04(%esp) AAPL01,Width
0000d4a0 c74424042c310100 movl $0x0001312c,0x04(%esp) AAPL01,Height
0000d4f2 c74424043c310100 movl $0x0001313c,0x04(%esp) AAPL01,Interlace
0000d536 c744240450310100 movl $0x00013150,0x04(%esp) AAPL01,Refresh
0000d6ce c744240468310100 movl $0x00013168,0x04(%esp) AAPL00,EDID
0000d73a c744240474310100 movl $0x00013174,0x04(%esp) AAPL01,EDID
0000d854 c744240480310100 movl $0x00013180,0x04(%esp) AAPL00,display-alias
0000d8a2 c744240498310100 movl $0x00013198,0x04(%esp) AAPL01,display-alias
0000d8fa c7442404b0310100 movl $0x000131b0,0x04(%esp) AAPL,SelfRefreshSupported
0000daaf c7442404f4310100 movl $0x000131f4,0x04(%esp) AAPL,display-alias
0000dd11 c744240408320100 movl $0x00013208,0x04(%esp) AAPL,boot-display
0001034d c744240418330100 movl $0x00013318,0x04(%esp) AAPL00,IgnoreConnection
000103a4 c744240430330100 movl $0x00013330,0x04(%esp) AAPL00,no-hotplug-interrupt
000103ff c74424044c330100 movl $0x0001334c,0x04(%esp) AAPL01,IgnoreConnection
00010456 c744240464330100 movl $0x00013364,0x04(%esp) AAPL01,no-hotplug-interrupt
HacBook:ASM slice$
THe KiNG
QUOTE (Slice @ Nov 6 2010, 10:03 PM) *
It is not only for nVidia. X3100FB also uses such properties

Good to know, maybe this will add more interest in this!

We need a proper Injector, to read and fill data from GFX BIOS and Display like EDID and stuff, like Apple does with EFI driver, if we don't do this, since Apple started to restrict things, soon we will get in trouble...

So is time to open the knowledge box and start to share stuff like fassl did, I know a OpenSource Injector will start another copyleft mania full of red or orange apple's but is the only way IMHO.
Krazubu
AAPL stands for internal display panel and not graphic adapter, so sure it's generic.
THe KiNG
QUOTE (Krazubu @ Nov 7 2010, 12:06 PM) *
AAPL stands for internal display panel and not graphic adapter, so sure it's generic.

I don't think is generic at all, it use information from display specific, and Apple is very strict about that, they have custom profiles for each display model they use, so I guess same happen with EFI driver.
Anyway seems EFI driver inject those only for displays connected on LVDS, on latest MacBookAir display is connected using displayport and most of the stuff is removed.
Slice
Most of the parameters can be obtained from VideoBIOS
CODE
        radeon_output->PanelXRes = BIOS_IN16(tmp+6);
        radeon_output->PanelYRes = BIOS_IN16(tmp+10);
        radeon_output->DotClock   = BIOS_IN16(tmp+4)*10;
        radeon_output->HBlank     = BIOS_IN16(tmp+8);
        radeon_output->HOverPlus  = BIOS_IN16(tmp+14);
        radeon_output->HSyncWidth = BIOS_IN16(tmp+16);
        radeon_output->VBlank     = BIOS_IN16(tmp+12);
        radeon_output->VOverPlus  = BIOS_IN16(tmp+18);
        radeon_output->VSyncWidth = BIOS_IN16(tmp+20);
        radeon_output->PanelPwrDly = BIOS_IN16(tmp+40);

if present here. It is not a big problem for Chameleon to read them but we need to know relations between BIOS and AAPL.
PanelXRes == AAPL00,Width
PanelYRes == AAPL00,Height
DotClock = InverterFrequency ???


Also
CODE
        info->sclk = BIOS_IN16(pll_info_block + 8) / 100.0;
        info->mclk = BIOS_IN16(pll_info_block + 10) / 100.0;

correspond to
AAPL,SCLK
AAPL,MCLK

that Chameleon set as constant angry.gif

I said about Radeon that I previously studied and dunno about nVidia. About IntelX3100 I have more or less working parameters and some thought why these parameters must have these values.
Krazubu
By generic I meant "it's present on any mac".
Slice you can obtain those infos from BIOS only if it has been coded there, tho this is rather common for laptops, it's not always the case.
I'm ok with your suggestions for PanelXRes and Y but I doubt DotClock is ok since there is "AAPL00,InverterFrequency"

Check my old thread about nVidia, it contains some findings and ideas for this AAPL stuff (http://www.projectosx.com/forum/index.php?showtopic=4)

Here's a list of some AAPL strings I gathered here and there :

NVDAResman.kext :
AAPL,gart-width
AAPL,RegEntryID
AAPL,temp-sensor
AAPL%02d,T%d
AAPL%02d,IgnoreConnection
AAPL,gray-page
AAPL,gray-value
AAPL%02d,blackscreen-preferences
AAPL,blackscreen-preferences
AAPL0
AAPL%02d,no-hotplug-interrupt
AAPL,display-power-switch
AAPL%02d,Dither
AAPL,EMC-Display-List

IONDRVSupport.kext :
AAPL,iokit-ignore-ndrv
AAPL,iokit-ndrv
driver,AAPL,MacOS,PowerPC (4 possible choices)
AAPL,vram-memory
AAPL,ndrv-dev
AAPL,boot-display
AAPL,RegEntryID
AAPL,ndrv-interrupt-set
AAPL,address
AAPL,maps
AAPL,DisableMSI

AppleGraphicsControl.kext :
AAPL,boot-display
AAPL,display-alias
AAPL,phandle
AAPL,gray-value
AAPL,gray-page

AppleGraphicsPowerManagement.kext :
AAPL,mux-switch-state
AAPL,display-alias
AAPL,alias-policy
AAPL0%d,T%d
AAPL00,override-has-edid-digital
AAPL01,override-has-edid-digital
AAPL,primary-display
AAPL,OpenCLdisabled
Slice
Yes, my information for laptops where Panel info already present in VideoBIOS.
Concerning IONDRVSupport.kext, it is available in sources so we can easy check what AAPL for a what. As well as IOGraphics and AppleOnboardDisplay.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2012 Invision Power Services, Inc.