-->Donations via PayPal [External Link Removed for Guests] :guitar
-->Installation/Post Installation Tutorial [Local Link Removed for Guests]
-->Useful Links [Local Link Removed for Guests]
-->Olarila Images - Updated images [Local Link Removed for Guests]
-->Guides and Tutorials [Local Link Removed for Guests]
-->Clover Folder for All Chipsets [Local Link Removed for Guests]
-->DSDT Patch Requests [Local Link Removed for Guests]

AppleGraphicsPowerManagement (AGPM) for nVidia

Post Reply
User avatar
oldnapalm
Olarila Staff
Olarila Staff
Posts: 1225
Joined: 05 Dec 2010, 20:49

AppleGraphicsPowerManagement (AGPM) for nVidia

Post by oldnapalm » 16 Aug 2012, 15:20

If you are noticing low performance in your nVidia, the problem may be in AppleGraphicsPowerManagement kext. A good app to test is [External Link Removed for Guests].

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
[Local Link Removed for Guests]

Legacy kext examples:

Laptop
[Local Link Removed for Guests] [2.6 KiB]

Desktop
[Local Link Removed for Guests] [2.59 KiB]

Edit: AGPM structure has changed in 10.8.2, here you find updated legacy examples
[Local Link Removed for Guests]

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>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>95</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>MacBookPro6,2</key> <dict> <key>LogControl</key> <integer>0</integer> <key>Vendor10deDevice0df0</key> <dict> ... </dict> </dict>
How to find vendor and device ID
[Local Link Removed for Guests]

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

Code: [Local Link Removed for Guests]

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.
indiandragon
Posts: 12
Joined: 08 May 2012, 12:09

Re: AppleGraphicsPowerManagement (AGPM) for nVidia

Post by indiandragon » 14 Sep 2012, 16:55

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
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
This is my kernel Log right after Open GL Test

Code: [Local Link Removed for Guests]

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,

Code: [Local Link Removed for Guests]

<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.
You do not have the required permissions to view the files attached to this post.
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).
DevZone
Posts: 2
Joined: 12 Jun 2012, 21:43

Re: AppleGraphicsPowerManagement (AGPM) for nVidia

Post by DevZone » 24 Jan 2013, 15:54

Code: [Local Link Removed for Guests]

				<key>iMac11,3</key>
				<dict>
					<key>GFX0</key>
					<dict>
						<key>control-id</key>
						<integer>17</integer>
					</dict>
					<key>LogControl</key>
					<integer>0</integer>
				</dict>
Image
Image

Gigabyte GeForce GTS 250, 10.8.3 (12D54)
Marchrius
Posts: 2
Joined: 09 Dec 2011, 11:15

Re: AppleGraphicsPowerManagement (AGPM) for nVidia

Post by Marchrius » 05 Feb 2013, 15:31

Here with MacBookPro5,5 SMBios works native on Acer Aspire 6930G with nVidia GeForce 9600M GT DDR2 (0x10de0649) :D
Schermata 2013-02-05 alle 16.28.03.png
EDIT:

With overclocked bios mod
Schermata 2013-02-07 alle 12.50.31.png
You do not have the required permissions to view the files attached to this post.
DevZone
Posts: 2
Joined: 12 Jun 2012, 21:43

Re: AppleGraphicsPowerManagement (AGPM) for nVidia

Post by DevZone » 15 Feb 2013, 04:45

oldnapalm,
What responsible for ControlID :?:
17 / 18
Jix0
Posts: 1
Joined: 17 Apr 2013, 06:12
CPU: Pentium T3200 2GHz
Motherboard: acer 5730zg laptop
GPU: Geforce 9600M

Re: AppleGraphicsPowerManagement (AGPM) for nVidia

Post by Jix0 » 22 Apr 2013, 07:15

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.

Code: [Local Link Removed for Guests]

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
Alexthebest27
Posts: 3
Joined: 07 Jun 2012, 23:44

Re: AppleGraphicsPowerManagement (AGPM) for nVidia

Post by Alexthebest27 » 02 Mar 2014, 12:48

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 :)
User avatar
artur-pt
Olarila Staff
Olarila Staff
Posts: 5012
Joined: 24 May 2011, 11:04
CPU: i5
Motherboard: Lenovo
GPU: Intel

Re: AppleGraphicsPowerManagement (AGPM) for nVidia

Post by artur-pt » 02 Mar 2014, 19:10

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
[External Link Removed for Guests] - join me at irc.freenode.net/##olarila
Post Reply

Return to “Guides and tutorials”