diff options
author | sievers@google.com <sievers@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-24 18:02:02 +0000 |
---|---|---|
committer | sievers@google.com <sievers@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-24 18:02:02 +0000 |
commit | 6dafc99a98eeabe8ffea451aa7eb4b3668c703c3 (patch) | |
tree | 0a6845769fb8da7eb5b6aac0058f3e28a9de099b /gpu | |
parent | 8b494dad6d8e92f188fb60af2db7f8277dd3974a (diff) | |
download | chromium_src-6dafc99a98eeabe8ffea451aa7eb4b3668c703c3.zip chromium_src-6dafc99a98eeabe8ffea451aa7eb4b3668c703c3.tar.gz chromium_src-6dafc99a98eeabe8ffea451aa7eb4b3668c703c3.tar.bz2 |
Revert 258122 "gpu: Allow fences to check whether a flush has oc..."
Seems to expose some GL call sites without current context.
Reverting for the time being...
BUG=355275
> gpu: Allow fences to check whether a flush has occurred
>
> This skips waiting on a fence that was created but never committed.
>
> BUG=352419
>
> Review URL: https://codereview.chromium.org/197563003
TBR=sievers@chromium.org
Review URL: https://codereview.chromium.org/209853004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@258965 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, 13 insertions, 10 deletions
diff --git a/gpu/command_buffer/service/mailbox_manager_unittest.cc b/gpu/command_buffer/service/mailbox_manager_unittest.cc index 13005e6..ae871f9 100644 --- a/gpu/command_buffer/service/mailbox_manager_unittest.cc +++ b/gpu/command_buffer/service/mailbox_manager_unittest.cc @@ -8,9 +8,7 @@ #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 { @@ -190,9 +188,6 @@ 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() { @@ -254,15 +249,12 @@ 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); @@ -291,6 +283,7 @@ TEST_F(MailboxManagerSyncTest, ProduceSyncDestroy) { EXPECT_EQ(texture, manager_->ConsumeTexture(GL_TEXTURE_2D, name)); // Synchronize + EXPECT_CALL(*gl_, Flush()).Times(1); manager_->PushTextureUpdates(); manager2_->PullTextureUpdates(); @@ -312,6 +305,7 @@ TEST_F(MailboxManagerSyncTest, ProduceConsumeResize) { EXPECT_EQ(texture, manager_->ConsumeTexture(GL_TEXTURE_2D, name)); // Synchronize + EXPECT_CALL(*gl_, Flush()).Times(1); manager_->PushTextureUpdates(); manager2_->PullTextureUpdates(); @@ -340,6 +334,7 @@ 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); @@ -401,6 +396,7 @@ TEST_F(MailboxManagerSyncTest, ProduceConsumeBidirectional) { manager2_->ProduceTexture(GL_TEXTURE_2D, name2, texture2); // Make visible. + EXPECT_CALL(*gl_, Flush()).Times(2); manager_->PushTextureUpdates(); manager2_->PushTextureUpdates(); @@ -439,6 +435,7 @@ 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 d25368a..0503fb1 100644 --- a/gpu/command_buffer/service/mailbox_synchronizer.cc +++ b/gpu/command_buffer/service/mailbox_synchronizer.cc @@ -174,6 +174,8 @@ 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 9b31dac..462131f 100644 --- a/gpu/command_buffer/service/texture_definition.cc +++ b/gpu/command_buffer/service/texture_definition.cc @@ -278,8 +278,12 @@ void NativeImageBuffer::DidRead(gfx::GLImage* client) { void NativeImageBuffer::DidWrite(gfx::GLImage* client) { base::AutoLock lock(lock_); - // Sharing semantics require the client to flush in order to make changes - // visible to other clients. + // 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. write_fence_.reset(gfx::GLFence::CreateWithoutFlush()); write_client_ = client; for (std::list<ClientInfo>::iterator it = client_infos_.begin(); |