diff options
author | kbr@google.com <kbr@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-26 20:16:18 +0000 |
---|---|---|
committer | kbr@google.com <kbr@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-26 20:16:18 +0000 |
commit | 33da8041706bbe87ec9ff8d95854bf7075ab2d7a (patch) | |
tree | 518fd9b01ac6355816acd64bfb7f9ce037274598 /chrome/browser/gpu_process_host.cc | |
parent | 76d20290e1a84f5a18c63c0f905062b986f01f55 (diff) | |
download | chromium_src-33da8041706bbe87ec9ff8d95854bf7075ab2d7a.zip chromium_src-33da8041706bbe87ec9ff8d95854bf7075ab2d7a.tar.gz chromium_src-33da8041706bbe87ec9ff8d95854bf7075ab2d7a.tar.bz2 |
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
Review URL: http://codereview.chromium.org/5317007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@67470 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gpu_process_host.cc')
-rw-r--r-- | chrome/browser/gpu_process_host.cc | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/chrome/browser/gpu_process_host.cc b/chrome/browser/gpu_process_host.cc index bf9c1c9..afa904c 100644 --- a/chrome/browser/gpu_process_host.cc +++ b/chrome/browser/gpu_process_host.cc @@ -308,11 +308,15 @@ class BuffersSwappedDispatcher : public Task { int32 renderer_id, int32 render_view_id, gfx::PluginWindowHandle window, - uint64 surface_id) + uint64 surface_id, + int32 route_id, + uint64 swap_buffers_count) : renderer_id_(renderer_id), render_view_id_(render_view_id), window_(window), - surface_id_(surface_id) { + surface_id_(surface_id), + route_id_(route_id), + swap_buffers_count_(swap_buffers_count) { } void Run() { @@ -323,7 +327,14 @@ class BuffersSwappedDispatcher : public Task { RenderWidgetHostView* view = host->view(); if (!view) return; - view->AcceleratedSurfaceBuffersSwapped(window_, surface_id_); + view->AcceleratedSurfaceBuffersSwapped( + // Parameters needed to swap the IOSurface. + window_, + surface_id_, + // Parameters needed to formulate an acknowledgment. + renderer_id_, + route_id_, + swap_buffers_count_); } private: @@ -331,6 +342,8 @@ class BuffersSwappedDispatcher : public Task { int32 render_view_id_; gfx::PluginWindowHandle window_; uint64 surface_id_; + int32 route_id_; + uint64 swap_buffers_count_; DISALLOW_COPY_AND_ASSIGN(BuffersSwappedDispatcher); }; @@ -338,14 +351,20 @@ class BuffersSwappedDispatcher : public Task { } // namespace void GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped( - int32 renderer_id, - int32 render_view_id, - gfx::PluginWindowHandle window, - uint64 surface_id) { + const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params) { BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, new BuffersSwappedDispatcher( - renderer_id, render_view_id, window, surface_id)); + // These are the parameters needed to look up the IOSurface + // on this side. + params.renderer_id, + params.render_view_id, + params.window, + params.surface_id, + // These are additional parameters needed to formulate an + // acknowledgment. + params.route_id, + params.swap_buffers_count)); } #endif |