Created attachment 158721 [details] Full dmesg log with drm.debug=0xe after few switch on/off iterations. Overview: I'm trying to get to work hybrid graphics on my macbookpro6.2 with efi stub kernel. For intel card is used i915 driver, for nvidia - nouveau. After system booted I switch off dedicated nvidia graphics card, with help of vgaswitcheroo, which cause to black screen. However, the system doesn't freeze. When I switch back to nvidia card I able to see console again. Steps to Reproduce: 1) Boot Linux kernel directly using the built-in EFI stub 2) Switch to intel card: echo IGD > /sys/kernel/debug/vgaswitcheroo/switch 3) For get screen back to work use: echo DIS > /sys/kernel/debug/vgaswitcheroo/switch Actual results: Screen become black, but you still able to work with console. Expected Results: Graphics card should be switched to integrated one with properly working screen and backlight. Build Date & Hardware: Linux 3.17.4-gentoo #9 SMP PREEMPT Mon Nov 24 21:38:06 2014 x86_64 Intel(R) Core(TM) i7 CPU M 620 @ 2.67GHz GenuineIntel GNU/Linux 00:02.0 VGA compatible controller: Intel Corporation Core Processor Integrated Graphics Controller (rev 18) 01:00.0 VGA compatible controller: NVIDIA Corporation GT216M [GeForce GT 330M] (rev a2) Additional Information: I think the issue is here: [ 6.855159] i915 0000:00:02.0: BAR 6: can't assign [??? 0x00000000 flags 0x20000000] (bogus alignment) [ 6.855161] [drm] failed to find VBIOS tables Firstly, I decided that problem is in backlight. But with help of this patch: https://github.com/ah-/gmux-scripts/issues/1#issuecomment-53850868 I was able to get it partially work. After switching to integrated graphics I got working backlight, but screen was black anyway. However, when I tried to switch back to nvidia I got completely black screen without backlight as was with intel card before. So after I tried to find some pathes for i915 vbios issue: http://lists.freedesktop.org/archives/dri-devel/2014-August/065880.html But all of them already added in 3.17.4 kernel, and didn't help me. //Hope we can find solution =)
Created attachment 158731 [details] lspci
Created attachment 158741 [details] Kernel config
Just realised that switching works if force integrated card load first. In this case there is just one issue with uncorrect resolution in console when switched on discrete card. For fix it helps patch from Darkulix: https://github.com/ah-/gmux-scripts/issues/1#issuecomment-53850868 Steps: 1) Patch kernel and install it 2) Boot Linux kernel 3) Turn on nvidia card using: echo ON > /sys/kernel/debug/vgaswitcheroo/switch; rmmod nouveau; echo DIS > /sys/kernel/debug/apple_gmux/switch; modprobe nouveau; echo DIS > /sys/kernel/debug/vgaswitcheroo 4) Switch to intel card: echo IGD > /sys/kernel/debug/apple_gmux/switch; echo IGD > /sys/kernel/debug/vgaswitcheroo/switch" 5) Now resolution will be correct in both cases 6) For further switching it is possible to use just: echo DIS > /sys/kernel/debug/vgaswitcheroo/switch echo OFF > /sys/kernel/debug/vgaswitcheroo/switch and echo IGD > /sys/kernel/debug/vgaswitcheroo/switch echo OFF > /sys/kernel/debug/vgaswitcheroo/switch
A patchset which is believed to fix this issue was posted to dri-devel: http://lists.freedesktop.org/archives/dri-devel/2015-April/081515.html This patchset enables GPU switching and should at least work on pre-retinas. Please apply it on top of a recent kernel and report back if it works for you. Thank you!
Hi Lukas, Thank you for the patchset. It works but partially. Good thing I able to load linux with it. But there are some problems with switching. First, sometimes after switching from intel to nvidia screen becomes black, but luckily system didn't freeze. It happens not each time. One of the possible way to repeat this behaviour: 1. Switch to intel gpu and disable nvidia one 2. Start xorg server 3. Stop xorg server 4. Power on nvida card and switch to it 5. Now screen will be black but system will work Second problem is that unloading of nouveau driver with switched of nvidia gpu leads to the system freeze. Please find attached 2 new dmesg logs. Best regards, Paul
Created attachment 179271 [details] dmesg log Patchset test. After switching from intel to nvida card screen becomes black.
(In reply to Lukas Wunner from comment #4) > A patchset which is believed to fix this issue was posted to dri-devel: > http://lists.freedesktop.org/archives/dri-devel/2015-April/081515.html > > This patchset enables GPU switching and should at least work on pre-retinas. > Please apply it on top of a recent kernel and report back if it works for > you. > > Thank you! I have tested this patches on top of the latest 4.0.6 arch linux kernel on a Macbook Pro Retina 2012 Mid (10.1). I am unable to switch between the cards and it still results in black screen. I am using the command "echo DIS > /sys/kernel/debug/vgaswitheroo/switch" when the X is not running. Please let me know if you need any additional information to debug the issue.
Please test Lukas' series at http://mid.gmane.org/cover.1452525860.git.lukas@wunner.de
Hi Jani, Paul Hordiienko, the reporter of this bug, successfully tested an earlier version (v2) of the patch set, see the Tested-by: tags on these patches: http://lists.freedesktop.org/archives/dri-devel/2015-August/thread.html#88156 The most recent version (v5) was tested on the following machines: Tested-by: Pierre Moreau <pierre.morrow@free.fr> [MBP 5,3 2009 nvidia MCP79 + G96 pre-retina 15"] Tested-by: William Brown <william@blackhats.net.au> [MBP 8,2 2011 intel SNB + amd turks pre-retina 15"] Tested-by: Lukas Wunner <lukas@wunner.de> [MBP 9,1 2012 intel IVB + nvidia GK107 pre-retina 15"] (The patches as posted miss the Tested-by: tags by Pierre and William since I posted them before getting their feedback.) The patch set worked just fine on my machine and William Brown's. On Pierre Moreau's machine the discrete GPU locks up when woken. It used to do that in the past as well but only after about 10 switches, now it's locking up every time. My guess is that this is a regression in nouveau on the G96 since it works fine on my GK107. Paul Hordiienko's machine is an MBP 6,2 2010 with intel ILK + nvidia GT216. So architecturally it is similar to my machine (integrated Intel and discrete Nvidia) and since v2 worked fine, I expect that v5 would work as well (FWIW).
Hi Lukas and Jani, I have tested v5 and confirm that it works on my MBP 6,2 2010 without any issues.
The commit message for https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=704ab614ec1201138032003c03113a81526638ab refers back here. I have bisected that patch as the reason why Xorg on my MacBook Pro 8,2 does not come up successfully with Linux 4.6. Reverting that commit makes Xorg work again. I boot Linux directly via rEFInd. I got the radeon xorg drivers installed, but neither intel nor fbdev or kms. Feel free to ask if any questions come up.
Thanks for the report, Wilfried. Could you please create attachments with dmesg output and Xorg output, both with and without this commit. Your kernel config and Xorg config (if any) would also be helpful. Do you have anything special configured in your Xorg config for the Intel card? Do you have any special rEFInd features or extensions enabled which might change settings of the gmux microcontroller?
Created attachment 217521 [details] config of non-working Linux 4.6.0
Created attachment 217531 [details] config of working Linux 4.6.0 (with commit reverted)
Created attachment 217541 [details] kern.log / dmesg of non-working Linux 4.6.0
Created attachment 217551 [details] kern.log / dmesg of working Linux 4.6.0 (commit reverted)
Created attachment 217561 [details] Xorg.log on non-working Linux 4.6.0
Created attachment 217571 [details] Xorg.log on working Linux 4.6.0 (commit reverted)
Created attachment 217581 [details] refind_linux.conf of both cases
No Xorg config. Especially nothing special for intel or radeon. No special rEFInd features. Files attached.
If you revert 4eebd5a4e7269 ("apple-gmux: lock iGP IO to protect from vgaarb changes") instead of 704ab614ec12, does the issue go away? https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=4eebd5a4e7269
The issue goes away too, then. I don't currently see any difference to when I reverted 704ab614ec12. Xorg comes up on boot like it also did with 4.5.4 (and 4.5.5).
I've e-mailed Bruno Prémont, author of 4eebd5a4e7269, and cc'ed platform-driver-x86: http://www.spinics.net/lists/platform-driver-x86/msg08889.html I've also cc'ed you but your e-mail address isn't working, please fix: <linux-kernel@lebenslange-mailadresse.de>: host mail.lebenslange-mailadresse.de[217.70.197.123] said: 550 Unrouteable address (in reply to RCPT TO command)
Oops, fixed (and double-checked) that email issue. Thanks.
This issue is still there in Linux 4.10. Because I didn't manage to find this bugzilla entry again I opened a new bug, #194697. The status on this bug here is "NEEDINFO" - what kind of info is needed?
*** Bug 194697 has been marked as a duplicate of this bug. ***
Created attachment 273877 [details] dmesg of logdep splat on 4.15-rc9 minus 4eebd5a4e726 logdep splat from Linux 4.15-rc9 with commit 4eebd5a4e726 reverted. The splat occurred after echoing first "DIS", then "OFF" into /sys/kernel/debug/vgaswitcheroo/switch. The "switched off" in the first line likely is from drivers/gpu/drm/i915/i915_drv.c:584, i915_switcheroo_set_state().