Jump to content
  • Announcements

    • Allan

      Forum Rules   04/13/2018

      Hello folks! As some things are being fixed, we'll keep you updated. Per hour the Forum Rules don't have a dedicated "Tab", so here is the place that we have our Rules back. New Users Lounge > [READ] - InsanelyMac Forum Rules - The InsanelyMac Staff Team. 
oldnapalm

AGPM on Fermi laptop

27 posts in this topic

Recommended Posts

I got an Asus N53JQ laptop with nVidia GeForce GT 425M 1 GB video.

 

Using stock AppleGraphicsPowerManagement.kext video is very laggy.

 

Without AGPM video is smooth, but as expected, the laptop runs hot all the time, even idling.

 

If I add the card's ID (0x0df0) in AGPM, it works fine, with low temps idling and good performance in games.

 

In AGPM I see some cards have values for Threshold_High and Threshold_Low, while others also have Threshold_High_v and Threshold_Low_v.

 

For my card, if I add the "_v" thresholds I have mouse lags at certain moments, like when FireFox is rendering a page. Also when an animation is run for the first time (like clicking the applications folder in dock) it's laggy, but if it's run again, next times it's smooth.

 

I'm running 10.6.7 with latest Fermi drivers (256.01.00f03v7 from 2011.03.22).

 

Does anyone know/guess what are those "_v" thresholds, or have any information about what values are recommended for each card?

 

Thanks.

Share this post


Link to post
Share on other sites

I did some more testing today, actually it's not the fact of having Threshold_High_v and Threshold_Low_v that causes the mouse and animation lag, but the values used in Threshold_High and Threshold_Low.

 

Attached is the legacy that gives the best result until now (GeForce GT 425M). The values used in Threshold_High and Threshold_Low are the same used in Threshold_High_v and Threshold_Low_v for the GT 330M (0x0a29) in MacBookPro6,2.

 

Looks like it needs low values in BoostPState 1 and 2, and high values only in 3 and 4. A high value in second BoostPState causes the lag.

 

LegacyAGPM.kext.zip get the one in post #12

Share this post


Link to post
Share on other sites

We need higher values in BoostPState 1 and 2 of Threshold_High. OpenGL test results were too low using legacy from post #2.

 

Some tests:

 

Stock 10.6.7 AGPM

stock_agpm.png

 

No AGPM

no_agpm.png

 

Legacy from post #2

legacy_1.png

 

Legacy from this post

legacy_2.png

 

LegacyAGPM.kext.zip get the one in post #12

Share this post


Link to post
Share on other sites

AGPM edited to allow PM with GTX470, however I replaced an existing device. I am worried that the threshold values do not correspond to my device. Is there a way to get these values in WIN or linux?

<key>MacPro5,1</key>
		<dict>
			<key>Vendor10deDevice05e2</key> /*/ changed to Device06cd /*/
				<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>5</integer>
					<key>Threshold_High</key>
					<array>
						<integer>87</integer>
						<integer>87</integer>
						<integer>87</integer>
						<integer>100</integer>
					</array>
					<key>Threshold_Low</key>
					<array>
						<integer>0</integer>
						<integer>87</integer>
						<integer>87</integer>
						<integer>87</integer>
					</array>
				</dict>
				<key>LogControl</key>
				<integer>0</integer>
				<key>control-id</key>
				<integer>18</integer>
			</dict>
			<key>Vendor10deDevice0640</key>
			<dict>
				<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>5</integer>
					<key>Threshold_High</key>
					<array>
						<integer>93</integer>
						<integer>93</integer>
						<integer>93</integer>
						<integer>100</integer>
					</array>
					<key>Threshold_Low</key>
					<array>
						<integer>0</integer>
						<integer>97</integer>
						<integer>97</integer>
						<integer>97</integer>
					</array>
				</dict>
				<key>LogControl</key>
				<integer>0</integer>
				<key>control-id</key>
				<integer>18</integer>
			</dict>
			<key>default-control-id</key>
			<integer>18</integer>
		</dict>

There are 2 devices. I chose the first one to replace. Both have slightly different thresholds. Are these values available to us in another way? Meaning can I figure out the threshold of my card and change these values to match? Or will replacing one of these devices be the best solution.

