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

Unified Diff: gpu/command_buffer/client/gles2_implementation.cc

Issue 116863003: gpu: Reuse transfer buffers more aggresively (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years 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/client/gles2_implementation.cc
diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc
index b0efc3769da617acfcc5423f07951c6f8d1dc208..83ae1c75dc8e10083f99dd9efc031d88fe2ff334 100644
--- a/gpu/command_buffer/client/gles2_implementation.cc
+++ b/gpu/command_buffer/client/gles2_implementation.cc
@@ -155,14 +155,29 @@ bool GLES2Implementation::Initialize(
return false;
}
- mapped_memory_.reset(new MappedMemoryManager(helper_, mapped_memory_limit));
-
+ MappedMemoryManagerSettings mapped_memory_settings;
+ mapped_memory_settings.unused_memory_reclaim_limit =
+ mapped_memory_limit;
+ mapped_memory_settings.aggressive_reuse = false;
+ mapped_memory_.reset(new MappedMemoryManager(
+ helper_, mapped_memory_settings));
+
+ MappedMemoryManagerSettings transfer_buffer_memory_settings;
+ transfer_buffer_memory_settings.unused_memory_reclaim_limit =
+ mapped_memory_limit;
+ transfer_buffer_memory_settings.aggressive_reuse = true;
+ transfer_buffer_memory_.reset(new MappedMemoryManager(
+ helper_, transfer_buffer_memory_settings));
+
+ // Set the chunk size of transfer buffer chunks. Let the generic memory
+ // manager allocate chunks to be as small as possible, i.e. the default size
+ // multiple 1.
unsigned chunk_size = 2 * 1024 * 1024;
if (mapped_memory_limit != kNoLimit) {
// Use smaller chunks if the client is very memory conscientious.
chunk_size = std::min(mapped_memory_limit / 4, chunk_size);
}
- mapped_memory_->set_chunk_size_multiple(chunk_size);
+ transfer_buffer_memory_->set_chunk_size_multiple(chunk_size);
if (!QueryAndCacheStaticState())
return false;
@@ -177,7 +192,7 @@ bool GLES2Implementation::Initialize(
static_state_.int_state.max_combined_texture_image_units]);
query_tracker_.reset(new QueryTracker(mapped_memory_.get()));
- buffer_tracker_.reset(new BufferTracker(mapped_memory_.get()));
+ buffer_tracker_.reset(new BufferTracker(transfer_buffer_memory_.get()));
gpu_memory_buffer_tracker_.reset(new GpuMemoryBufferTracker(gpu_control_));
#if defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS)
@@ -304,6 +319,7 @@ uint32 GLES2Implementation::GetResultShmOffset() {
void GLES2Implementation::FreeUnusedSharedMemory() {
mapped_memory_->FreeUnused();
+ transfer_buffer_memory_->FreeUnused();
}
void GLES2Implementation::FreeEverything() {

Powered by Google App Engine
This is Rietveld 408576698