Setup & Software Discussions
2012 15" MacBook Pro Retina (GT650M) [3rd,4C,Q] + RX 580 @ 10Gbps-TB1>TB3 (Razer...
 

2012 15" MacBook Pro Retina (GT650M) [3rd,4C,Q] + RX 580 @ 10Gbps-TB1>TB3 (Razer Core X) + macOS 10.14.5 [Gaerraty] // functional sleeping, waking up and brightness control!  

  RSS

Gaerraty
(@gaerraty)
Active Member
Joined: 3 months ago
 

My dear 7 years old MacBook Pro 15" Retina has recently ever-growingly shown insufficient graphics performance. Still unhappy with current MacBook offerings and believing that Mid 2012 model is one of the best laptops Apple has ever engineered – I decided to seek alternative solution to update my system. With courage given by this forum I decided pursue the eGPU path despite the fact that Mid 2012 model has problematic iGPU/Nvidia dGPU combination.

Base system

  • MacBook Pro 15" Retina Mid 2012 with dual GPU setup: iGPU Intel HD4000 + dGPU Nvidia GT 650M
  • Still in 2019 truly gorgeous Retina display
  • macOS 10.14.5 with APFS, no FileVault

eGPU setup

  • Razer Core X
  • Sapphire RADEON RX 580 8GB GDDR5 NITRO+
  • Original 2012 Apple Thunderbolt Cable (TB1)
  • Apple Thunderbolt 3 (USB-C) to Thunderbolt 2 adapter
  • Test display: Ancient Samsung SyncMaster connected with DVI-cable (dear god how thick and unflexible these cables are!). Display has resolution of 1920x1080 at 60 Hz with truly horrible color accuracy and abysmally low contrast ratio 😉

 


Setting up the system for eGPU

Initial setup both from hardware and software perspectives was remarkably easy.

First, eGPU was assembled. Razer Core X has solid built-quality and rack-like solution allowed easy and quick installation of GPU. It is still worth noting that having small fingers made backplate screw access easier compared to those who have big fingers (access to backplate screw when GPU is in-place is hindered). RX 580 was chosen because it is natively supported by macOS, card was moderately priced and readily available, and performance was deemed sufficient.

Second, cable connections were established. Apple Thunderbolt 3 to TB2 adapter and original 2012 Apple Thunderbolt cable made aesthetically pleasing solution and formed connection between MacBook Pro and Razer Core X. Samsung SyncMaster display was connected to RX 580 with DVI cable which is truly an eyesore but was necessary for test setup. Upon powering up the system, macOS detected eGPU setup (menubar icon), Razer Core X (under Thunderbolt in System information), RX 580 (under PCIe in System information), and even SyncMaster. Still, drivers weren't there yet, so software next.

Third, required software were installed as instructed here in the forums. System Integrity Protection (SIP) was disabled with Recovery Mode and purge-wrangler was installed and configured to match required settings. After reboot system drivers for RX 580 were operational and secondary display sort-of worked – it was detected but no image appeared. Issue is related to MacBook Pro 15" Retina Mid 2012 which also has Nvidia dGPU. To solve the issue, purge-nvda was also required. To finish, purge-nvda was installed and configured, and system once again rebooted.

Everything in the eGPU setup just simply worked! Both internal Retina display and external SyncMaster were operational, drivers for RX 580 were operational, and system in general detected everything correctly. Even ejecting eGPU via menubar icon was functional (it takes few seconds). Few tested games and application worked great.

However, because of purge-nvda sleeping and waking up of MacBook has issues and keyboard brightness adjustments keys (F1 and F2) doesn't work.


Fixing sleeping, waking up and brightness adjustment

Even if eGPU setup was functional, I considered side-effects of purge-nvda too big compromise for daily use. Also, Terminal control for purge-nvda and repeated rebooting was deemed too cumbersome for long-term use.

This is all work-in-progress documentation and I'll describe here only the "clean" solution. In reality the process wasn't at all clean and I managed to mess up with booting and kexts. 😆 🙄 Luckily nothing was permanently damaged or lost.

Fix process in short

  1. Disable Nvidia dGPU pseudo-permanently via EFI boot alteration
  2. Fix sleep and wake-up processes with kext (NVDAGPUWakeHandler)
  3. Fix internal Retina display brightness control with NativeDisplayBrightness app

All of this was accomplished with help of various sources outside this forum and I'll try to link and credit those involved. My role was merely putting puzzle pieces together.

Fix process elaborated