Thanks

Share this post


Link to post
Share on other sites

Using GPU-Z in Windows you can check the clocks.

 

The lowest reading in my card was 50.6 MHz (9%) and the highest was 560.8 MHz (100%).

 

min.PNG

 

max.PNG

 

The problem is that AGPM has 4 BoostPStates in Threshold_High and other 4 in Threshold_Low, and in some models there are also Threshold_High_v and Threshold_Low_v which I have no idea what they are for.

 

There's also this RivaTuner app that may help, but I didn't try it yet.

 

http://www.youtube.com/watch?v=ERAgoln1dLQ

 

el coniglio wrote a parser for AGPM Info.plist which may help. Desktop cards look an easier task as they have only 2 threshold profiles with 2 values each

 

imac9_1_1.png

 

while laptop ones have more values and more profiles

 

macbookpro6_2.png

 

All graphs

AGPM.zip

Share this post


Link to post
Share on other sites

I don't think that we really have a complete idea how this AGPM kext works.

 

I posted a year ago at MR that I thought it awfully odd that of the two Nvidia devices listed, one was 0640, the GT120 (9500GT to you & me) and the other is 05e2...which is the Nvidia GTX260, a card which Apple never included in their machines.

 

If the kext actually needed to have correct device id's in it to work, why hasn't anyone with a 4,1 or 5,1 ever noticed that their GTX285 was always running at Power State 1? Wouldn't Apple have fixed that long ago? I think there is a part of this next that we aren't viewing where actual card ids are listed. Why is it that Quadro 4000 works fine but ISN'T listed either?

 

I have found that usually just chucking the thing out of the Ext folder makes my cards run fine. As in, I can see the OGL Ext Viewer scores JUMP from 100's to 1000's as the card jumps power states to 3D. I have also noted that an Nvidia 8800GT will run WORSE once I have done this, and it doesn't seem to be listed.

 

So, as a post above shows that highest speeds occurred when the kext was just GONE...can anyone show that a particular card worked BETTER using this kext (vs. tossing it out)?

 

Has anyone dug deeper inside to see how it actually works?

 

My guess is that the fact that the only GT200 card listed is a GTX260 shows that when they were writing drivers for GTX285 they did it with a GTX260 and this value we see in AGPM is a left over stub, something not necessarily used anymore.

Share this post


Link to post
Share on other sites
So, as a post above shows that highest speeds occurred when the kext was just GONE...can anyone show that a particular card worked BETTER using this kext (vs. tossing it out)?

The problem in my case is that it's a laptop, and without AGPM the battery lasts half the time when I'm not using full 3D acceleration, so removing the kext is not an option.

 

I'm not saying AGPM will give higher speeds. It's about power management.

Share this post


Link to post
Share on other sites

hello,

 

I was just doing a search for the threshold_high variable because I was hoping some clever person already figured this stuff out :) So I stumbled in on this fresh topic. You see I have this asus netbook, and I was curious to see if I could get a better understanding of the graphics power management system, to make sure everything is well.

 

So far what I've learned is that, legacyagpm kext removed, my core clock was no longer throttled and applications run very smoothly, opengl extensions, velociraptor game, and minecraft. After entering my own device id into the oem apple kext, the throttling begins. I learned that having a "LogControl" entry set to 1 will provide you a verbose print out to the kernel.log any time your IGPU, integrated gpu, changes power savings states.

0 = no throttling, 1 = some throttling, 2 = decent throttling, 3 = most conservative mode.

 

I have the 9400M chipset in here, so I've been pluggin in different Heuristics from model that should have similar hardware, Macbook 5,3 Macmini 3,1. As I experimented around with these things, I also noticed that throttling wouldn't work until I gave it the SensorOption 1. The Legacyagpm kext which I tossed had that sensoroption 1 in there, along with SensorSampleRate 4, and TargetCount 5. I left those last variables out to find out that, my gpu works even without them. And from looking at other oem mac configs, I see thats not uncommon for some mac's heuristics to leave those options out.

 

