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

Side by Side Diff: ui/gl/gl_fence_egl.cc

Issue 892323002: Add workaround to ignore egl sync errors on qc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: OS_MACOSX Created 5 years, 10 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 unified diff | Download patch
« no previous file with comments | « ui/gl/gl_fence_egl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/gl/gl_fence_egl.h" 5 #include "ui/gl/gl_fence_egl.h"
6 6
7 #include "ui/gl/egl_util.h" 7 #include "ui/gl/egl_util.h"
8 #include "ui/gl/gl_bindings.h" 8 #include "ui/gl/gl_bindings.h"
9 9
10 namespace gfx { 10 namespace gfx {
11 11
12 namespace {
13
14 bool g_ignore_egl_sync_failures = false;
15
16 } // namespace
17
18 // static
19 void GLFenceEGL::SetIgnoreFailures() {
20 g_ignore_egl_sync_failures = true;
21 }
22
12 GLFenceEGL::GLFenceEGL() { 23 GLFenceEGL::GLFenceEGL() {
13 display_ = eglGetCurrentDisplay(); 24 display_ = eglGetCurrentDisplay();
14 sync_ = eglCreateSyncKHR(display_, EGL_SYNC_FENCE_KHR, NULL); 25 sync_ = eglCreateSyncKHR(display_, EGL_SYNC_FENCE_KHR, NULL);
15 DCHECK(sync_ != EGL_NO_SYNC_KHR); 26 DCHECK(sync_ != EGL_NO_SYNC_KHR);
16 glFlush(); 27 glFlush();
17 } 28 }
18 29
19 bool GLFenceEGL::HasCompleted() { 30 bool GLFenceEGL::HasCompleted() {
20 EGLint value = 0; 31 EGLint value = 0;
21 if (eglGetSyncAttribKHR(display_, sync_, EGL_SYNC_STATUS_KHR, &value) != 32 if (eglGetSyncAttribKHR(display_, sync_, EGL_SYNC_STATUS_KHR, &value) !=
22 EGL_TRUE) { 33 EGL_TRUE) {
23 LOG(ERROR) << "Failed to get EGLSync attribute. error code:" 34 LOG(ERROR) << "Failed to get EGLSync attribute. error code:"
24 << eglGetError(); 35 << eglGetError();
25 return true; 36 return true;
26 } 37 }
27 38
28 DCHECK(value == EGL_SIGNALED_KHR || value == EGL_UNSIGNALED_KHR); 39 DCHECK(value == EGL_SIGNALED_KHR || value == EGL_UNSIGNALED_KHR);
29 return !value || value == EGL_SIGNALED_KHR; 40 return !value || value == EGL_SIGNALED_KHR;
30 } 41 }
31 42
32 void GLFenceEGL::ClientWait() { 43 void GLFenceEGL::ClientWait() {
33 EGLint flags = 0; 44 EGLint flags = 0;
34 EGLTimeKHR time = EGL_FOREVER_KHR; 45 EGLTimeKHR time = EGL_FOREVER_KHR;
35 EGLint result = eglClientWaitSyncKHR(display_, sync_, flags, time); 46 EGLint result = eglClientWaitSyncKHR(display_, sync_, flags, time);
36 DCHECK_NE(EGL_TIMEOUT_EXPIRED_KHR, result); 47 DCHECK_IMPLIES(!g_ignore_egl_sync_failures,
48 EGL_TIMEOUT_EXPIRED_KHR == result);
37 if (result == EGL_FALSE) { 49 if (result == EGL_FALSE) {
38 LOG(FATAL) << "Failed to wait for EGLSync. error:" 50 LOG(ERROR) << "Failed to wait for EGLSync. error:"
39 << ui::GetLastEGLErrorString(); 51 << ui::GetLastEGLErrorString();
52 CHECK(g_ignore_egl_sync_failures);
40 } 53 }
41 } 54 }
42 55
43 void GLFenceEGL::ServerWait() { 56 void GLFenceEGL::ServerWait() {
44 if (!gfx::g_driver_egl.ext.b_EGL_KHR_wait_sync) { 57 if (!gfx::g_driver_egl.ext.b_EGL_KHR_wait_sync) {
45 ClientWait(); 58 ClientWait();
46 return; 59 return;
47 } 60 }
48 EGLint flags = 0; 61 EGLint flags = 0;
49 if (eglWaitSyncKHR(display_, sync_, flags) == EGL_FALSE) { 62 if (eglWaitSyncKHR(display_, sync_, flags) == EGL_FALSE) {
50 LOG(FATAL) << "Failed to wait for EGLSync. error:" 63 LOG(ERROR) << "Failed to wait for EGLSync. error:"
51 << ui::GetLastEGLErrorString(); 64 << ui::GetLastEGLErrorString();
65 CHECK(g_ignore_egl_sync_failures);
52 } 66 }
53 } 67 }
54 68
55 GLFenceEGL::~GLFenceEGL() { 69 GLFenceEGL::~GLFenceEGL() {
56 eglDestroySyncKHR(display_, sync_); 70 eglDestroySyncKHR(display_, sync_);
57 } 71 }
58 72
59 } // namespace gfx 73 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gl/gl_fence_egl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698