Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Issue 8233027: Support dynamic switching between integrated and discrete GPUs on Mac OS X. (Closed)

Created:
9 years, 2 months ago by Ken Russell (switch to Gerrit)
Modified:
9 years, 2 months ago
CC:
chromium-reviews, hclam+watch_chromium.org, ddorwin+watch_chromium.org, fischman+watch_chromium.org, jam, jonathan.backer, dpranke+watch-content_chromium.org, acolwell+watch_chromium.org, annacc+watch_chromium.org, apatrick_chromium, joi+watch-content_chromium.org, pam+watch_chromium.org, ajwong+watch_chromium.org, darin-cc_chromium.org, dhollowa, tfarina, scherkus (not reviewing), Nico
Visibility:
Public.

Description

Support dynamic switching between integrated and discrete GPUs on Mac OS X. Change Chrome to allocate most OpenGL contexts with the kCGLPFAAllowOfflineRenderers flag, and specify NSSupportsAutomaticGraphicsSwitching in the Info.plist for the main executable and helper apps. This keeps Chrome on the integrated GPU except when using WebGL, accelerated 2D Canvas, Pepper 3D, and Core Animation-based plugins (except Flash). Chrome shares resources between OpenGL contexts in order to display WebGL and other content in the compositor, and resource sharing doesn't work between contexts allocated on different GPUs. Therefore, when the first context for a given renderer requests the discrete GPU, the channel is dropped and all contexts are reallocated on the discrete GPU. Similarly, when the last context requesting the discrete GPU for a given renderer is shut down, all contexts are dropped and reallocated on the integrated GPU. Currently dynamic GPU switching is only supported on the latest Mac OS X 10.7 update and MacBook Pros with dual AMD / Intel GPUs, though this will improve in future OS updates. Tested with WebGL, CSS 3D, Flash and Unity3D content and observed desired GPU switching behavior. Also added a layout test to WebKit under https://bugs.webkit.org/show_bug.cgi?id=69776 which when run in Chrome catches an assertion failure related to the destruction of contexts. The intent is to add it as a UI layout test on the GPU bots. BUG=88788 TEST=none Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=105399

Patch Set 1 #

Patch Set 2 : '' #

Patch Set 3 : '' #

Total comments: 15

Patch Set 4 : '' #

Total comments: 12

Patch Set 5 : '' #

Patch Set 6 : '' #

Patch Set 7 : '' #

Total comments: 12

Patch Set 8 : '' #

Total comments: 5

Patch Set 9 : '' #

Total comments: 6

