Jump to content
oldnapalm

AppleGraphicsPowerManagement (AGPM) for nVidia

Recommended Posts

If you are noticing low performance in your nVidia, the problem may be in AppleGraphicsPowerManagement kext. A good app to test is OpenGL Extensions Viewer.


In order to tune it, you can edit the kext's Info.plist, or use a legacy kext and keep the original AGPM.


How to edit Info.plist

http://Olarila.com/forum/viewtopic.php?f=18&t=1704


Legacy kext examples:


Laptop

LegacyAGPM.kext.zip [2.6 KiB]


Desktop

LegacyAGPM.kext.zip [2.59 KiB]


Edit: AGPM structure has changed in 10.8.2, here you find updated legacy examples

http://Olarila.com/forum/viewtopic.php?f=3&t=629&start=90#p22641


The problem happens because the GPU stays at its lowest G-state (lowest performance for energy saving).


G-states are defined in keys Threshold_High and Threshold_Low, for example:

<key>Threshold_High</key>
<array>
<integer>[color=#FF0000]57[/color]</integer>
<integer>[color=#008000]70[/color]</integer>
<integer>[color=#0000FF]88[/color]</integer>
<integer>[color=#8000FF]100[/color]</integer>
</array>
<key>Threshold_Low</key>
<array>
<integer>[color=#FF0000]0[/color]</integer>
<integer>[color=#008000]68[/color]</integer>
<integer>[color=#0000FF]75[/color]</integer>
<integer>[color=#8000FF]95[/color]</integer>
</array>

It means when the GPU is 95 to 100 % idle, it must engage state 3 (more energy saving).

75 to 88 % idle, state 2.

68 to 70 % idle, state 1.

0 to 57 % idle, state 0 (max performance).


To activate G-state switching we need to specify the GPU's vendor and device ID under the key with the model identifier (SMproductname) used in SMBIOS.


Example:

<key>[color=#FF0000]MacBookPro6,2[/color]</key>
<dict>
<key>[b]LogControl[/b]</key>
<integer>0</integer>
<key>Vendor[color=#0000FF]10de[/color]Device[color=#008000]0df0[/color]</key>
<dict>
	...
</dict>
</dict>

 

How to find vendor and device ID

http://Olarila.com/forum/viewtopic.php?f=18&t=63


Change LogControl from 0 to 1 to see state changes in kernel log

Apr  8 18:29:18 MacBook-de-Cassio kernel[0]: AGPM: GPU = GFX0 G-state set to 1 from 2, ControlID = 17
Apr  8 18:29:19 MacBook-de-Cassio kernel[0]: AGPM: GPU = GFX0 G-state set to 0 from 1, ControlID = 17
Apr  8 18:30:30 MacBook-de-Cassio kernel[0]: AGPM: GPU = GFX0 G-state set to 1 from 0, ControlID = 17
Apr  8 18:30:32 MacBook-de-Cassio kernel[0]: AGPM: GPU = GFX0 G-state set to 2 from 1, ControlID = 17

 

If you choose the legacy kext, copy a key from original AGPM according to your hardware. For desktop use iMac or MacPro. For laptop use MacBook or MacBookPro.

Link to comment
Share on other sites

Hi oldnapalm,


Like always an excellent guide.

But seems like my Nvidia 8600 M GT (256MB) is giving low performance since 10.8.1 update, I patched AGPM and G states seems to be working but performance is still very low compared to 10.8.0 any suggestions ?


This is my Open GL results with 10.8.0 (Non patched AGPM)

Open_GL_Benchmarks_10.8.0.png.c6530a0f9af90cfbec614a32657539d4.png

 

This is my Open GL results with 10.8.1 (Patched AGPM) [slightly better results than 10.8.1 without patched AGPM]

Open_GL_10.8.1.png.a4176d9ba772e8db561d452fb38a66d5.png

 

This is my kernel Log right after Open GL Test

Sep 14 22:20:06 localhost kernel[0]: AGPM: GPU = VID G-state set to 0 from 0, ControlID = 17. SW occupancy updated.
Sep 14 22:20:07 localhost kernel[0]: AGPM: updateGPUHwPstate(1, 0): fHwPstate = 0 fFB = 0xffffff800c42a000
Sep 14 22:20:07 localhost kernel[0]: AGPM: updateGPUHwPstate(): state = 1. Calling fFB->setAggressiveness()...
Sep 14 22:20:07 localhost kernel[0]: AGPM: GPU = VID G-state set to 1 from 0, ControlID = 17. SW occupancy updated.
Sep 14 22:20:09 localhost kernel[0]: AGPM: updateGPUHwPstate(2, 0): fHwPstate = 1 fFB = 0xffffff800c42a000
Sep 14 22:20:09 localhost kernel[0]: AGPM: updateGPUHwPstate(): state = 2. Calling fFB->setAggressiveness()...
Sep 14 22:20:09 localhost kernel[0]: AGPM: GPU = VID G-state set to 2 from 1, ControlID = 17. SW occupancy updated.

 

This is my patch in the AGPM,

<key>MacBookPro7,1</key>
				<dict>
			<key>LogControl</key>
			<integer>1</integer>
			<key>Vendor10deDevice0407</key>
			<dict>
				<key>BoostPState</key>
				<array>
					<integer>0</integer>
					<integer>1</integer>
					<integer>2</integer>
					<integer>3</integer>
				</array>
				<key>BoostTime</key>
				<array>
					<integer>3</integer>
					<integer>3</integer>
					<integer>3</integer>
					<integer>3</integer>
				</array>
				<key>Heuristic</key>
				<dict>
					<key>ID</key>
					<integer>0</integer>
					<key>IdleInterval</key>
					<integer>250</integer>
					<key>SensorOption</key>
					<integer>1</integer>
					<key>SensorSampleRate</key>
					<integer>4</integer>
					<key>TargetCount</key>
					<integer>1</integer>
					<key>Threshold_High</key>
					<array>
						<integer>57</integer>
						<integer>70</integer>
						<integer>88</integer>
						<integer>100</integer>
					</array>
					<key>Threshold_Low</key>
					<array>
						<integer>0</integer>
						<integer>68</integer>
						<integer>75</integer>
						<integer>100</integer>
					</array>
				</dict>
				<key>control-id</key>
				<integer>17</integer>
			</dict>
		</dict>

 

P.S - Installed CUDA Drive 5.0.24, does not help in performance. Awaiting your suggestions.

Rig I: OSX 10.6.8

Pentium D 3.4 GHz ,250 Gb HDD,2GB 667MHz RAM, Nvidia 7600GT XXXgraphics card, 16:9 LCD display,dual webcams,Bluetooth.

Rig II:OSX 10.8.1

Dell inspiron 1520,Core2duo T7250, 4GB 667MHz RAM,NV 8600GTM, BCM 4322 (Rebranded to Apple Extreme).

Link to comment
Share on other sites

Hello everyone.


I have followed the steps provided in the beginning of the thread, but after editing Info.plist and pasting the right Vendor and Device ID in the right section, GPU switches only between 2 power states. But 3 have to be available, the lowest power state is not set at all.

 

22.04.13 8:51:14,000 kernel[0]: AGPM: updateGPUHwPstate(1, 0): fHwPstate = 1 fFB = 0xffffff800c029000
22.04.13 8:55:05,000 kernel[0]: AGPM: updateGPUHwPstate(0, 0): fHwPstate = 0 fFB = 0xffffff800c029000

 

I am using MacBookPro5.1 SMBIOS, Vendor10deDevice0648 I have set instead of the GFX0 string in AppleGraphicsPowerManagement Info.plist (Nvidia GeForce 9600M GS). I have tried to edit treshold values but it doesnt matter what I set. It always switches only between two highest power states even if I delete the excessive one (there are values 0-3, so I deleted the 3 and tried to correct treshold values but it does not change anything). I tried LegacyAGPM.kext but it does not help at all (looks like it ignores it at all)


When I use default AGPM with GFX0 string instead of specifiying Vendor and Device ID, everything is working and GPU switches its power states as it has to, but after monitor sleep, it brokes, sets its highest power state and no more switching again.


Running on Acer 5730ZG laptop (default with Nvidia GF9300M GS, but I replaced it for 9600M GS). AppleGraphicsPowerManagement.kext is default from system


Thanks for your help

Link to comment
Share on other sites

Hello,

thanks for this great tutorial, i finally managed to get it working but now it seems that AGPM is always running on full speed.


02.03.14 13:46:54,000 kernel[0]: AGPM: GPU = GFX0 G-state set to 0 from 0, ControlID = 17. SW occupancy updated.


Only during the boot it changes from 3 to 2 to 1 and backwards but after the system booted its only at 0

Can anyone help me?

I've got the exact same configuration as above. Thanks :)

Link to comment
Share on other sites

hello


u should use smbios


macbook5,1 not macbookpro5,1


and in the legacy same thing AGPM for macbook5,1


u can try without the legacy.. only using the right smbios


good hack

PB Easy Note TM 86 - i5 430 M - H55M - Ram - 6 GB - Alc272 - Radeon HD 5470 512 QE/CI

Lenovo G500 - i5 3230m - HM77 - Ram - 8 GB - Conexant audio - HD 4000

My OS X Files 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.





×
  • Create New...