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

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

Issue 116863003: gpu: Reuse transfer buffers more aggresively (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: [WIP] Review comments follow-up 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/client/fenced_allocator.h
diff --git a/gpu/command_buffer/client/fenced_allocator.h b/gpu/command_buffer/client/fenced_allocator.h
index bb5c55170ab25e2766a4804c762a51ee00e8c2f3..55adea888bfa2a62a28948345bf01016f3ada7bc 100644
--- a/gpu/command_buffer/client/fenced_allocator.h
+++ b/gpu/command_buffer/client/fenced_allocator.h
@@ -65,6 +65,8 @@ class GPU_EXPORT FencedAllocator {
// token: the token value to wait for before re-using the memory.
void FreePendingToken(Offset offset, int32 token);
+ void FreePendingSerial(Offset offset, uint32 token);
+
// Frees any blocks pending a token for which the token has been read.
void FreeUnused();
@@ -91,7 +93,8 @@ class GPU_EXPORT FencedAllocator {
enum State {
IN_USE,
FREE,
- FREE_PENDING_TOKEN
+ FREE_PENDING_TOKEN,
+ FREE_PENDING_SERIAL
};
// Book-keeping sturcture that describes a block of memory.
@@ -100,6 +103,7 @@ class GPU_EXPORT FencedAllocator {
Offset offset;
unsigned int size;
int32 token; // token to wait for in the FREE_PENDING_TOKEN case.
+ uint32 serial;
};
// Comparison functor for memory block sorting.
@@ -114,6 +118,7 @@ class GPU_EXPORT FencedAllocator {
typedef unsigned int BlockIndex;
static const int32 kUnusedToken = 0;
+ static const uint32 kUnusedSerial = 0;
// Gets the index of a memory block, given its offset.
BlockIndex GetBlockByOffset(Offset offset);
@@ -202,6 +207,11 @@ class FencedAllocatorWrapper {
allocator_.FreePendingToken(GetOffset(pointer), token);
}
+ void FreePendingSerial(void *pointer, uint32 serial) {
+ DCHECK(pointer);
+ allocator_.FreePendingSerial(GetOffset(pointer), serial);
+ }
+
// Frees any blocks pending a token for which the token has been read.
void FreeUnused() {
allocator_.FreeUnused();

Powered by Google App Engine
This is Rietveld 408576698