Patch Set 10 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+718 lines, -120 lines) Patch
A base/memory/scoped_generic_obj.h View 1 2 3 4 5 6 7 8 9 1 chunk +130 lines, -0 lines 0 comments Download
M chrome/app/app-Info.plist View 1 2 3 4 5 6 7 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/app/helper-Info.plist View 1 2 3 4 5 6 7 1 chunk +2 lines, -0 lines 0 comments Download
M content/browser/renderer_host/accelerated_plugin_view_mac.mm View 1 2 3 4 5 6 7 2 chunks +10 lines, -3 lines 0 comments Download
M content/common/gpu/gpu_channel.h View 1 2 3 4 5 6 7 4 chunks +14 lines, -0 lines 0 comments Download
M content/common/gpu/gpu_channel.cc View 1 2 3 4 5 6 7 10 chunks +55 lines, -0 lines 0 comments Download
M content/common/gpu/gpu_command_buffer_stub.h View 1 2 3 4 5 6 7 5 chunks +6 lines, -0 lines 0 comments Download
M content/common/gpu/gpu_command_buffer_stub.cc View 1 2 3 4 5 6 7 3 chunks +10 lines, -2 lines 0 comments Download
M content/common/gpu/gpu_messages.h View 1 2 3 4 5 6 7 4 chunks +17 lines, -0 lines 0 comments Download
M content/common/sandbox_mac.mm View 1 2 3 4 5 6 7 2 chunks +0 lines, -11 lines 0 comments Download
M content/gpu/gpu_info_collector.cc View 1 2 3 4 5 6 7 1 chunk +3 lines, -1 line 0 comments Download
M content/plugin/webplugin_accelerated_surface_proxy_mac.h View 1 2 3 4 5 6 7 2 chunks +3 lines, -1 line 0 comments Download
M content/plugin/webplugin_accelerated_surface_proxy_mac.cc View 1 2 3 4 5 6 7 1 chunk +3 lines, -2 lines 0 comments Download
M content/plugin/webplugin_proxy.h View 1 2 3 4 5 6 7 2 chunks +3 lines, -1 line 0 comments Download
M content/plugin/webplugin_proxy.cc View 1 2 3 4 5 6 7 1 chunk +4 lines, -2 lines 0 comments Download
M content/renderer/gpu/gpu_channel_host.h View 1 2 3 4 5 6 7 4 chunks +19 lines, -2 lines 0 comments Download
M content/renderer/gpu/gpu_channel_host.cc View 1 2 3 4 5 6 7 5 chunks +22 lines, -2 lines 0 comments Download
M content/renderer/gpu/renderer_gl_context.h View 1 2 3 4 5 6 7 4 chunks +7 lines, -3 lines 0 comments Download
M content/renderer/gpu/renderer_gl_context.cc View 1 2 3 4 5 6 7 6 chunks +14 lines, -7 lines 0 comments Download
M content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.h View 1 2 3 4 5 6 7 2 chunks +2 lines, -0 lines 0 comments Download
M content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.cc View 1 2 3 4 5 6 7 5 chunks +40 lines, -8 lines 0 comments Download
M content/renderer/pepper_platform_context_3d_impl.cc View 1 2 3 4 5 6 7 2 chunks +3 lines, -1 line 0 comments Download
M content/renderer/render_widget_fullscreen_pepper.cc View 1 2 3 4 5 6 7 2 chunks +3 lines, -1 line 0 comments Download
M gpu/demos/framework/window.cc View 1 2 3 4 5 6 7 1 chunk +2 lines, -1 line 0 comments Download
M gpu/gles2_conform_support/egl/display.cc View 1 2 3 4 5 6 7 1 chunk +3 lines, -1 line 0 comments Download
M media/tools/shader_bench/shader_bench.cc View 1 2 3 4 5 6 7 1 chunk +4 lines, -1 line 0 comments Download
M ui/gfx/compositor/compositor_gl.cc View 1 2 3 4 5 6 7 2 chunks +8 lines, -2 lines 0 comments Download
M ui/gfx/gl/gl_context.h View 1 2 3 4 5 6 7 3 chunks +7 lines, -2 lines 0 comments Download
M ui/gfx/gl/gl_context_cgl.h View 1 2 3 4 5 6 7 2 chunks +5 lines, -1 line 0 comments Download
M ui/gfx/gl/gl_context_cgl.cc View 1 2 3 4 5 6 7 3 chunks +45 lines, -5 lines 0 comments Download
M ui/gfx/gl/gl_context_egl.h View 1 2 3 4 5 6 7 1 chunk +2 lines, -1 line 0 comments Download
M ui/gfx/gl/gl_context_egl.cc View 1 2 3 4 5 6 7 1 chunk +2 lines, -1 line 0 comments Download
M ui/gfx/gl/gl_context_glx.h View 1 2 3 4 5 6 7 1 chunk +2 lines, -1 line 0 comments Download
M ui/gfx/gl/gl_context_glx.cc View 1 2 3 4 5 6 7 1 chunk +2 lines, -1 line 0 comments Download
M ui/gfx/gl/gl_context_linux.cc View 1 2 3 4 5 6 7 3 chunks +9 lines, -4 lines 0 comments Download
M ui/gfx/gl/gl_context_mac.cc View 1 2 3 4 5 6 7 8 9 3 chunks +99 lines, -3 lines 0 comments Download
M ui/gfx/gl/gl_context_osmesa.h View 1 2 3 4 5 6 7 1 chunk +2 lines, -1 line 0 comments Download
M ui/gfx/gl/gl_context_osmesa.cc View 1 2 3 4 5 6 7 1 chunk +2 lines, -1 line 0 comments Download
M ui/gfx/gl/gl_context_stub.h View 1 2 3 4 5 6 7 1 chunk +2 lines, -1 line 0 comments Download
M ui/gfx/gl/gl_context_stub.cc View 1 2 3 4 5 6 7 1 chunk +2 lines, -1 line 0 comments Download
M ui/gfx/gl/gl_context_wgl.h View 1 2 3 4 5 6 7 1 chunk +2 lines, -1 line 0 comments Download
M ui/gfx/gl/gl_context_wgl.cc View 1 2 3 4 5 6 7 1 chunk +2 lines, -1 line 0 comments Download
M ui/gfx/gl/gl_context_win.cc View 1 2 3 4 5 6 7 2 chunks +9 lines, -4 lines 0 comments Download
M ui/gfx/gl/gl_share_group.h View 1 2 3 4 5 6 7 1 chunk +4 lines, -0 lines 0 comments Download
M ui/gfx/gl/gl_share_group.cc View 1 2 3 4 5 6 7 1 chunk +10 lines, -2 lines 0 comments Download
M ui/gfx/gl/gl_surface_cgl.cc View 1 2 3 4 5 6 7 2 chunks +20 lines, -13 lines 0 comments Download
A ui/gfx/gl/gpu_preference.h View 1 2 3 4 1 chunk +25 lines, -0 lines 0 comments Download
M ui/gfx/surface/accelerated_surface_mac.h View 1 2 3 4 5 6 7 2 chunks +10 lines, -4 lines 0 comments Download
M ui/gfx/surface/accelerated_surface_mac.cc View 1 2 3 4 5 6 7 2 chunks +8 lines, -4 lines 0 comments Download
M views/widget/native_widget_wayland.cc View 1 2 3 4 5 6 7 1 chunk +4 lines, -1 line 0 comments Download
M webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc View 1 2 3 4 5 6 7 11 chunks +28 lines, -10 lines 0 comments Download
M webkit/gpu/webgraphicscontext3d_in_process_impl.cc View 1 2 3 4 5 6 7 2 chunks +8 lines, -2 lines 0 comments Download
M webkit/plugins/npapi/webplugin.h View 1 2 3 4 5 6 7 2 chunks +3 lines, -1 line 0 comments Download
M webkit/plugins/npapi/webplugin.cc View 1 2 3 4 5 6 7 1 chunk +2 lines, -1 line 0 comments Download
M webkit/plugins/npapi/webplugin_delegate_impl_mac.mm View 1 2 3 4 5 6 7 1 chunk +13 lines, -1 line 0 comments Download

