diff options
author | sievers@chromium.org <sievers@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-03 14:44:55 +0000 |
---|---|---|
committer | sievers@chromium.org <sievers@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-03 14:44:55 +0000 |
commit | f6c292fff1959661d15b27915d77f65964457e10 (patch) | |
tree | 5fdc07355cdfbe9f0dd4374b5c6b0b012613cdea /gpu | |
parent | eb4319e9a9d5088660f465b652c54b187bf951c8 (diff) | |
download | chromium_src-f6c292fff1959661d15b27915d77f65964457e10.zip chromium_src-f6c292fff1959661d15b27915d77f65964457e10.tar.gz chromium_src-f6c292fff1959661d15b27915d77f65964457e10.tar.bz2 |
Revert r258965 aka reland r258122
gpu: Allow fences to check whether a flush has occurred
This skips waiting on a fence that was created but never committed.
BUG=352419,355275
TBR=piman@chromium.org
> Original Review URL: https://codereview.chromium.org/197563003
Review URL: https://codereview.chromium.org/222103008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@261383 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r-- | gpu/command_buffer/service/mailbox_manager_unittest.cc | 13 | ||||
-rw-r--r-- | gpu/command_buffer/service/mailbox_synchronizer.cc | 2 | ||||
-rw-r--r-- | gpu/command_buffer/service/texture_definition.cc | 8 |
3 files changed, 10 insertions, 13 deletions
diff --git a/gpu/command_buffer/service/mailbox_manager_unittest.cc b/gpu/command_buffer/service/mailbox_manager_unittest.cc index ae871f9..13005e6 100644 --- a/gpu/command_buffer/service/mailbox_manager_unittest.cc +++ b/gpu/command_buffer/service/mailbox_manager_unittest.cc @@ -8,7 +8,9 @@ #include "gpu/command_buffer/service/mailbox_synchronizer.h" #include "gpu/command_buffer/service/texture_manager.h" #include "testing/gtest/include/gtest/gtest.h" +#include "ui/gl/gl_context_stub.h" #include "ui/gl/gl_mock.h" +#include "ui/gl/gl_surface_stub.h" namespace gpu { namespace gles2 { @@ -188,6 +190,9 @@ class MailboxManagerSyncTest : public MailboxManagerTest { manager2_ = new MailboxManager; gl_.reset(new ::testing::StrictMock< ::gfx::MockGLInterface>()); ::gfx::MockGLInterface::SetGLInterface(gl_.get()); + context_ = new gfx::GLContextStub(); + surface_ = new gfx::GLSurfaceStub(); + context_->MakeCurrent(surface_); } Texture* DefineTexture() { @@ -249,12 +254,15 @@ class MailboxManagerSyncTest : public MailboxManagerTest { virtual void TearDown() { MailboxManagerTest::TearDown(); MailboxSynchronizer::Terminate(); + context_->ReleaseCurrent(NULL); ::gfx::MockGLInterface::SetGLInterface(NULL); gl_.reset(); } scoped_ptr< ::testing::StrictMock< ::gfx::MockGLInterface> > gl_; scoped_refptr<MailboxManager> manager2_; + scoped_refptr<gfx::GLContext> context_; + scoped_refptr<gfx::GLSurface> surface_; private: DISALLOW_COPY_AND_ASSIGN(MailboxManagerSyncTest); @@ -283,7 +291,6 @@ TEST_F(MailboxManagerSyncTest, ProduceSyncDestroy) { EXPECT_EQ(texture, manager_->ConsumeTexture(GL_TEXTURE_2D, name)); // Synchronize - EXPECT_CALL(*gl_, Flush()).Times(1); manager_->PushTextureUpdates(); manager2_->PullTextureUpdates(); @@ -305,7 +312,6 @@ TEST_F(MailboxManagerSyncTest, ProduceConsumeResize) { EXPECT_EQ(texture, manager_->ConsumeTexture(GL_TEXTURE_2D, name)); // Synchronize - EXPECT_CALL(*gl_, Flush()).Times(1); manager_->PushTextureUpdates(); manager2_->PullTextureUpdates(); @@ -334,7 +340,6 @@ TEST_F(MailboxManagerSyncTest, ProduceConsumeResize) { EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL); // Synchronize again - EXPECT_CALL(*gl_, Flush()).Times(1); manager_->PushTextureUpdates(); SetupUpdateTexParamExpectations( kNewTextureId, GL_LINEAR, GL_LINEAR, GL_REPEAT, GL_REPEAT); @@ -396,7 +401,6 @@ TEST_F(MailboxManagerSyncTest, ProduceConsumeBidirectional) { manager2_->ProduceTexture(GL_TEXTURE_2D, name2, texture2); // Make visible. - EXPECT_CALL(*gl_, Flush()).Times(2); manager_->PushTextureUpdates(); manager2_->PushTextureUpdates(); @@ -435,7 +439,6 @@ TEST_F(MailboxManagerSyncTest, ProduceConsumeBidirectional) { Mock::VerifyAndClearExpectations(gl_.get()); // Synchronize in both directions - EXPECT_CALL(*gl_, Flush()).Times(2); manager_->PushTextureUpdates(); manager2_->PushTextureUpdates(); // manager1 should see the change to texture2 mag_filter being applied. diff --git a/gpu/command_buffer/service/mailbox_synchronizer.cc b/gpu/command_buffer/service/mailbox_synchronizer.cc index 0503fb1..d25368a 100644 --- a/gpu/command_buffer/service/mailbox_synchronizer.cc +++ b/gpu/command_buffer/service/mailbox_synchronizer.cc @@ -174,8 +174,6 @@ void MailboxSynchronizer::PushTextureUpdates(MailboxManager* manager) { textures_.insert(std::make_pair(texture, TextureVersion(group))); } } - // Make sure all write fences are flushed. - glFlush(); } void MailboxSynchronizer::UpdateTextureLocked(Texture* texture, diff --git a/gpu/command_buffer/service/texture_definition.cc b/gpu/command_buffer/service/texture_definition.cc index 462131f..9b31dac 100644 --- a/gpu/command_buffer/service/texture_definition.cc +++ b/gpu/command_buffer/service/texture_definition.cc @@ -278,12 +278,8 @@ void NativeImageBuffer::DidRead(gfx::GLImage* client) { void NativeImageBuffer::DidWrite(gfx::GLImage* client) { base::AutoLock lock(lock_); - // TODO(sievers): crbug.com/352419 - // This is super-risky. We need to somehow find out about when the current - // context gets flushed, so that we will only ever wait on the write fence - // (esp. from another context) if it was flushed and is guaranteed to clear. - // On the other hand, proactively flushing here is not feasible in terms - // of perf when there are multiple draw calls per frame. + // Sharing semantics require the client to flush in order to make changes + // visible to other clients. write_fence_.reset(gfx::GLFence::CreateWithoutFlush()); write_client_ = client; for (std::list<ClientInfo>::iterator it = client_infos_.begin(); |