Index: ui/gl/gl_fence_egl.cc |
diff --git a/ui/gl/gl_fence_egl.cc b/ui/gl/gl_fence_egl.cc |
index c96d6d8157dea1b5c9c5f1915e6149d5379ca316..74f0a0171b6907a7b2943328af25e2360826070f 100644 |
--- a/ui/gl/gl_fence_egl.cc |
+++ b/ui/gl/gl_fence_egl.cc |
@@ -6,19 +6,25 @@ |
#include "ui/gl/egl_util.h" |
#include "ui/gl/gl_bindings.h" |
-#include "ui/gl/gl_context.h" |
namespace gfx { |
-GLFenceEGL::GLFenceEGL(bool flush) { |
+namespace { |
+ |
+bool g_ignore_egl_sync_failures = false; |
+ |
+} // namespace |
+ |
+// static |
+void GLFenceEGL::SetIgnoreFailures() { |
+ g_ignore_egl_sync_failures = true; |
+} |
+ |
+GLFenceEGL::GLFenceEGL() { |
display_ = eglGetCurrentDisplay(); |
sync_ = eglCreateSyncKHR(display_, EGL_SYNC_FENCE_KHR, NULL); |
DCHECK(sync_ != EGL_NO_SYNC_KHR); |
- if (flush) { |
- glFlush(); |
- } else { |
- flush_event_ = GLContext::GetCurrent()->SignalFlush(); |
- } |
+ glFlush(); |
} |
bool GLFenceEGL::HasCompleted() { |
@@ -35,17 +41,15 @@ bool GLFenceEGL::HasCompleted() { |
} |
void GLFenceEGL::ClientWait() { |
- if (!flush_event_.get() || flush_event_->IsSignaled()) { |
- EGLint flags = 0; |
- EGLTimeKHR time = EGL_FOREVER_KHR; |
- EGLint result = eglClientWaitSyncKHR(display_, sync_, flags, time); |
- DCHECK_NE(EGL_TIMEOUT_EXPIRED_KHR, result); |
- if (result == EGL_FALSE) { |
- LOG(FATAL) << "Failed to wait for EGLSync. error:" |
- << ui::GetLastEGLErrorString(); |
- } |
- } else { |
- LOG(ERROR) << "Trying to wait for uncommitted fence. Skipping..."; |
+ EGLint flags = 0; |
+ EGLTimeKHR time = EGL_FOREVER_KHR; |
+ EGLint result = eglClientWaitSyncKHR(display_, sync_, flags, time); |
+ DCHECK_IMPLIES(!g_ignore_egl_sync_failures, |
+ EGL_TIMEOUT_EXPIRED_KHR == result); |
+ if (result == EGL_FALSE) { |
+ LOG(ERROR) << "Failed to wait for EGLSync. error:" |
+ << ui::GetLastEGLErrorString(); |
+ CHECK(g_ignore_egl_sync_failures); |
} |
} |
@@ -54,14 +58,11 @@ void GLFenceEGL::ServerWait() { |
ClientWait(); |
return; |
} |
- if (!flush_event_.get() || flush_event_->IsSignaled()) { |
- EGLint flags = 0; |
- if (eglWaitSyncKHR(display_, sync_, flags) == EGL_FALSE) { |
- LOG(FATAL) << "Failed to wait for EGLSync. error:" |
- << ui::GetLastEGLErrorString(); |
- } |
- } else { |
- LOG(ERROR) << "Trying to wait for uncommitted fence. Skipping..."; |
+ EGLint flags = 0; |
+ if (eglWaitSyncKHR(display_, sync_, flags) == EGL_FALSE) { |
+ LOG(ERROR) << "Failed to wait for EGLSync. error:" |
+ << ui::GetLastEGLErrorString(); |
+ CHECK(g_ignore_egl_sync_failures); |
} |
} |