It's my belief that the V stands for volts in this "Threshold_Low_v" and that "Threshold_Low" would be related to Mhz. It would only make sense, that if you change the core clock value, to change the volts to be as power efficient as possible.

 

Now what the "number" value represents is what I'm trying to understand now, and presumably you are also.

 

So each Power State is represented by 0, 1,2,3. Each state has a High and a corresponding Low value.

 

Here's a visual diagram

 

2i1z0ns.png

 

By the definition of it, these Heuristics, are just a best guess, but they do represent a logical component, I was thinking maybe such as % GPU Idle.

 

Update

 

I did some testing to see if my theory would hold and it does so far. I got a video clip from youtube, downloaded it, and opened up the OpenGL Driver Monitor found in the dev tools. I setup a parameter for GPU core utilization, set the option to Linear, Min zero 0, Max 1G. When I play the video the GPU usage peaks just under 20% and falls back down to just a bit over 10% average while playing. Prior to modifications, my thresholds were as above on the Macbook 5,2 example. So when the video starts, and gets going, my PState is at 2 because utiltization is above the 3rd Pstate's threshold at aboutg 15% or so, so Pstate 2 is engaged.

 

So with that, I went in and made a modification to Pstate 3 low to 75, and moved Pstate 2's High out of it's range to 74. After a touch of the file system and a reboot, my Pstate is at 3 while playing the same video.

 

After quickly glancing at your earlier posts and applying that IDLE GPU % utilization logic, it makes sense. If your processor is 100% idle, then it doesn't need an overclock nor extra voltage. The opposite is true for low numbers. It's an overclock/underclock power savings mechanism.

Share this post


Link to post
Share on other sites

Hello camoguy,

 

thanks for the explanation, it makes perfect sense.

 

I was wrong again in post #2, the mouse lag happens when it switches between G-states 3 and 2

 

Apr 8 16:05:41 MacBook-de-Cassio kernel[0]: AGPM: GPU = GFX0 G-state set to 2 from 3, ControlID = 17

Apr 8 16:05:44 MacBook-de-Cassio kernel[0]: AGPM: GPU = GFX0 G-state set to 3 from 2, ControlID = 17

 

When I set G-state 3 with low=99 ang high=100 it's never used, so no mouse lag.

 

Now I'm trying to figure out if I should increase the interval for G-state 3 as you did, leave it in 2 as minimum (which gives smooth desktop animations) or if it's better not using AGPM at all (looks like using latest Fermi drivers it stays in G-state 3 while in desktop, because animations are laggy, like when clicking the applications folder in dock).

Share this post


Link to post
Share on other sites
looks like using latest Fermi drivers it stays in G-state 3 while in desktop, because animations are laggy, like when clicking the applications folder in dock

Unfortunately it's not true. It seems to start in G-state 3, but once it goes to higher states it never goes back to 3. I can tell because desktop animations stay smooth and the laptop gets much hotter.

 

The best setup for me (so far) is with AGPM but never using G-state 3 (to avoid mouse lag).

 

Test results

opengl_test.png

 

State changes during test

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

Share this post


Link to post
Share on other sites

This is the legacy I'm using now (based on MacBookPro6,2 values)

LegacyAGPM.kext.zip

 

I tried "fixing" the intervals as below, but it only causes more unnecessary state changes (like switching between states 0-2 more times when playing a game)

						<key>Threshold_High</key>
					<array>
						<integer>59</integer>
						<integer>79</integer>
						<integer>99</integer>
						<integer>100</integer>
					</array>
					<key>Threshold_Low</key>
					<array>
						<integer>0</integer>
						<integer>60</integer>
						<integer>80</integer>
						<integer>100</integer>
					</array>

Share this post


Link to post
Share on other sites

Do you use nvclock? I had to get the experimental version to support my igpu. I use it to keep an eye on the mhz of the processor, to make sure it's actually working correctly. Another thing that just came to mind, is, I would try to get an idea of what processing speed, bare minimum it will require for the quartz stuff to look smooth. Then armed with that, I would look into possibly modding the bios. The way I'd go about it would be to turn off agpm, use nvclock to make frequency adustments to the card to find the right number. Then plug that into nbitor. That should work, but as a last resort.

 

