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 // A class to emulate GLES2 over command buffers. | 5 // A class to emulate GLES2 over command buffers. |
6 | 6 |
7 #include "gpu/command_buffer/client/gles2_implementation.h" | 7 #include "gpu/command_buffer/client/gles2_implementation.h" |
8 | 8 |
9 #include <GLES2/gl2.h> | 9 #include <GLES2/gl2.h> |
10 #include <GLES2/gl2ext.h> | 10 #include <GLES2/gl2ext.h> |
11 #include <GLES2/gl2extchromium.h> | 11 #include <GLES2/gl2extchromium.h> |
12 #include <GLES3/gl3.h> | 12 #include <GLES3/gl3.h> |
13 #include <stddef.h> | 13 #include <stddef.h> |
14 #include <stdint.h> | 14 #include <stdint.h> |
15 #include <algorithm> | 15 #include <algorithm> |
16 #include <map> | 16 #include <map> |
17 #include <set> | 17 #include <set> |
18 #include <sstream> | 18 #include <sstream> |
19 #include <string> | 19 #include <string> |
20 #include "base/atomic_sequence_num.h" | 20 #include "base/atomic_sequence_num.h" |
21 #include "base/compiler_specific.h" | 21 #include "base/compiler_specific.h" |
| 22 #include "base/memory/shared_memory_tracker.h" |
22 #include "base/numerics/safe_math.h" | 23 #include "base/numerics/safe_math.h" |
23 #include "base/strings/string_split.h" | 24 #include "base/strings/string_split.h" |
24 #include "base/strings/stringprintf.h" | 25 #include "base/strings/stringprintf.h" |
25 #include "base/sys_info.h" | 26 #include "base/sys_info.h" |
26 #include "base/threading/thread_task_runner_handle.h" | 27 #include "base/threading/thread_task_runner_handle.h" |
27 #include "base/trace_event/memory_allocator_dump.h" | 28 #include "base/trace_event/memory_allocator_dump.h" |
28 #include "base/trace_event/memory_dump_manager.h" | 29 #include "base/trace_event/memory_dump_manager.h" |
29 #include "base/trace_event/process_memory_dump.h" | 30 #include "base/trace_event/process_memory_dump.h" |
30 #include "base/trace_event/trace_event.h" | 31 #include "base/trace_event/trace_event.h" |
31 #include "gpu/command_buffer/client/buffer_tracker.h" | 32 #include "gpu/command_buffer/client/buffer_tracker.h" |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 | 453 |
453 MemoryAllocatorDump* dump = pmd->CreateAllocatorDump(base::StringPrintf( | 454 MemoryAllocatorDump* dump = pmd->CreateAllocatorDump(base::StringPrintf( |
454 "gpu/transfer_buffer_memory/buffer_%d", transfer_buffer_->GetShmId())); | 455 "gpu/transfer_buffer_memory/buffer_%d", transfer_buffer_->GetShmId())); |
455 dump->AddScalar(MemoryAllocatorDump::kNameSize, | 456 dump->AddScalar(MemoryAllocatorDump::kNameSize, |
456 MemoryAllocatorDump::kUnitsBytes, | 457 MemoryAllocatorDump::kUnitsBytes, |
457 transfer_buffer_->GetSize()); | 458 transfer_buffer_->GetSize()); |
458 | 459 |
459 if (args.level_of_detail != MemoryDumpLevelOfDetail::BACKGROUND) { | 460 if (args.level_of_detail != MemoryDumpLevelOfDetail::BACKGROUND) { |
460 dump->AddScalar("free_size", MemoryAllocatorDump::kUnitsBytes, | 461 dump->AddScalar("free_size", MemoryAllocatorDump::kUnitsBytes, |
461 transfer_buffer_->GetFreeSize()); | 462 transfer_buffer_->GetFreeSize()); |
462 auto guid = GetBufferGUIDForTracing(tracing_process_id, | 463 auto shared_memory = transfer_buffer_->GetSharedMemory(); |
463 transfer_buffer_->GetShmId()); | 464 if (shared_memory) { |
464 const int kImportance = 2; | 465 auto guid = GetBufferGUIDForTracing(tracing_process_id, |
465 pmd->CreateSharedGlobalAllocatorDump(guid); | 466 transfer_buffer_->GetShmId()); |
466 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); | 467 const int kImportance = 2; |
| 468 pmd->CreateSharedGlobalAllocatorDump(guid); |
| 469 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); |
| 470 base::SharedMemoryTracker::AddOwnershipEdgeToSharedGlobalDump(pmd, guid, |
| 471 shared_memory->handle(), shared_memory->mapped_size()); |
| 472 } |
467 } | 473 } |
468 | 474 |
469 return true; | 475 return true; |
470 } | 476 } |
471 | 477 |
472 void GLES2Implementation::WaitForCmd() { | 478 void GLES2Implementation::WaitForCmd() { |
473 TRACE_EVENT0("gpu", "GLES2::WaitForCmd"); | 479 TRACE_EVENT0("gpu", "GLES2::WaitForCmd"); |
474 helper_->CommandBufferHelper::Finish(); | 480 helper_->CommandBufferHelper::Finish(); |
475 } | 481 } |
476 | 482 |
(...skipping 6592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7069 CheckGLError(); | 7075 CheckGLError(); |
7070 } | 7076 } |
7071 | 7077 |
7072 // Include the auto-generated part of this file. We split this because it means | 7078 // Include the auto-generated part of this file. We split this because it means |
7073 // we can easily edit the non-auto generated parts right here in this file | 7079 // we can easily edit the non-auto generated parts right here in this file |
7074 // instead of having to edit some template or the code generator. | 7080 // instead of having to edit some template or the code generator. |
7075 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" | 7081 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" |
7076 | 7082 |
7077 } // namespace gles2 | 7083 } // namespace gles2 |
7078 } // namespace gpu | 7084 } // namespace gpu |
OLD | NEW |