HOWTO: Low DPC latencies (<100 us) on bootcamped Macbooks (Pro)

Discussion in 'MacBook Pro' started by Timur, Dec 9, 2008.

  1. Timur macrumors 6502a

    Timur

    Joined:
    Oct 14, 2008
    #1
    Here is a small HOWTO for getting the lowest possible DPC latencies (<100 us) on bootcamped Macbooks Pro (late 2008):

    Disclaimer: I did all tests on my late 2008 Macbook Pro Unibody 2.8 GHz model with NVidia chipset and graphic. Most of the following suggestions should apply to standard Macbook models and likely older generation as well.

    First of all Intel Speedstep leads to dropouts and higher DPC latencies on small load! Unfortunately all tools that are supposed to manually switch Speedstep off don't seem to run on the late Macbooks (Pro) while on OS X you can use "Coolbook".

    Your only way to make sure your processor is clocked high enough and not dynamically switching is to put up a constant load (like running your DAW pretty hot or running Prime95 at "Idle/Lowest" process Priority in the background). I will keep investigating if I can find a tool to switch Speedstep off.

    Most importantly (to get rid of really bad DPC latency spikes):

    Kill the process "KBDMGR.EXE"!

    That's Apple's driver for controlling brightness and keyboard lighting via the function keys and setting tap options for the trackpad. It seems to have broken multithreading! You can also the CPU affinity of KBDMGR.EXE to CPU1 (not CPU0!) which will help decreasing DPC Latencies alot, but there will still be Audio dropouts.

    Here's a small toolkit I put together that allows you to conviniently enable/disable Apple's "Boot Camp" tray application (KBDMGR.EXE) via an icon link and/or keyboard shortcut. Optionally it will switch the function of the F-Keys automatically for you depending on whether Boot Camp is loaded or not.

    Furthermore it automatically turns Boot Camp's CPU priority to "Idle" and CPU affinity to CPU1 in order to turn down the bug induced DPC Latencies and prevent dropouts with Windows sounds and Media Player playback. Professional Audio users will find that only turning off Boot Camp will allow low audio latency usage. Installation instructions are included in the README.TXT for your convinience. ;)

    Boot CampED - Download Page

    Turn off the Broadcom 802.11N WLAN driver via Device-Manager or update to the latest drivers via Microsoft Update Catalog.

    Like on OS X the Airport module can lead to audio dropouts. The DPC Latencies produced by the Broadcom driver are less regular than the KBDMGR thing, alot higher in value. Best thing is to try for your own needs.

    Update:Meanwhile a new Broadcom drivers was published via Microsoft's Update Catalog named "Broadcom - Network - Broadcom 4322AG 802.11a/b/g/draft-n Wi-Fi Adapter " (4322 is the chip used). This one comes with both low DPC latencies and finally the ability to use the full rate upto 300 mbit/s. Go get it! For safety you might still want to turn WLAN off during critical audio work though.

    Change the graphic-card driver to "Standard VGA Driver" via Device-Manager or use RIVATUNER to enforce a fixed clock-rate and performance mode.

    Update:The dynamic clock-rate switching happening with NVidia drivers in order to save power and keep temperatures low leads to extreme DPC spikes for each switch and constantly high DPC latencies when it settles in low performance 2D mode. RIVATUNER's "Enforce Performance Mode" option can be used to set the card to a fixed clock-rate. I recommend using "Low Power 3D" for audio work.

    User of XP might think that they don't need this, but be aware that on XP the NVidia driver keeps running at highest clock-rates in "Performance 3D Mode" all the time. Via RIVATUNER you can switch to "Low Power 3D".

    Turn off the ACPI compliant Battery driver via Device-Manager

    This driver polls the battery for its current load status and produces a small, single, short spike exactly every 15 seconds. In my own tests I found that it doesn't seem to affect low latency audio performance. Furthermore turning it off will remove monitoring of your current battery status. But if you are running on power-chord anyway and want to make absolutely sure you can turn it off.

    All other devices don't add much if anything to DPC latencies, but can savely be turned off if you don't need them (like Nvidia LAN, Bluetooth, Onboard High Definition Audio).

    Attention: Removing the Battery while the power chord is connected results in permanently reduced CPU clock (downto the lowest clock setting possible). According to Apple this is done to prevent overloading the power-supply during heavy load as it needs the assistance of the battery from time to time.
     
  2. Timur thread starter macrumors 6502a

    Timur

    Joined:
    Oct 14, 2008
    #2
    Unfortunately I just found out that for low latency performance you need to kill the KBDMGR.EXE process completely!

    Even when there is no increase in DPC and IRQ cycles and near to no CPU load happening from KBDMGR it still interrupts the audio of my Kore 1. Interestingly the buzzing/zipping noises that are happening sound very much like the noise I get on OS X (eventhough at higher load). So something about that Keyboard/Screen lighting control is fishy.
     
  3. Timur thread starter macrumors 6502a

    Timur

    Joined:
    Oct 14, 2008
    #3
    There is some good news: Because of the Windows 7 Beta that will be published in the near future Microsoft has put up a new "Microsoft Update-Catalog" at: http://catalog.update.microsoft.com/v7/site/Home.aspx

    This includes many updated drivers for hundreds of hardware interfaces including Broadcom WLAN drivers and Nvidia 9600M GT drivers that are found on the current Macbook (Pro) models.

    Especially the Broadcom driver is very interesting:

    1. It finally enables full 300 mbit/s 802.11n support, whereas older drivers (including OS X) only connect upto 130 mbit/s with many routers. Whatever the driver does to switch 300 mbit on it even stays on when you reinstall the older drivers!

    As a drawback you cannot use channels 12 and 13 anymore (in Germany) as this driver seems to be made for the USA only.

    2. It dramatically improves DPC latencies

    From this (Bootcamp Broadcom driver version 4.170.77.3/03-21-08):

    [​IMG]

    To this (Broadcom driver version 5.10.38.26/10-22-08):

    [​IMG]

    I would still advice to turn off WLAN when doing critical Audio work, but at least you only have to do it for special circumstances now.

    The Nvidia 9600M GT drivers are version 177.48 and thus slightly newer than the Bootcamp ones. Unfortunately they shows about the same DPC Latency behavior as before. So for critical Audio work you still have to fall back to the "Standard VGA Drivers".

    PS: Curiously the new driver version of the Broadcom drivers resembles what OS X reports as "Firmware Version: 5.10.38.24". Even more strange Windows 7 Beta comes with a driver version 4.176.75.11/10-23-08 that is one day younger, but less performing than the version 5 drivers.
     
  4. Timur thread starter macrumors 6502a

    Timur

    Joined:
    Oct 14, 2008
    #4
    Some Updates:

    1. NVidia now officially offers graphic-drivers for their mobile line of GPU including the 9400M/9600M that are found in the Macbook (Pro). So you can just download the latest drivers directly from NVidia now without any need to mess with INF files or any other hack.

    2. I have found the source for the DPC Latency spikes that are happening with NVidia graphic-drivers installed. Actually there are two reasons for this happening.

    a) The Nvidia driver dynamically changes the GPU clock-rate (including GPU memory) up and down depending on current graphic-load. Everytime the clock-rate changes (especially when it changes down) a huge DPC Latency spike happens. This has been reported with Geforce-8 based GPU on other forums and unfortunately the 9600M is more of a Geforce-8 than Geforce-9.

    b) When graphic-load is low (like with most 2D based DAWs) the GPU memory is clocked down to only 100 MHz (from a max of over 700 MHz), this leads to regular and ongoing DPC Latency spikes when many dymanic elements are displayed by a DAW.

    I have already managed to temporarily get rid of NVidia based DPC Latency spikes and I'm working on finding a solution that allows to permanently get rid of those during DAW work. I will report back on that.

    Until then the best performing option that leads to the lowest average DPCs is still to switch the graphic-driver to "VGA Standard Driver" (minimum power draw will be upto 5W higher though).

    3. Nvidia also offers an application called Ntune at version 6. NTune allows you to overclock/underclock the Frontsidebus (and thus the CPU and RAM), modify RAM timings and overclock/underclock the GPU. Only experienced people who know what they are doing should mess with it, but it's nice to have for those of us who like messing around anyway. ;)
     
  5. Timur thread starter macrumors 6502a

    Timur

    Joined:
    Oct 14, 2008
    #5
    I have one bad news and two lightly good news:

    Bad news: I was not able to keep the Nvidia 9600M GT from switching down to 2D mode sooner or later. Even when it is possible to keep it from switching clock-rates in performance-3D and low-power-3D by setting those to the same clock-rates once it goes down to 2D the performance is rather bad aka DPC latencies are regular high enough to make it unusable for low latency audio work. It seems that the lower the memory clock the higher the DPC latencies.

    1. good news: "For a limited time, provide your feedback on Rel 179 notebook drivers."

    http://surveys.nvidia.com/index.jsp?pi=50aa59cdf782d18a4d043cdd3baa920a

    So for the first time they offer us end-users to tell them what we think about the performance of their drivers. I will use that opportunity to tell them about bad DPC behavior! ;)

    2. good news: NVidia not only officially offers drivers for the graphic-card but also for the system chipset. You can find it under "NForce -> NForce7 -> 730i/Geforce 9400m/9300m mGPU". The current version is already a bit more up-to-date than the ones on the Bootcamp disc.

    3. good news: I forgot what it was, but I'm sure there was a third good news. :)
     
  6. Timur thread starter macrumors 6502a

    Timur

    Joined:
    Oct 14, 2008
    #6
    Update: I didn't give up and finally found a way to keep the NVidia graphic from producing DPC Latencies on Vista/W7 while NVidia drivers are used (instead of just using VGA Standard drivers).

    Furthermore I found that the only reason why Windows XP is not affected by NVidia induced DPC Latencies is because the graphic card's clock-rates are never changed but keep running at the highest settings (Performance 3D), not even when installing the latest drivers. This is a bug! The obvious drawback is that power drain and likely GPU temperatures are somewhat higher compared to Vista/W7.

    Actually I found two ways to stop NVidia DPC Latencies from happening on Vista/W7. Since the reason for the DPC Latencies are:

    1. dynamically switching clock-rates
    2. running at low performance 2D mode most of the time

    We need to get rid of both! One way is to switch to the Microsoft VGA Standard driver which makes the 9600M run at fixed "medium" clock-rates for both GPU and memory. But since this not only means to abandon Aero, but also Nvidia video-playback acceleration and other driver goodies it's only the second best option.

    The best option I found is to use an application called Rivatuner that offers a somewhat hidden option called "Force Performance Mode". This allows to set the NVidia driver to one of it's three modes: "Standard 2D" (we don't want that!), "Low Power 3D" (comparable to Standard VGA driver clock-rates), "Performance 3D" (that's what XP gets stuck at).

    I recommend enforcing the "Low Power 3D" mode for audio work. You need to restart the computer in order to switch the "Force Performance Mode" on and off in case you need to get the old behavior back or need the full "Performance 3D" mode for gaming, but that's not too much of an inconvenience. It also works on XP by the way.

    The second method I found is a bit too geeky and needs too much work to setup so I wont explain that in detail. The general idea of that second idea is that once a DAW GUI is loaded any switching of GPU clock-rates forces the GPU back to "Performance 3D" mode (even when the rate doesn't actually change). So a regular occurring switch every few seconds would keep the rate constant. I prefer method 1 even when that means to reboot for changing it.
     
  7. Timur thread starter macrumors 6502a

    Timur

    Joined:
    Oct 14, 2008
    #7
    I spent some time to get more convinient control over KBDMGR and the corresponding settings application (the one you configure the trackpad and F-keys behavior besides other stuff).

    Right ALT-. will switch KBDMGR on and off now. Additionally the F-keys are automatically switched to their special Macbook functions (like controlling brightness) when KBDMGR is on and to normal F-keys function when KBDMGR is off.

    Furthermore when Windows boots up and when enabling it via ALT-. then KBDMGR is set to "Idle" priority and CPU1 affinity. That helps for normal desktop audio output, but for professional audio work it still needs to be turned off.

    Right ALT-, will open up the settings dialog now. It also works with KBDMGR being disabled including setting brightness via the slider.

    PS: While I was at it I also remapped the key left to the backspace to act as DEL (it's the never used key `´ on german keyboards) and the right CMD key to act as CTRL (so I can use it like on the OS X).
     
  8. Timur thread starter macrumors 6502a

    Timur

    Joined:
    Oct 14, 2008
    #8
    Here's a small toolkit I put together that allows you to conviniently enable/disable Apple's "Boot Camp" tray application (KBDMGR.EXE) via an icon link and/or keyboard shortcut. Optionally it will switch the function of the F-Keys automatically for you depending on whether Boot Camp is loaded or not.

    Furthermore it automatically turns Boot Camp's CPU priority to "Idle" and CPU affinity to CPU1 in order to turn down the bug induced DPC Latencies and prevent dropouts with Windows sounds and Media Player playback. Professional Audio users will find that only turning off Boot Camp will allow low audio latency usage. Installation instructions are included in the README.TXT for your convinience. ;)

    Boot CampED - Download Page
     
  9. RX64MACBOOKPRO macrumors member

    RX64MACBOOKPRO

    Joined:
    Oct 26, 2008
    #9
    thanks

    thanks a lot! did you try rapidshare?

    you should tell Apple about your Bootcamp audio crackle fixes & discoveries
    sjobs@apple.com
     
  10. Timur thread starter macrumors 6502a

    Timur

    Joined:
    Oct 14, 2008
  11. Timur thread starter macrumors 6502a

    Timur

    Joined:
    Oct 14, 2008
    #11
  12. Timur thread starter macrumors 6502a

    Timur

    Joined:
    Oct 14, 2008
    #12
    The following screenshots should help you find the options in Rivatuner that allow you to set the graphic-card to a fixed performance level.

    First you need to unlock the option:

    [​IMG]

    Then you go to the System Tweaks settings:

    [​IMG]

    [​IMG]

    Then you have to set a desired performance level (I advice to use lowpower 3D unless you want to play some performance 3D games):

    [​IMG]
     
  13. bugracan macrumors newbie

    Joined:
    Apr 18, 2009
    #13
    Timur, I really would like to thank you for your solution. The problem on my new 17-inch MacBook Pro solved.

    However after that there is a overheating problem occurred on the left speaker. The reason I understood from your posts is about the "low power 3d" selection instead of "2d". Would you please kindly confirm that and is it risky for long usage ?
     
  14. Timur thread starter macrumors 6502a

    Timur

    Joined:
    Oct 14, 2008
    #14
    Yes, "Low Power 3D" uses higher voltages and clock-rates for the GPU than "2D", but less than "Performance 3D" (which can be run for hours when gaming without problems). So I don't think it's risky, because temperatures are well within the limits. Apple prefers higher temperatures to noise when it sets the fan-speeds obviously.

    Download HWMonitor and check yourself though (it's free):

    http://www.cpuid.com/hwmonitor.php

    This will display all temperatures of the Macbook (Pro) in Windows.
     
  15. bugracan macrumors newbie

    Joined:
    Apr 18, 2009
  16. ryannazaretian macrumors 6502a

    ryannazaretian

    Joined:
    Sep 21, 2008
    Location:
    Mississippi
    #16
    Just trying to make sense of the situation.

    If the hard freezes in Vista and Windows 7 are indeed due to the graphics driver switching the performance state of the GPU, then wouldn't everybody with Vista or Windows 7 be affected by this glitch?

    I'm totally with you on the point that switching the graphics states will freeze Windows (as I found out when I put XP in 2D mode and it froze using Firefox,) but why isn't everyone affected by it? Surely most machines don't have the freezing problem, right? Would Apple really keep its customers from using Vista or Windows 7 on these brand new "start-of-the-art" laptops and keep those that know of this issue in the dark?

    Thanks for the advice though! You're truly onto something with this and I can't believe Apple has gone so long without admitting any problems, as there really are problems, especially with the audio and freezing. And what the hell is with the latency problems in the BootCamp manager?!?! This has been a problem for years and they have not addressed this? WTF:apple:
     
  17. Timur thread starter macrumors 6502a

    Timur

    Joined:
    Oct 14, 2008
    #17
    It wont freeze (as in computer wont react anymore, not as in audio dropouts) on other computers because of the combination of drivers and hardware. This is not just a driver problem, but one of hardware, too. The same driver running on my NVidia 7800 GT desktop runs without problems.

    Also most people seem to suffer from freezes when using the Trackpad in combination with Firefox. That makes sense, because Firefox and Safari are the only two pieces of software that make full use of the Trackpads horizontal scrolling when using Windows. And whenever you are using the Trackpad in Firefox you are also invoking lots of graphic-output (browser rendering). So two devices come together.

    The main problem about 2D mode on the Macbook Pro is that it clock down video memory to only 100 mHz, or more exactly in sync to the PCIe bus' native clock-rate, which seemingly runs the driver/displaying applications into some problems. This is kind of strange though, because again my 7800 GT shows no such problems when using the very same clock-rate. I tried increasing the memory clock-rates but you run into hard freezing once you get higher than around 140 mHz.
     
  18. rbmanian75 macrumors member

    Joined:
    Mar 6, 2009
    #18
    Freezing

    I am also getting the hard freeze in vista. it always happens in firefox...while rendering or scrolling...this is with the new 2.66 model
     
  19. Timur thread starter macrumors 6502a

    Timur

    Joined:
    Oct 14, 2008
    #19
    @rbmanian75: Then try my fixes. I don't get no freezing on Vista 64 while using the Trackpad with Firefox 3 (.1 and .5 beta) to my hearts content. Also make sure you installed the Trackpad driver fix from Apple (which idiotically wont show up via the Apple Software Update application).
     
  20. ryannazaretian macrumors 6502a

    ryannazaretian

    Joined:
    Sep 21, 2008
    Location:
    Mississippi
    #20
    What?!?! Do install the trackpad driver fix?!?!

    For me, the trackpad results in very unexpected behavior.

    Yes, this is me and my laptop. This happens no matter what Windows OS I use. I'm also not the only one with this problem, but it does seem to be hit or miss for many. I may try to install it again and see what happens. Like I mentioned in the video, the audio glitches up, the laptop will blue screen, and web browsers will crash with flash or while scrolling randomly.
     
  21. ryannazaretian macrumors 6502a

    ryannazaretian

    Joined:
    Sep 21, 2008
    Location:
    Mississippi
    #21
    Here's another video of the same problem I just took this morning. This time using XP. Gives me the same results. I think my problem is a hardware issue.
     
  22. rbmanian75 macrumors member

    Joined:
    Mar 6, 2009
    #22
    Freezing again

    The trackpad driver is upto date in the system and running vista 32 bit. it froze today also....with a strange noise coming from speakers....
     
  23. Timur thread starter macrumors 6502a

    Timur

    Joined:
    Oct 14, 2008
    #23
    You are kinda hijacking the thread. This thread is about optimizing Bootcamp Windows for optimal audio performance. Some people report that the settings and fixes I suggest also help with the freezing. Personally I did have some very few freezes (like 3 or something) on Windows over the course of 6 months, but I am also doing alot of tweeking, trying and demanding tasks. Firefox and Apple apps are likely the most proone apps when it comes to Trackpad problems because they are the only ones to make full use of horizontal scrolling on Windows.

    So if you already tried all steps described in the first post of this thread and think this is a hardware problem then this may not be the right thread to discuss your issues, sorry. If you did not yet try my suggestions then do that and see if it helps by any chance. :rolleyes:
     
  24. andaman528 macrumors newbie

    Joined:
    Jun 2, 2009
    #24
    Rivatuner Forceware

    Timur-

    I tried following your guide under post 12, but in step 2 under the Main tab, I am not seeing anything under driver settings. It's saying that "No supported drivers detected for this display adapter." I recently updated my NVIDIA driver to their newest release of 185.85 . Like everyone else, I'm having the hard freeze issue and would like to get this resolved. Any ideas on why it's not detected the forceware with the newest driver?
     
  25. Timur thread starter macrumors 6502a

    Timur

    Joined:
    Oct 14, 2008
    #25
    Here is a solution that someone posted in another thread. I'm still running on older drivers, but will give it a try myself.

    [​IMG]
     

Share This Page