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

Issue 5317007: Add flow control between renderer and GPU processes, and, on Mac OS X,... (Closed)

Created:
10 years, 1 month ago by Ken Russell (switch to Gerrit)
Modified:
9 years, 7 months ago
CC:
chromium-reviews, darin-cc_chromium.org, brettw-cc_chromium.org, pam+watch_chromium.org, apatrick_chromium, ben+cc_chromium.org, darin (slow to review), stuartmorgan, pink (ping after 24hrs), greggman, Vangelis Kokkevis, jonathan.backer
Visibility:
Public.

Description

Add flow control between renderer and GPU processes, and, on Mac OS X, between GPU process and browser process. Thanks to Al Patrick for the renderer<->GPU flow control mechanism. This CL prevents the renderer from issuing more OpenGL work than the GPU process can execute, and, on the Mac, prevents the combination of the renderer and GPU processes from transmitting more frames via IOSurfaces from the GPU to the browser process than can be handled by the GPU. This fix causes the renderer to block inside ggl::SwapBuffers() when it gets too far ahead. Different strategies can be considered going forward, including measuring frame rates in the GPU and renderer processes and trying to match them via techniques such as delaying the execution of some timers. However, despite the general undesirability of blocking the render thread, this fix results in a significant performance improvement. With this fix integrated, a fill-limited test case from Chris Rogers displays at 60 FPS instead of 15 FPS on a Mac Pro. Gregg Tavares' aquarium from webglsamples.googlecode.com displays at 30 FPS instead of 4 or 5 FPS on a MacBook Pro. The frame rates measured at the JavaScript level now match the actual frame rate of the browser, where previously they were much higher since they were issuing more work than the browser could render. A few other minor OpenGL bugs potentially impacting the correctness of the Mac compositor are being fixed as well in this CL. Verified that WebGL, CSS 3D and YouTube (Core Animation plugin) content all work. BUG=63539 TEST=none Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=67470

Patch Set 1 #

Total comments: 9

Patch Set 2 : '' #

Patch Set 3 : '' #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+398 lines, -47 lines) Patch
M app/surface/accelerated_surface_mac.cc View 2 chunks +4 lines, -0 lines 0 comments Download
M chrome/browser/gpu_process_host.h View 2 chunks +3 lines, -4 lines 0 comments Download
M chrome/browser/gpu_process_host.cc View 4 chunks +27 lines, -8 lines 0 comments Download
M chrome/browser/renderer_host/accelerated_surface_container_manager_mac.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/renderer_host/render_widget_host.cc View 1 chunk +5 lines, -1 line 0 comments Download
M chrome/browser/renderer_host/render_widget_host_view.h View 1 chunk +11 lines, -1 line 0 comments Download
M chrome/browser/renderer_host/render_widget_host_view_mac.h View 2 chunks +12 lines, -2 lines 0 comments Download
M chrome/browser/renderer_host/render_widget_host_view_mac.mm View 1 12 chunks +105 lines, -10 lines 0 comments Download
M chrome/browser/renderer_host/test/test_render_view_host.h View 1 chunk +6 lines, -2 lines 0 comments Download
M chrome/browser/renderer_host/test/test_render_view_host.cc View 1 chunk +5 lines, -1 line 0 comments Download
M chrome/common/gpu_messages.cc View 2 chunks +49 lines, -0 lines 0 comments Download
M chrome/common/gpu_messages_internal.h View 3 chunks +14 lines, -12 lines 0 comments Download
M chrome/common/gpu_param_traits.h View 2 chunks +19 lines, -0 lines 0 comments Download
M chrome/gpu/gpu_channel.h View 1 chunk +5 lines, -0 lines 0 comments Download
M chrome/gpu/gpu_channel.cc View 1 chunk +10 lines, -0 lines 0 comments Download
M chrome/gpu/gpu_command_buffer_stub.h View 1 chunk +5 lines, -0 lines 0 comments Download
M chrome/gpu/gpu_command_buffer_stub.cc View 1 1 chunk +18 lines, -2 lines 0 comments Download
M chrome/gpu/gpu_thread.h View 1 chunk +4 lines, -0 lines 0 comments Download
M chrome/gpu/gpu_thread.cc View 2 chunks +15 lines, -0 lines 0 comments Download
M chrome/renderer/ggl/ggl.cc View 4 chunks +21 lines, -0 lines 2 comments Download
M gpu/command_buffer/service/gpu_processor.h View 1 3 chunks +14 lines, -0 lines 0 comments Download
M gpu/command_buffer/service/gpu_processor.cc View 1 5 chunks +34 lines, -3 lines 0 comments Download
M gpu/command_buffer/service/gpu_processor_mac.cc View 1 chunk +11 lines, -0 lines 0 comments Download

