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

Unified Diff: gpu/command_buffer/service/mailbox_synchronizer.cc

Issue 664803003: Update from chromium a8e7c94b1b79a0948d05a1fcfff53391d22ce37a (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 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 | « gpu/command_buffer/service/mailbox_synchronizer.h ('k') | gpu/command_buffer/service/program_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/mailbox_synchronizer.cc
diff --git a/gpu/command_buffer/service/mailbox_synchronizer.cc b/gpu/command_buffer/service/mailbox_synchronizer.cc
index eac31f95e48f94db8ad6fa9646bb9ce73b82aaec..81a279379d6365126350b238bf14969376fdbfc0 100644
--- a/gpu/command_buffer/service/mailbox_synchronizer.cc
+++ b/gpu/command_buffer/service/mailbox_synchronizer.cc
@@ -7,8 +7,13 @@
#include "base/bind.h"
#include "gpu/command_buffer/service/mailbox_manager.h"
#include "gpu/command_buffer/service/texture_manager.h"
+#include "ui/gl/gl_fence.h"
#include "ui/gl/gl_implementation.h"
+#if !defined(OS_MACOSX)
+#include "ui/gl/gl_fence_egl.h"
+#endif
+
namespace gpu {
namespace gles2 {
@@ -136,7 +141,8 @@ void MailboxSynchronizer::TextureDeleted(Texture* texture) {
}
}
-void MailboxSynchronizer::PushTextureUpdates(MailboxManager* manager) {
+void MailboxSynchronizer::PushTextureUpdates(MailboxManager* manager,
+ uint32 sync_point) {
base::AutoLock lock(lock_);
for (MailboxManager::MailboxToTextureMap::const_iterator texture_it =
manager->mailbox_to_textures_.begin();
@@ -179,6 +185,33 @@ void MailboxSynchronizer::PushTextureUpdates(MailboxManager* manager) {
textures_.insert(std::make_pair(texture, TextureVersion(group)));
}
}
+
+ CreateFenceLocked(sync_point);
+}
+
+void MailboxSynchronizer::CreateFenceLocked(uint32 sync_point) {
+ lock_.AssertAcquired();
+ if (gfx::GetGLImplementation() == gfx::kGLImplementationMockGL)
+ return;
+
+#if !defined(OS_MACOSX)
+ if (sync_point) {
+ while (!sync_points_.empty() &&
+ sync_points_.front()->second->HasCompleted()) {
+ sync_point_to_fence_.erase(sync_points_.front());
+ sync_points_.pop();
+ }
+ // Need to use EGL fences since we are likely not in a single share group.
+ linked_ptr<gfx::GLFence> fence(make_linked_ptr(new gfx::GLFenceEGL(true)));
+ if (fence.get()) {
+ std::pair<SyncPointToFenceMap::iterator, bool> result =
+ sync_point_to_fence_.insert(std::make_pair(sync_point, fence));
+ DCHECK(result.second);
+ sync_points_.push(result.first);
+ }
+ DCHECK(sync_points_.size() == sync_point_to_fence_.size());
+ }
+#endif
}
void MailboxSynchronizer::UpdateTextureLocked(Texture* texture,
@@ -208,8 +241,20 @@ void MailboxSynchronizer::UpdateTextureLocked(Texture* texture,
gl_image ? image_buffer : NULL);
}
-void MailboxSynchronizer::PullTextureUpdates(MailboxManager* manager) {
+void MailboxSynchronizer::AcquireFenceLocked(uint32 sync_point) {
+ lock_.AssertAcquired();
+ SyncPointToFenceMap::iterator fence_it =
+ sync_point_to_fence_.find(sync_point);
+ if (fence_it != sync_point_to_fence_.end()) {
+ fence_it->second->ServerWait();
+ }
+}
+
+void MailboxSynchronizer::PullTextureUpdates(MailboxManager* manager,
+ uint32 sync_point) {
base::AutoLock lock(lock_);
+ AcquireFenceLocked(sync_point);
+
for (MailboxManager::MailboxToTextureMap::const_iterator texture_it =
manager->mailbox_to_textures_.begin();
texture_it != manager->mailbox_to_textures_.end();
« no previous file with comments | « gpu/command_buffer/service/mailbox_synchronizer.h ('k') | gpu/command_buffer/service/program_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698