Messages

Total messages: 19 (0 generated)
Ken Russell (switch to Gerrit)
Please review => apatrick, mark, stuartmorgan OWNERS review => ananta, darin, sky, vrk FYI => ...
9 years, 2 months ago (2011-10-11 22:55:04 UTC) #1
sky
The other reviewers you have no more than I. I'm rubber stamping this: LGTM
9 years, 2 months ago (2011-10-11 23:40:25 UTC) #2
Mark Mentovai
http://codereview.chromium.org/8233027/diff/7012/chrome/app/app-Info.plist File chrome/app/app-Info.plist (right): http://codereview.chromium.org/8233027/diff/7012/chrome/app/app-Info.plist#newcode260 chrome/app/app-Info.plist:260: <key>NSSupportsAutomaticGraphicsSwitching</key> Keep the keys in this file sorted. You’ll ...
9 years, 2 months ago (2011-10-12 00:48:18 UTC) #3
Ken Russell (switch to Gerrit)
http://codereview.chromium.org/8233027/diff/7012/chrome/app/app-Info.plist File chrome/app/app-Info.plist (right): http://codereview.chromium.org/8233027/diff/7012/chrome/app/app-Info.plist#newcode260 chrome/app/app-Info.plist:260: <key>NSSupportsAutomaticGraphicsSwitching</key> On 2011/10/12 00:48:18, Mark Mentovai wrote: > Keep ...
9 years, 2 months ago (2011-10-12 01:16:36 UTC) #4
Mark Mentovai
LGTM You might be able to figure out how to detect the GPU configuration you’re ...
9 years, 2 months ago (2011-10-12 01:32:09 UTC) #5
stuartmorgan
LGTM with nits Also, in the CL description: "This keeps Chrome on the integrated GPU ...
9 years, 2 months ago (2011-10-12 07:13:24 UTC) #6
vrk (LEFT CHROMIUM)
LGTM for media!
9 years, 2 months ago (2011-10-12 17:21:13 UTC) #7
apatrick_chromium
I have nothing to add. LGTM. http://codereview.chromium.org/8233027/diff/7012/ui/gfx/gl/gl_context_cgl.cc File ui/gfx/gl/gl_context_cgl.cc (right): http://codereview.chromium.org/8233027/diff/7012/ui/gfx/gl/gl_context_cgl.cc#newcode34 ui/gfx/gl/gl_context_cgl.cc:34: return NULL; return ...
9 years, 2 months ago (2011-10-12 19:01:28 UTC) #8
Ken Russell (switch to Gerrit)
mark: please re-review gl_context_cgl.cc. Implemented the dual-GPU detection logic and tested it on Lion laptop ...
9 years, 2 months ago (2011-10-12 22:39:42 UTC) #9
Mark Mentovai
http://codereview.chromium.org/8233027/diff/15010/ui/gfx/gl/gl_context_cgl.cc File ui/gfx/gl/gl_context_cgl.cc (right): http://codereview.chromium.org/8233027/diff/15010/ui/gfx/gl/gl_context_cgl.cc#newcode57 ui/gfx/gl/gl_context_cgl.cc:57: if (!format) { This is similar to the other ...
9 years, 2 months ago (2011-10-13 03:50:32 UTC) #10
Ken Russell (switch to Gerrit)
http://codereview.chromium.org/8233027/diff/15010/ui/gfx/gl/gl_context_cgl.cc File ui/gfx/gl/gl_context_cgl.cc (right): http://codereview.chromium.org/8233027/diff/15010/ui/gfx/gl/gl_context_cgl.cc#newcode57 ui/gfx/gl/gl_context_cgl.cc:57: if (!format) { On 2011/10/13 03:50:33, Mark Mentovai wrote: ...
9 years, 2 months ago (2011-10-13 20:09:32 UTC) #11
Mark Mentovai
http://codereview.chromium.org/8233027/diff/22001/base/mac/scoped_cftyperef.h File base/mac/scoped_cftyperef.h (right): http://codereview.chromium.org/8233027/diff/22001/base/mac/scoped_cftyperef.h#newcode40 base/mac/scoped_cftyperef.h:40: // is embedded in the type name) but with ...
9 years, 2 months ago (2011-10-13 20:20:48 UTC) #12
Ken Russell (switch to Gerrit)
Rebuilt and retested. http://codereview.chromium.org/8233027/diff/22001/ui/gfx/gl/gl_context_mac.cc File ui/gfx/gl/gl_context_mac.cc (right): http://codereview.chromium.org/8233027/diff/22001/ui/gfx/gl/gl_context_mac.cc#newcode25 ui/gfx/gl/gl_context_mac.cc:25: CGLDestroyRendererInfo(x); On 2011/10/13 20:20:48, Mark Mentovai ...
9 years, 2 months ago (2011-10-13 21:01:27 UTC) #13
Mark Mentovai
LGTM with the file moved and an example added to the comment http://codereview.chromium.org/8233027/diff/29004/base/mac/scoped_generic_obj.h File base/mac/scoped_generic_obj.h ...
9 years, 2 months ago (2011-10-13 21:13:00 UTC) #14
Ken Russell (switch to Gerrit)
For the record: the try jobs I submitted for this CL after fixing the link ...
9 years, 2 months ago (2011-10-13 21:43:48 UTC) #15
Mark Mentovai
LGTM
9 years, 2 months ago (2011-10-13 22:06:01 UTC) #16
Ken Russell (switch to Gerrit)
+ben for content/ OWNERS review
9 years, 2 months ago (2011-10-13 22:19:27 UTC) #17
Ben Goodger (Google)
Assuming Mark, Stuart et al. know what they're doing LGTM for content.
9 years, 2 months ago (2011-10-13 22:22:05 UTC) #18
Mark Mentovai
9 years, 2 months ago (2011-10-13 22:23:09 UTC) #19
Know what I’m doing? Me? Good luck with THAT!

Powered by Google App Engine
This is Rietveld 408576698