Important finding was that fix for circumventing non-operational system caused by hardware failure of Nvidia dGPU chip and side-effects of purge-nvda have somewhat similar context. Upon the failure of the dGPU chip, the fix is to disable permanently – or to be exact pseudo-permanently– Nvidia dGPU. Goal of this fix if to keep laptop operational purely with only Intel HD4000. This process is fully described by timpalpant here and my solution is inspired by his solution.

  1. NVRAM settings should be altered for iGPU preference. However because purge-nvda already alters NVRAM for iGPU preference, we can right away jump to step of disabling Nvidia dGPU when system is booting.
  2. Setting up USB drive for EFI boot alteration follows the Section 3 in this method described by blackgate but has following adjustments:
    • In Step 3.1 link to download Ubuntu iso is obsolete, I downloaded it from here:  http://old-releases.ubuntu.com/releases/17.10/ubuntu-17.10.1-desktop-amd64.iso
    • In Step 3.4 editing the grub.cfg file, I used instead the code suggested by timpalpant in his post which suitable for MacBook Pro 15" Retina Mid 2012 running Mojave
    • As described in step 3.5 holding Option key while booting from USB drive resulted in disabled Nvidia dGPU – it isn't detected by System Information which shows only Intel HD Graphics 4000 (eGPU was not connected during this process)
    • I chose to not make changes permanent as Section 4 suggests as it will result in non-bootable system if purge-nvda somehow fails or system NVRAM is reset (I have empirical evidence  😆 )
  3. (Optional) While USB drive does the trick, it hinders daily use – let's make it internal!
    • Procedure is exactly similar to the USB drive one but instead of formatting USB drive, make new FAT32 formatted partition on internal SSD for EFI boot alteration
      • Keep in mind to actually make new partition not merely new volume
    • Size of the partition can be as minuscule as possible: I chose 32 MB to fit "EFI" and "boot" folders from Ubuntu iso
    • Booting with Option key down and choosing EFI boot partition now disables Nvidia eGPU – if booting is done without EFI boot alteration macOS starts normally with dGPU
  4. To prevent system from looking up disabled Nvidia dGPU when waking up we need additional kext
    • Procedure to create required kext is fully detailed in NVDAGPUWakeHandler which is also work of timpalpant – no alterations to this process were made
    • NVDAGPUWakeHandler is based on AMDGPUWakeHandler which I have seen referred here in the forums for iGPU + AMD dGPU configurations
  5. Final step is to regain internal Retina display brightness control
    • Solution is to use NativeDisplayBrightness app
    • When the app is starting up first time it requires access to Accessibility settings under System Preferences > Security & Privacy
    • To ensure that brightness controls are always available I made the app a part of the Login items under System Preferences > Users & Groups
    • Default app key bindings for brightness controls are Function + F1 and Function + F2. Converting back to default macOS brightness controls you need to:
      • Solution 1: Use FunctionFlip app for selectively inverting brightness control keys.
      • Solution 2: Check "Use F1, F2, etc. keys as standard function keys" under System Preferences > Keyboard. Unfortunately this inverts all other media keys.
      • It could be possible to alter NativeDisplayBrightness app with Xcode to fix the issue. Unfortunately I'm not skilled enough to do this and GitHub project doesn't seem active.

Results

After all these steps it is possible to enjoy eGPU enabled MacBook Pro 15" Retina Mid 2012 while also having properly functional sleeping, waking up and brightness control for internal Retina display both when laptop is connected to eGPU or when laptop is on the go! No need to use Terminal, edit settings of purge-nvda and constantly reboot in daily use. Still some sacrifice had to be made – Nvidia dGPU is now always disabled under daily use which means there is no additional graphical power on the go.

Reverting system

Systems can be reverted back to iGPU + Nvidia dGPU state by:

  1. Uninstalling purge-nvda via Terminal
  2. Booting directly to macOS without EFI boot alteration

 


