public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH v3 4/6] drm/i915: Switch DDC when reading the EDID
       [not found]     ` <af50270ecf44e9f88013ce48c96c5ffbd0fbc250.1443952353.git.lukas@wunner.de>
@ 2015-09-11 10:40       ` Lukas Wunner
  0 siblings, 0 replies; 8+ messages in thread
From: Lukas Wunner @ 2015-09-11 10:40 UTC (permalink / raw)
  To: dri-devel, intel-gfx; +Cc: Pierre Moreau, William Brown

The pre-retina MacBook Pro uses an LVDS panel and a gmux controller
to switch the panel between its two GPUs. The panel mode in VBIOS
is notoriously bogus on these machines and some models have no
VBIOS at all.

Use drm_get_edid_switcheroo() in lieu of drm_get_edid() on LVDS.
This allows us to retrieve the EDID if the outputs are currently
muxed to the discrete GPU by temporarily switching the panel's DDC
lines to the integrated GPU.

This only enables EDID probing on the pre-retina MBP (2008 - 2013).
The retina MBP (2012 - present) uses eDP and gmux is apparently not
capable of switching AUX separately from the main link on these models.
This will be addressed in later patches.

List of pre-retina MBPs with dual GPUs, one of them Intel:
    [MBP  6,2 2010  intel ILK + nvidia GT216  pre-retina  15"]
    [MBP  6,1 2010  intel ILK + nvidia GT216  pre-retina  17"]
    [MBP  8,2 2011  intel SNB + amd turks     pre-retina  15"]
    [MBP  8,3 2011  intel SNB + amd turks     pre-retina  17"]
    [MBP  9,1 2012  intel IVB + nvidia GK107  pre-retina  15"]

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=88861
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=61115
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"]

Signed-off-by: Lukas Wunner <lukas@wunner.de>
---
 drivers/gpu/drm/i915/intel_lvds.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index 2c2d1f0..dbc2682 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -1082,7 +1082,8 @@ void intel_lvds_init(struct drm_device *dev)
 	 * preferred mode is the right one.
 	 */
 	mutex_lock(&dev->mode_config.mutex);
-	edid = drm_get_edid(connector, intel_gmbus_get_adapter(dev_priv, pin));
+	edid = drm_get_edid_switcheroo(connector,
+				       intel_gmbus_get_adapter(dev_priv, pin));
 	if (edid) {
 		if (drm_add_edid_modes(connector, edid)) {
 			drm_mode_connector_update_edid_property(connector,
-- 
1.8.5.2 (Apple Git-48)

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v3 0/6] Enable gpu switching on the MacBook Pro
@ 2015-10-04  9:52 Lukas Wunner
       [not found] ` <a46bc3667badb466475ed9ab6eac21c2b4814741.1443952353.git.lukas@wunner.de>
  2015-10-05 13:23 ` [PATCH v3 0/6] Enable gpu switching on the MacBook Pro Lukas Wunner
  0 siblings, 2 replies; 8+ messages in thread
From: Lukas Wunner @ 2015-10-04  9:52 UTC (permalink / raw)
  To: dri-devel, intel-gfx, nouveau; +Cc: Pierre Moreau, William Brown

The pre-retina MacBook Pro uses an LVDS panel and a gmux controller
to switch the panel between its two GPUs. The panel mode in VBIOS
is notoriously bogus on these machines and some models have no
VBIOS at all, so the inactive GPU cannot set up its LVDS output.

Extend vga_switcheroo to support switching only the DDC lines.
Introduce a drm_get_edid_switcheroo() helper which uses this feature.
Amend i915, nouveau and radeon to call it for LVDS connectors.

This only enables EDID probing on the pre-retina MBP (2008 - 2013),
and only under the condition that apple-gmux loads before the DRM
drivers. Later patches will address reprobing of the DRM drivers
if apple-gmux loads late.

The retina MBP (2012 - present) uses eDP and is apparently not
capable of switching AUX separately from the main link.
This will also be addressed in later patches.


Previous installments:
v1: http://lists.freedesktop.org/archives/dri-devel/2015-April/081515.html
v2: http://lists.freedesktop.org/archives/dri-devel/2015-August/088156.html


Changes since v2:
  * Previously the DDC locking happened in drm_get_edid() and thus
    was done for all DRM drivers, regardless if they are ever used
    on muxed machines. Now this is moved to a separate helper which
    is only called by relevant drivers and only for LVDS connectors.
    (Suggested by Thierry Reding and seconded by Alex Deucher and
    Daniel Vetter.)
  * Squashed commits, overhauled locking, added kernel-doc for new
    public functions and locks.
    (Suggested by Daniel Vetter.)


Thanks a lot to the reviewers and testers for your valuable feedback.


Lukas Wunner (6):
  vga_switcheroo: Add support for switching only the DDC
  apple-gmux: Add switch_ddc support
  drm/edid: Switch DDC when reading the EDID
  drm/i915: Switch DDC when reading the EDID
  drm/nouveau: Switch DDC when reading the EDID
  drm/radeon: Switch DDC when reading the EDID

 drivers/gpu/drm/drm_edid.c                  | 26 ++++++++
 drivers/gpu/drm/i915/intel_lvds.c           |  3 +-
 drivers/gpu/drm/nouveau/nouveau_connector.c | 13 +++-
 drivers/gpu/drm/radeon/radeon_connectors.c  |  4 ++
 drivers/gpu/vga/vga_switcheroo.c            | 98 ++++++++++++++++++++++++++++-
 drivers/platform/x86/apple-gmux.c           | 23 +++++++
 include/drm/drm_crtc.h                      |  2 +
 include/linux/vga_switcheroo.h              |  9 +++
 8 files changed, 173 insertions(+), 5 deletions(-)

-- 
1.8.5.2 (Apple Git-48)

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v3 0/6] Enable gpu switching on the MacBook Pro
  2015-10-04  9:52 [PATCH v3 0/6] Enable gpu switching on the MacBook Pro Lukas Wunner
       [not found] ` <a46bc3667badb466475ed9ab6eac21c2b4814741.1443952353.git.lukas@wunner.de>
@ 2015-10-05 13:23 ` Lukas Wunner
       [not found]   ` <20151005132349.GA15130-JFq808J9C/izQB+pC5nmwQ@public.gmane.org>
  1 sibling, 1 reply; 8+ messages in thread
From: Lukas Wunner @ 2015-10-05 13:23 UTC (permalink / raw)
  To: dri-devel, intel-gfx, nouveau; +Cc: Pierre Moreau, William Brown

Hi,

I've also pushed this series to GitHub now to ease reviewing:
https://github.com/l1k/linux/commits/mbp_switcheroo_v3

Thanks,

Lukas
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v3 0/6] Enable gpu switching on the MacBook Pro
       [not found]   ` <20151005132349.GA15130-JFq808J9C/izQB+pC5nmwQ@public.gmane.org>
@ 2015-10-05 14:15     ` Evan Foss
  2015-10-05 15:17       ` [Nouveau] " Lukas Wunner
       [not found]       ` <CAM2RGhT5x9GoNU4xPwzoEoiWKqVrC2pwp3ydFgaXFwtsYiBa7A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 2 replies; 8+ messages in thread
From: Evan Foss @ 2015-10-05 14:15 UTC (permalink / raw)
  To: Lukas Wunner
  Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	intel-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, William Brown

On Mon, Oct 5, 2015 at 9:23 AM, Lukas Wunner <lukas@wunner.de> wrote:
> Hi,
>
> I've also pushed this series to GitHub now to ease reviewing:
> https://github.com/l1k/linux/commits/mbp_switcheroo_v3

So to test this all someone has to do is pull this and try it? No
patching required?

> Thanks,
>
> Lukas
> _______________________________________________
> Nouveau mailing list
> Nouveau@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/nouveau



-- 
Home
http://evanfoss.googlepages.com/
Work
http://forge.abcd.harvard.edu/gf/project/epl_engineering/wiki/
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Nouveau] [PATCH v3 0/6] Enable gpu switching on the MacBook Pro
  2015-10-05 14:15     ` Evan Foss
@ 2015-10-05 15:17       ` Lukas Wunner
       [not found]         ` <20151005151704.GA15177-JFq808J9C/izQB+pC5nmwQ@public.gmane.org>
       [not found]       ` <CAM2RGhT5x9GoNU4xPwzoEoiWKqVrC2pwp3ydFgaXFwtsYiBa7A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  1 sibling, 1 reply; 8+ messages in thread
From: Lukas Wunner @ 2015-10-05 15:17 UTC (permalink / raw)
  To: Evan Foss
  Cc: nouveau@lists.freedesktop.org, intel-gfx, dri-devel,
	William Brown

Hi Evan,

On Mon, Oct 05, 2015 at 10:15:53AM -0400, Evan Foss wrote:
> On Mon, Oct 5, 2015 at 9:23 AM, Lukas Wunner <lukas@wunner.de> wrote:
> > I've also pushed this series to GitHub now to ease reviewing:
> > https://github.com/l1k/linux/commits/mbp_switcheroo_v3
> 
> So to test this all someone has to do is pull this and try it? No
> patching required?

Yes. But if you don't already have a kernel git repo, this will be
a > 1 GByte download.

Which MacBook Pro model do you want to test this on? As noted in the
cover letter, this will only work on pre-retinas and only if the
apple-gmux module loads before the DRM drivers. You can try to ensure
the latter by editing modules.dep, or grab this tarball which contains
reprobing patches on top:
http://wunner.de/mbp_switcheroo_v3_reprobe_4.3-rc4pre.tar.gz

Best regards,

Lukas
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v3 0/6] Enable gpu switching on the MacBook Pro
       [not found]       ` <CAM2RGhT5x9GoNU4xPwzoEoiWKqVrC2pwp3ydFgaXFwtsYiBa7A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2015-10-05 15:20         ` Pierre Moreau
  0 siblings, 0 replies; 8+ messages in thread
From: Pierre Moreau @ 2015-10-05 15:20 UTC (permalink / raw)
  To: Evan Foss
  Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	intel-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, William Brown

The repo is a fork of Linus' tree, with the patches on top of it. So you just need to build that modified version of the kernel and boot it. :-)

Pierre

> On 05 Oct 2015, at 16:15, Evan Foss <evanfoss@gmail.com> wrote:
> 
>> On Mon, Oct 5, 2015 at 9:23 AM, Lukas Wunner <lukas@wunner.de> wrote:
>> Hi,
>> 
>> I've also pushed this series to GitHub now to ease reviewing:
>> https://github.com/l1k/linux/commits/mbp_switcheroo_v3
> 
> So to test this all someone has to do is pull this and try it? No
> patching required?
> 
>> Thanks,
>> 
>> Lukas
>> _______________________________________________
>> Nouveau mailing list
>> Nouveau@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/nouveau
> 
> 
> 
> -- 
> Home
> http://evanfoss.googlepages.com/
> Work
> http://forge.abcd.harvard.edu/gf/project/epl_engineering/wiki/
> _______________________________________________
> Nouveau mailing list
> Nouveau@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/nouveau
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v3 0/6] Enable gpu switching on the MacBook Pro
       [not found]         ` <20151005151704.GA15177-JFq808J9C/izQB+pC5nmwQ@public.gmane.org>
@ 2015-10-05 15:23           ` Evan Foss
  2015-10-05 15:31             ` [Nouveau] " Lukas Wunner
  0 siblings, 1 reply; 8+ messages in thread
From: Evan Foss @ 2015-10-05 15:23 UTC (permalink / raw)
  To: Lukas Wunner
  Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	intel-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, William Brown

On Mon, Oct 5, 2015 at 11:17 AM, Lukas Wunner <lukas@wunner.de> wrote:
> Hi Evan,
>
> On Mon, Oct 05, 2015 at 10:15:53AM -0400, Evan Foss wrote:
>> On Mon, Oct 5, 2015 at 9:23 AM, Lukas Wunner <lukas@wunner.de> wrote:
>> > I've also pushed this series to GitHub now to ease reviewing:
>> > https://github.com/l1k/linux/commits/mbp_switcheroo_v3
>>
>> So to test this all someone has to do is pull this and try it? No
>> patching required?
>
> Yes. But if you don't already have a kernel git repo, this will be
> a > 1 GByte download.

2012
Macbook Pro 9,2

$ dmesg|grep Apple
[    0.000000] efi: EFI v1.10 by Apple
[    0.000000] DMI: Apple Inc. MacBookPro9,1/Mac-
4B7AC7E43945597E,
BIOS MBP91.88Z.00D3.B08.1208081132 08/08/2012

> Which MacBook Pro model do you want to test this on? As noted in the
> cover letter, this will only work on pre-retinas and only if the
> apple-gmux module loads before the DRM drivers. You can try to ensure
> the latter by editing modules.dep, or grab this tarball which contains
> reprobing patches on top:
> http://wunner.de/mbp_switcheroo_v3_reprobe_4.3-rc4pre.tar.gz

Ok thanks

> Best regards,
>
> Lukas

Evan

-- 
Home
http://evanfoss.googlepages.com/
Work
http://forge.abcd.harvard.edu/gf/project/epl_engineering/wiki/
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Nouveau] [PATCH v3 0/6] Enable gpu switching on the MacBook Pro
  2015-10-05 15:23           ` Evan Foss
@ 2015-10-05 15:31             ` Lukas Wunner
  0 siblings, 0 replies; 8+ messages in thread
From: Lukas Wunner @ 2015-10-05 15:31 UTC (permalink / raw)
  To: Evan Foss
  Cc: nouveau@lists.freedesktop.org, intel-gfx, dri-devel,
	William Brown

Hi Evan,

On Mon, Oct 05, 2015 at 11:23:21AM -0400, Evan Foss wrote:
> $ dmesg|grep Apple
> [    0.000000] efi: EFI v1.10 by Apple
> [    0.000000] DMI: Apple Inc. MacBookPro9,1/Mac-
> 4B7AC7E43945597E,
> BIOS MBP91.88Z.00D3.B08.1208081132 08/08/2012

That was the last of the pre-retinas. I have exactly the same machine,
so yes, it should work just fine on that one.

Best regards,

Lukas
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-10-05 15:31 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-04  9:52 [PATCH v3 0/6] Enable gpu switching on the MacBook Pro Lukas Wunner
     [not found] ` <a46bc3667badb466475ed9ab6eac21c2b4814741.1443952353.git.lukas@wunner.de>
     [not found]   ` <90fa3492f441814eab48c7df2431bcac39d6219a.1443952353.git.lukas@wunner.de>
     [not found]     ` <af50270ecf44e9f88013ce48c96c5ffbd0fbc250.1443952353.git.lukas@wunner.de>
2015-09-11 10:40       ` [PATCH v3 4/6] drm/i915: Switch DDC when reading the EDID Lukas Wunner
2015-10-05 13:23 ` [PATCH v3 0/6] Enable gpu switching on the MacBook Pro Lukas Wunner
     [not found]   ` <20151005132349.GA15130-JFq808J9C/izQB+pC5nmwQ@public.gmane.org>
2015-10-05 14:15     ` Evan Foss
2015-10-05 15:17       ` [Nouveau] " Lukas Wunner
     [not found]         ` <20151005151704.GA15177-JFq808J9C/izQB+pC5nmwQ@public.gmane.org>
2015-10-05 15:23           ` Evan Foss
2015-10-05 15:31             ` [Nouveau] " Lukas Wunner
     [not found]       ` <CAM2RGhT5x9GoNU4xPwzoEoiWKqVrC2pwp3ydFgaXFwtsYiBa7A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-10-05 15:20         ` Pierre Moreau

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox