summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--content/common/gpu/gpu_channel.cc22
-rw-r--r--content/common/gpu/gpu_channel.h7
-rw-r--r--content/common/gpu/gpu_command_buffer_stub.cc7
-rw-r--r--content/renderer/gpu/renderer_gl_context.cc142
-rw-r--r--content/renderer/gpu/renderer_gl_context.h18
-rw-r--r--content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.cc31
-rw-r--r--content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.h5
-rw-r--r--gpu/command_buffer/common/constants.h6
-rw-r--r--gpu/command_buffer/service/common_decoder_unittest.cc3
-rw-r--r--gpu/command_buffer/service/feature_info.cc1
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder_mock.h1
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h3
-rw-r--r--webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc181
-rw-r--r--webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h5
-rw-r--r--webkit/gpu/webgraphicscontext3d_in_process_impl.cc21
-rw-r--r--webkit/gpu/webgraphicscontext3d_in_process_impl.h5
16 files changed, 3 insertions, 455 deletions
diff --git a/content/common/gpu/gpu_channel.cc b/content/common/gpu/gpu_channel.cc
index aba6c6d..17de5c4 100644
--- a/content/common/gpu/gpu_channel.cc
+++ b/content/common/gpu/gpu_channel.cc
@@ -61,28 +61,6 @@ void GpuChannel::DestroyTransportTexture(int32 route_id) {
router_.RemoveRoute(route_id);
}
-void GpuChannel::OnLatchCallback(int route_id, bool is_set_latch) {
-#if defined(ENABLE_GPU)
- if (is_set_latch) {
- // Wake up any waiting contexts. If they are still blocked, they will re-add
- // themselves to the set.
- for (std::set<int32>::iterator i = latched_routes_.begin();
- i != latched_routes_.end(); ++i) {
- GpuCommandBufferStub* stub = stubs_.Lookup(*i);
- if (stub)
- stub->scheduler()->SetScheduled(true);
- }
- latched_routes_.clear();
- } else {
- // Add route_id context to a set to be woken upon any set latch.
- latched_routes_.insert(route_id);
- GpuCommandBufferStub* stub = stubs_.Lookup(route_id);
- if (stub)
- stub->scheduler()->SetScheduled(false);
- }
-#endif
-}
-
bool GpuChannel::OnMessageReceived(const IPC::Message& message) {
if (log_messages_) {
VLOG(1) << "received message @" << &message << " on channel @" << this
diff --git a/content/common/gpu/gpu_channel.h b/content/common/gpu/gpu_channel.h
index 6f7614b..1efebca 100644
--- a/content/common/gpu/gpu_channel.h
+++ b/content/common/gpu/gpu_channel.h
@@ -122,11 +122,6 @@ class GpuChannel : public IPC::Channel::Listener,
// TransportTexture to delete and detach itself.
void DestroyTransportTexture(int32 route_id);
- // A callback which is called after a Set/WaitLatch command is processed.
- // The bool parameter will be true for SetLatch, and false for a WaitLatch
- // that is blocked. An unblocked WaitLatch will not trigger a callback.
- void OnLatchCallback(int route_id, bool is_set_latch);
-
private:
void OnDestroy();
@@ -181,8 +176,6 @@ class GpuChannel : public IPC::Channel::Listener,
typedef IDMap<GpuSurfaceStub, IDMapOwnPointer> SurfaceMap;
SurfaceMap surfaces_;
-
- std::set<int32> latched_routes_;
#endif // defined (ENABLE_GPU)
// A collection of transport textures created.
diff --git a/content/common/gpu/gpu_command_buffer_stub.cc b/content/common/gpu/gpu_command_buffer_stub.cc
index b86750a..a93c173 100644
--- a/content/common/gpu/gpu_command_buffer_stub.cc
+++ b/content/common/gpu/gpu_command_buffer_stub.cc
@@ -292,13 +292,6 @@ void GpuCommandBufferStub::OnParseError() {
route_id_, state.context_lost_reason);
msg->set_unblock(true);
Send(msg);
- // If an error occurs, the remaining commands will not be processed.
- // Since we may have a pending WaitLatch on a related context, we need to
- // forcefully unblock all contexts on the same GpuChannel. However, since we
- // don't know whether the corresponding WaitLatch is in the past or future,
- // it may cause other side effects to simply pass the next WaitLatch on all
- // contexts. Instead, just lose all related contexts when there's an error.
- channel_->DestroySoon();
}
void GpuCommandBufferStub::OnFlush(int32 put_offset,
diff --git a/content/renderer/gpu/renderer_gl_context.cc b/content/renderer/gpu/renderer_gl_context.cc
index 4937a46..894a950 100644
--- a/content/renderer/gpu/renderer_gl_context.cc
+++ b/content/renderer/gpu/renderer_gl_context.cc
@@ -36,8 +36,6 @@ const int32 kCommandBufferSize = 1024 * 1024;
// creation attributes.
const int32 kTransferBufferSize = 1024 * 1024;
-const uint32 kMaxLatchesPerRenderer = 2048;
-
// Singleton used to initialize and terminate the gles2 library.
class GLES2Initializer {
public:
@@ -53,93 +51,6 @@ class GLES2Initializer {
DISALLOW_COPY_AND_ASSIGN(GLES2Initializer);
};
-// Shared memory allocator for latches. Creates a block of shared memory for
-// each renderer process.
-class LatchAllocator {
- public:
- static LatchAllocator* GetInstance();
- static uint32 size() { return kMaxLatchesPerRenderer*sizeof(uint32); }
- static const uint32_t kFreeLatch = 0xffffffffu;
-
- LatchAllocator();
- ~LatchAllocator();
-
- base::SharedMemoryHandle handle() const { return shm_->handle(); }
- base::SharedMemory* shared_memory() { return shm_.get(); }
-
- bool AllocateLatch(uint32* latch_id);
- bool FreeLatch(uint32 latch_id);
-
- private:
- friend struct DefaultSingletonTraits<LatchAllocator>;
-
- scoped_ptr<base::SharedMemory> shm_;
- // Pointer to mapped shared memory.
- volatile uint32* latches_;
-
- DISALLOW_COPY_AND_ASSIGN(LatchAllocator);
-};
-
-////////////////////////////////////////////////////////////////////////////////
-/// LatchAllocator implementation
-
-LatchAllocator* LatchAllocator::GetInstance() {
- return Singleton<LatchAllocator>::get();
-}
-
-LatchAllocator::LatchAllocator() {
- base::SharedMemoryHandle handle;
- RenderThread* render_thread = RenderThread::current();
- if (!render_thread->Send(
- new ViewHostMsg_AllocateSharedMemoryBuffer(size(), &handle))) {
- NOTREACHED() << "failed to send sync IPC";
- }
-
- if (!base::SharedMemory::IsHandleValid(handle)) {
- NOTREACHED() << "failed to create shared memory";
- }
-
- // Handle is closed by the SharedMemory object below. This stops
- // base::FileDescriptor from closing it as well.
-#if defined(OS_POSIX)
- handle.auto_close = false;
-#endif
-
- shm_.reset(new base::SharedMemory(handle, false));
- if (!shm_->Map(size())) {
- NOTREACHED() << "failed to map shared memory";
- }
-
- latches_ = static_cast<uint32*>(shm_->memory());
- // Mark all latches as unallocated.
- for (uint32 i = 0; i < kMaxLatchesPerRenderer; ++i)
- latches_[i] = kFreeLatch;
-}
-
-LatchAllocator::~LatchAllocator() {
-}
-
-bool LatchAllocator::AllocateLatch(uint32* latch_id) {
- for (uint32 i = 0; i < kMaxLatchesPerRenderer; ++i) {
- if (latches_[i] == kFreeLatch) {
- // mark latch as taken and blocked.
- // 0 means waiter will block, 1 means waiter will pass.
- latches_[i] = 0;
- *latch_id = i;
- return true;
- }
- }
- return false;
-}
-
-bool LatchAllocator::FreeLatch(uint32 latch_id) {
- if (latch_id < kMaxLatchesPerRenderer && latches_[latch_id] != kFreeLatch) {
- latches_[latch_id] = kFreeLatch;
- return true;
- }
- return false;
-}
-
////////////////////////////////////////////////////////////////////////////////
static base::LazyInstance<GLES2Initializer> g_gles2_initializer(
@@ -407,9 +318,6 @@ RendererGLContext::RendererGLContext(GpuChannelHost* channel)
: channel_(channel),
parent_(base::WeakPtr<RendererGLContext>()),
parent_texture_id_(0),
- child_to_parent_latch_(gpu::kInvalidLatchId),
- parent_to_child_latch_(gpu::kInvalidLatchId),
- latch_transfer_buffer_id_(-1),
command_buffer_(NULL),
gles2_helper_(NULL),
transfer_buffer_id_(-1),
@@ -527,24 +435,6 @@ bool RendererGLContext::Initialize(bool onscreen,
return false;
}
- // Register transfer buffer so that the context can access latches.
- LatchAllocator* latch_shm = LatchAllocator::GetInstance();
- latch_transfer_buffer_id_ = command_buffer_->RegisterTransferBuffer(
- latch_shm->shared_memory(), LatchAllocator::size(),
- gpu::kLatchSharedMemoryId);
- if (latch_transfer_buffer_id_ != gpu::kLatchSharedMemoryId) {
- Destroy();
- return false;
- }
-
- // If this is a child context, setup latches for synchronization between child
- // and parent.
- if (!CreateLatch(&child_to_parent_latch_) ||
- !CreateLatch(&parent_to_child_latch_)) {
- Destroy();
- return false;
- }
-
// Create the object exposing the OpenGL API.
gles2_implementation_ = new gpu::gles2::GLES2Implementation(
gles2_helper_,
@@ -565,10 +455,9 @@ void RendererGLContext::Destroy() {
delete gles2_implementation_;
gles2_implementation_ = NULL;
- // Do not destroy these transfer buffers here, because commands are still
+ // Do not destroy this transfer buffer here, because commands are still
// in flight on the GPU process that may access them. When the command buffer
// is destroyed, the associated shared memory will be cleaned up.
- latch_transfer_buffer_id_ = -1;
transfer_buffer_id_ = -1;
delete gles2_helper_;
@@ -580,17 +469,6 @@ void RendererGLContext::Destroy() {
}
channel_ = NULL;
-
- // Destroy latches here, after the command buffer is destroyed so that no
- // commands are still in flight that may access the latch memory.
- if (child_to_parent_latch_ != gpu::kInvalidLatchId) {
- DestroyLatch(child_to_parent_latch_);
- child_to_parent_latch_ = gpu::kInvalidLatchId;
- }
- if (parent_to_child_latch_ != gpu::kInvalidLatchId) {
- DestroyLatch(parent_to_child_latch_);
- parent_to_child_latch_ = gpu::kInvalidLatchId;
- }
}
void RendererGLContext::OnSwapBuffers() {
@@ -608,21 +486,3 @@ void RendererGLContext::OnContextLost() {
context_lost_callback_->Run(reason);
}
}
-
-bool RendererGLContext::CreateLatch(uint32* ret_latch) {
- return LatchAllocator::GetInstance()->AllocateLatch(ret_latch);
-}
-
-bool RendererGLContext::DestroyLatch(uint32 latch) {
- return LatchAllocator::GetInstance()->FreeLatch(latch);
-}
-
-bool RendererGLContext::GetParentToChildLatch(uint32* parent_to_child_latch) {
- *parent_to_child_latch = parent_to_child_latch_;
- return true;
-}
-
-bool RendererGLContext::GetChildToParentLatch(uint32* child_to_parent_latch) {
- *child_to_parent_latch = child_to_parent_latch_;
- return true;
-}
diff --git a/content/renderer/gpu/renderer_gl_context.h b/content/renderer/gpu/renderer_gl_context.h
index 1c0280e..911e0c6 100644
--- a/content/renderer/gpu/renderer_gl_context.h
+++ b/content/renderer/gpu/renderer_gl_context.h
@@ -181,21 +181,6 @@ class RendererGLContext : public base::SupportsWeakPtr<RendererGLContext> {
CommandBufferProxy* GetCommandBufferProxy();
- // Create a latch for synchronization between contexts using glSetLatch and
- // glWaitLatch.
- // CreateLatch will only fail if there is a generally unrecoverable
- // error, in which case 0 is returned. Returns latch_id on success.
- bool CreateLatch(uint32* ret_latch);
-
- // Destroy a latch.
- bool DestroyLatch(uint32 latch);
-
- // All child contexts get a latch pair automatically. These latches are used
- // for synchronization with parent context. If *this* context does not have a
- // parent context, these methods will return false.
- bool GetParentToChildLatch(uint32* parent_to_child_latch);
- bool GetChildToParentLatch(uint32* child_to_parent_latch);
-
private:
explicit RendererGLContext(GpuChannelHost* channel);
@@ -215,9 +200,6 @@ class RendererGLContext : public base::SupportsWeakPtr<RendererGLContext> {
scoped_ptr<Callback0::Type> swap_buffers_callback_;
scoped_ptr<Callback1<ContextLostReason>::Type> context_lost_callback_;
uint32 parent_texture_id_;
- uint32 child_to_parent_latch_;
- uint32 parent_to_child_latch_;
- int32 latch_transfer_buffer_id_;
CommandBufferProxy* command_buffer_;
gpu::gles2::GLES2CmdHelper* gles2_helper_;
int32 transfer_buffer_id_;
diff --git a/content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.cc b/content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.cc
index 7836744..8d4d0c8 100644
--- a/content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.cc
+++ b/content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.cc
@@ -337,37 +337,6 @@ void WebGraphicsContext3DCommandBufferImpl::copyTextureToParentTextureCHROMIUM(
gl_->Flush();
}
-void WebGraphicsContext3DCommandBufferImpl::getParentToChildLatchCHROMIUM(
- WGC3Duint* latch_id)
-{
- if (!context_->GetParentToChildLatch(latch_id)) {
- LOG(ERROR) << "getLatch must only be called on child context";
- synthesizeGLError(GL_INVALID_OPERATION);
- *latch_id = gpu::kInvalidLatchId;
- }
-}
-
-void WebGraphicsContext3DCommandBufferImpl::getChildToParentLatchCHROMIUM(
- WGC3Duint* latch_id)
-{
- if (!context_->GetChildToParentLatch(latch_id)) {
- LOG(ERROR) << "getLatch must only be called on child context";
- synthesizeGLError(GL_INVALID_OPERATION);
- *latch_id = gpu::kInvalidLatchId;
- }
-}
-
-void WebGraphicsContext3DCommandBufferImpl::waitLatchCHROMIUM(
- WGC3Duint latch_id)
-{
-}
-
-void WebGraphicsContext3DCommandBufferImpl::setLatchCHROMIUM(
- WGC3Duint latch_id)
-{
- gl_->Flush();
-}
-
void WebGraphicsContext3DCommandBufferImpl::
rateLimitOffscreenContextCHROMIUM() {
gl_->RateLimitOffscreenContextCHROMIUM();
diff --git a/content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.h b/content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.h
index e291c82..be6b9cc 100644
--- a/content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.h
+++ b/content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.h
@@ -405,11 +405,6 @@ class WebGraphicsContext3DCommandBufferImpl
virtual void copyTextureToParentTextureCHROMIUM(
WebGLId texture, WebGLId parentTexture);
- virtual void getParentToChildLatchCHROMIUM(WGC3Duint* latch_id);
- virtual void getChildToParentLatchCHROMIUM(WGC3Duint* latch_id);
- virtual void waitLatchCHROMIUM(WGC3Duint latch_id);
- virtual void setLatchCHROMIUM(WGC3Duint latch_id);
-
virtual void rateLimitOffscreenContextCHROMIUM();
virtual WebKit::WebString getRequestableExtensionsCHROMIUM();
diff --git a/gpu/command_buffer/common/constants.h b/gpu/command_buffer/common/constants.h
index 1b14636..38a8c32 100644
--- a/gpu/command_buffer/common/constants.h
+++ b/gpu/command_buffer/common/constants.h
@@ -49,12 +49,6 @@ const int32 kInvalidSharedMemoryId = -1;
// Common Command Buffer shared memory transfer buffer ID.
const int32 kCommandBufferSharedMemoryId = 4;
-// Common Latch shared memory transfer buffer ID.
-const int32 kLatchSharedMemoryId = 5;
-
-// Invalid latch ID.
-const uint32 kInvalidLatchId = 0xffffffffu;
-
} // namespace gpu
#endif // GPU_COMMAND_BUFFER_COMMON_CONSTANTS_H_
diff --git a/gpu/command_buffer/service/common_decoder_unittest.cc b/gpu/command_buffer/service/common_decoder_unittest.cc
index 8f88398..a240948 100644
--- a/gpu/command_buffer/service/common_decoder_unittest.cc
+++ b/gpu/command_buffer/service/common_decoder_unittest.cc
@@ -131,8 +131,7 @@ class MockCommandBufferEngine : public CommandBufferEngine {
private:
bool IsValidSharedMemoryId(int32 shm_id) {
- return shm_id == kValidShmId || shm_id == kStartValidShmId ||
- shm_id == gpu::kLatchSharedMemoryId;
+ return shm_id == kValidShmId || shm_id == kStartValidShmId;
}
int8 buffer_[kBufferSize];
diff --git a/gpu/command_buffer/service/feature_info.cc b/gpu/command_buffer/service/feature_info.cc
index bbc06cb..21e4550 100644
--- a/gpu/command_buffer/service/feature_info.cc
+++ b/gpu/command_buffer/service/feature_info.cc
@@ -106,7 +106,6 @@ void FeatureInfo::AddFeatures(const char* desired_features) {
AddExtensionString("GL_CHROMIUM_resource_safe");
AddExtensionString("GL_CHROMIUM_resize");
AddExtensionString("GL_CHROMIUM_strict_attribs");
- AddExtensionString("GL_CHROMIUM_latch");
AddExtensionString("GL_CHROMIUM_swapbuffers_complete_callback");
AddExtensionString("GL_CHROMIUM_rate_limit_offscreen_context");
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_mock.h b/gpu/command_buffer/service/gles2_cmd_decoder_mock.h
index 2f1275c..13e60bb 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_mock.h
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_mock.h
@@ -48,7 +48,6 @@ class MockGLES2Decoder : public GLES2Decoder {
MOCK_METHOD0(GetContextGroup, ContextGroup*());
MOCK_METHOD1(SetResizeCallback, void(Callback1<gfx::Size>::Type*));
MOCK_METHOD1(SetSwapBuffersCallback, void(Callback0::Type*));
- MOCK_METHOD1(SetLatchCallback, void(const base::Callback<void(bool)>&));
MOCK_METHOD3(DoCommand, error::Error(unsigned int command,
unsigned int arg_count,
const void* cmd_data));
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h
index 10d3037..3762952 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h
@@ -307,8 +307,7 @@ class GLES2DecoderTestBase : public testing::Test {
}
virtual Buffer GetSharedMemoryBuffer(int32 shm_id) {
- return shm_id == kSharedMemoryId || shm_id == gpu::kLatchSharedMemoryId ?
- valid_buffer_ : invalid_buffer_;
+ return shm_id == kSharedMemoryId ? valid_buffer_ : invalid_buffer_;
}
void ClearSharedMemory() {
diff --git a/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc b/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc
index fd6cc27..c046bc3 100644
--- a/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc
+++ b/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc
@@ -172,21 +172,6 @@ class GLInProcessContext : public base::SupportsWeakPtr<GLInProcessContext> {
CommandBufferService* GetCommandBufferService();
- // Create a latch for synchronization between contexts using glSetLatch and
- // glWaitLatch.
- // CreateLatch will only fail if there is a generally unrecoverable
- // error, in which case 0 is returned. Returns latch_id on success.
- bool CreateLatch(uint32* ret_latch);
-
- // Destroy a latch.
- bool DestroyLatch(uint32 latch);
-
- // All child contexts get a latch pair automatically. These latches are used
- // for synchronization with parent context. If *this* context does not have a
- // parent context, these methods will return false.
- bool GetParentToChildLatch(uint32* parent_to_child_latch);
- bool GetChildToParentLatch(uint32* child_to_parent_latch);
-
private:
GLInProcessContext(GLInProcessContext* parent);
@@ -205,9 +190,6 @@ class GLInProcessContext : public base::SupportsWeakPtr<GLInProcessContext> {
scoped_ptr<Callback0::Type> swap_buffers_callback_;
scoped_ptr<Callback0::Type> context_lost_callback_;
uint32 parent_texture_id_;
- uint32 child_to_parent_latch_;
- uint32 parent_to_child_latch_;
- int32 latch_transfer_buffer_id_;
scoped_ptr<CommandBufferService> command_buffer_;
GpuScheduler* gpu_scheduler_;
GLES2CmdHelper* gles2_helper_;
@@ -226,9 +208,6 @@ const int32 kCommandBufferSize = 1024 * 1024;
// creation attributes.
const int32 kTransferBufferSize = 1024 * 1024;
-const uint32 kMaxLatchesPerRenderer = 2048;
-const uint32 kInvalidLatchId = 0xffffffffu;
-
// Singleton used to initialize and terminate the gles2 library.
class GLES2Initializer {
public:
@@ -244,73 +223,6 @@ class GLES2Initializer {
DISALLOW_COPY_AND_ASSIGN(GLES2Initializer);
};
-// Allocator for latches.
-class LatchAllocator {
- public:
- static LatchAllocator* GetInstance();
- static uint32 size() { return kMaxLatchesPerRenderer*sizeof(uint32); }
- static const uint32_t kFreeLatch = 0xffffffffu;
-
- LatchAllocator();
- ~LatchAllocator();
-
- base::SharedMemoryHandle handle() const { return shm_->handle(); }
- base::SharedMemory* shared_memory() { return shm_.get(); }
-
- bool AllocateLatch(uint32* latch_id);
- bool FreeLatch(uint32 latch_id);
-
- private:
- friend struct DefaultSingletonTraits<LatchAllocator>;
-
- scoped_ptr<base::SharedMemory> shm_;
- // Pointer to mapped shared memory.
- volatile uint32* latches_;
-
- DISALLOW_COPY_AND_ASSIGN(LatchAllocator);
-};
-
-////////////////////////////////////////////////////////////////////////////////
-/// LatchAllocator implementation
-
-LatchAllocator* LatchAllocator::GetInstance() {
- return Singleton<LatchAllocator>::get();
-}
-
-LatchAllocator::LatchAllocator() {
- shm_.reset(new base::SharedMemory());
- shm_->CreateAndMapAnonymous(size());
-
- latches_ = static_cast<uint32*>(shm_->memory());
- // Mark all latches as unallocated.
- for (uint32 i = 0; i < kMaxLatchesPerRenderer; ++i)
- latches_[i] = kFreeLatch;
-}
-
-LatchAllocator::~LatchAllocator() {
-}
-
-bool LatchAllocator::AllocateLatch(uint32* latch_id) {
- for (uint32 i = 0; i < kMaxLatchesPerRenderer; ++i) {
- if (latches_[i] == kFreeLatch) {
- // mark latch as taken and blocked.
- // 0 means waiter will block, 1 means waiter will pass.
- latches_[i] = 0;
- *latch_id = i;
- return true;
- }
- }
- return false;
-}
-
-bool LatchAllocator::FreeLatch(uint32 latch_id) {
- if (latch_id < kMaxLatchesPerRenderer && latches_[latch_id] != kFreeLatch) {
- latches_[latch_id] = kFreeLatch;
- return true;
- }
- return false;
-}
-
////////////////////////////////////////////////////////////////////////////////
static base::LazyInstance<GLES2Initializer> g_gles2_initializer(
@@ -512,9 +424,6 @@ GLInProcessContext::GLInProcessContext(GLInProcessContext* parent)
: parent_(parent ?
parent->AsWeakPtr() : base::WeakPtr<GLInProcessContext>()),
parent_texture_id_(0),
- child_to_parent_latch_(kInvalidLatchId),
- parent_to_child_latch_(kInvalidLatchId),
- latch_transfer_buffer_id_(-1),
gpu_scheduler_(NULL),
gles2_helper_(NULL),
transfer_buffer_id_(-1),
@@ -647,26 +556,6 @@ bool GLInProcessContext::Initialize(bool onscreen,
return false;
}
- // Register transfer buffer so that the context can access latches.
- LatchAllocator* latch_shm = LatchAllocator::GetInstance();
- latch_transfer_buffer_id_ = command_buffer_->RegisterTransferBuffer(
- latch_shm->shared_memory(), LatchAllocator::size(),
- ::gpu::kLatchSharedMemoryId);
- if (latch_transfer_buffer_id_ != ::gpu::kLatchSharedMemoryId) {
- Destroy();
- return false;
- }
-
- // If this is a child context, setup latches for synchronization between child
- // and parent.
- if (parent_.get()) {
- if (!CreateLatch(&child_to_parent_latch_) ||
- !CreateLatch(&parent_to_child_latch_)) {
- Destroy();
- return false;
- }
- }
-
// Create the object exposing the OpenGL API.
gles2_implementation_ = new GLES2Implementation(
gles2_helper_,
@@ -689,19 +578,6 @@ void GLInProcessContext::Destroy() {
delete gles2_implementation_;
gles2_implementation_ = NULL;
- if (child_to_parent_latch_ != kInvalidLatchId) {
- DestroyLatch(child_to_parent_latch_);
- child_to_parent_latch_ = kInvalidLatchId;
- }
- if (parent_to_child_latch_ != kInvalidLatchId) {
- DestroyLatch(parent_to_child_latch_);
- parent_to_child_latch_ = kInvalidLatchId;
- }
- if (command_buffer_.get() && latch_transfer_buffer_id_ != -1) {
- command_buffer_->DestroyTransferBuffer(latch_transfer_buffer_id_);
- latch_transfer_buffer_id_ = -1;
- }
-
if (command_buffer_.get() && transfer_buffer_id_ != -1) {
command_buffer_->DestroyTransferBuffer(transfer_buffer_id_);
transfer_buffer_id_ = -1;
@@ -723,30 +599,6 @@ void GLInProcessContext::OnContextLost() {
context_lost_callback_->Run();
}
-bool GLInProcessContext::CreateLatch(uint32* ret_latch) {
- return LatchAllocator::GetInstance()->AllocateLatch(ret_latch);
-}
-
-bool GLInProcessContext::DestroyLatch(uint32 latch) {
- return LatchAllocator::GetInstance()->FreeLatch(latch);
-}
-
-bool GLInProcessContext::GetParentToChildLatch(uint32* parent_to_child_latch) {
- if (parent_.get()) {
- *parent_to_child_latch = parent_to_child_latch_;
- return true;
- }
- return false;
-}
-
-bool GLInProcessContext::GetChildToParentLatch(uint32* child_to_parent_latch) {
- if (parent_.get()) {
- *child_to_parent_latch = child_to_parent_latch_;
- return true;
- }
- return false;
-}
-
WebGraphicsContext3DInProcessCommandBufferImpl::
WebGraphicsContext3DInProcessCommandBufferImpl()
: context_(NULL),
@@ -1056,39 +908,6 @@ void WebGraphicsContext3DInProcessCommandBufferImpl::
}
void WebGraphicsContext3DInProcessCommandBufferImpl::
- getParentToChildLatchCHROMIUM(WGC3Duint* latch_id)
-{
- ClearContext();
- if (!context_->GetParentToChildLatch(latch_id)) {
- LOG(ERROR) << "getLatch must only be called on child context";
- synthesizeGLError(GL_INVALID_OPERATION);
- *latch_id = ::gpu::kInvalidLatchId;
- }
-}
-
-void WebGraphicsContext3DInProcessCommandBufferImpl::
- getChildToParentLatchCHROMIUM(WGC3Duint* latch_id)
-{
- ClearContext();
- if (!context_->GetChildToParentLatch(latch_id)) {
- LOG(ERROR) << "getLatch must only be called on child context";
- synthesizeGLError(GL_INVALID_OPERATION);
- *latch_id = ::gpu::kInvalidLatchId;
- }
-}
-
-void WebGraphicsContext3DInProcessCommandBufferImpl::waitLatchCHROMIUM(
- WGC3Duint latch_id)
-{
-}
-
-void WebGraphicsContext3DInProcessCommandBufferImpl::setLatchCHROMIUM(
- WGC3Duint latch_id)
-{
- gl_->Flush();
-}
-
-void WebGraphicsContext3DInProcessCommandBufferImpl::
rateLimitOffscreenContextCHROMIUM() {
// TODO(gmam): See if we can comment this in.
// ClearContext();
diff --git a/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h b/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h
index ce6ce46..6330a34 100644
--- a/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h
+++ b/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h
@@ -406,11 +406,6 @@ class WebGraphicsContext3DInProcessCommandBufferImpl
virtual void copyTextureToParentTextureCHROMIUM(
WebGLId texture, WebGLId parentTexture);
- virtual void getParentToChildLatchCHROMIUM(WGC3Duint* latch_id);
- virtual void getChildToParentLatchCHROMIUM(WGC3Duint* latch_id);
- virtual void waitLatchCHROMIUM(WGC3Duint latch_id);
- virtual void setLatchCHROMIUM(WGC3Duint latch_id);
-
virtual void rateLimitOffscreenContextCHROMIUM();
virtual WebKit::WebString getRequestableExtensionsCHROMIUM();
diff --git a/webkit/gpu/webgraphicscontext3d_in_process_impl.cc b/webkit/gpu/webgraphicscontext3d_in_process_impl.cc
index 3564d24..6b8d7fc 100644
--- a/webkit/gpu/webgraphicscontext3d_in_process_impl.cc
+++ b/webkit/gpu/webgraphicscontext3d_in_process_impl.cc
@@ -694,27 +694,6 @@ void WebGraphicsContext3DInProcessImpl::copyTextureToParentTextureCHROMIUM(
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, bound_fbo_);
}
-void WebGraphicsContext3DInProcessImpl::getParentToChildLatchCHROMIUM(
- WGC3Duint* latch_id)
-{
-}
-
-void WebGraphicsContext3DInProcessImpl::getChildToParentLatchCHROMIUM(
- WGC3Duint* latch_id)
-{
-}
-
-void WebGraphicsContext3DInProcessImpl::waitLatchCHROMIUM(
- WGC3Duint latch_id)
-{
-}
-
-void WebGraphicsContext3DInProcessImpl::setLatchCHROMIUM(
- WGC3Duint latch_id)
-{
- glFlush();
-}
-
WebString WebGraphicsContext3DInProcessImpl::
getRequestableExtensionsCHROMIUM() {
return WebString();
diff --git a/webkit/gpu/webgraphicscontext3d_in_process_impl.h b/webkit/gpu/webgraphicscontext3d_in_process_impl.h
index 05bc06d..4778094 100644
--- a/webkit/gpu/webgraphicscontext3d_in_process_impl.h
+++ b/webkit/gpu/webgraphicscontext3d_in_process_impl.h
@@ -92,11 +92,6 @@ class WebGraphicsContext3DInProcessImpl : public WebGraphicsContext3D {
virtual void copyTextureToParentTextureCHROMIUM(
WebGLId texture, WebGLId parentTexture);
- virtual void getParentToChildLatchCHROMIUM(WGC3Duint* latch_id);
- virtual void getChildToParentLatchCHROMIUM(WGC3Duint* latch_id);
- virtual void waitLatchCHROMIUM(WGC3Duint latch_id);
- virtual void setLatchCHROMIUM(WGC3Duint latch_id);
-
virtual void rateLimitOffscreenContextCHROMIUM() { }
virtual WebString getRequestableExtensionsCHROMIUM();