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

Unified Diff: ui/gl/gl_fence.cc

Issue 2418613004: ui: Add EGL_ANDROID_native_fence_sync support.
Patch Set: rebase Created 4 years, 2 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') | ui/gl/gl_fence_egl.h » ('j') | 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 e69d4cf144dca6c4e298885b29e6cd8accd317c3..9bb071d6c4f799d5e0de9afbb7521d20b16fa7ac 100644
--- a/ui/gl/gl_fence.cc
+++ b/ui/gl/gl_fence.cc
@@ -6,11 +6,13 @@
#include "base/compiler_specific.h"
#include "build/build_config.h"
+#include "ui/gfx/gpu_fence.h"
#include "ui/gl/gl_bindings.h"
#include "ui/gl/gl_context.h"
#include "ui/gl/gl_fence_arb.h"
#include "ui/gl/gl_fence_egl.h"
#include "ui/gl/gl_fence_nv.h"
+#include "ui/gl/gl_fence_shared_event.h"
#include "ui/gl/gl_gl_api_implementation.h"
#include "ui/gl/gl_implementation.h"
#include "ui/gl/gl_version_info.h"
@@ -19,6 +21,10 @@
#include "ui/gl/gl_fence_apple.h"
#endif
+#if defined(OS_LINUX)
+#include "ui/gl/gl_fence_libsync.h"
+#endif
+
namespace gl {
GLFence::GLFence() {
@@ -70,6 +76,34 @@ scoped_refptr<GLFence> GLFence::Create() {
return fence;
}
+scoped_refptr<GLFence> GLFence::CreateFromGpuFenceHandle(
+ const gfx::GpuFenceHandle& handle) {
+ DCHECK(GLContext::GetCurrent()) << "Trying to create fence with no context";
+
+ scoped_refptr<GLFence> fence;
+#if defined(OS_LINUX)
+ base::ScopedFD fence_fd(handle.fd.fd);
+ if (fence_fd.is_valid()) {
+ if (g_driver_egl.ext.b_EGL_ANDROID_native_fence_sync) {
+ EGLint attribs[] = {EGL_SYNC_NATIVE_FENCE_FD_ANDROID, fence_fd.release(),
+ EGL_NONE};
+ fence = make_scoped_refptr(
+ new GLFenceEGL(EGL_SYNC_NATIVE_FENCE_ANDROID, attribs));
+ } else {
+ fence = make_scoped_refptr(new GLFenceLibsync(std::move(fence_fd)));
+ }
+ } else {
+ fence =
+ make_scoped_refptr(new GLFenceSharedEvent(handle.shared_event_handle));
+ }
+#else
+ fence =
+ make_scoped_refptr(new GLFenceSharedEvent(handle.shared_event_handle));
+#endif
+
+ return fence;
+}
+
bool GLFence::ResetSupported() {
// Resetting a fence to its original state isn't supported by default.
return false;
« no previous file with comments | « ui/gl/gl_fence.h ('k') | ui/gl/gl_fence_egl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698