Messages

Total messages: 7 (0 generated)
Ken Russell (switch to Gerrit)
Please review. Thanks.
10 years, 1 month ago (2010-11-24 23:30:31 UTC) #1
Nico
Drive-by Some amazing progress in this CL! http://codereview.chromium.org/5317007/diff/1/chrome/browser/renderer_host/accelerated_surface_container_manager_mac.cc File chrome/browser/renderer_host/accelerated_surface_container_manager_mac.cc (right): http://codereview.chromium.org/5317007/diff/1/chrome/browser/renderer_host/accelerated_surface_container_manager_mac.cc#newcode103 chrome/browser/renderer_host/accelerated_surface_container_manager_mac.cc:103: glClearColor(1.0f, 1.0f, ...
10 years, 1 month ago (2010-11-24 23:43:29 UTC) #2
apatrick_chromium
LGTM for my part http://codereview.chromium.org/5317007/diff/1/chrome/browser/renderer_host/render_widget_host_view_mac.mm File chrome/browser/renderer_host/render_widget_host_view_mac.mm (right): http://codereview.chromium.org/5317007/diff/1/chrome/browser/renderer_host/render_widget_host_view_mac.mm#newcode1067 chrome/browser/renderer_host/render_widget_host_view_mac.mm:1067: private: indentation http://codereview.chromium.org/5317007/diff/1/gpu/command_buffer/service/gpu_processor.cc File gpu/command_buffer/service/gpu_processor.cc ...
10 years, 1 month ago (2010-11-24 23:56:09 UTC) #3
Ken Russell (switch to Gerrit)
http://codereview.chromium.org/5317007/diff/1/chrome/browser/renderer_host/render_widget_host_view_mac.mm File chrome/browser/renderer_host/render_widget_host_view_mac.mm (right): http://codereview.chromium.org/5317007/diff/1/chrome/browser/renderer_host/render_widget_host_view_mac.mm#newcode394 chrome/browser/renderer_host/render_widget_host_view_mac.mm:394: CGLSetCurrentContext(0); On 2010/11/24 23:43:29, Nico wrote: > Why did ...
10 years, 1 month ago (2010-11-25 01:02:08 UTC) #4
Nico
LG for what I looked at, thanks for bearing with my questions. On Wed, Nov ...
10 years, 1 month ago (2010-11-25 01:08:32 UTC) #5
nduca
LGTM. Dying to get some actual timing diagrams made for this to see how this ...
10 years ago (2010-11-26 19:07:36 UTC) #6
Ken Russell (switch to Gerrit)
10 years ago (2010-11-26 20:23:09 UTC) #7
http://codereview.chromium.org/5317007/diff/34003/chrome/renderer/ggl/ggl.cc
File chrome/renderer/ggl/ggl.cc (right):

http://codereview.chromium.org/5317007/diff/34003/chrome/renderer/ggl/ggl.cc#...
chrome/renderer/ggl/ggl.cc:38: // in the general case. On Mac OS X it seems we
really want this to be 1,
On 2010/11/26 19:07:37, nduca wrote:
> Just checking my understanding, the 1 is because the IOSurface isnt' double
> buffered so >1 would cause us to render into the IOSurface before it is
> presented?

No. It's because if we increase it to 2 then the renderer process races ahead
and produces 2 frames for each 1 that is actually displayed to the screen. For
at least one of our test cases this makes JavaScript think that it's rendering
at 120 FPS when in fact it's only rendering at 60 FPS. I think we need to get to
a baseline where JavaScript has a correct notion of the frame rate, which is
achieved by setting this to 1 as well as the number of outstanding swap buffers
calls in gpu_processor.cc to 1.

Powered by Google App Engine
This is Rietveld 408576698