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

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

Issue 116863003: gpu: Reuse transfer buffers more aggresively (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: [WIP] Introduced internal SetAsyncToken command buffer command Created 6 years, 11 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
Index: gpu/command_buffer/service/command_buffer_service.cc
diff --git a/gpu/command_buffer/service/command_buffer_service.cc b/gpu/command_buffer/service/command_buffer_service.cc
index bae2d801dd5021612ce6550bdcd7197c10082c72..02c255060ca745c823abd5be5289211bff86a7b3 100644
--- a/gpu/command_buffer/service/command_buffer_service.cc
+++ b/gpu/command_buffer/service/command_buffer_service.cc
@@ -13,6 +13,7 @@
#include "gpu/command_buffer/service/transfer_buffer_manager.h"
using ::base::SharedMemory;
+using ::base::AutoLock;
namespace gpu {
@@ -25,6 +26,7 @@ CommandBufferService::CommandBufferService(
put_offset_(0),
transfer_buffer_manager_(transfer_buffer_manager),
token_(0),
+ async_token_(0),
generation_(0),
error_(error::kNoError),
context_lost_reason_(error::kUnknown) {
@@ -38,11 +40,17 @@ bool CommandBufferService::Initialize() {
}
CommandBufferService::State CommandBufferService::GetState() {
+ AutoLock lock(lock_);
+ return GetStateImpl();
+}
+
+CommandBufferService::State CommandBufferService::GetStateImpl() {
reveman 2014/01/22 17:30:04 Please add a lock_.AssertAcquired() call here to p
State state;
state.num_entries = num_entries_;
state.get_offset = get_offset_;
state.put_offset = put_offset_;
state.token = token_;
+ state.async_token = async_token_;
state.error = error_;
state.context_lost_reason = context_lost_reason_;
state.generation = ++generation_;
@@ -59,8 +67,9 @@ int32 CommandBufferService::GetLastToken() {
}
void CommandBufferService::UpdateState() {
+ AutoLock lock(lock_);
if (shared_state_) {
- CommandBufferService::State state = GetState();
+ CommandBufferService::State state = GetStateImpl();
shared_state_->Write(state);
}
}
@@ -174,6 +183,11 @@ void CommandBufferService::SetToken(int32 token) {
UpdateState();
}
+void CommandBufferService::SetAsyncToken(uint32 token) {
+ async_token_ = token;
reveman 2014/01/22 17:30:04 Do you need to acquire the lock before writing to
+ UpdateState();
+}
+
void CommandBufferService::SetParseError(error::Error error) {
if (error_ == error::kNoError) {
error_ = error;

Powered by Google App Engine
This is Rietveld 408576698