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

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

Issue 2418613004: ui: Add EGL_ANDROID_native_fence_sync support.
Patch Set: rebase Created 4 years, 1 month 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 gl { 10 namespace gl {
11 11
12 namespace { 12 namespace {
13 13
14 bool g_ignore_egl_sync_failures = false; 14 bool g_ignore_egl_sync_failures = false;
15 15
16 } // namespace 16 } // namespace
17 17
18 // static 18 // static
19 void GLFenceEGL::SetIgnoreFailures() { 19 void GLFenceEGL::SetIgnoreFailures() {
20 g_ignore_egl_sync_failures = true; 20 g_ignore_egl_sync_failures = true;
21 } 21 }
22 22
23 GLFenceEGL::GLFenceEGL() { 23 GLFenceEGL::GLFenceEGL() : GLFenceEGL(EGL_SYNC_FENCE_KHR, nullptr) {
24 display_ = eglGetCurrentDisplay();
25 sync_ = eglCreateSyncKHR(display_, EGL_SYNC_FENCE_KHR, NULL);
26 DCHECK(sync_ != EGL_NO_SYNC_KHR);
27 glFlush(); 24 glFlush();
28 } 25 }
29 26
27 GLFenceEGL::GLFenceEGL(GLenum type, EGLint* attribs) {
28 display_ = eglGetCurrentDisplay();
29 sync_ = eglCreateSyncKHR(display_, type, attribs);
30 DCHECK(sync_ != EGL_NO_SYNC_KHR);
31 }
32
30 bool GLFenceEGL::HasCompleted() { 33 bool GLFenceEGL::HasCompleted() {
31 EGLint value = 0; 34 EGLint value = 0;
32 if (eglGetSyncAttribKHR(display_, sync_, EGL_SYNC_STATUS_KHR, &value) != 35 if (eglGetSyncAttribKHR(display_, sync_, EGL_SYNC_STATUS_KHR, &value) !=
33 EGL_TRUE) { 36 EGL_TRUE) {
34 LOG(ERROR) << "Failed to get EGLSync attribute. error code:" 37 LOG(ERROR) << "Failed to get EGLSync attribute. error code:"
35 << eglGetError(); 38 << eglGetError();
36 return true; 39 return true;
37 } 40 }
38 41
39 DCHECK(value == EGL_SIGNALED_KHR || value == EGL_UNSIGNALED_KHR); 42 DCHECK(value == EGL_SIGNALED_KHR || value == EGL_UNSIGNALED_KHR);
(...skipping 23 matching lines...) Expand all
63 << ui::GetLastEGLErrorString(); 66 << ui::GetLastEGLErrorString();
64 CHECK(g_ignore_egl_sync_failures); 67 CHECK(g_ignore_egl_sync_failures);
65 } 68 }
66 } 69 }
67 70
68 GLFenceEGL::~GLFenceEGL() { 71 GLFenceEGL::~GLFenceEGL() {
69 eglDestroySyncKHR(display_, sync_); 72 eglDestroySyncKHR(display_, sync_);
70 } 73 }
71 74
72 } // namespace gl 75 } // namespace gl
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