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

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

Issue 2064853002: Add timeout to swap fence (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 | « no previous file | 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 1ced5d09fe883c99e9e6531bd40af9c9056e4e24..f68ffc4623f330d6ad10718606b4bce0f3ff9ea6 100644
--- a/gpu/ipc/service/image_transport_surface_overlay_mac.mm
+++ b/gpu/ipc/service/image_transport_surface_overlay_mac.mm
@@ -182,10 +182,18 @@ gfx::SwapResult ImageTransportSurfaceOverlayMac::SwapBuffersInternal(
// While we could call GLFence::ClientWait, this performs a busy wait on
// Mac, leading to high CPU usage. Instead we poll with a 1ms delay. This
// should have minimal impact, as we will only hit this path when we are
- // more than one frame (16ms) behind.
- while (!previous_frame_fence_->HasCompleted()) {
+ // more than one frame (16ms) behind. Note that on some platforms (10.9),
+ // fences appear to sometimes get lost and will naver pass. Add a 32ms
ccameron 2016/06/13 22:16:14 s/naver/never
ericrk 2016/06/13 22:23:14 Done.
+ // timout to prevent these situations from causing a GPU process hang.
+ int timeout = 32;
ccameron 2016/06/13 22:16:14 s/timeout/timeout_msec
ericrk 2016/06/13 22:23:14 Done.
+ while (!previous_frame_fence_->HasCompleted() && timeout > 0) {
+ --timeout;
base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(1));
}
+ if (!previous_frame_fence_->HasCompleted()) {
+ // We timed out waiting for the above fence, just issue a glFinish.
+ glFinish();
+ }
}
// Create a fence for the current frame's work and save the context.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698