summaryrefslogtreecommitdiff
path: root/chromium/gpu/command_buffer/client
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2017-04-05 14:08:31 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2017-04-11 07:46:53 +0000
commit6a4cabb866f66d4128a97cdc6d9d08ce074f1247 (patch)
treeab00f70a5e89278d6a0d16ff0c42578dc4d84a2d /chromium/gpu/command_buffer/client
parente733310db58160074f574c429d48f8308c0afe17 (diff)
downloadqtwebengine-chromium-6a4cabb866f66d4128a97cdc6d9d08ce074f1247.tar.gz
BASELINE: Update Chromium to 57.0.2987.144
Change-Id: I29db402ff696c71a04c4dbaec822c2e53efe0267 Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
Diffstat (limited to 'chromium/gpu/command_buffer/client')
-rw-r--r--chromium/gpu/command_buffer/client/client_context_state.cc13
-rw-r--r--chromium/gpu/command_buffer/client/client_context_state.h8
-rw-r--r--chromium/gpu/command_buffer/client/client_test_helper.cc46
-rw-r--r--chromium/gpu/command_buffer/client/client_test_helper.h9
-rw-r--r--chromium/gpu/command_buffer/client/cmd_buffer_helper.cc78
-rw-r--r--chromium/gpu/command_buffer/client/cmd_buffer_helper.h54
-rw-r--r--chromium/gpu/command_buffer/client/cmd_buffer_helper_test.cc6
-rw-r--r--chromium/gpu/command_buffer/client/context_support.h7
-rw-r--r--chromium/gpu/command_buffer/client/gles2_c_lib_autogen.h24
-rw-r--r--chromium/gpu/command_buffer/client/gles2_cmd_helper_autogen.h25
-rw-r--r--chromium/gpu/command_buffer/client/gles2_implementation.cc99
-rw-r--r--chromium/gpu/command_buffer/client/gles2_implementation.h3
-rw-r--r--chromium/gpu/command_buffer/client/gles2_implementation_autogen.h9
-rw-r--r--chromium/gpu/command_buffer/client/gles2_implementation_impl_autogen.h72
-rw-r--r--chromium/gpu/command_buffer/client/gles2_implementation_unittest.cc4
-rw-r--r--chromium/gpu/command_buffer/client/gles2_implementation_unittest_autogen.h17
-rw-r--r--chromium/gpu/command_buffer/client/gles2_interface_autogen.h8
-rw-r--r--chromium/gpu/command_buffer/client/gles2_interface_stub_autogen.h8
-rw-r--r--chromium/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h9
-rw-r--r--chromium/gpu/command_buffer/client/gles2_trace_implementation_autogen.h8
-rw-r--r--chromium/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h26
-rw-r--r--chromium/gpu/command_buffer/client/gpu_control.h29
-rw-r--r--chromium/gpu/command_buffer/client/gpu_memory_buffer_manager.h14
-rw-r--r--chromium/gpu/command_buffer/client/mapped_memory.cc10
-rw-r--r--chromium/gpu/command_buffer/client/mapped_memory.h9
-rw-r--r--chromium/gpu/command_buffer/client/ring_buffer.cc3
26 files changed, 373 insertions, 225 deletions
diff --git a/chromium/gpu/command_buffer/client/client_context_state.cc b/chromium/gpu/command_buffer/client/client_context_state.cc
index df81f30a264..132142383bd 100644
--- a/chromium/gpu/command_buffer/client/client_context_state.cc
+++ b/chromium/gpu/command_buffer/client/client_context_state.cc
@@ -4,6 +4,8 @@
#include "gpu/command_buffer/client/client_context_state.h"
+#include "base/logging.h"
+
namespace gpu {
namespace gles2 {
@@ -13,6 +15,17 @@ ClientContextState::ClientContextState() {
ClientContextState::~ClientContextState() {
}
+void ClientContextState::SetViewport(
+ GLint x, GLint y, GLsizei width, GLsizei height) {
+ DCHECK_LE(0, width);
+ DCHECK_LE(0, height);
+
+ viewport_x = x;
+ viewport_y = y;
+ viewport_width = width;
+ viewport_height = height;
+}
+
// Include the auto-generated part of this file. We split this because it means
// we can easily edit the non-auto generated parts right here in this file
// instead of having to edit some template or the code generator.
diff --git a/chromium/gpu/command_buffer/client/client_context_state.h b/chromium/gpu/command_buffer/client/client_context_state.h
index 45cd14b40a8..e9f5ad15f31 100644
--- a/chromium/gpu/command_buffer/client/client_context_state.h
+++ b/chromium/gpu/command_buffer/client/client_context_state.h
@@ -26,9 +26,17 @@ struct GLES2_IMPL_EXPORT ClientContextState {
// 'changed' will be true if the state was different from 'enabled.
bool SetCapabilityState(GLenum cap, bool enabled, bool* changed);
+ // Cache the user's valid viewport.
+ void SetViewport(GLint x, GLint y, GLsizei width, GLsizei height);
+
#include "gpu/command_buffer/client/client_context_state_autogen.h"
EnableFlags enable_flags;
+
+ GLint viewport_x = 0;
+ GLint viewport_y = 0;
+ GLsizei viewport_width = 0;
+ GLsizei viewport_height = 0;
};
} // namespace gles2
diff --git a/chromium/gpu/command_buffer/client/client_test_helper.cc b/chromium/gpu/command_buffer/client/client_test_helper.cc
index ff7e0694487..12c889c6424 100644
--- a/chromium/gpu/command_buffer/client/client_test_helper.cc
+++ b/chromium/gpu/command_buffer/client/client_test_helper.cc
@@ -20,30 +20,33 @@ using ::testing::Invoke;
namespace gpu {
-MockCommandBufferBase::MockCommandBufferBase() : put_offset_(0) {
-}
+MockCommandBufferBase::MockCommandBufferBase() : put_offset_(0) {}
-MockCommandBufferBase::~MockCommandBufferBase() {
-}
+MockCommandBufferBase::~MockCommandBufferBase() {}
CommandBuffer::State MockCommandBufferBase::GetLastState() {
return state_;
}
-int32_t MockCommandBufferBase::GetLastToken() {
- return state_.token;
-}
-
void MockCommandBufferBase::SetGetOffset(int32_t get_offset) {
state_.get_offset = get_offset;
}
-void MockCommandBufferBase::WaitForTokenInRange(int32_t start, int32_t end) {}
+void MockCommandBufferBase::SetReleaseCount(uint64_t release_count) {
+ state_.release_count = release_count;
+}
+
+CommandBuffer::State MockCommandBufferBase::WaitForTokenInRange(int32_t start,
+ int32_t end) {
+ return state_;
+}
-void MockCommandBufferBase::WaitForGetOffsetInRange(int32_t start,
- int32_t end) {
+CommandBuffer::State MockCommandBufferBase::WaitForGetOffsetInRange(
+ int32_t start,
+ int32_t end) {
state_.get_offset = put_offset_;
OnFlush();
+ return state_;
}
void MockCommandBufferBase::SetGetBuffer(int transfer_buffer_id) {
@@ -125,8 +128,7 @@ MockClientCommandBuffer::MockClientCommandBuffer() {
DelegateToFake();
}
-MockClientCommandBuffer::~MockClientCommandBuffer() {
-}
+MockClientCommandBuffer::~MockClientCommandBuffer() {}
void MockClientCommandBuffer::Flush(int32_t put_offset) {
FlushHelper(put_offset);
@@ -138,30 +140,24 @@ void MockClientCommandBuffer::OrderingBarrier(int32_t put_offset) {
void MockClientCommandBuffer::DelegateToFake() {
ON_CALL(*this, DestroyTransferBuffer(_))
- .WillByDefault(Invoke(
- this, &MockCommandBufferBase::DestroyTransferBufferHelper));
+ .WillByDefault(
+ Invoke(this, &MockCommandBufferBase::DestroyTransferBufferHelper));
}
MockClientCommandBufferMockFlush::MockClientCommandBufferMockFlush() {
DelegateToFake();
}
-MockClientCommandBufferMockFlush::~MockClientCommandBufferMockFlush() {
-}
+MockClientCommandBufferMockFlush::~MockClientCommandBufferMockFlush() {}
void MockClientCommandBufferMockFlush::DelegateToFake() {
MockClientCommandBuffer::DelegateToFake();
ON_CALL(*this, Flush(_))
- .WillByDefault(Invoke(
- this, &MockCommandBufferBase::FlushHelper));
+ .WillByDefault(Invoke(this, &MockCommandBufferBase::FlushHelper));
}
-MockClientGpuControl::MockClientGpuControl() {
-}
+MockClientGpuControl::MockClientGpuControl() {}
-MockClientGpuControl::~MockClientGpuControl() {
-}
+MockClientGpuControl::~MockClientGpuControl() {}
} // namespace gpu
-
-
diff --git a/chromium/gpu/command_buffer/client/client_test_helper.h b/chromium/gpu/command_buffer/client/client_test_helper.h
index 3b85773f397..9df3e6bac71 100644
--- a/chromium/gpu/command_buffer/client/client_test_helper.h
+++ b/chromium/gpu/command_buffer/client/client_test_helper.h
@@ -24,8 +24,6 @@
namespace gpu {
-class CommandBufferHelper;
-
class MockCommandBufferBase : public CommandBufferServiceBase {
public:
static const int32_t kTransferBufferBaseId = 0x123;
@@ -35,11 +33,11 @@ class MockCommandBufferBase : public CommandBufferServiceBase {
~MockCommandBufferBase() override;
State GetLastState() override;
- int32_t GetLastToken() override;
- void WaitForTokenInRange(int32_t start, int32_t end) override;
- void WaitForGetOffsetInRange(int32_t start, int32_t end) override;
+ State WaitForTokenInRange(int32_t start, int32_t end) override;
+ State WaitForGetOffsetInRange(int32_t start, int32_t end) override;
void SetGetBuffer(int transfer_buffer_id) override;
void SetGetOffset(int32_t get_offset) override;
+ void SetReleaseCount(uint64_t release_count) override;
scoped_refptr<gpu::Buffer> CreateTransferBuffer(size_t size,
int32_t* id) override;
scoped_refptr<gpu::Buffer> GetTransferBuffer(int32_t id) override;
@@ -121,6 +119,7 @@ class MockClientGpuControl : public GpuControl {
MOCK_METHOD1(IsFenceSyncRelease, bool(uint64_t release));
MOCK_METHOD1(IsFenceSyncFlushed, bool(uint64_t release));
MOCK_METHOD1(IsFenceSyncFlushReceived, bool(uint64_t release));
+ MOCK_METHOD1(IsFenceSyncReleased, bool(uint64_t release));
MOCK_METHOD2(SignalSyncToken, void(const SyncToken& sync_token,
const base::Closure& callback));
MOCK_METHOD1(CanWaitUnverifiedSyncToken, bool(const SyncToken*));
diff --git a/chromium/gpu/command_buffer/client/cmd_buffer_helper.cc b/chromium/gpu/command_buffer/client/cmd_buffer_helper.cc
index 0304b8f7e5d..7021fa399f4 100644
--- a/chromium/gpu/command_buffer/client/cmd_buffer_helper.cc
+++ b/chromium/gpu/command_buffer/client/cmd_buffer_helper.cc
@@ -27,12 +27,14 @@ CommandBufferHelper::CommandBufferHelper(CommandBuffer* command_buffer)
: command_buffer_(command_buffer),
ring_buffer_id_(-1),
ring_buffer_size_(0),
- entries_(NULL),
+ entries_(nullptr),
total_entry_count_(0),
immediate_entry_count_(0),
token_(0),
put_(0),
last_put_sent_(0),
+ cached_last_token_read_(0),
+ cached_get_offset_(0),
#if defined(CMD_HELPER_PERIODIC_FLUSH_CHECK)
commands_issued_(0),
#endif
@@ -40,13 +42,6 @@ CommandBufferHelper::CommandBufferHelper(CommandBuffer* command_buffer)
context_lost_(false),
flush_automatically_(true),
flush_generation_(0) {
- // In certain cases, ThreadTaskRunnerHandle isn't set (Android Webview).
- // Don't register a dump provider in these cases.
- // TODO(ericrk): Get this working in Android Webview. crbug.com/517156
- if (base::ThreadTaskRunnerHandle::IsSet()) {
- base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider(
- this, "gpu::CommandBufferHelper", base::ThreadTaskRunnerHandle::Get());
- }
}
void CommandBufferHelper::SetAutomaticFlushes(bool enabled) {
@@ -55,9 +50,8 @@ void CommandBufferHelper::SetAutomaticFlushes(bool enabled) {
}
bool CommandBufferHelper::IsContextLost() {
- if (!context_lost_) {
- context_lost_ = error::IsError(command_buffer()->GetLastError());
- }
+ if (!context_lost_)
+ context_lost_ = error::IsError(command_buffer()->GetLastState().error);
return context_lost_;
}
@@ -71,7 +65,7 @@ void CommandBufferHelper::CalcImmediateEntries(int waiting_count) {
}
// Get maximum safe contiguous entries.
- const int32_t curr_get = get_offset();
+ const int32_t curr_get = cached_get_offset_;
if (curr_get > put_) {
immediate_entry_count_ = curr_get - put_ - 1;
} else {
@@ -116,7 +110,7 @@ bool CommandBufferHelper::AllocateRingBuffer() {
command_buffer_->CreateTransferBuffer(ring_buffer_size_, &id);
if (id < 0) {
ClearUsable();
- DCHECK(error::IsError(command_buffer()->GetLastError()));
+ DCHECK(context_lost_);
return false;
}
@@ -128,6 +122,7 @@ bool CommandBufferHelper::AllocateRingBuffer() {
// Call to SetGetBuffer(id) above resets get and put offsets to 0.
// No need to query it through IPC.
put_ = 0;
+ cached_get_offset_ = 0;
CalcImmediateEntries(0);
return true;
}
@@ -143,8 +138,8 @@ void CommandBufferHelper::FreeResources() {
}
void CommandBufferHelper::FreeRingBuffer() {
- CHECK((put_ == get_offset()) ||
- error::IsError(command_buffer_->GetLastState().error));
+ CHECK((put_ == cached_get_offset_) ||
+ error::IsError(command_buffer_->GetLastState().error));
FreeResources();
}
@@ -154,19 +149,25 @@ bool CommandBufferHelper::Initialize(int32_t ring_buffer_size) {
}
CommandBufferHelper::~CommandBufferHelper() {
- base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvider(
- this);
FreeResources();
}
+void CommandBufferHelper::UpdateCachedState(const CommandBuffer::State& state) {
+ cached_get_offset_ = state.get_offset;
+ cached_last_token_read_ = state.token;
+ context_lost_ = error::IsError(state.error);
+}
+
bool CommandBufferHelper::WaitForGetOffsetInRange(int32_t start, int32_t end) {
DCHECK(start >= 0 && start <= total_entry_count_);
DCHECK(end >= 0 && end <= total_entry_count_);
if (!usable()) {
return false;
}
- command_buffer_->WaitForGetOffsetInRange(start, end);
- return command_buffer_->GetLastError() == gpu::error::kNoError;
+ CommandBuffer::State last_state =
+ command_buffer_->WaitForGetOffsetInRange(start, end);
+ UpdateCachedState(last_state);
+ return !context_lost_;
}
void CommandBufferHelper::Flush() {
@@ -213,7 +214,7 @@ bool CommandBufferHelper::Finish() {
return false;
}
// If there is no work just exit.
- if (put_ == get_offset()) {
+ if (put_ == cached_get_offset_) {
return true;
}
DCHECK(HaveRingBuffer() ||
@@ -221,7 +222,7 @@ bool CommandBufferHelper::Finish() {
Flush();
if (!WaitForGetOffsetInRange(put_, put_))
return false;
- DCHECK_EQ(get_offset(), put_);
+ DCHECK_EQ(cached_get_offset_, put_);
CalcImmediateEntries(0);
@@ -246,14 +247,25 @@ int32_t CommandBufferHelper::InsertToken() {
cmd->Init(token_);
if (token_ == 0) {
TRACE_EVENT0("gpu", "CommandBufferHelper::InsertToken(wrapped)");
- // we wrapped
- Finish();
- DCHECK_EQ(token_, last_token_read());
+ bool finished = Finish(); // we wrapped
+ DCHECK(!finished || (cached_last_token_read_ == 0));
}
}
return token_;
}
+bool CommandBufferHelper::HasTokenPassed(int32_t token) {
+ // If token_ wrapped around we Finish'd.
+ if (token > token_)
+ return true;
+ // Don't update state if we don't have to.
+ if (token <= cached_last_token_read_)
+ return true;
+ CommandBuffer::State last_state = command_buffer_->GetLastState();
+ UpdateCachedState(last_state);
+ return token <= cached_last_token_read_;
+}
+
// Waits until the current token value is greater or equal to the value passed
// in argument.
void CommandBufferHelper::WaitForToken(int32_t token) {
@@ -263,11 +275,17 @@ void CommandBufferHelper::WaitForToken(int32_t token) {
// Return immediately if corresponding InsertToken failed.
if (token < 0)
return;
- if (token > token_) return; // we wrapped
- if (last_token_read() >= token)
+ if (token > token_)
+ return; // we wrapped
+ if (cached_last_token_read_ >= token)
+ return;
+ UpdateCachedState(command_buffer_->GetLastState());
+ if (cached_last_token_read_ >= token)
return;
Flush();
- command_buffer_->WaitForTokenInRange(token, token_);
+ CommandBuffer::State last_state =
+ command_buffer_->WaitForTokenInRange(token, token_);
+ UpdateCachedState(last_state);
}
// Waits for available entries, basically waiting until get >= put + count + 1.
@@ -288,13 +306,13 @@ void CommandBufferHelper::WaitForAvailableEntries(int32_t count) {
// but we need to make sure get wraps first, actually that get is 1 or
// more (since put will wrap to 0 after we add the noops).
DCHECK_LE(1, put_);
- int32_t curr_get = get_offset();
+ int32_t curr_get = cached_get_offset_;
if (curr_get > put_ || curr_get == 0) {
TRACE_EVENT0("gpu", "CommandBufferHelper::WaitForAvailableEntries");
Flush();
if (!WaitForGetOffsetInRange(1, put_))
return;
- curr_get = get_offset();
+ curr_get = cached_get_offset_;
DCHECK_LE(curr_get, put_);
DCHECK_NE(0, curr_get);
}
@@ -328,7 +346,7 @@ void CommandBufferHelper::WaitForAvailableEntries(int32_t count) {
}
int32_t CommandBufferHelper::GetTotalFreeEntriesNoWaiting() const {
- int32_t current_get_offset = get_offset();
+ int32_t current_get_offset = cached_get_offset_;
if (current_get_offset > put_) {
return current_get_offset - put_ - 1;
} else {
diff --git a/chromium/gpu/command_buffer/client/cmd_buffer_helper.h b/chromium/gpu/command_buffer/client/cmd_buffer_helper.h
index 0c0edddfd7b..3ea507f8975 100644
--- a/chromium/gpu/command_buffer/client/cmd_buffer_helper.h
+++ b/chromium/gpu/command_buffer/client/cmd_buffer_helper.h
@@ -102,11 +102,7 @@ class GPU_EXPORT CommandBufferHelper
// Returns true if the token has passed.
// Parameters:
// the value of the token to check whether it has passed
- bool HasTokenPassed(int32_t token) const {
- if (token > token_)
- return true; // we wrapped
- return last_token_read() >= token;
- }
+ bool HasTokenPassed(int32_t token);
// Waits until the token of a particular value has passed through the command
// stream (i.e. commands inserted before that token have been executed).
@@ -179,12 +175,6 @@ class GPU_EXPORT CommandBufferHelper
return data;
}
- int32_t last_token_read() const { return command_buffer_->GetLastToken(); }
-
- int32_t get_offset() const {
- return command_buffer_->GetLastState().get_offset;
- }
-
// Common Commands
void Noop(uint32_t skip_count) {
cmd::Noop* cmd = GetImmediateCmdSpace<cmd::Noop>(
@@ -215,10 +205,7 @@ class GPU_EXPORT CommandBufferHelper
uint32_t shared_memory_offset) {
cmd::SetBucketData* cmd = GetCmdSpace<cmd::SetBucketData>();
if (cmd) {
- cmd->Init(bucket_id,
- offset,
- size,
- shared_memory_id,
+ cmd->Init(bucket_id, offset, size, shared_memory_id,
shared_memory_offset);
}
}
@@ -243,12 +230,8 @@ class GPU_EXPORT CommandBufferHelper
uint32_t data_memory_offset) {
cmd::GetBucketStart* cmd = GetCmdSpace<cmd::GetBucketStart>();
if (cmd) {
- cmd->Init(bucket_id,
- result_memory_id,
- result_memory_offset,
- data_memory_size,
- data_memory_id,
- data_memory_offset);
+ cmd->Init(bucket_id, result_memory_id, result_memory_offset,
+ data_memory_size, data_memory_id, data_memory_offset);
}
}
@@ -259,17 +242,12 @@ class GPU_EXPORT CommandBufferHelper
uint32_t shared_memory_offset) {
cmd::GetBucketData* cmd = GetCmdSpace<cmd::GetBucketData>();
if (cmd) {
- cmd->Init(bucket_id,
- offset,
- size,
- shared_memory_id,
+ cmd->Init(bucket_id, offset, size, shared_memory_id,
shared_memory_offset);
}
}
- CommandBuffer* command_buffer() const {
- return command_buffer_;
- }
+ CommandBuffer* command_buffer() const { return command_buffer_; }
scoped_refptr<Buffer> get_ring_buffer() const { return ring_buffer_; }
@@ -277,13 +255,9 @@ class GPU_EXPORT CommandBufferHelper
void FreeRingBuffer();
- bool HaveRingBuffer() const {
- return ring_buffer_id_ != -1;
- }
+ bool HaveRingBuffer() const { return ring_buffer_id_ != -1; }
- bool usable () const {
- return usable_;
- }
+ bool usable() const { return usable_; }
void ClearUsable() {
usable_ = false;
@@ -296,11 +270,6 @@ class GPU_EXPORT CommandBufferHelper
base::trace_event::ProcessMemoryDump* pmd) override;
private:
- // Returns the number of available entries (they may not be contiguous).
- int32_t AvailableEntries() {
- return (get_offset() - put_ - 1 + total_entry_count_) % total_entry_count_;
- }
-
void CalcImmediateEntries(int waiting_count);
bool AllocateRingBuffer();
void FreeResources();
@@ -316,6 +285,10 @@ class GPU_EXPORT CommandBufferHelper
int32_t GetTotalFreeEntriesNoWaiting() const;
+ // Updates |cached_get_offset_|, |cached_last_token_read_| and |context_lost_|
+ // from given command buffer state.
+ void UpdateCachedState(const CommandBuffer::State& state);
+
CommandBuffer* command_buffer_;
int32_t ring_buffer_id_;
int32_t ring_buffer_size_;
@@ -326,7 +299,8 @@ class GPU_EXPORT CommandBufferHelper
int32_t token_;
int32_t put_;
int32_t last_put_sent_;
- int32_t last_barrier_put_sent_;
+ int32_t cached_last_token_read_;
+ int32_t cached_get_offset_;
#if defined(CMD_HELPER_PERIODIC_FLUSH_CHECK)
int commands_issued_;
diff --git a/chromium/gpu/command_buffer/client/cmd_buffer_helper_test.cc b/chromium/gpu/command_buffer/client/cmd_buffer_helper_test.cc
index 40ae25e700f..3489ea8b8de 100644
--- a/chromium/gpu/command_buffer/client/cmd_buffer_helper_test.cc
+++ b/chromium/gpu/command_buffer/client/cmd_buffer_helper_test.cc
@@ -68,7 +68,7 @@ class CommandBufferServiceLocked : public CommandBufferService {
int FlushCount() { return flush_count_; }
- void WaitForGetOffsetInRange(int32_t start, int32_t end) override {
+ State WaitForGetOffsetInRange(int32_t start, int32_t end) override {
// Flush only if it's required to unblock this Wait.
if (last_flush_ != -1 &&
!CommandBuffer::InRange(start, end, previous_put_offset_)) {
@@ -76,7 +76,7 @@ class CommandBufferServiceLocked : public CommandBufferService {
CommandBufferService::Flush(last_flush_);
last_flush_ = -1;
}
- CommandBufferService::WaitForGetOffsetInRange(start, end);
+ return CommandBufferService::WaitForGetOffsetInRange(start, end);
}
private:
@@ -247,7 +247,7 @@ class CommandBufferHelperTest : public testing::Test {
int32_t GetPutOffset() { return command_buffer_->GetPutOffset(); }
- int32_t GetHelperGetOffset() { return helper_->get_offset(); }
+ int32_t GetHelperGetOffset() { return helper_->cached_get_offset_; }
int32_t GetHelperPutOffset() { return helper_->put_; }
diff --git a/chromium/gpu/command_buffer/client/context_support.h b/chromium/gpu/command_buffer/client/context_support.h
index c2d71734144..2e40d51d314 100644
--- a/chromium/gpu/command_buffer/client/context_support.h
+++ b/chromium/gpu/command_buffer/client/context_support.h
@@ -21,10 +21,15 @@ struct SyncToken;
class ContextSupport {
public:
- // Runs |callback| when a sync token is signalled.
+ // Runs |callback| when the given sync token is signalled. The sync token may
+ // belong to any context.
virtual void SignalSyncToken(const SyncToken& sync_token,
const base::Closure& callback) = 0;
+ // Returns true if the given sync token has been signalled. The sync token
+ // must belong to this context. This may be called from any thread.
+ virtual bool IsSyncTokenSignalled(const SyncToken& sync_token) = 0;
+
// Runs |callback| when a query created via glCreateQueryEXT() has cleared
// passed the glEndQueryEXT() point.
virtual void SignalQuery(uint32_t query, const base::Closure& callback) = 0;
diff --git a/chromium/gpu/command_buffer/client/gles2_c_lib_autogen.h b/chromium/gpu/command_buffer/client/gles2_c_lib_autogen.h
index 934fe97620c..77720ecfe74 100644
--- a/chromium/gpu/command_buffer/client/gles2_c_lib_autogen.h
+++ b/chromium/gpu/command_buffer/client/gles2_c_lib_autogen.h
@@ -1338,19 +1338,23 @@ void GL_APIENTRY GLES2PostSubBufferCHROMIUM(GLint x,
gles2::GetGLContext()->PostSubBufferCHROMIUM(x, y, width, height);
}
void GL_APIENTRY GLES2CopyTextureCHROMIUM(GLenum source_id,
+ GLint source_level,
GLenum dest_id,
+ GLint dest_level,
GLint internalformat,
GLenum dest_type,
GLboolean unpack_flip_y,
GLboolean unpack_premultiply_alpha,
GLboolean unpack_unmultiply_alpha) {
gles2::GetGLContext()->CopyTextureCHROMIUM(
- source_id, dest_id, internalformat, dest_type, unpack_flip_y,
- unpack_premultiply_alpha, unpack_unmultiply_alpha);
+ source_id, source_level, dest_id, dest_level, internalformat, dest_type,
+ unpack_flip_y, unpack_premultiply_alpha, unpack_unmultiply_alpha);
}
void GL_APIENTRY
GLES2CopySubTextureCHROMIUM(GLenum source_id,
+ GLint source_level,
GLenum dest_id,
+ GLint dest_level,
GLint xoffset,
GLint yoffset,
GLint x,
@@ -1361,8 +1365,9 @@ GLES2CopySubTextureCHROMIUM(GLenum source_id,
GLboolean unpack_premultiply_alpha,
GLboolean unpack_unmultiply_alpha) {
gles2::GetGLContext()->CopySubTextureCHROMIUM(
- source_id, dest_id, xoffset, yoffset, x, y, width, height, unpack_flip_y,
- unpack_premultiply_alpha, unpack_unmultiply_alpha);
+ source_id, source_level, dest_id, dest_level, xoffset, yoffset, x, y,
+ width, height, unpack_flip_y, unpack_premultiply_alpha,
+ unpack_unmultiply_alpha);
}
void GL_APIENTRY GLES2CompressedCopyTextureCHROMIUM(GLenum source_id,
GLenum dest_id) {
@@ -1709,6 +1714,13 @@ GLES2UniformMatrix4fvStreamTextureMatrixCHROMIUM(GLint location,
gles2::GetGLContext()->UniformMatrix4fvStreamTextureMatrixCHROMIUM(
location, transpose, transform);
}
+void GL_APIENTRY GLES2OverlayPromotionHintCHROMIUM(GLuint texture,
+ GLboolean promotion_hint,
+ GLint display_x,
+ GLint display_y) {
+ gles2::GetGLContext()->OverlayPromotionHintCHROMIUM(texture, promotion_hint,
+ display_x, display_y);
+}
void GL_APIENTRY GLES2SwapBuffersWithDamageCHROMIUM(GLint x,
GLint y,
GLint width,
@@ -3015,6 +3027,10 @@ extern const NameToFunc g_gles2_function_table[] = {
glUniformMatrix4fvStreamTextureMatrixCHROMIUM),
},
{
+ "glOverlayPromotionHintCHROMIUM",
+ reinterpret_cast<GLES2FunctionPointer>(glOverlayPromotionHintCHROMIUM),
+ },
+ {
"glSwapBuffersWithDamageCHROMIUM",
reinterpret_cast<GLES2FunctionPointer>(glSwapBuffersWithDamageCHROMIUM),
},
diff --git a/chromium/gpu/command_buffer/client/gles2_cmd_helper_autogen.h b/chromium/gpu/command_buffer/client/gles2_cmd_helper_autogen.h
index 5cb447980de..300fc739ee5 100644
--- a/chromium/gpu/command_buffer/client/gles2_cmd_helper_autogen.h
+++ b/chromium/gpu/command_buffer/client/gles2_cmd_helper_autogen.h
@@ -2505,7 +2505,9 @@ void PostSubBufferCHROMIUM(GLint x, GLint y, GLint width, GLint height) {
}
void CopyTextureCHROMIUM(GLenum source_id,
+ GLint source_level,
GLenum dest_id,
+ GLint dest_level,
GLint internalformat,
GLenum dest_type,
GLboolean unpack_flip_y,
@@ -2514,13 +2516,16 @@ void CopyTextureCHROMIUM(GLenum source_id,
gles2::cmds::CopyTextureCHROMIUM* c =
GetCmdSpace<gles2::cmds::CopyTextureCHROMIUM>();
if (c) {
- c->Init(source_id, dest_id, internalformat, dest_type, unpack_flip_y,
- unpack_premultiply_alpha, unpack_unmultiply_alpha);
+ c->Init(source_id, source_level, dest_id, dest_level, internalformat,
+ dest_type, unpack_flip_y, unpack_premultiply_alpha,
+ unpack_unmultiply_alpha);
}
}
void CopySubTextureCHROMIUM(GLenum source_id,
+ GLint source_level,
GLenum dest_id,
+ GLint dest_level,
GLint xoffset,
GLint yoffset,
GLint x,
@@ -2533,8 +2538,9 @@ void CopySubTextureCHROMIUM(GLenum source_id,
gles2::cmds::CopySubTextureCHROMIUM* c =
GetCmdSpace<gles2::cmds::CopySubTextureCHROMIUM>();
if (c) {
- c->Init(source_id, dest_id, xoffset, yoffset, x, y, width, height,
- unpack_flip_y, unpack_premultiply_alpha, unpack_unmultiply_alpha);
+ c->Init(source_id, source_level, dest_id, dest_level, xoffset, yoffset, x,
+ y, width, height, unpack_flip_y, unpack_premultiply_alpha,
+ unpack_unmultiply_alpha);
}
}
@@ -3166,6 +3172,17 @@ void UniformMatrix4fvStreamTextureMatrixCHROMIUMImmediate(
}
}
+void OverlayPromotionHintCHROMIUM(GLuint texture,
+ GLboolean promotion_hint,
+ GLint display_x,
+ GLint display_y) {
+ gles2::cmds::OverlayPromotionHintCHROMIUM* c =
+ GetCmdSpace<gles2::cmds::OverlayPromotionHintCHROMIUM>();
+ if (c) {
+ c->Init(texture, promotion_hint, display_x, display_y);
+ }
+}
+
void SwapBuffersWithDamageCHROMIUM(GLint x,
GLint y,
GLint width,
diff --git a/chromium/gpu/command_buffer/client/gles2_implementation.cc b/chromium/gpu/command_buffer/client/gles2_implementation.cc
index 3424bc2a531..0c1ac65d3e1 100644
--- a/chromium/gpu/command_buffer/client/gles2_implementation.cc
+++ b/chromium/gpu/command_buffer/client/gles2_implementation.cc
@@ -18,6 +18,7 @@
#include <sstream>
#include <string>
#include "base/atomic_sequence_num.h"
+#include "base/bits.h"
#include "base/compiler_specific.h"
#include "base/numerics/safe_math.h"
#include "base/strings/string_split.h"
@@ -219,6 +220,8 @@ bool GLES2Implementation::Initialize(
if (mapped_memory_limit != SharedMemoryLimits::kNoLimit) {
// Use smaller chunks if the client is very memory conscientious.
chunk_size = std::min(mapped_memory_limit / 4, chunk_size);
+ chunk_size = base::bits::Align(chunk_size,
+ FencedAllocator::kAllocAlignment);
}
mapped_memory_->set_chunk_size_multiple(chunk_size);
@@ -262,21 +265,10 @@ bool GLES2Implementation::Initialize(
return false;
}
- // In certain cases, ThreadTaskRunnerHandle isn't set (Android Webview).
- // Don't register a dump provider in these cases.
- // TODO(ericrk): Get this working in Android Webview. crbug.com/517156
- if (base::ThreadTaskRunnerHandle::IsSet()) {
- base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider(
- this, "GLES2Implementation", base::ThreadTaskRunnerHandle::Get());
- }
-
return true;
}
GLES2Implementation::~GLES2Implementation() {
- base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvider(
- this);
-
// Make sure the queries are finished otherwise we'll delete the
// shared memory (mapped_memory_) which will free the memory used
// by the queries. The GPU process when validating that memory is still
@@ -405,6 +397,16 @@ void GLES2Implementation::SignalSyncToken(const gpu::SyncToken& sync_token,
}
}
+// This may be called from any thread. It's safe to access gpu_control_ without
+// the lock because it is const.
+bool GLES2Implementation::IsSyncTokenSignalled(
+ const gpu::SyncToken& sync_token) {
+ // Check that the sync token belongs to this context.
+ DCHECK_EQ(gpu_control_->GetNamespaceID(), sync_token.namespace_id());
+ DCHECK_EQ(gpu_control_->GetCommandBufferID(), sync_token.command_buffer_id());
+ return gpu_control_->IsFenceSyncReleased(sync_token.release_count());
+}
+
void GLES2Implementation::SignalQuery(uint32_t query,
const base::Closure& callback) {
// Flush previously entered commands to ensure ordering with any
@@ -441,6 +443,9 @@ bool GLES2Implementation::OnMemoryDump(
using base::trace_event::MemoryAllocatorDump;
using base::trace_event::MemoryDumpLevelOfDetail;
+ // Dump owned MappedMemoryManager memory as well.
+ mapped_memory_->OnMemoryDump(args, pmd);
+
if (!transfer_buffer_->HaveBuffer())
return true;
@@ -804,6 +809,15 @@ bool GLES2Implementation::GetHelper(GLenum pname, GLint* params) {
case GL_MAX_VERTEX_UNIFORM_VECTORS:
*params = capabilities_.max_vertex_uniform_vectors;
return true;
+ case GL_MAX_VIEWPORT_DIMS:
+ if (capabilities_.max_viewport_width > 0 &&
+ capabilities_.max_viewport_height > 0) {
+ params[0] = capabilities_.max_viewport_width;
+ params[1] = capabilities_.max_viewport_height;
+ return true;
+ }
+ // If they are not cached on the client side yet, query the service side.
+ return false;
case GL_NUM_COMPRESSED_TEXTURE_FORMATS:
*params = capabilities_.num_compressed_texture_formats;
return true;
@@ -832,7 +846,8 @@ bool GLES2Implementation::GetHelper(GLenum pname, GLint* params) {
*params = bound_pixel_unpack_transfer_buffer_id_;
return true;
case GL_READ_FRAMEBUFFER_BINDING:
- if (IsChromiumFramebufferMultisampleAvailable()) {
+ if (capabilities_.major_version >= 3 ||
+ IsChromiumFramebufferMultisampleAvailable()) {
*params = bound_read_framebuffer_;
return true;
}
@@ -847,6 +862,23 @@ bool GLES2Implementation::GetHelper(GLenum pname, GLint* params) {
*params = static_cast<GLint>(query_tracker_->CheckAndResetDisjoint());
return true;
+ case GL_VIEWPORT:
+ if (state_.viewport_width > 0 &&
+ state_.viewport_height > 0 &&
+ capabilities_.max_viewport_width > 0 &&
+ capabilities_.max_viewport_height > 0) {
+ params[0] = state_.viewport_x;
+ params[1] = state_.viewport_y;
+ params[2] = std::min(state_.viewport_width,
+ capabilities_.max_viewport_width);
+ params[3] = std::min(state_.viewport_height,
+ capabilities_.max_viewport_height);
+ return true;
+ }
+ // If they haven't been cached on the client side, go to service side
+ // to query the underlying driver.
+ return false;
+
// Non-cached parameters.
case GL_ALIASED_LINE_WIDTH_RANGE:
case GL_ALIASED_POINT_SIZE_RANGE:
@@ -879,7 +911,6 @@ bool GLES2Implementation::GetHelper(GLenum pname, GLint* params) {
case GL_IMPLEMENTATION_COLOR_READ_FORMAT:
case GL_IMPLEMENTATION_COLOR_READ_TYPE:
case GL_LINE_WIDTH:
- case GL_MAX_VIEWPORT_DIMS:
case GL_PACK_ALIGNMENT:
case GL_POLYGON_OFFSET_FACTOR:
case GL_POLYGON_OFFSET_FILL:
@@ -914,7 +945,6 @@ bool GLES2Implementation::GetHelper(GLenum pname, GLint* params) {
case GL_STENCIL_WRITEMASK:
case GL_SUBPIXEL_BITS:
case GL_UNPACK_ALIGNMENT:
- case GL_VIEWPORT:
return false;
default:
break;
@@ -2388,7 +2418,7 @@ void GLES2Implementation::CompressedTexSubImage2D(
helper_->CompressedTexSubImage2D(
target, level, xoffset, yoffset, width, height, format, image_size,
0, ToGLuint(data));
- } else {
+ } else if (data) {
SetBucketContents(kResultBucketId, data, image_size);
helper_->CompressedTexSubImage2DBucket(
target, level, xoffset, yoffset, width, height, format,
@@ -2397,6 +2427,9 @@ void GLES2Implementation::CompressedTexSubImage2D(
// and we don't have to wait for the result so from the client's perspective
// it's cheap.
helper_->SetBucketSize(kResultBucketId, 0);
+ } else {
+ helper_->CompressedTexSubImage2D(target, level, xoffset, yoffset, width,
+ height, format, image_size, 0, 0);
}
CheckGLError();
}
@@ -2491,7 +2524,7 @@ void GLES2Implementation::CompressedTexSubImage3D(
helper_->CompressedTexSubImage3D(
target, level, xoffset, yoffset, zoffset, width, height, depth, format,
image_size, 0, ToGLuint(data));
- } else {
+ } else if (data) {
SetBucketContents(kResultBucketId, data, image_size);
helper_->CompressedTexSubImage3DBucket(
target, level, xoffset, yoffset, zoffset, width, height, depth, format,
@@ -2500,6 +2533,10 @@ void GLES2Implementation::CompressedTexSubImage3D(
// and we don't have to wait for the result so from the client's perspective
// it's cheap.
helper_->SetBucketSize(kResultBucketId, 0);
+ } else {
+ helper_->CompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset,
+ width, height, depth, format, image_size,
+ 0, 0);
}
CheckGLError();
}
@@ -4340,20 +4377,16 @@ void GLES2Implementation::BindFramebufferHelper(
}
break;
case GL_READ_FRAMEBUFFER:
- if (!IsChromiumFramebufferMultisampleAvailable()) {
- SetGLErrorInvalidEnum("glBindFramebuffer", target, "target");
- return;
- }
+ DCHECK(capabilities_.major_version >= 3 ||
+ IsChromiumFramebufferMultisampleAvailable());
if (bound_read_framebuffer_ != framebuffer) {
bound_read_framebuffer_ = framebuffer;
changed = true;
}
break;
case GL_DRAW_FRAMEBUFFER:
- if (!IsChromiumFramebufferMultisampleAvailable()) {
- SetGLErrorInvalidEnum("glBindFramebuffer", target, "target");
- return;
- }
+ DCHECK(capabilities_.major_version >= 3 ||
+ IsChromiumFramebufferMultisampleAvailable());
if (bound_framebuffer_ != framebuffer) {
bound_framebuffer_ = framebuffer;
changed = true;
@@ -6327,7 +6360,7 @@ bool GLES2Implementation::PackStringsToBucket(GLsizei count,
const char* func_name) {
DCHECK_LE(0, count);
// Compute the total size.
- base::CheckedNumeric<size_t> total_size = count;
+ base::CheckedNumeric<uint32_t> total_size = count;
total_size += 1;
total_size *= sizeof(GLint);
if (!total_size.IsValid()) {
@@ -7030,6 +7063,22 @@ void GLES2Implementation::InvalidateCachedExtensions() {
cached_extensions_.clear();
}
+void GLES2Implementation::Viewport(GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height) {
+ GPU_CLIENT_SINGLE_THREAD_CHECK();
+ GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glViewport(" << x << ", " << y
+ << ", " << width << ", " << height << ")");
+ if (width < 0 || height < 0) {
+ SetGLError(GL_INVALID_VALUE, "glViewport", "negative width/height");
+ return;
+ }
+ state_.SetViewport(x, y, width, height);
+ helper_->Viewport(x, y, width, height);
+ CheckGLError();
+}
+
// Include the auto-generated part of this file. We split this because it means
// we can easily edit the non-auto generated parts right here in this file
// instead of having to edit some template or the code generator.
diff --git a/chromium/gpu/command_buffer/client/gles2_implementation.h b/chromium/gpu/command_buffer/client/gles2_implementation.h
index d26378a4387..b34cdc39c9a 100644
--- a/chromium/gpu/command_buffer/client/gles2_implementation.h
+++ b/chromium/gpu/command_buffer/client/gles2_implementation.h
@@ -251,6 +251,7 @@ class GLES2_IMPL_EXPORT GLES2Implementation
// ContextSupport implementation.
void SignalSyncToken(const gpu::SyncToken& sync_token,
const base::Closure& callback) override;
+ bool IsSyncTokenSignalled(const gpu::SyncToken& sync_token) override;
void SignalQuery(uint32_t query, const base::Closure& callback) override;
void SetAggressivelyFreeResources(bool aggressively_free_resources) override;
@@ -816,7 +817,7 @@ class GLES2_IMPL_EXPORT GLES2Implementation
int current_trace_stack_;
- GpuControl* gpu_control_;
+ GpuControl* const gpu_control_;
Capabilities capabilities_;
diff --git a/chromium/gpu/command_buffer/client/gles2_implementation_autogen.h b/chromium/gpu/command_buffer/client/gles2_implementation_autogen.h
index 0635ca1ee20..3a66cb71e6c 100644
--- a/chromium/gpu/command_buffer/client/gles2_implementation_autogen.h
+++ b/chromium/gpu/command_buffer/client/gles2_implementation_autogen.h
@@ -942,7 +942,9 @@ void PostSubBufferCHROMIUM(GLint x,
GLint height) override;
void CopyTextureCHROMIUM(GLenum source_id,
+ GLint source_level,
GLenum dest_id,
+ GLint dest_level,
GLint internalformat,
GLenum dest_type,
GLboolean unpack_flip_y,
@@ -950,7 +952,9 @@ void CopyTextureCHROMIUM(GLenum source_id,
GLboolean unpack_unmultiply_alpha) override;
void CopySubTextureCHROMIUM(GLenum source_id,
+ GLint source_level,
GLenum dest_id,
+ GLint dest_level,
GLint xoffset,
GLint yoffset,
GLint x,
@@ -1199,6 +1203,11 @@ void UniformMatrix4fvStreamTextureMatrixCHROMIUM(
GLboolean transpose,
const GLfloat* transform) override;
+void OverlayPromotionHintCHROMIUM(GLuint texture,
+ GLboolean promotion_hint,
+ GLint display_x,
+ GLint display_y) override;
+
void SwapBuffersWithDamageCHROMIUM(GLint x,
GLint y,
GLint width,
diff --git a/chromium/gpu/command_buffer/client/gles2_implementation_impl_autogen.h b/chromium/gpu/command_buffer/client/gles2_implementation_impl_autogen.h
index 679822032dd..eed99df1622 100644
--- a/chromium/gpu/command_buffer/client/gles2_implementation_impl_autogen.h
+++ b/chromium/gpu/command_buffer/client/gles2_implementation_impl_autogen.h
@@ -2782,25 +2782,6 @@ void GLES2Implementation::VertexAttribI4uiv(GLuint indx, const GLuint* values) {
CheckGLError();
}
-void GLES2Implementation::Viewport(GLint x,
- GLint y,
- GLsizei width,
- GLsizei height) {
- GPU_CLIENT_SINGLE_THREAD_CHECK();
- GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glViewport(" << x << ", " << y
- << ", " << width << ", " << height << ")");
- if (width < 0) {
- SetGLError(GL_INVALID_VALUE, "glViewport", "width < 0");
- return;
- }
- if (height < 0) {
- SetGLError(GL_INVALID_VALUE, "glViewport", "height < 0");
- return;
- }
- helper_->Viewport(x, y, width, height);
- CheckGLError();
-}
-
void GLES2Implementation::BlitFramebufferCHROMIUM(GLint srcX0,
GLint srcY0,
GLint srcX1,
@@ -3131,7 +3112,9 @@ void GLES2Implementation::GetTranslatedShaderSourceANGLE(GLuint shader,
}
void GLES2Implementation::CopyTextureCHROMIUM(
GLenum source_id,
+ GLint source_level,
GLenum dest_id,
+ GLint dest_level,
GLint internalformat,
GLenum dest_type,
GLboolean unpack_flip_y,
@@ -3140,21 +3123,23 @@ void GLES2Implementation::CopyTextureCHROMIUM(
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG(
"[" << GetLogPrefix() << "] glCopyTextureCHROMIUM("
- << GLES2Util::GetStringEnum(source_id) << ", "
- << GLES2Util::GetStringEnum(dest_id) << ", " << internalformat << ", "
- << GLES2Util::GetStringPixelType(dest_type) << ", "
- << GLES2Util::GetStringBool(unpack_flip_y) << ", "
+ << GLES2Util::GetStringEnum(source_id) << ", " << source_level << ", "
+ << GLES2Util::GetStringEnum(dest_id) << ", " << dest_level << ", "
+ << internalformat << ", " << GLES2Util::GetStringPixelType(dest_type)
+ << ", " << GLES2Util::GetStringBool(unpack_flip_y) << ", "
<< GLES2Util::GetStringBool(unpack_premultiply_alpha) << ", "
<< GLES2Util::GetStringBool(unpack_unmultiply_alpha) << ")");
- helper_->CopyTextureCHROMIUM(source_id, dest_id, internalformat, dest_type,
- unpack_flip_y, unpack_premultiply_alpha,
- unpack_unmultiply_alpha);
+ helper_->CopyTextureCHROMIUM(
+ source_id, source_level, dest_id, dest_level, internalformat, dest_type,
+ unpack_flip_y, unpack_premultiply_alpha, unpack_unmultiply_alpha);
CheckGLError();
}
void GLES2Implementation::CopySubTextureCHROMIUM(
GLenum source_id,
+ GLint source_level,
GLenum dest_id,
+ GLint dest_level,
GLint xoffset,
GLint yoffset,
GLint x,
@@ -3167,10 +3152,11 @@ void GLES2Implementation::CopySubTextureCHROMIUM(
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG(
"[" << GetLogPrefix() << "] glCopySubTextureCHROMIUM("
- << GLES2Util::GetStringEnum(source_id) << ", "
- << GLES2Util::GetStringEnum(dest_id) << ", " << xoffset << ", "
- << yoffset << ", " << x << ", " << y << ", " << width << ", "
- << height << ", " << GLES2Util::GetStringBool(unpack_flip_y) << ", "
+ << GLES2Util::GetStringEnum(source_id) << ", " << source_level << ", "
+ << GLES2Util::GetStringEnum(dest_id) << ", " << dest_level << ", "
+ << xoffset << ", " << yoffset << ", " << x << ", " << y << ", "
+ << width << ", " << height << ", "
+ << GLES2Util::GetStringBool(unpack_flip_y) << ", "
<< GLES2Util::GetStringBool(unpack_premultiply_alpha) << ", "
<< GLES2Util::GetStringBool(unpack_unmultiply_alpha) << ")");
if (width < 0) {
@@ -3181,9 +3167,10 @@ void GLES2Implementation::CopySubTextureCHROMIUM(
SetGLError(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM", "height < 0");
return;
}
- helper_->CopySubTextureCHROMIUM(
- source_id, dest_id, xoffset, yoffset, x, y, width, height, unpack_flip_y,
- unpack_premultiply_alpha, unpack_unmultiply_alpha);
+ helper_->CopySubTextureCHROMIUM(source_id, source_level, dest_id, dest_level,
+ xoffset, yoffset, x, y, width, height,
+ unpack_flip_y, unpack_premultiply_alpha,
+ unpack_unmultiply_alpha);
CheckGLError();
}
@@ -3221,8 +3208,9 @@ void GLES2Implementation::DiscardFramebufferEXT(GLenum target,
const GLenum* attachments) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDiscardFramebufferEXT("
- << GLES2Util::GetStringEnum(target) << ", " << count
- << ", " << static_cast<const void*>(attachments) << ")");
+ << GLES2Util::GetStringFramebufferTarget(target) << ", "
+ << count << ", " << static_cast<const void*>(attachments)
+ << ")");
GPU_CLIENT_LOG_CODE_BLOCK({
for (GLsizei i = 0; i < count; ++i) {
GPU_CLIENT_LOG(" " << i << ": " << attachments[0 + i * 1]);
@@ -3506,4 +3494,18 @@ void GLES2Implementation::UniformMatrix4fvStreamTextureMatrixCHROMIUM(
CheckGLError();
}
+void GLES2Implementation::OverlayPromotionHintCHROMIUM(GLuint texture,
+ GLboolean promotion_hint,
+ GLint display_x,
+ GLint display_y) {
+ GPU_CLIENT_SINGLE_THREAD_CHECK();
+ GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glOverlayPromotionHintCHROMIUM("
+ << texture << ", "
+ << GLES2Util::GetStringBool(promotion_hint) << ", "
+ << display_x << ", " << display_y << ")");
+ helper_->OverlayPromotionHintCHROMIUM(texture, promotion_hint, display_x,
+ display_y);
+ CheckGLError();
+}
+
#endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_IMPL_AUTOGEN_H_
diff --git a/chromium/gpu/command_buffer/client/gles2_implementation_unittest.cc b/chromium/gpu/command_buffer/client/gles2_implementation_unittest.cc
index 33b4eda5be9..fbf35d21917 100644
--- a/chromium/gpu/command_buffer/client/gles2_implementation_unittest.cc
+++ b/chromium/gpu/command_buffer/client/gles2_implementation_unittest.cc
@@ -404,6 +404,8 @@ class GLES2ImplementationTest : public testing::Test {
static const GLint kMaxVertexAttribs = 8;
static const GLint kMaxVertexTextureImageUnits = 0;
static const GLint kMaxVertexUniformVectors = 128;
+ static const GLint kMaxViewportWidth = 8192;
+ static const GLint kMaxViewportHeight = 6144;
static const GLint kNumCompressedTextureFormats = 0;
static const GLint kNumShaderBinaryFormats = 0;
static const GLuint kMaxTransformFeedbackSeparateAttribs = 4;
@@ -467,6 +469,8 @@ class GLES2ImplementationTest : public testing::Test {
capabilities.max_vertex_attribs = kMaxVertexAttribs;
capabilities.max_vertex_texture_image_units = kMaxVertexTextureImageUnits;
capabilities.max_vertex_uniform_vectors = kMaxVertexUniformVectors;
+ capabilities.max_viewport_width = kMaxViewportWidth;
+ capabilities.max_viewport_height = kMaxViewportHeight;
capabilities.num_compressed_texture_formats =
kNumCompressedTextureFormats;
capabilities.num_shader_binary_formats = kNumShaderBinaryFormats;
diff --git a/chromium/gpu/command_buffer/client/gles2_implementation_unittest_autogen.h b/chromium/gpu/command_buffer/client/gles2_implementation_unittest_autogen.h
index e0b5487a5e2..cbdf57f24ad 100644
--- a/chromium/gpu/command_buffer/client/gles2_implementation_unittest_autogen.h
+++ b/chromium/gpu/command_buffer/client/gles2_implementation_unittest_autogen.h
@@ -189,9 +189,9 @@ TEST_F(GLES2ImplementationTest, Clear) {
cmds::Clear cmd;
};
Cmds expected;
- expected.cmd.Init(1);
+ expected.cmd.Init(GL_COLOR_BUFFER_BIT);
- gl_->Clear(1);
+ gl_->Clear(GL_COLOR_BUFFER_BIT);
EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
}
@@ -2717,9 +2717,10 @@ TEST_F(GLES2ImplementationTest, CopyTextureCHROMIUM) {
cmds::CopyTextureCHROMIUM cmd;
};
Cmds expected;
- expected.cmd.Init(1, 2, GL_ALPHA, GL_UNSIGNED_BYTE, true, true, true);
+ expected.cmd.Init(1, 2, 3, 4, GL_ALPHA, GL_UNSIGNED_BYTE, true, true, true);
- gl_->CopyTextureCHROMIUM(1, 2, GL_ALPHA, GL_UNSIGNED_BYTE, true, true, true);
+ gl_->CopyTextureCHROMIUM(1, 2, 3, 4, GL_ALPHA, GL_UNSIGNED_BYTE, true, true,
+ true);
EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
}
@@ -2728,9 +2729,9 @@ TEST_F(GLES2ImplementationTest, CopySubTextureCHROMIUM) {
cmds::CopySubTextureCHROMIUM cmd;
};
Cmds expected;
- expected.cmd.Init(1, 2, 3, 4, 5, 6, 7, 8, true, true, true);
+ expected.cmd.Init(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, true, true, true);
- gl_->CopySubTextureCHROMIUM(1, 2, 3, 4, 5, 6, 7, 8, true, true, true);
+ gl_->CopySubTextureCHROMIUM(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, true, true, true);
EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
}
@@ -2802,8 +2803,8 @@ TEST_F(GLES2ImplementationTest, DiscardFramebufferEXT) {
data[ii][jj] = static_cast<GLenum>(ii * 1 + jj);
}
}
- expected.cmd.Init(1, 2, &data[0][0]);
- gl_->DiscardFramebufferEXT(1, 2, &data[0][0]);
+ expected.cmd.Init(GL_FRAMEBUFFER, 2, &data[0][0]);
+ gl_->DiscardFramebufferEXT(GL_FRAMEBUFFER, 2, &data[0][0]);
EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
}
diff --git a/chromium/gpu/command_buffer/client/gles2_interface_autogen.h b/chromium/gpu/command_buffer/client/gles2_interface_autogen.h
index 0055e6c167a..52e8ffba8bc 100644
--- a/chromium/gpu/command_buffer/client/gles2_interface_autogen.h
+++ b/chromium/gpu/command_buffer/client/gles2_interface_autogen.h
@@ -689,14 +689,18 @@ virtual void PostSubBufferCHROMIUM(GLint x,
GLint width,
GLint height) = 0;
virtual void CopyTextureCHROMIUM(GLenum source_id,
+ GLint source_level,
GLenum dest_id,
+ GLint dest_level,
GLint internalformat,
GLenum dest_type,
GLboolean unpack_flip_y,
GLboolean unpack_premultiply_alpha,
GLboolean unpack_unmultiply_alpha) = 0;
virtual void CopySubTextureCHROMIUM(GLenum source_id,
+ GLint source_level,
GLenum dest_id,
+ GLint dest_level,
GLint xoffset,
GLint yoffset,
GLint x,
@@ -886,6 +890,10 @@ virtual void UniformMatrix4fvStreamTextureMatrixCHROMIUM(
GLint location,
GLboolean transpose,
const GLfloat* transform) = 0;
+virtual void OverlayPromotionHintCHROMIUM(GLuint texture,
+ GLboolean promotion_hint,
+ GLint display_x,
+ GLint display_y) = 0;
virtual void SwapBuffersWithDamageCHROMIUM(GLint x,
GLint y,
GLint width,
diff --git a/chromium/gpu/command_buffer/client/gles2_interface_stub_autogen.h b/chromium/gpu/command_buffer/client/gles2_interface_stub_autogen.h
index 75af4906662..ac0f7a6852c 100644
--- a/chromium/gpu/command_buffer/client/gles2_interface_stub_autogen.h
+++ b/chromium/gpu/command_buffer/client/gles2_interface_stub_autogen.h
@@ -668,14 +668,18 @@ void PostSubBufferCHROMIUM(GLint x,
GLint width,
GLint height) override;
void CopyTextureCHROMIUM(GLenum source_id,
+ GLint source_level,
GLenum dest_id,
+ GLint dest_level,
GLint internalformat,
GLenum dest_type,
GLboolean unpack_flip_y,
GLboolean unpack_premultiply_alpha,
GLboolean unpack_unmultiply_alpha) override;
void CopySubTextureCHROMIUM(GLenum source_id,
+ GLint source_level,
GLenum dest_id,
+ GLint dest_level,
GLint xoffset,
GLint yoffset,
GLint x,
@@ -860,6 +864,10 @@ void UniformMatrix4fvStreamTextureMatrixCHROMIUM(
GLint location,
GLboolean transpose,
const GLfloat* transform) override;
+void OverlayPromotionHintCHROMIUM(GLuint texture,
+ GLboolean promotion_hint,
+ GLint display_x,
+ GLint display_y) override;
void SwapBuffersWithDamageCHROMIUM(GLint x,
GLint y,
GLint width,
diff --git a/chromium/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h b/chromium/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h
index ce62d915020..dc15f9d69de 100644
--- a/chromium/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h
+++ b/chromium/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h
@@ -916,7 +916,9 @@ void GLES2InterfaceStub::PostSubBufferCHROMIUM(GLint /* x */,
GLint /* height */) {}
void GLES2InterfaceStub::CopyTextureCHROMIUM(
GLenum /* source_id */,
+ GLint /* source_level */,
GLenum /* dest_id */,
+ GLint /* dest_level */,
GLint /* internalformat */,
GLenum /* dest_type */,
GLboolean /* unpack_flip_y */,
@@ -924,7 +926,9 @@ void GLES2InterfaceStub::CopyTextureCHROMIUM(
GLboolean /* unpack_unmultiply_alpha */) {}
void GLES2InterfaceStub::CopySubTextureCHROMIUM(
GLenum /* source_id */,
+ GLint /* source_level */,
GLenum /* dest_id */,
+ GLint /* dest_level */,
GLint /* xoffset */,
GLint /* yoffset */,
GLint /* x */,
@@ -1163,6 +1167,11 @@ void GLES2InterfaceStub::UniformMatrix4fvStreamTextureMatrixCHROMIUM(
GLint /* location */,
GLboolean /* transpose */,
const GLfloat* /* transform */) {}
+void GLES2InterfaceStub::OverlayPromotionHintCHROMIUM(
+ GLuint /* texture */,
+ GLboolean /* promotion_hint */,
+ GLint /* display_x */,
+ GLint /* display_y */) {}
void GLES2InterfaceStub::SwapBuffersWithDamageCHROMIUM(GLint /* x */,
GLint /* y */,
GLint /* width */,
diff --git a/chromium/gpu/command_buffer/client/gles2_trace_implementation_autogen.h b/chromium/gpu/command_buffer/client/gles2_trace_implementation_autogen.h
index 9277de1fa51..75006d58b32 100644
--- a/chromium/gpu/command_buffer/client/gles2_trace_implementation_autogen.h
+++ b/chromium/gpu/command_buffer/client/gles2_trace_implementation_autogen.h
@@ -668,14 +668,18 @@ void PostSubBufferCHROMIUM(GLint x,
GLint width,
GLint height) override;
void CopyTextureCHROMIUM(GLenum source_id,
+ GLint source_level,
GLenum dest_id,
+ GLint dest_level,
GLint internalformat,
GLenum dest_type,
GLboolean unpack_flip_y,
GLboolean unpack_premultiply_alpha,
GLboolean unpack_unmultiply_alpha) override;
void CopySubTextureCHROMIUM(GLenum source_id,
+ GLint source_level,
GLenum dest_id,
+ GLint dest_level,
GLint xoffset,
GLint yoffset,
GLint x,
@@ -860,6 +864,10 @@ void UniformMatrix4fvStreamTextureMatrixCHROMIUM(
GLint location,
GLboolean transpose,
const GLfloat* transform) override;
+void OverlayPromotionHintCHROMIUM(GLuint texture,
+ GLboolean promotion_hint,
+ GLint display_x,
+ GLint display_y) override;
void SwapBuffersWithDamageCHROMIUM(GLint x,
GLint y,
GLint width,
diff --git a/chromium/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h b/chromium/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h
index 2d08ece5315..f09bc335668 100644
--- a/chromium/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h
+++ b/chromium/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h
@@ -1949,21 +1949,25 @@ void GLES2TraceImplementation::PostSubBufferCHROMIUM(GLint x,
void GLES2TraceImplementation::CopyTextureCHROMIUM(
GLenum source_id,
+ GLint source_level,
GLenum dest_id,
+ GLint dest_level,
GLint internalformat,
GLenum dest_type,
GLboolean unpack_flip_y,
GLboolean unpack_premultiply_alpha,
GLboolean unpack_unmultiply_alpha) {
TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::CopyTextureCHROMIUM");
- gl_->CopyTextureCHROMIUM(source_id, dest_id, internalformat, dest_type,
- unpack_flip_y, unpack_premultiply_alpha,
- unpack_unmultiply_alpha);
+ gl_->CopyTextureCHROMIUM(source_id, source_level, dest_id, dest_level,
+ internalformat, dest_type, unpack_flip_y,
+ unpack_premultiply_alpha, unpack_unmultiply_alpha);
}
void GLES2TraceImplementation::CopySubTextureCHROMIUM(
GLenum source_id,
+ GLint source_level,
GLenum dest_id,
+ GLint dest_level,
GLint xoffset,
GLint yoffset,
GLint x,
@@ -1974,8 +1978,9 @@ void GLES2TraceImplementation::CopySubTextureCHROMIUM(
GLboolean unpack_premultiply_alpha,
GLboolean unpack_unmultiply_alpha) {
TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::CopySubTextureCHROMIUM");
- gl_->CopySubTextureCHROMIUM(source_id, dest_id, xoffset, yoffset, x, y, width,
- height, unpack_flip_y, unpack_premultiply_alpha,
+ gl_->CopySubTextureCHROMIUM(source_id, source_level, dest_id, dest_level,
+ xoffset, yoffset, x, y, width, height,
+ unpack_flip_y, unpack_premultiply_alpha,
unpack_unmultiply_alpha);
}
@@ -2488,6 +2493,17 @@ void GLES2TraceImplementation::UniformMatrix4fvStreamTextureMatrixCHROMIUM(
transform);
}
+void GLES2TraceImplementation::OverlayPromotionHintCHROMIUM(
+ GLuint texture,
+ GLboolean promotion_hint,
+ GLint display_x,
+ GLint display_y) {
+ TRACE_EVENT_BINARY_EFFICIENT0("gpu",
+ "GLES2Trace::OverlayPromotionHintCHROMIUM");
+ gl_->OverlayPromotionHintCHROMIUM(texture, promotion_hint, display_x,
+ display_y);
+}
+
void GLES2TraceImplementation::SwapBuffersWithDamageCHROMIUM(GLint x,
GLint y,
GLint width,
diff --git a/chromium/gpu/command_buffer/client/gpu_control.h b/chromium/gpu/command_buffer/client/gpu_control.h
index 813d5630960..62429898c88 100644
--- a/chromium/gpu/command_buffer/client/gpu_control.h
+++ b/chromium/gpu/command_buffer/client/gpu_control.h
@@ -24,10 +24,6 @@ namespace base {
class Lock;
}
-namespace gfx {
-class GpuMemoryBuffer;
-}
-
namespace gpu {
class GpuControlClient;
struct SyncToken;
@@ -86,18 +82,29 @@ class GPU_EXPORT GpuControl {
virtual CommandBufferId GetCommandBufferID() const = 0;
virtual int32_t GetExtraCommandBufferData() const = 0;
- // Fence Syncs use release counters at a context level, these fence syncs
- // need to be flushed before they can be shared with other contexts across
- // channels. Subclasses should implement these functions and take care of
- // figuring out when a fence sync has been flushed. The difference between
- // IsFenceSyncFlushed and IsFenceSyncFlushReceived, one is testing is the
- // client has issued the flush, and the other is testing if the service
- // has received the flush.
+ // Generates a fence sync which should be inserted into the GL command stream.
+ // When the service executes the fence sync it is released. Fence syncs are
+ // shared with other contexts as sync tokens which encapsulate the fence sync
+ // and the command buffer on which it was generated. Fence syncs need to be
+ // flushed before they can be used by other contexts. Furthermore, the flush
+ // must be verified before sending a sync token across channel boundaries.
virtual uint64_t GenerateFenceSyncRelease() = 0;
+
+ // Returns true if the fence sync is valid.
virtual bool IsFenceSyncRelease(uint64_t release) = 0;
+
+ // Returns true if the client has flushed the fence sync.
virtual bool IsFenceSyncFlushed(uint64_t release) = 0;
+
+ // Returns true if the service has received the fence sync. Used for verifying
+ // sync tokens.
virtual bool IsFenceSyncFlushReceived(uint64_t release) = 0;
+ // Returns true if the service has released (executed) the fence sync. Some
+ // implementations may support calling this from any thread without holding
+ // the lock provided by the client.
+ virtual bool IsFenceSyncReleased(uint64_t release) = 0;
+
// Runs |callback| when sync token is signalled.
virtual void SignalSyncToken(const SyncToken& sync_token,
const base::Closure& callback) = 0;
diff --git a/chromium/gpu/command_buffer/client/gpu_memory_buffer_manager.h b/chromium/gpu/command_buffer/client/gpu_memory_buffer_manager.h
index 921b42e8e34..b75780bbc14 100644
--- a/chromium/gpu/command_buffer/client/gpu_memory_buffer_manager.h
+++ b/chromium/gpu/command_buffer/client/gpu_memory_buffer_manager.h
@@ -19,26 +19,18 @@ struct SyncToken;
class GPU_EXPORT GpuMemoryBufferManager {
public:
GpuMemoryBufferManager();
+ virtual ~GpuMemoryBufferManager();
- // Allocates a GpuMemoryBuffer that can be shared with another process.
- virtual std::unique_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBuffer(
+ // Creates a GpuMemoryBuffer that can be shared with another process.
+ virtual std::unique_ptr<gfx::GpuMemoryBuffer> CreateGpuMemoryBuffer(
const gfx::Size& size,
gfx::BufferFormat format,
gfx::BufferUsage usage,
gpu::SurfaceHandle surface_handle) = 0;
- // Creates a GpuMemoryBuffer from existing handle.
- virtual std::unique_ptr<gfx::GpuMemoryBuffer> CreateGpuMemoryBufferFromHandle(
- const gfx::GpuMemoryBufferHandle& handle,
- const gfx::Size& size,
- gfx::BufferFormat format) = 0;
-
// Associates destruction sync point with |buffer|.
virtual void SetDestructionSyncToken(gfx::GpuMemoryBuffer* buffer,
const gpu::SyncToken& sync_token) = 0;
-
- protected:
- virtual ~GpuMemoryBufferManager();
};
} // namespace gpu
diff --git a/chromium/gpu/command_buffer/client/mapped_memory.cc b/chromium/gpu/command_buffer/client/mapped_memory.cc
index 0501d574e4b..708e121f39c 100644
--- a/chromium/gpu/command_buffer/client/mapped_memory.cc
+++ b/chromium/gpu/command_buffer/client/mapped_memory.cc
@@ -47,19 +47,9 @@ MappedMemoryManager::MappedMemoryManager(CommandBufferHelper* helper,
max_free_bytes_(unused_memory_reclaim_limit),
max_allocated_bytes_(SharedMemoryLimits::kNoLimit),
tracing_id_(g_next_mapped_memory_manager_tracing_id.GetNext()) {
- // In certain cases, ThreadTaskRunnerHandle isn't set (Android Webview).
- // Don't register a dump provider in these cases.
- // TODO(ericrk): Get this working in Android Webview. crbug.com/517156
- if (base::ThreadTaskRunnerHandle::IsSet()) {
- base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider(
- this, "gpu::MappedMemoryManager", base::ThreadTaskRunnerHandle::Get());
- }
}
MappedMemoryManager::~MappedMemoryManager() {
- base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvider(
- this);
-
CommandBuffer* cmd_buf = helper_->command_buffer();
for (auto& chunk : chunks_) {
cmd_buf->DestroyTransferBuffer(chunk->shm_id());
diff --git a/chromium/gpu/command_buffer/client/mapped_memory.h b/chromium/gpu/command_buffer/client/mapped_memory.h
index 0af38b56e92..72a96764c5d 100644
--- a/chromium/gpu/command_buffer/client/mapped_memory.h
+++ b/chromium/gpu/command_buffer/client/mapped_memory.h
@@ -121,8 +121,7 @@ class GPU_EXPORT MemoryChunk {
};
// Manages MemoryChunks.
-class GPU_EXPORT MappedMemoryManager
- : public base::trace_event::MemoryDumpProvider {
+class GPU_EXPORT MappedMemoryManager {
public:
enum MemoryLimit {
kNoLimit = 0,
@@ -133,7 +132,7 @@ class GPU_EXPORT MappedMemoryManager
MappedMemoryManager(CommandBufferHelper* helper,
size_t unused_memory_reclaim_limit);
- ~MappedMemoryManager() override;
+ ~MappedMemoryManager();
unsigned int chunk_size_multiple() const {
return chunk_size_multiple_;
@@ -179,9 +178,9 @@ class GPU_EXPORT MappedMemoryManager
// Free Any Shared memory that is not in use.
void FreeUnused();
- // Overridden from base::trace_event::MemoryDumpProvider:
+ // Dump memory usage - called from GLES2Implementation.
bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args,
- base::trace_event::ProcessMemoryDump* pmd) override;
+ base::trace_event::ProcessMemoryDump* pmd);
// Used for testing
size_t num_chunks() const {
diff --git a/chromium/gpu/command_buffer/client/ring_buffer.cc b/chromium/gpu/command_buffer/client/ring_buffer.cc
index ebbb1182aed..118dc57276e 100644
--- a/chromium/gpu/command_buffer/client/ring_buffer.cc
+++ b/chromium/gpu/command_buffer/client/ring_buffer.cc
@@ -146,10 +146,9 @@ void RingBuffer::DiscardBlock(void* pointer) {
}
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;
+ if (!helper_->HasTokenPassed(block.token) || block.state == IN_USE) break;
FreeOldestBlock();
}
if (free_offset_ == in_use_offset_) {