I'm curious how things would work for your card on a windows 7 install, for example doing windows aero stuff like the 3d alt tabbin stuff, check and see how it performs, check which state it runs in and such to get an idea of how things work there, might be useful here.

 

I'm about to load windows xp or 7 on here to get a better understanding or how things work on here. I'll do my best to not hose this near perfect os.

Share this post


Link to post
Share on other sites

hello oldnapalm

 

i tried to start a AGPM thread on projectosx a while ago, without any response, so i am interested in what comes out here.

masterchief has done some experiments with it a while ago.

 

but there is on projectosx a nvidia clock darwin port thread

http://www.projectosx.com/forum/index.php?showtopic=1246

 

which gives a little insight about the temp and fanspeed of the GPU

Share this post


Link to post
Share on other sites

AFAIK NVClock does not work at all with Fermi cards.

For example, here's my GTX 460, running at roughly minus two million MHz (I think that would make time go backwards or something):

Gringos-MacPro:nvclock0.8b5_7-bin-universal Gringo$ sudo ./nvclock -f -i
-- General info --
Card: Unknown Nvidia card
Architecture: GC4 A1
PCI id: 0x0000
Subvendor id: 0x0000
GPU clock: -2147483.750 MHz
Bustype: PCI

-- Memory info --
Amount: 0 MB
Type: 128 bit SDR
Clock: -2147483.750 MHz

Share this post


Link to post
Share on other sites

It also doesn't work in mine

Unable to shadow the video bios
-- General info --
Card: 		Unknown Nvidia card
Architecture: 	GC1 A1
PCI id: 	0x0000
Subvendor id: 	0x0000
GPU clock: 	-2147483.750 MHz
Bustype: 	PCI

-- Memory info --
Amount: 	0 MB
Type: 		128 bit SDR
Clock: 		-2147483.750 MHz

 

camoguy, sorry for late reply, I only tested it today.

Share this post


Link to post
Share on other sites

I'm trying Lion DP4 and Snow 10.6.8 with latest Quadro drivers from nVidia, the mouse lags almost don't happen when the card switches between first and second g-states, so I can use default MacBookPro6,2 AGPM thresholds.

 

But now I noticed something strange, when it's in the lowest g-state, if I scroll a page in FireFox (using trackpad or mouse wheel) I hear some crackles in the laptop speakers. When it engages the second g-state there's no noise. Have someone experienced something like this?

Share this post


Link to post
Share on other sites

Guys,

 

I just wanted to thank you for explaining AGPM kext in detail.

 

I also own Fermi card (460) but I've lost my temper due freezes and bought Mac Mini 2010. Only to find out that Mac Mini also suffers from AGPM throttling lag, especially in expose, interface animations etc. Worst thing is that 320M, which is integrated in my Mini, has same issues across all Mac hardware, Macbook Air, Pro etc. Although, there are some Macbooks with this GPU which don't have any lag :S

 

Hopefully, for a weekend project, I'll come up with perfect AGPM mode for my Mac Mini. Currently, I've deleted it and appleupstreamclient.kext as well, to get somewhat normal animations.

 

It really sucks that Apple allowed such a thing to happen.

 

Thanks!

Share this post


Link to post
Share on other sites

I modded my 9800gt Bios with NIBiTor and now have 2 power states:

-- VideoBios information --
Version: 62.92.52.00.09
Signon message: GeForce 9800 GT VGA BIOS
Performance level 0: gpu 450MHz/shader 1200MHz/memory 700MHz/0.00V/100%
Performance level 1: gpu 600MHz/shader 1500MHz/memory 900MHz/0.00V/100%
VID mask: 3
Voltage level 0: 0.95V, VID: 0
Voltage level 1: 1.00V, VID: 1
Voltage level 2: 1.05V, VID: 2
Voltage level 3: 1.10V, VID: 3

 

 

I copied the the 10de 640 renamed it to 605. What what values are in the driver?

 

Voltage , clock speed?

