Skip to content

Enable GPU switching on pre-retina MacBook Pro

Lukas Wunner dri-devel intel-gfx nouveau platform-driver-x86 5 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest12 patches 35 repliesIn review
  2. v45 of 6 patches 6 repliesSuperseded
  3. v36 patches 14 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v219 of 22 patches6 repliesSuperseded
v111 patches7 repliesSuperseded

Changes from the cover letter

* New patch [01/12]: vga_switcheroo handler flags
Alex Deucher asked if this series might regress on non-Apple laptops. To address this concern, I let handlers declare their capabilities in a bitmask. DRM drivers call drm_get_edid_switcheroo() only if the handler has set the VGA_SWITCHEROO_CAN_SWITCH_DDC flag. Currently just one other flag is defined which is used on retinas.

* Changed patch [02/12]: vga_switcheroo DDC locking Rename ddc_lock to mux_hw_lock, suggested by Daniel Vetter.

* New patch [03/12]: track switch state of apple-gmux Fixes a bug in previous versions of this series which occurred if the system was suspended while DDC was temporarily switched:
On resume DDC was switched to the wrong GPU.

* New patches [09/12 - 12/12]: deferred probing Previously I used connector reprobing if the inactive GPU's driver loaded before gmux. I've ditched that in favor of deferred driver probing, which is much simpler. Thanks to Daniel Vetter for the suggestion.

Patches in v5 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/12vga_switcheroo: Add handler flags infrastructureDocumentation/DocBook/gpu.tmpl drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c drivers/gpu/drm/nouveau/nouveau_acpi.c +4 more+54 -70 replies
2/12vga_switcheroo: Add support for switching only the DDCdrivers/gpu/vga/vga_switcheroo.c include/linux/vga_switcheroo.h+103 -20 replies
3/12apple-gmux: Track switch statedrivers/platform/x86/apple-gmux.c+46 -210 replies
4/12apple-gmux: Add switch_ddc supportdrivers/platform/x86/apple-gmux.c+42 -30 replies
5/12drm/edid: Switch DDC when reading the EDIDdrivers/gpu/drm/drm_edid.c include/drm/drm_crtc.h+28 -00 replies
6/12drm/i915: Switch DDC when reading the EDIDdrivers/gpu/drm/i915/intel_lvds.c+7 -10 replies
7/12drm/nouveau: Switch DDC when reading the EDIDdrivers/gpu/drm/nouveau/nouveau_connector.c+20 -10 replies
8/12drm/radeon: Switch DDC when reading the EDIDdrivers/gpu/drm/radeon/radeon_connectors.c+6 -00 replies
9/12apple-gmux: Add helper for presence detectDocumentation/DocBook/gpu.tmpl drivers/platform/x86/apple-gmux.c include/linux/apple-gmux.h+45 -10 replies
10/12drm/i915: Defer probe if gmux is present but its driver isn'tdrivers/gpu/drm/i915/i915_drv.c+12 -010 replies
11/12drm/nouveau: Defer probe if gmux is present but its driver isn'tdrivers/gpu/drm/nouveau/nouveau_drm.c+11 -00 replies
12/12drm/radeon: Defer probe if gmux is present but its driver isn'tdrivers/gpu/drm/radeon/radeon_drv.c+11 -00 replies

Reviews trailers per patch

None of the 12 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchLukas WunnerPierre MoreauWilliam BrownPaul HordiienkoDarren Hart
SeriesT-b T-b T-b T-b R-b
1/12T-b
2/12T-b
3/12T-b
4/12T-b
5/12T-b T-b T-b
6/12T-b
7/12T-b
8/12
9/12T-b
10/12T-b
11/12T-b
12/12

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 5 reviewers.

Read the v5 thread

Cover letter [PATCH v5 00/12] Enable GPU switching on pre-retina MacBook Pro

Enable GPU switching on the pre-retina MacBook Pro (2008 - 2013), v5.

The main obstacle on these machines is that the panel mode in VBIOS is bogus. Fortunately gmux can switch DDC independently from the display, thereby allowing the inactive GPU to probe the panel's EDID.

