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

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

Issue 1168853002: Use mapped memory for uploading large textures. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added new max allocated bytes limit to mapped memory manager Created 5 years, 6 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
« no previous file with comments | « gpu/command_buffer/client/ring_buffer.h ('k') | gpu/command_buffer/client/transfer_buffer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/client/ring_buffer.cc
diff --git a/gpu/command_buffer/client/ring_buffer.cc b/gpu/command_buffer/client/ring_buffer.cc
index 813bb348863d8810c93690896a9441c67e194c79..bf848a22199bc27903aecc786486de91150114ff 100644
--- a/gpu/command_buffer/client/ring_buffer.cc
+++ b/gpu/command_buffer/client/ring_buffer.cc
@@ -103,6 +103,27 @@ void RingBuffer::FreePendingToken(void* pointer,
NOTREACHED() << "attempt to free non-existant block";
}
+void RingBuffer::DiscardBlock(void* pointer) {
+ Offset offset = GetOffset(pointer);
+ offset -= base_offset_;
+ DCHECK(!blocks_.empty()) << "no allocations to free";
+ for (Container::reverse_iterator it = blocks_.rbegin();
+ it != blocks_.rend();
+ ++it) {
+ Block& block = *it;
+ if (block.offset == offset) {
+ DCHECK(block.state == IN_USE)
+ << "block that corresponds to offset already freed";
piman 2015/06/09 22:55:05 nit: I would keep this.
David Yen 2015/06/10 18:17:09 I've changed it to check if state != PADDING. I th
+
+ // Mark this as padding and let the FreeOldestBlock() logic handle
+ // updating all the various offsets.
piman 2015/06/09 17:38:27 I think this is close to not doing anything... If
David Yen 2015/06/09 20:11:20 That is a fair point. I have added the logic to ac
+ block.state = PADDING;
+ return;
+ }
+ }
+ NOTREACHED() << "attempt to free non-existant block";
+}
+
unsigned int RingBuffer::GetLargestFreeSizeNoWaiting() {
unsigned int last_token_read = helper_->last_token_read();
while (!blocks_.empty()) {
« no previous file with comments | « gpu/command_buffer/client/ring_buffer.h ('k') | gpu/command_buffer/client/transfer_buffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698