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

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: feedback 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..6acf91e9b5067f236f4de6e2fe21c95605c06f90 100644
--- a/gpu/ipc/service/image_transport_surface_overlay_mac.mm
+++ b/gpu/ipc/service/image_transport_surface_overlay_mac.mm
@@ -183,9 +183,19 @@ gfx::SwapResult ImageTransportSurfaceOverlayMac::SwapBuffersInternal(
// 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()) {
+ //
+ // Note that on some platforms (10.9), fences appear to sometimes get
+ // lost and will never pass. Add a 32ms timout to prevent these
+ // situations from causing a GPU process hang. crbug.com/618075
+ int timeout_msec = 32;
+ while (!previous_frame_fence_->HasCompleted() && timeout_msec > 0) {
+ --timeout_msec;
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