Known glitches

  • After first time Nvidia dGPU is disabled, fans operate at maximum speed
    • Solution 1: Use Macs Fan Control to adjust fan speeds.
    • Solution 2: Put system right away to sleep mode and then wake up – after this fans operate normally.
  • Rarely fans operate at maximum speed after waking up
    • Solution 1: Use Macs Fan Control to adjust fan speeds.
    • Solution 2: Put system back to sleep mode and then wake up – after this fans should most likely operate normally. Based several dozens of sleep/wake up tests this hasn't never twice in row.
  • Rarely LED backlight of internal Retina display doesn't lit up after waking up
    • Solution: Remember what is normally shown after wake up. I have login dialog, so I'll type in my password and press Enter, then immediately press Function + F1/F2 to revive backlight with NativeDisplayBrightness commands. Issue is with display backlight as the system operates normally – keyboard backlights are good indicator of the system waking up.
  • NativeDisplayBrightness causes unintuitive brightness jump after adjustment
    • Under certain circumstances actual brightness level and next assumed adjustment level get off-sync leading to jumps in brightness level
  • NativeDisplayBrightness shows visual feedback always on main display regardless if it is the actual adjusted display
  • Using laptop in closed-clamshell mode when connected to eGPU keeps LED backlight always on
    • This can be observed by looking Apple logo on the back of the display
    • Brightness of the Apple logo can be adjusted via display brightness control 😉 
  • Using laptop in closed-clamshell mode when connected to eGPU keeps internal Retina display image as it was when lid was closed
    • This is slightly peculiar behavior: even if the system doesn't detect internal display when used in closed-clamshell mode it appears to maintain the image of the moment when lid was closed
    • This was tested as following:
      • Lid was closed while eGPU was connected – after fraction of second external display blinks to remark changed signal
      • System wide visually easily noticeable effect was changed: in this case from Dark mode to Light mode
      • Lid was opened very quickly in order to observe internal display before changed signal – internal display does indeed look exactly like it was when lid was closed (Dark mode) but after fraction of second view updated to Light mode

 


I'll keep this updated when more information or refinements are made!

2019-07-15 Added alternatives for fixing brightness control keys back to macOS default keys.

This topic was modified 3 months ago

2012 15" Macbook Pro Retina (GT 650M disabled) + RX 580 @ 10Gbps-TB1>TB3 (Razer Core X) + macOS 10.14.5


ReplyQuote
naticom
(@naticom)
Active Member
Joined: 2 months ago
 

@gaerraty This is an invaluable post. Thanks a lot for your sharing!

The reason why I came across this post is that I am looking for solutions for my "always on apple light" after applying purge-nvda along with my eGPU and external monitor. However, I followed your steps (without doing the sleep/wake up part as I don't need it) but when I'm using the NativeDisplayBrightness.app it actually adjusts the brightness of my external monitor (how does it achieve this!?). Even if I unplugged my eGPU and external monitor, my internal screen still cannot be adjusted although the brightness adjust icon showed up in the middle of the screen but nothing changed. How did you solve this?

 

Thanks

This post was modified 2 months ago

Pending: Add my system information and expected eGPU configuration to my signature to give context to my posts


ReplyQuote
clarketus
(@clarketus)
Eminent Member
Joined: 2 years ago
 

Awesome, thanks a ton for this write up.

My number one complaint with my setup (2012 macbook pro - non retina) was that in MacOS, Chrome was defaulting to using only the integrated GPU, even when being used on the egpu connected external display which resulted in a really laggy experience.
Nothing I tried could fix this, and a suggestion I didn't know how to implement was to "disable the internal display" to force Chrome into selecting only the GPU with an active display.

Following your writeup fixed the issue with clamshell mode that has always been around for my setup (using purge-nvda). Now that it is fixed, going into clamshell mode effectively "unplugs" the internal display, which then fixes the issue with Chrome selecting the wrong GPU. Shutting the laptop lid, starting chrome, and re-opening the lid also works totally fine.

One question: 
You mention using the NativeDisplayBrightness app to fix the brightness controls. I built an archive of this in XCode using the github link provided and exported a .app file. Using this .app the brightness control appears when using f1/f2 keys, but the actual screen brightness does not change at all on either the internal or external display, even though the brightness progress bar is displayed and goes up and down depending on what keys are pressed. Did you notice this and was there a solution for that?

Thanks again for the writeup!

Guides:
Mid 2012 15" MBP GT650M Non Retina + [email protected] (Gigabyte Gaming Box via TB3->TB2 adapter) + macOS 10.13.4 / Win10


ReplyQuote
emanuelediba
(@emanuelediba)
Eminent Member
Joined: 10 months ago
 

Finally I can use my MacBook Pro on-the-go without having to reboot everytime. I'm curious to see if there are also improvements on battery life with the Nvidia dGPU disabled.

As you, when I close the lid on the Mac, the Apple logo is still lit, but I noticed that if you Stop the Mac, and than you turn it back on, the screen will remain off. For the display brightness, as another user said, NativeDisplayBrightness changes the brightness only of the external monitor, I don't understand why, or how, but it is still a useful feature, since I can turn off the Mac display by sending it to sleep and then turning it back on. Since I never used a MacBook in clamshell mode, do you think that the heat from the CPU and other components could damage the screen?

Anyway thank you for the awesome guide!

Mid-2012 15" Retina MacBook Pro + Akitio Node + AMD RX 580


ReplyQuote