summaryrefslogtreecommitdiffstats
path: root/gpu
diff options
context:
space:
mode:
authorraymes@chromium.org <raymes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-10 17:44:14 +0000
committerraymes@chromium.org <raymes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-10 17:44:14 +0000
commitf02e1c269829ef43fb6b71da915cdb5213bc29f5 (patch)
treedf6127b891dd966aa2e5b9fa54fbdc68adec872b /gpu
parentf44641747375590681b98681acc9869a9950c09d (diff)
downloadchromium_src-f02e1c269829ef43fb6b71da915cdb5213bc29f5.zip
chromium_src-f02e1c269829ef43fb6b71da915cdb5213bc29f5.tar.gz
chromium_src-f02e1c269829ef43fb6b71da915cdb5213bc29f5.tar.bz2
Revert 205224 "In RingBuffer::GetLargestFreeSizeNoWaiting, relea..."
Caused build breakage: http://build.chromium.org/p/chromium.chrome/builders/Google%20Chrome%20Linux%20x64/builds/41437 > In RingBuffer::GetLargestFreeSizeNoWaiting, release until current token. > > RingBuffer::GetLargestFreeSizeNoWaiting can release any block for which > tokens have already been seen. > > R=gman@chromium.org > > Review URL: https://codereview.chromium.org/16226019 TBR=qsr@chromium.org Review URL: https://codereview.chromium.org/16578007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@205239 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r--gpu/command_buffer/client/ring_buffer.cc8
-rw-r--r--gpu/command_buffer/client/ring_buffer_test.cc33
2 files changed, 3 insertions, 38 deletions
diff --git a/gpu/command_buffer/client/ring_buffer.cc b/gpu/command_buffer/client/ring_buffer.cc
index 42e09bd..46a86a2 100644
--- a/gpu/command_buffer/client/ring_buffer.cc
+++ b/gpu/command_buffer/client/ring_buffer.cc
@@ -94,12 +94,8 @@ void RingBuffer::FreePendingToken(RingBuffer::Offset offset,
}
unsigned int RingBuffer::GetLargestFreeSizeNoWaiting() {
- unsigned int last_token_read = helper_->last_token_read();
- while (!blocks_.empty()) {
- Block& block = blocks_.front();
- if (block.token > last_token_read || block.state == IN_USE) break;
- FreeOldestBlock();
- }
+ // TODO(gman): Should check what the current token is and free up to that
+ // point.
if (free_offset_ == in_use_offset_) {
if (blocks_.empty()) {
// The entire buffer is free.
diff --git a/gpu/command_buffer/client/ring_buffer_test.cc b/gpu/command_buffer/client/ring_buffer_test.cc
index 921cf39..ceeb2ed 100644
--- a/gpu/command_buffer/client/ring_buffer_test.cc
+++ b/gpu/command_buffer/client/ring_buffer_test.cc
@@ -35,29 +35,7 @@ class BaseRingBufferTest : public testing::Test {
static const unsigned int kBaseOffset = 128;
static const unsigned int kBufferSize = 1024;
- void RunPendingSetToken() {
- for (std::vector<const void*>::iterator it = set_token_arguments_.begin();
- it != set_token_arguments_.end();
- ++it) {
- api_mock_->SetToken(cmd::kSetToken, 1, *it);
- }
- set_token_arguments_.clear();
- delay_set_token_ = false;
- }
-
- void SetToken(unsigned int command,
- unsigned int arg_count,
- const void* _args) {
- EXPECT_EQ(cmd::kSetToken, command);
- EXPECT_EQ(1u, arg_count);
- if (delay_set_token_)
- set_token_arguments_.push_back(_args);
- else
- api_mock_->SetToken(cmd::kSetToken, 1, _args);
- }
-
virtual void SetUp() {
- delay_set_token_ = false;
api_mock_.reset(new AsyncAPIMock);
// ignore noops in the mock - we don't want to inspect the internals of the
// helper.
@@ -65,7 +43,7 @@ class BaseRingBufferTest : public testing::Test {
.WillRepeatedly(Return(error::kNoError));
// Forward the SetToken calls to the engine
EXPECT_CALL(*api_mock_.get(), DoCommand(cmd::kSetToken, 1, _))
- .WillRepeatedly(DoAll(Invoke(this, &BaseRingBufferTest::SetToken),
+ .WillRepeatedly(DoAll(Invoke(api_mock_.get(), &AsyncAPIMock::SetToken),
Return(error::kNoError)));
{
@@ -103,9 +81,6 @@ class BaseRingBufferTest : public testing::Test {
scoped_ptr<CommandBufferService> command_buffer_;
scoped_ptr<GpuScheduler> gpu_scheduler_;
scoped_ptr<CommandBufferHelper> helper_;
- std::vector<const void*> set_token_arguments_;
- bool delay_set_token_;
-
};
#ifndef _MSC_VER
@@ -153,7 +128,6 @@ TEST_F(RingBufferTest, TestFreePendingToken) {
const unsigned int kAllocCount = kBufferSize / kSize;
CHECK(kAllocCount * kSize == kBufferSize);
- delay_set_token_ = true;
// Allocate several buffers to fill in the memory.
int32 tokens[kAllocCount];
for (unsigned int ii = 0; ii < kAllocCount; ++ii) {
@@ -166,8 +140,6 @@ TEST_F(RingBufferTest, TestFreePendingToken) {
EXPECT_EQ(kBufferSize - (kSize * kAllocCount),
allocator_->GetLargestFreeSizeNoWaiting());
- RunPendingSetToken();
-
// This allocation will need to reclaim the space freed above, so that should
// process the commands until a token is passed.
RingBuffer::Offset offset1 = allocator_->Alloc(kSize);
@@ -270,7 +242,6 @@ TEST_F(RingBufferWrapperTest, TestFreePendingToken) {
const unsigned int kAllocCount = kBufferSize / kSize;
CHECK(kAllocCount * kSize == kBufferSize);
- delay_set_token_ = true;
// Allocate several buffers to fill in the memory.
int32 tokens[kAllocCount];
for (unsigned int ii = 0; ii < kAllocCount; ++ii) {
@@ -283,8 +254,6 @@ TEST_F(RingBufferWrapperTest, TestFreePendingToken) {
EXPECT_EQ(kBufferSize - (kSize * kAllocCount),
allocator_->GetLargestFreeSizeNoWaiting());
- RunPendingSetToken();
-
// This allocation will need to reclaim the space freed above, so that should
// process the commands until the token is passed.
void* pointer1 = allocator_->Alloc(kSize);