Message ID | 20150425142004.GA1108@wunner.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi Lukas, Lukas Wunner wrote: > Included below is a tentative patch to set register 0x7F when switching > the DDC lines. It would be great if someone with a retina could test > the patchset I've posted plus this tentative patch since I can't test it > myself. > > * MacBookPro11 (second-gen retina): > The patchset I've posted plus the tentative patch below. > Fellow gmux hackers Andreas Heider and Bruno Bierbaumer tell me that > additionally, this patch is needed otherwise the i915 gpu is turned off: > https://www.marc.info/?l=grub-deavel&m=141586614924917&w=2 Thank you very much for your effort of bringing gpu switching to RMBP, I tried your patchset, including the one in this email, on my laptop. It is a Retina MacBookPro, late 2013 version, which is how ifixit calls it. It seems to work at least partially. Here is the results I observed. First of all, I use gfxstatus in OSX to force the system to use the intel gpu. So when I boot into Linux the intel gpu will be activated and I can turn of the discrete nvidia gpu to save power. After booted with the patched kernel (on top of v4.0). I can use "echo DIS > /sys/kernel/debug/vgaswitcheroo/switch" to switch to the nvidia gpu. The console turned black, I guess the system is incapable of switching to the nouveau's framebuffer at this moment. But after I startx through ssh, I can use everything without any problem. After quit the X the framebuffer is recovered as well. I can switch back to intel gpu and start X again no problem. However when I activated the discrete gpu again, I got a black screen after startx, the log of X seems normal, just no display on the screen. I also tried to use the gfxstatus to resume the "normal" (dynamical switching) behavior in OSX. Then the nvidia gpu will be used when booting to linux. I switched to the intel gpu but it appears the gpu did not find the correct screen. After startx I got a black screen, xrandr does not give me the eDP output, only some Virtual and VGA outputs. I hope these information can help to improve those patches. I am happy to try any (hopefully not dangerous) patches if you have any new ones.
diff --git a/drivers/platform/x86/apple-gmux.c b/drivers/platform/x86/apple-gmux.c index 05bba92..719cfd3 100644 --- a/drivers/platform/x86/apple-gmux.c +++ b/drivers/platform/x86/apple-gmux.c @@ -60,6 +60,7 @@ static struct apple_gmux_data *apple_gmux_data; #define GMUX_PORT_DISCRETE_POWER 0x50 #define GMUX_PORT_MAX_BRIGHTNESS 0x70 #define GMUX_PORT_BRIGHTNESS 0x74 +#define GMUX_PORT_SWITCH_AUXCH 0x7F #define GMUX_PORT_VALUE 0xc2 #define GMUX_PORT_READ 0xd0 #define GMUX_PORT_WRITE 0xd4 @@ -285,10 +286,13 @@ static int gmux_switch_ddc(enum vga_switcheroo_client_id id) if (id == old_ddc_owner) return old_ddc_owner; - if (id == VGA_SWITCHEROO_IGD) + if (id == VGA_SWITCHEROO_IGD) { + gmux_write8(apple_gmux_data, GMUX_PORT_SWITCH_AUXCH, 1); gmux_write8(apple_gmux_data, GMUX_PORT_SWITCH_DDC, 1); - else + } else { + gmux_write8(apple_gmux_data, GMUX_PORT_SWITCH_AUXCH, 2); gmux_write8(apple_gmux_data, GMUX_PORT_SWITCH_DDC, 2); + } return old_ddc_owner; }