Cherry-pick: gpu: Always use EGL_KHR_fence_sync with mailbox sync
Clean cherry-pick of chromium r279800
Original description:
This is the only GLFence implementation that works across
contexts and share groups. This codepath is only used by
Android WebView.
Change-Id: Ia7aebbb1ae9f853520205cc8648f8bc385ac315a
diff --git a/gpu/command_buffer/service/texture_definition.cc b/gpu/command_buffer/service/texture_definition.cc
index 7028a5a..84ca103 100644
--- a/gpu/command_buffer/service/texture_definition.cc
+++ b/gpu/command_buffer/service/texture_definition.cc
@@ -4,12 +4,18 @@
#include "gpu/command_buffer/service/texture_definition.h"
+#include <list>
+
+#include "base/memory/linked_ptr.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/synchronization/lock.h"
#include "gpu/command_buffer/service/texture_manager.h"
#include "ui/gl/gl_image.h"
#include "ui/gl/gl_implementation.h"
#include "ui/gl/scoped_binders.h"
#if !defined(OS_MACOSX)
+#include "ui/gl/gl_fence_egl.h"
#include "ui/gl/gl_surface_egl.h"
#endif
@@ -102,9 +108,7 @@
static scoped_refptr<NativeImageBufferEGL> Create(GLuint texture_id);
private:
- NativeImageBufferEGL(scoped_ptr<gfx::GLFence> write_fence,
- EGLDisplay display,
- EGLImageKHR image);
+ NativeImageBufferEGL(EGLDisplay display, EGLImageKHR image);
virtual ~NativeImageBufferEGL();
virtual void AddClient(gfx::GLImage* client) OVERRIDE;
virtual void RemoveClient(gfx::GLImage* client) OVERRIDE;
@@ -160,8 +164,7 @@
if (egl_image == EGL_NO_IMAGE_KHR)
return NULL;
- return new NativeImageBufferEGL(
- make_scoped_ptr(gfx::GLFence::Create()), egl_display, egl_image);
+ return new NativeImageBufferEGL(egl_display, egl_image);
}
NativeImageBufferEGL::ClientInfo::ClientInfo(gfx::GLImage* client)
@@ -169,13 +172,12 @@
NativeImageBufferEGL::ClientInfo::~ClientInfo() {}
-NativeImageBufferEGL::NativeImageBufferEGL(scoped_ptr<gfx::GLFence> write_fence,
- EGLDisplay display,
+NativeImageBufferEGL::NativeImageBufferEGL(EGLDisplay display,
EGLImageKHR image)
: NativeImageBuffer(),
egl_display_(display),
egl_image_(image),
- write_fence_(write_fence.Pass()),
+ write_fence_(new gfx::GLFenceEGL(true)),
write_client_(NULL) {
DCHECK(egl_display_ != EGL_NO_DISPLAY);
DCHECK(egl_image_ != EGL_NO_IMAGE_KHR);
@@ -263,7 +265,7 @@
it != client_infos_.end();
it++) {
if (it->client == client) {
- it->read_fence = make_linked_ptr(gfx::GLFence::Create());
+ it->read_fence = make_linked_ptr(new gfx::GLFenceEGL(true));
return;
}
}
@@ -274,7 +276,7 @@
base::AutoLock lock(lock_);
// Sharing semantics require the client to flush in order to make changes
// visible to other clients.
- write_fence_.reset(gfx::GLFence::CreateWithoutFlush());
+ write_fence_.reset(new gfx::GLFenceEGL(false));
write_client_ = client;
for (std::list<ClientInfo>::iterator it = client_infos_.begin();
it != client_infos_.end();
diff --git a/gpu/command_buffer/service/texture_definition.h b/gpu/command_buffer/service/texture_definition.h
index 0b4816a..6df4b86 100644
--- a/gpu/command_buffer/service/texture_definition.h
+++ b/gpu/command_buffer/service/texture_definition.h
@@ -5,19 +5,12 @@
#ifndef GPU_COMMAND_BUFFER_SERVICE_TEXTURE_DEFINITION_H_
#define GPU_COMMAND_BUFFER_SERVICE_TEXTURE_DEFINITION_H_
-#include <list>
#include <vector>
-#include "base/callback.h"
-#include "base/memory/linked_ptr.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
-#include "base/synchronization/lock.h"
#include "gpu/command_buffer/service/gl_utils.h"
-#include "ui/gl/gl_fence.h"
namespace gfx {
-class GLFence;
class GLImage;
}