diff options
author | ccameron <ccameron@chromium.org> | 2014-10-09 02:06:42 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-10-09 09:07:13 +0000 |
commit | 95e3616034fcf2ef6d1a7caf8b289ad87ad8b6d0 (patch) | |
tree | 8352c068cf1a9e0402b0f92c57815f045780d6bb /content/common/gpu/image_transport_surface.cc | |
parent | a98abe65be310e50064ff84e38a7e79e45251dc5 (diff) | |
download | chromium_src-95e3616034fcf2ef6d1a7caf8b289ad87ad8b6d0.zip chromium_src-95e3616034fcf2ef6d1a7caf8b289ad87ad8b6d0.tar.gz chromium_src-95e3616034fcf2ef6d1a7caf8b289ad87ad8b6d0.tar.bz2 |
Clean up GPU back-pressure with remote CALayers
If a CAOpenGLLayer is attached to a NSView that is completely occluded
or isn't in the window hierarchy, then when we ask that layer to draw, it
will not draw, or will draw after a long delay. This optimization can be a
problem if we need to renderer to continue to produce frames, e.g, for
tab capture.
Fix this issue by having the frame acknowledgement from the browser
to the GPU process (which currently informs the GPU process of the
CGL renderer ID) inform the GPU process of the occlusion status of the
NSView being drawn to. Use this information in the GPU process to force
the CAOpenGLLayer to draw as soon as a new frame arrives.
Add the same timeout mechanism as is in the IOSurface drawing path
to limit CoreAnimation's throttling (based on GPU back-pressure) to
6 fps, to avoid having the renderer block indefinitely. This is something
of a hack, but is an unfortunate necessity.
Note that this change assumes that calling setNeedsDisplay and then
displayIfNeeded will result in the CALayer being draw except in the
case where the CALayer is backing a NSView that is not in the window
hierarchy. This exception only happens during tab capture of a
backgrounded tab, and the contents not drawn are actually never seen,
so it is safe to skip the draw entirely.
Also, wrap some Mac-only IPCs and structures #if defined(OS_MACOSX).
BUG=312462
Review URL: https://codereview.chromium.org/636003002
Cr-Commit-Position: refs/heads/master@{#298828}
Diffstat (limited to 'content/common/gpu/image_transport_surface.cc')
-rw-r--r-- | content/common/gpu/image_transport_surface.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/content/common/gpu/image_transport_surface.cc b/content/common/gpu/image_transport_surface.cc index 61fe511..94991a8 100644 --- a/content/common/gpu/image_transport_surface.cc +++ b/content/common/gpu/image_transport_surface.cc @@ -91,8 +91,10 @@ bool ImageTransportHelper::Initialize() { bool ImageTransportHelper::OnMessageReceived(const IPC::Message& message) { bool handled = true; IPC_BEGIN_MESSAGE_MAP(ImageTransportHelper, message) +#if defined(OS_MACOSX) IPC_MESSAGE_HANDLER(AcceleratedSurfaceMsg_BufferPresented, OnBufferPresented) +#endif IPC_MESSAGE_HANDLER(AcceleratedSurfaceMsg_WakeUpGpu, OnWakeUpGpu); IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() @@ -177,10 +179,12 @@ gpu::gles2::GLES2Decoder* ImageTransportHelper::Decoder() { return stub_->decoder(); } +#if defined(OS_MACOSX) void ImageTransportHelper::OnBufferPresented( const AcceleratedSurfaceMsg_BufferPresented_Params& params) { surface_->OnBufferPresented(params); } +#endif void ImageTransportHelper::OnWakeUpGpu() { surface_->WakeUpGpu(); @@ -268,10 +272,12 @@ bool PassThroughImageTransportSurface::OnMakeCurrent(gfx::GLContext* context) { return true; } +#if defined(OS_MACOSX) void PassThroughImageTransportSurface::OnBufferPresented( const AcceleratedSurfaceMsg_BufferPresented_Params& /* params */) { NOTREACHED(); } +#endif void PassThroughImageTransportSurface::OnResize(gfx::Size size, float scale_factor) { |