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

Unified Diff: gpu/ipc/service/image_transport_surface_overlay_mac.mm

Issue 2028303002: Modify ImageTransportSurfaceOverlayMac to allow pipelining (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gpu/ipc/service/image_transport_surface_overlay_mac.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/ipc/service/image_transport_surface_overlay_mac.mm
diff --git a/gpu/ipc/service/image_transport_surface_overlay_mac.mm b/gpu/ipc/service/image_transport_surface_overlay_mac.mm
index 8f4e73002298232de83d01a6894e06c9d82fb39a..141184e173a77001a53b001c88cfa84407ccd4ba 100644
--- a/gpu/ipc/service/image_transport_surface_overlay_mac.mm
+++ b/gpu/ipc/service/image_transport_surface_overlay_mac.mm
@@ -157,10 +157,30 @@ gfx::SwapResult ImageTransportSurfaceOverlayMac::SwapBuffersInternal(
const gfx::Rect& pixel_damage_rect) {
TRACE_EVENT0("gpu", "ImageTransportSurfaceOverlayMac::SwapBuffersInternal");
- // A glFlush is necessary to ensure correct content appears. A glFinish
- // appears empirically to be the best way to get maximum performance when
- // GPU bound.
- {
+ // If supported, use GLFence to ensure that we haven't gotten more than one
+ // frame ahead of GL.
+ if (gl::GLFence::IsSupported()) {
+ // If we have gotten more than one frame ahead of GL, wait for the previous
+ // frame to complete.
+ if (previous_frame_fence_) {
+ TRACE_EVENT0("gpu", "ImageTransportSurfaceOverlayMac::ClientWait");
+ previous_frame_fence_->ClientWait();
ccameron 2016/06/01 21:26:37 This will cause the CPU to spin up to 100% on Mac.
+ previous_frame_fence_ = nullptr;
+ }
+
+ // A glFlush is necessary to ensure correct content appears.
+ {
+ gl::ScopedSetGLToRealGLApi scoped_set_gl_api;
+ CheckGLErrors("Before flush");
+ glFlush();
+ CheckGLErrors("After flush");
+ }
+
+ // Create a new fence after flushing work from the current frame.
+ previous_frame_fence_.reset(gl::GLFence::Create());
+ } else {
+ // GLFence isn't supported - issue a glFinish on each frame to ensure
+ // there is backpressure from GL.
gl::ScopedSetGLToRealGLApi scoped_set_gl_api;
TRACE_EVENT0("gpu", "ImageTransportSurfaceOverlayMac::glFinish");
CheckGLErrors("Before finish");
« no previous file with comments | « gpu/ipc/service/image_transport_surface_overlay_mac.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698