In short, vga_switcheroo and apple-gmux are amended with hooks to switch DDC, DRM core is amended with a drm_get_edid_switcheroo() helper, and relevant drivers are amended to call that for LVDS outputs.

The retina MacBook Pro (2012 - present) uses eDP and cannot switch AUX independently from the main link. The main obstacle there is link training, I'm currently working on this, it will be addressed in a future patch set.

This series is also reviewable on GitHub:
https://github.com/l1k/linux/commits/mbp_switcheroo_v5

Changes:

* New patch [01/12]: vga_switcheroo handler flags
Alex Deucher asked if this series might regress on non-Apple laptops. To address this concern, I let handlers declare their capabilities in a bitmask. DRM drivers call drm_get_edid_switcheroo() only if the handler has set the VGA_SWITCHEROO_CAN_SWITCH_DDC flag. Currently just one other flag is defined which is used on retinas.

* Changed patch [02/12]: vga_switcheroo DDC locking Rename ddc_lock to mux_hw_lock, suggested by Daniel Vetter.

* New patch [03/12]: track switch state of apple-gmux Fixes a bug in previous versions of this series which occurred if the system was suspended while DDC was temporarily switched:
On resume DDC was switched to the wrong GPU.

* New patches [09/12 - 12/12]: deferred probing Previously I used connector reprobing if the inactive GPU's driver loaded before gmux. I've ditched that in favor of deferred driver probing, which is much simpler. Thanks to Daniel Vetter for the suggestion.

Caution: Patch [09/12] depends on a new acpi_dev_present() API which will land in 4.5 via Rafael J. Wysocki's tree.

I would particularly be interested in feedback on the handler flags patch [01/12]. I'm not 100% happy with the number of characters required to query the flags (e.g.: if (vga_switcheroo_handler_flags() & VGA_SWITCHEROO_CAN_SWITCH_DDC)), but failed to come up with something shorter. Thierry Reding used a struct of bools instead of a bitmask for his recent drm_dp_link_caps patches. Maybe use that instead?
http://lists.freedesktop.org/archives/dri-devel/2015-December/097025.html

Thanks,

Lukas

Lukas Wunner (12):
vga_switcheroo: Add handler flags infrastructure
vga_switcheroo: Add support for switching only the DDC
apple-gmux: Track switch state
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
apple-gmux: Add helper for presence detect
drm/i915: Defer probe if gmux is present but its driver isn't drm/nouveau: Defer probe if gmux is present but its driver isn't drm/radeon: Defer probe if gmux is present but its driver isn't

 Documentation/DocBook/gpu.tmpl                   |   5 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c |   3 +-
 drivers/gpu/drm/drm_edid.c                       |  26 +++++
 drivers/gpu/drm/i915/i915_drv.c                  |  12 +++
 drivers/gpu/drm/i915/intel_lvds.c                |   8 +-
 drivers/gpu/drm/nouveau/nouveau_acpi.c           |   2 +-
 drivers/gpu/drm/nouveau/nouveau_connector.c      |  21 +++-
 drivers/gpu/drm/nouveau/nouveau_drm.c            |  11 +++
 drivers/gpu/drm/radeon/radeon_atpx_handler.c     |   3 +-
 drivers/gpu/drm/radeon/radeon_connectors.c       |   6 ++
 drivers/gpu/drm/radeon/radeon_drv.c              |  11 +++
 drivers/gpu/vga/vga_switcheroo.c                 | 119 ++++++++++++++++++++++-
 drivers/platform/x86/apple-gmux.c                | 111 ++++++++++++++++-----
 include/drm/drm_crtc.h                           |   2 +
 include/linux/apple-gmux.h                       |  39 ++++++++
 include/linux/vga_switcheroo.h                   |  36 ++++++-
 16 files changed, 382 insertions(+), 33 deletions(-)
 create mode 100644 include/linux/apple-gmux.h
Signature · 6 lines
1.8.5.2 (Apple Git-48)

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx