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

Side by Side Diff: gpu/command_buffer/client/mapped_memory.h

Issue 1186393004: gpu: Remove async texture uploads. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef GPU_COMMAND_BUFFER_CLIENT_MAPPED_MEMORY_H_ 5 #ifndef GPU_COMMAND_BUFFER_CLIENT_MAPPED_MEMORY_H_
6 #define GPU_COMMAND_BUFFER_CLIENT_MAPPED_MEMORY_H_ 6 #define GPU_COMMAND_BUFFER_CLIENT_MAPPED_MEMORY_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/scoped_vector.h" 12 #include "base/memory/scoped_vector.h"
13 #include "base/trace_event/memory_dump_provider.h" 13 #include "base/trace_event/memory_dump_provider.h"
14 #include "gpu/command_buffer/client/fenced_allocator.h" 14 #include "gpu/command_buffer/client/fenced_allocator.h"
15 #include "gpu/command_buffer/common/buffer.h" 15 #include "gpu/command_buffer/common/buffer.h"
16 #include "gpu/gpu_export.h" 16 #include "gpu/gpu_export.h"
17 17
18 namespace gpu { 18 namespace gpu {
19 19
20 class CommandBufferHelper; 20 class CommandBufferHelper;
21 21
22 // Manages a shared memory segment. 22 // Manages a shared memory segment.
23 class GPU_EXPORT MemoryChunk { 23 class GPU_EXPORT MemoryChunk {
24 public: 24 public:
25 MemoryChunk(int32_t shm_id, 25 MemoryChunk(int32_t shm_id,
26 scoped_refptr<gpu::Buffer> shm, 26 scoped_refptr<gpu::Buffer> shm,
27 CommandBufferHelper* helper, 27 CommandBufferHelper* helper);
28 const base::Closure& poll_callback);
29 ~MemoryChunk(); 28 ~MemoryChunk();
30 29
31 // Gets the size of the largest free block that is available without waiting. 30 // Gets the size of the largest free block that is available without waiting.
32 unsigned int GetLargestFreeSizeWithoutWaiting() { 31 unsigned int GetLargestFreeSizeWithoutWaiting() {
33 return allocator_.GetLargestFreeSize(); 32 return allocator_.GetLargestFreeSize();
34 } 33 }
35 34
36 // Gets the size of the largest free block that can be allocated if the 35 // Gets the size of the largest free block that can be allocated if the
37 // caller can wait. 36 // caller can wait.
38 unsigned int GetLargestFreeSizeWithWaiting() { 37 unsigned int GetLargestFreeSizeWithWaiting() {
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 class GPU_EXPORT MappedMemoryManager 122 class GPU_EXPORT MappedMemoryManager
124 : public base::trace_event::MemoryDumpProvider { 123 : public base::trace_event::MemoryDumpProvider {
125 public: 124 public:
126 enum MemoryLimit { 125 enum MemoryLimit {
127 kNoLimit = 0, 126 kNoLimit = 0,
128 }; 127 };
129 128
130 // |unused_memory_reclaim_limit|: When exceeded this causes pending memory 129 // |unused_memory_reclaim_limit|: When exceeded this causes pending memory
131 // to be reclaimed before allocating more memory. 130 // to be reclaimed before allocating more memory.
132 MappedMemoryManager(CommandBufferHelper* helper, 131 MappedMemoryManager(CommandBufferHelper* helper,
133 const base::Closure& poll_callback,
134 size_t unused_memory_reclaim_limit); 132 size_t unused_memory_reclaim_limit);
135 133
136 ~MappedMemoryManager() override; 134 ~MappedMemoryManager() override;
137 135
138 unsigned int chunk_size_multiple() const { 136 unsigned int chunk_size_multiple() const {
139 return chunk_size_multiple_; 137 return chunk_size_multiple_;
140 } 138 }
141 139
142 void set_chunk_size_multiple(unsigned int multiple) { 140 void set_chunk_size_multiple(unsigned int multiple) {
143 DCHECK(multiple % FencedAllocator::kAllocAlignment == 0); 141 DCHECK(multiple % FencedAllocator::kAllocAlignment == 0);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 size_t allocated_memory() const { 199 size_t allocated_memory() const {
202 return allocated_memory_; 200 return allocated_memory_;
203 } 201 }
204 202
205 private: 203 private:
206 typedef ScopedVector<MemoryChunk> MemoryChunkVector; 204 typedef ScopedVector<MemoryChunk> MemoryChunkVector;
207 205
208 // size a chunk is rounded up to. 206 // size a chunk is rounded up to.
209 unsigned int chunk_size_multiple_; 207 unsigned int chunk_size_multiple_;
210 CommandBufferHelper* helper_; 208 CommandBufferHelper* helper_;
211 base::Closure poll_callback_;
212 MemoryChunkVector chunks_; 209 MemoryChunkVector chunks_;
213 size_t allocated_memory_; 210 size_t allocated_memory_;
214 size_t max_free_bytes_; 211 size_t max_free_bytes_;
215 size_t max_allocated_bytes_; 212 size_t max_allocated_bytes_;
216 // A process-unique ID used for disambiguating memory dumps from different 213 // A process-unique ID used for disambiguating memory dumps from different
217 // mapped memory manager. 214 // mapped memory manager.
218 int tracing_id_; 215 int tracing_id_;
219 216
220 DISALLOW_COPY_AND_ASSIGN(MappedMemoryManager); 217 DISALLOW_COPY_AND_ASSIGN(MappedMemoryManager);
221 }; 218 };
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 uint32_t shm_offset_; 273 uint32_t shm_offset_;
277 bool flush_after_release_; 274 bool flush_after_release_;
278 CommandBufferHelper* helper_; 275 CommandBufferHelper* helper_;
279 MappedMemoryManager* mapped_memory_manager_; 276 MappedMemoryManager* mapped_memory_manager_;
280 DISALLOW_COPY_AND_ASSIGN(ScopedMappedMemoryPtr); 277 DISALLOW_COPY_AND_ASSIGN(ScopedMappedMemoryPtr);
281 }; 278 };
282 279
283 } // namespace gpu 280 } // namespace gpu
284 281
285 #endif // GPU_COMMAND_BUFFER_CLIENT_MAPPED_MEMORY_H_ 282 #endif // GPU_COMMAND_BUFFER_CLIENT_MAPPED_MEMORY_H_
OLDNEW
« no previous file with comments | « gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h ('k') | gpu/command_buffer/client/mapped_memory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698