Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 // This file contains the command buffer helper class. | 5 // This file contains the command buffer helper class. |
| 6 | 6 |
| 7 #ifndef GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_ | 7 #ifndef GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_ |
| 8 #define GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_ | 8 #define GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_ |
| 9 | 9 |
| 10 #include <string.h> | 10 #include <string.h> |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 299 bool usable () const { | 299 bool usable () const { |
| 300 return usable_; | 300 return usable_; |
| 301 } | 301 } |
| 302 | 302 |
| 303 void ClearUsable() { | 303 void ClearUsable() { |
| 304 usable_ = false; | 304 usable_ = false; |
| 305 context_lost_ = true; | 305 context_lost_ = true; |
| 306 CalcImmediateEntries(0); | 306 CalcImmediateEntries(0); |
| 307 } | 307 } |
| 308 | 308 |
| 309 uint32_t GenerateFenceSyncRelease(); | |
| 310 | |
| 311 bool IsFenceSyncRelease(uint32_t release) { | |
| 312 return release < next_fence_sync_release_; | |
| 313 } | |
| 314 | |
| 315 bool IsFenceSyncFlushed(uint32_t release) { | |
| 316 return release <= flushed_fence_sync_release_; | |
| 317 } | |
| 318 | |
| 309 // Overridden from base::trace_event::MemoryDumpProvider: | 319 // Overridden from base::trace_event::MemoryDumpProvider: |
| 310 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, | 320 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, |
| 311 base::trace_event::ProcessMemoryDump* pmd) override; | 321 base::trace_event::ProcessMemoryDump* pmd) override; |
| 312 | 322 |
| 313 private: | 323 private: |
| 314 // Returns the number of available entries (they may not be contiguous). | 324 // Returns the number of available entries (they may not be contiguous). |
| 315 int32 AvailableEntries() { | 325 int32 AvailableEntries() { |
| 316 return (get_offset() - put_ - 1 + total_entry_count_) % total_entry_count_; | 326 return (get_offset() - put_ - 1 + total_entry_count_) % total_entry_count_; |
| 317 } | 327 } |
| 318 | 328 |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 334 CommandBuffer* command_buffer_; | 344 CommandBuffer* command_buffer_; |
| 335 int32 ring_buffer_id_; | 345 int32 ring_buffer_id_; |
| 336 int32 ring_buffer_size_; | 346 int32 ring_buffer_size_; |
| 337 scoped_refptr<gpu::Buffer> ring_buffer_; | 347 scoped_refptr<gpu::Buffer> ring_buffer_; |
| 338 CommandBufferEntry* entries_; | 348 CommandBufferEntry* entries_; |
| 339 int32 total_entry_count_; // the total number of entries | 349 int32 total_entry_count_; // the total number of entries |
| 340 int32 immediate_entry_count_; | 350 int32 immediate_entry_count_; |
| 341 int32 token_; | 351 int32 token_; |
| 342 int32 put_; | 352 int32 put_; |
| 343 int32 last_put_sent_; | 353 int32 last_put_sent_; |
| 344 int32 last_barrier_put_sent_; | 354 |
| 355 uint32_t next_fence_sync_release_; | |
|
sunnyps
2015/09/23 21:44:45
I think this should be part of GpuChannelHost::Str
David Yen
2015/09/25 20:13:33
The command buffer ID should be per context (as th
| |
| 356 uint32_t flushed_fence_sync_release_; | |
| 345 | 357 |
| 346 #if defined(CMD_HELPER_PERIODIC_FLUSH_CHECK) | 358 #if defined(CMD_HELPER_PERIODIC_FLUSH_CHECK) |
| 347 int commands_issued_; | 359 int commands_issued_; |
| 348 #endif | 360 #endif |
| 349 | 361 |
| 350 bool usable_; | 362 bool usable_; |
| 351 bool context_lost_; | 363 bool context_lost_; |
| 352 bool flush_automatically_; | 364 bool flush_automatically_; |
| 353 | 365 |
| 354 base::TimeTicks last_flush_time_; | 366 base::TimeTicks last_flush_time_; |
| 355 | 367 |
| 356 // Incremented every time the helper flushes the command buffer. | 368 // Incremented every time the helper flushes the command buffer. |
| 357 // Can be used to track when prior commands have been flushed. | 369 // Can be used to track when prior commands have been flushed. |
| 358 uint32 flush_generation_; | 370 uint32 flush_generation_; |
| 359 | 371 |
| 360 friend class CommandBufferHelperTest; | 372 friend class CommandBufferHelperTest; |
| 361 DISALLOW_COPY_AND_ASSIGN(CommandBufferHelper); | 373 DISALLOW_COPY_AND_ASSIGN(CommandBufferHelper); |
| 362 }; | 374 }; |
| 363 | 375 |
| 364 } // namespace gpu | 376 } // namespace gpu |
| 365 | 377 |
| 366 #endif // GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_ | 378 #endif // GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_ |
| OLD | NEW |