[Intel-gfx] [PATCH v5 00/12] Enable GPU switching on pre-retina?MacBook Pro

Alex Deucher alexdeucher at gmail.com
Sat Mar 5 18:10:56 UTC 2016


On Sat, Mar 5, 2016 at 9:16 AM, Lukas Wunner <lukas at wunner.de> wrote:
> Hi Bastien,
>
> On Fri, Mar 04, 2016 at 04:12:27PM +0000, Bastien Nocera wrote:
>> Lukas Wunner <lukas <at> wunner.de> writes:
>> > Enable GPU switching on the pre-retina MacBook Pro (2008 - 2013), v5.
>>
>> I've tested your patchset on a MacBookPro8,1, with an integrated Intel and
>> discrete AMD/ATI GPUs.
>
> Hm, it must be either an 8,2 or 8,3. The 8,1 was a 13" machine and only
> had an integrated GPU.
>
>
>> I've used the COPR repository here to cut down on my compilation time:
>> https://copr.fedorainfracloud.org/coprs/firstyear/kernel-mbp/
>>
>> I'm not certain how to test out your changes, or what the consequences should
>> be on a stock Fedora 23/GNOME 3.18 installation. After booting (note that I
>> did not change any command-line options in grub), a gnome-shell/gdm X11
>> session comes up (I disabled Wayland, to rule out behavioural changes), I'd
>> log in to GNOME and gnome-shell (which starts another X11 session on
>> another VT).
>
> Switching and power control currently requires manual intervention
> by echoing commands to /sys/kernel/debug/vgaswitcheroo/switch
> as documented here:
> https://01.org/linuxgraphics/gfx-docs/drm/modes_of_use.html
>
> As you've correctly observed, the machine is initially switched to
> the discrete GPU and both GPUs are turned on. By echoing "IGD" to
> the sysfs file, you'll switch to the integrated GPU and turn off
> the discrete GPU.
>
> It's possible to let the EFI firmware switch to the integrated GPU
> on boot by using this tool: https://github.com/0xbb/gpu-switch
> However still both GPUs will be powered up, so you have to issue
> the "OFF" command to sysfs to power the discrete GPU down. Also,
> once you boot into OS X, the setting made by the gpu-switch tool
> will be overwritten and the machine will be switched to the discrete
> GPU again the next time you boot Linux.
>
> Note that switching is only possible from the text console, with
> X11/Wayland shut down. Obviously this is not great in terms of UX.
> A few years ago there was a GSoC proposal to get hot GPU switching
> to work on Linux (akin to what OS X does) but nothing ever came of it:
> http://www.phoronix.com/scan.php?page=news_item&px=OTIyMQ
> https://lists.x.org/archives/xorg/2011-March/052522.html
>
> Unfortunately this seems to be a low priority item for kernel graphics
> developers since nowadays most dual GPU notebooks no longer have a mux
> and cannot switch. The MacBook Pro seems to be the last one supporting
> this but I've witnessed a bit of an anti-Apple sentiment among kernel
> graphics developers since everything is non-standard there. Which is
> unfortunate because these machines have a large market share and Apple
> software quality is deteriorating rapidly so a lot of Mac users are
> ripe for converting to Linux.

Is there any reason to make use of the mux?  The usage model and
amount of stack work for non-mux systems is a lot easier to deal with
and covers a lot more systems overall.  runtime pm generally works
pretty seemlessly for mux-less systems.  Properly handling the mux is
a lot of work for relatively little gain as there are very few systems
that use them.


>
> Anyway, one short-term improvement will be to add runtime pm support
> (called "Driver power control" in the vga_switcheroo documentation
> linked above). That way it'll no longer be necessary to power the
> discrete GPU up and down manually, this will happen automatically
> as needed (when switching or using render offloading with DRI PRIME).
> I have patches to enable this for radeon but they're completely untested:
>
> http://wunner.de/mbp_switcheroo_v5-4.5.tar.gz       => gpu switching for 4.5
> http://wunner.de/mbp_switcheroo_v5-4.5-runpm.tar.gz => runtime pm for radeon
>
> I have an Nvidia based machine and runtime pm doesn't work there yet
> because of bugs in nouveau that I haven't had the time to look into.
>
>
>> I did not use any external screens to test this.
>
> Since your machine has Thunderbolt, the external port is no longer
> switchable between GPUs, it can only be driven by the discrete GPU.
> So you need to power it up manually for this to work. You don't need
> to switch to it, but it's probably recommendable to save energy.
> (Otherwise both GPUs are on with the integrated GPU driving the panel
> and the discrete GPU driving the DP port.)
>
> The runpm tarball linked above contains a patch to automatically
> wake the discrete GPU on hotplug.
>
> I've heard that the AMD GPU is picky about external monitors and
> doesn't recognize them unless they're plugged in at exactly the
> right moment, so you may need to retry a couple of times until it
> works.
>

Are talking about some issue specific to these muxed apple systems or
in general?  If you are having issues, please file a bug.

Alex


More information about the Intel-gfx mailing list