<key>Vendor10deDevice0605</key>
			<dict>
				<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>5</integer>
					<key>Threshold_High</key>
					<array>
						<integer>93</integer>
						<integer>93</integer>
						<integer>93</integer>
						<integer>100</integer>
					</array>
					<key>Threshold_Low</key>
					<array>
						<integer>0</integer>
						<integer>97</integer>
						<integer>97</integer>
						<integer>97</integer>
					</array>
				</dict>
				<key>LogControl</key>
				<integer>1</integer>
				<key>control-id</key>
				<integer>18</integer>
			</dict>
		</dict>

According to Kernel log the GPU States are changing.

Share this post


Link to post
Share on other sites

@oldnapalm

 

Thanks for starting this thread! It helped me a lot! :)

 

@camoguy

 

Thanks so much, for your research on AGPM's thresholds. Your posting let me tweak the GTX 570 to save energy up to 50W during low GPU load. :)

 

I wrote a guide how and why to edit the thresholds here:

 

[GUIDE] Edit AppleGraphicsPowerManagement.kext to unleash nvidia's GTX 570/580 full power and save energy at the same time.

Share this post


Link to post
Share on other sites
I got an Asus N53JQ laptop with nVidia GeForce GT 425M 1 GB video.

 

Using stock AppleGraphicsPowerManagement.kext video is very laggy.

 

Without AGPM video is smooth, but as expected, the laptop runs hot all the time, even idling.

 

If I add the card's ID (0x0df0) in AGPM, it works fine, with low temps idling and good performance in games.

 

In AGPM I see some cards have values for Threshold_High and Threshold_Low, while others also have Threshold_High_v and Threshold_Low_v.

 

For my card, if I add the "_v" thresholds I have mouse lags at certain moments, like when FireFox is rendering a page. Also when an animation is run for the first time (like clicking the applications folder in dock) it's laggy, but if it's run again, next times it's smooth.

 

I'm running 10.6.7 with latest Fermi drivers (256.01.00f03v7 from 2011.03.22).

 

Does anyone know/guess what are those "_v" thresholds, or have any information about what values are recommended for each card?

 

Thanks.

 

I think Threshold_Low_v and Threshold_High_v take effect when using battery?

Share this post


Link to post
Share on other sites
I think Threshold_Low_v and Threshold_High_v take effect when using battery?

I don't think so, I believe camoguy is right.

 

It's my belief that the V stands for volts in this "Threshold_Low_v" and that "Threshold_Low" would be related to Mhz. It would only make sense, that if you change the core clock value, to change the volts to be as power efficient as possible.

Share this post


Link to post
Share on other sites
I don't think so, I believe camoguy is right.

 

Here are some values under Vendor10deDevice0a29 and Vendor10deDevice0a34:

 

						<key>Threshold_High</key>
					<array>
						<integer>57</integer>
						<integer>70</integer>
						<integer>80</integer>
						<integer>100</integer>
					</array>
					<key>Threshold_High_v</key>
					<array>
						<integer>1</integer>
						<integer>3</integer>
						<integer>98</integer>
						<integer>100</integer>
					</array>
					<key>Threshold_Low</key>
					<array>
						<integer>0</integer>
						<integer>68</integer>
						<integer>75</integer>
						<integer>94</integer>
					</array>
					<key>Threshold_Low_v</key>
					<array>
						<integer>0</integer>
						<integer>2</integer>
						<integer>4</integer>
						<integer>99</integer>
[list=1][*]						</array>[/list]

 

I think even 0% idle the AGPM will not stay at BoostPState 0 or 1 when using battery but I don't know whether my thought is right or not.

Share this post


Link to post
Share on other sites

You mean when you are using battery (AC unplugged) it never enters states 0 and 1, but using AC power it does?

 

If so then your thought may be right.

 

Try removing Threshold_Low_v and Threshold_High_v and check if it goes to states 0 and 1 even on battery power.

Share this post


Link to post
Share on other sites

You mean when you are using battery (AC unplugged) it never enters states 0 and 1, but using AC power it does?

 

If so then your thought may be right.

 

Try removing Threshold_Low_v and Threshold_High_v and check if it goes to states 0 and 1 even on battery power.

That "_v" doesn't work with GT330m and MacBookpro6,1 (same result with AC and battery)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Recently Browsing   0 members

    No registered users viewing this page.

×