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

Unified Diff: gpu/command_buffer/client/mapped_memory.h

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/mapped_memory.h
diff --git a/gpu/command_buffer/client/mapped_memory.h b/gpu/command_buffer/client/mapped_memory.h
index b8f3129eb4a3cddf452e9fabe30ec62a1af12eda..a0f810c6c8c245c820e3019230254356f83da8bd 100644
--- a/gpu/command_buffer/client/mapped_memory.h
+++ b/gpu/command_buffer/client/mapped_memory.h
@@ -18,7 +18,10 @@ class CommandBufferHelper;
// Manages a shared memory segment.
class GPU_EXPORT MemoryChunk {
public:
- MemoryChunk(int32 shm_id, gpu::Buffer shm, CommandBufferHelper* helper);
+ MemoryChunk(int32 shm_id,
+ gpu::Buffer shm,
+ bool aggressive_reuse,
+ CommandBufferHelper* helper);
// Gets the size of the largest free block that is available without waiting.
unsigned int GetLargestFreeSizeWithoutWaiting() {
@@ -107,6 +110,19 @@ class GPU_EXPORT MemoryChunk {
DISALLOW_COPY_AND_ASSIGN(MemoryChunk);
};
+// Configure MappedMemoryManager
+struct GPU_EXPORT MappedMemoryManagerSettings {
+ // |unused_memory_reclaim_limit|: When exceeded this causes pending memory
+ // to be reclaimed before allocating more memory.
+ size_t unused_memory_reclaim_limit;
+
+ // |aggressive_reuse|: When set to true, the memory manager will reuse a
+ // block marked either as FREE or FREE_PENDING_TOKEN. This setting is only
+ // allowed if the user can guarantee that all parts are done using a block
+ // that was free:ed by the client.
+ bool aggressive_reuse;
+};
+
// Manages MemoryChunks.
class GPU_EXPORT MappedMemoryManager {
public:
@@ -114,10 +130,8 @@ class GPU_EXPORT MappedMemoryManager {
kNoLimit = 0,
};
- // |unused_memory_reclaim_limit|: When exceeded this causes pending memory
- // to be reclaimed before allocating more memory.
MappedMemoryManager(CommandBufferHelper* helper,
- size_t unused_memory_reclaim_limit);
+ MappedMemoryManagerSettings settings);
~MappedMemoryManager();
@@ -175,6 +189,7 @@ class GPU_EXPORT MappedMemoryManager {
MemoryChunkVector chunks_;
size_t allocated_memory_;
size_t max_free_bytes_;
+ bool aggressive_reuse_;
DISALLOW_COPY_AND_ASSIGN(MappedMemoryManager);
};

Powered by Google App Engine
This is Rietveld 408576698