diff options
| author | Bo Liu <boliu@google.com> | 2014-10-20 11:50:12 -0700 |
|---|---|---|
| committer | The Android Automerger <android-build@google.com> | 2014-10-22 11:32:55 -0700 |
| commit | 96d9d2a7805383e2ffc6ec181816de87026cbc84 (patch) | |
| tree | 0408dfdd5e2c48653802850a9f0c690a37ee059c | |
| parent | 88e1073c2fe4c6c74a1ea41c4965ed16f30e9f46 (diff) | |
Fork: Fix read fences with MailboxSynchronizer
The problem is when a texture (and the corresponding GLImage) is
deleted, the read fence is deleted and never clears.
In this workaround, we keep a "read fence for all deleted textures"
that is renewed every time a texture is deleted. This fence will have a
null GLImage client pointer, which will be cleared in the next
WillWrite.
BUG: 17690996
Change-Id: I067860a62a3e445ded6208906fa073f4f57239fe
| -rw-r--r-- | gpu/command_buffer/service/texture_definition.cc | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/gpu/command_buffer/service/texture_definition.cc b/gpu/command_buffer/service/texture_definition.cc index 84ca103a3d..78558b7400 100644 --- a/gpu/command_buffer/service/texture_definition.cc +++ b/gpu/command_buffer/service/texture_definition.cc @@ -119,6 +119,8 @@ class NativeImageBufferEGL : public NativeImageBuffer { virtual void DidRead(gfx::GLImage* client) OVERRIDE; virtual void DidWrite(gfx::GLImage* client) OVERRIDE; + void ClearCompletedReadFencesLocked(); + EGLDisplay egl_display_; EGLImageKHR egl_image_; @@ -202,7 +204,12 @@ void NativeImageBufferEGL::RemoveClient(gfx::GLImage* client) { it != client_infos_.end(); it++) { if (it->client == client) { - client_infos_.erase(it); + if (it->read_fence.get()) { + it->client = NULL; + } else { + client_infos_.erase(it); + } + ClearCompletedReadFencesLocked(); return; } } @@ -251,6 +258,7 @@ void NativeImageBufferEGL::WillWrite(gfx::GLImage* client) { if (write_client_ != client) write_fence_->ServerWait(); + ClearCompletedReadFencesLocked(); for (std::list<ClientInfo>::iterator it = client_infos_.begin(); it != client_infos_.end(); it++) { @@ -261,6 +269,7 @@ void NativeImageBufferEGL::WillWrite(gfx::GLImage* client) { void NativeImageBufferEGL::DidRead(gfx::GLImage* client) { base::AutoLock lock(lock_); + ClearCompletedReadFencesLocked(); for (std::list<ClientInfo>::iterator it = client_infos_.begin(); it != client_infos_.end(); it++) { @@ -285,6 +294,18 @@ void NativeImageBufferEGL::DidWrite(gfx::GLImage* client) { } } +void NativeImageBufferEGL::ClearCompletedReadFencesLocked() { + lock_.AssertAcquired(); + std::list<ClientInfo>::iterator it = client_infos_.begin(); + while (it != client_infos_.end()) { + if (!it->client && it->read_fence->HasCompleted()) { + it = client_infos_.erase(it); + } else { + it++; + } + } +} + #endif class NativeImageBufferStub : public NativeImageBuffer { |
