For those who want to run FreeBSD on a MacBook Pro, here're some tips to enable the iGPU, screen brightness and get suspend/resume working.
Specifically, the Late 2011 model works when following this guide. However, this solution will probably work for a number of MBP models. YMMV.
Both the GPU and brightness are configured on a MacBook Pro using a graphics multiplexer, gmux. For Linux, several solutions exist to get the MBP to work, but I didn't find any solutions for FreeBSD, and the software that does exist doesn't compile on FreeBSD.
Please see https://github.com/kstaring/gmux for a little program which allows one to switch to the iGPU on MBP hardware and alter its screen brightness.
GPU
But first, let's add some lines to /boot/loader.conf to make the i915 Intel GPU driver work correctly:
After that, please clone and compile
Now that we have
To test if
Your screen might flash, but if everything goes OK, your console screen will re-appear. You can now try running
to check the GPU status.
OK. Let's now make a script to switch to the iGPU, saved as /usr/local/etc/rc.iGPU :
.. And make it executable:
Add the script to /etc/rc.local (in case it is not present, one might want to prepend it with #!/bin/sh and make it executable) :
Then, add this line to /etc/rc.suspend , preferably before the logger line:
and this line to /etc/rc.resume, before exit 0 and after the logger line:
Brightness
Changing screen brightness can already be done with
Or alternatively:
or
to change the brightness value relative to the current value.
Touchpad
Lastly, in my experience, the wsp driver works far better than the atp touchpad driver. atp, in my experience, doesn't keep the cursor in place while performing two-finger-scrolls and its two-finger-scroll is very jerky (possibly because the mouse cursor is also moving). wsp handles this correctly and also has better support for back/forward two-finger gestures. Again, YMMV.
Conclusion
Hopefully this post is useful for some people! Together with other power-saving options, the MBP has gone from somewhere about 22 watt to 13 watt power consumption, in part due to the configurable brightness and disabling of the dGPU. At approximately 13 watt, I get a bit more than 5 hours (indication) out of the laptop, which I believe is pretty OK for a MacBook Pro Late 2011!
Now if only the internal BCM4331 WiFi module was supported and I wouldn't have to use a Realtek USB Wifi dongle, it'd be a perfect FreeBSD machine! ;-)
Specifically, the Late 2011 model works when following this guide. However, this solution will probably work for a number of MBP models. YMMV.
Both the GPU and brightness are configured on a MacBook Pro using a graphics multiplexer, gmux. For Linux, several solutions exist to get the MBP to work, but I didn't find any solutions for FreeBSD, and the software that does exist doesn't compile on FreeBSD.
Please see https://github.com/kstaring/gmux for a little program which allows one to switch to the iGPU on MBP hardware and alter its screen brightness.
GPU
But first, let's add some lines to /boot/loader.conf to make the i915 Intel GPU driver work correctly:
Code:
drm.i915.enable_rc6=7
drm.i915.lvds_channel_mode=2
drm.i915.modeset=1
drm.i915.lvds_use_ssc=0
gmux
, and install as root: su -
git clone https://github.com/kstaring/gmux.git
cd gmux
make install
Now that we have
gmux
installed, we can try switching. It's important to remember that the i915kms driver - which allows FreeBSD to use the iGPU - needs to probe the screen, so gmux
must have enabled the iGPU before i915kms is loaded. At the time of writing, it is not recommended to load i915kms from /boot/loader.conf anyway so please don't load i915kms before enabling the integrated GPU with gmux
.To test if
gmux
works with your MacBook Pro, try this in the console (do not try from within an X11 session!) : /usr/local/bin/gmux gpu iGPU ; /sbin/kldload i915kms
Your screen might flash, but if everything goes OK, your console screen will re-appear. You can now try running
/usr/local/bin/gmux
to check the GPU status.
OK. Let's now make a script to switch to the iGPU, saved as /usr/local/etc/rc.iGPU :
Code:
#!/bin/sh
if [ -f /etc/gmux.savedstate ]; then
sh /etc/gmux.savedstate
else
/usr/local/bin/gmux gpu iGPU
/usr/local/bin/gmux brightness 8000
fi
/sbin/kldload i915kms
chmod 755 /usr/local/etc/rc.iGPU
Add the script to /etc/rc.local (in case it is not present, one might want to prepend it with #!/bin/sh and make it executable) :
echo /usr/local/etc/rc.iGPU >> /etc/rc.local
Then, add this line to /etc/rc.suspend , preferably before the logger line:
/usr/local/bin/gmux > /etc/gmux.savedstate
and this line to /etc/rc.resume, before exit 0 and after the logger line:
/usr/local/etc/rc.iGPU
Brightness
Changing screen brightness can already be done with
xbrightness
, however this does not alter the backlight intensity and will save you no power. xbacklight
doesn't support the MacBook Pro hardware. To change the backlight brightness, one can use gmux
thusly: /usr/local/bin/gmux brightness 8000
Or alternatively:
/usr/local/bin/gmux brightness -1000
or
/usr/local/bin/gmux brightness +1000
to change the brightness value relative to the current value.
Touchpad
Lastly, in my experience, the wsp driver works far better than the atp touchpad driver. atp, in my experience, doesn't keep the cursor in place while performing two-finger-scrolls and its two-finger-scroll is very jerky (possibly because the mouse cursor is also moving). wsp handles this correctly and also has better support for back/forward two-finger gestures. Again, YMMV.
Conclusion
Hopefully this post is useful for some people! Together with other power-saving options, the MBP has gone from somewhere about 22 watt to 13 watt power consumption, in part due to the configurable brightness and disabling of the dGPU. At approximately 13 watt, I get a bit more than 5 hours (indication) out of the laptop, which I believe is pretty OK for a MacBook Pro Late 2011!
Now if only the internal BCM4331 WiFi module was supported and I wouldn't have to use a Realtek USB Wifi dongle, it'd be a perfect FreeBSD machine! ;-)