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

Unified Diff: ui/gl/gl_fence.cc

Issue 14358014: gpu: Add EGL fence support. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reduce scope. Created 7 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 | « ui/gl/gl_fence.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gl/gl_fence.cc
diff --git a/ui/gl/gl_fence.cc b/ui/gl/gl_fence.cc
index 9a40ec2a8b652f11135be687c46aeef9a22216fb..15b21a9fa9919f33aaa8fa204047823d0265de6b 100644
--- a/ui/gl/gl_fence.cc
+++ b/ui/gl/gl_fence.cc
@@ -32,6 +32,10 @@ class GLFenceNVFence: public gfx::GLFence {
return !!glTestFenceNV(fence_);
}
+ virtual void ClientWait() {
+ NOTIMPLEMENTED();
apatrick_chromium 2013/06/18 22:15:01 glFinishFenceNV(fence_);
epenner 2013/06/18 22:37:25 Done.
+ }
+
private:
virtual ~GLFenceNVFence() {
glDeleteFencesNV(1, &fence_);
@@ -62,6 +66,10 @@ class GLFenceARBSync: public gfx::GLFence {
return length == 1 && value == GL_SIGNALED;
}
+ virtual void ClientWait() {
+ NOTIMPLEMENTED();
apatrick_chromium 2013/06/18 22:15:01 glClientWaitSyncARB(sync_, SYNC_FLUSH_COMMANDS_BIT
epenner 2013/06/18 22:37:25 Done. Note there is no ARB, and added GL_ to const
+ }
+
private:
virtual ~GLFenceARBSync() {
glDeleteSync(sync_);
@@ -70,6 +78,36 @@ class GLFenceARBSync: public gfx::GLFence {
GLsync sync_;
};
+class EglFenceSync : public gfx::GLFence {
apatrick_chromium 2013/06/18 22:15:01 We've been using "EGL" (all caps) everywhere else.
epenner 2013/06/18 22:37:25 Done.
+ public:
+ EglFenceSync() {
+ sync_ = eglCreateSyncKHR(eglGetCurrentDisplay(),
apatrick_chromium 2013/06/18 22:15:01 nit: make first arg display_ and move the statemen
epenner 2013/06/18 22:37:25 Done.
+ EGL_SYNC_FENCE_KHR, NULL);
+ display_ = eglGetCurrentDisplay();
+ }
+
+ virtual bool HasCompleted() OVERRIDE {
+ EGLint value = 0;
+ eglGetSyncAttribKHR(display_, sync_, EGL_SYNC_STATUS_KHR, &value);
+ DCHECK(value == EGL_SIGNALED_KHR || value == EGL_UNSIGNALED_KHR);
+ return !value || value == EGL_SIGNALED_KHR;
+ }
+
+ virtual void ClientWait() OVERRIDE {
+ EGLint flags = EGL_SYNC_FLUSH_COMMANDS_BIT_KHR;
+ EGLTimeKHR time = EGL_FOREVER_KHR;
+ eglClientWaitSyncKHR(display_, sync_, flags, time);
+ }
+
+ private:
+ virtual ~EglFenceSync() {
+ eglDestroySyncKHR(display_, sync_);
+ }
+
+ EGLSyncKHR sync_;
+ EGLDisplay display_;
+};
+
} // namespace
namespace gfx {
@@ -82,7 +120,9 @@ GLFence::~GLFence() {
// static
GLFence* GLFence::Create() {
- if (gfx::g_driver_gl.ext.b_GL_NV_fence) {
+ if (gfx::g_driver_egl.ext.b_EGL_KHR_fence_sync) {
+ return new EglFenceSync();
+ } else if (gfx::g_driver_gl.ext.b_GL_NV_fence) {
return new GLFenceNVFence();
} else if (gfx::g_driver_gl.ext.b_GL_ARB_sync) {
return new GLFenceARBSync();
« no previous file with comments | « ui/gl/gl_fence.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698