0

Fix viz memory dumping

When there are multiple windows open with viz, each window has it's own
InProcCmdBuffer. If we do a memory dump with multiple windows, we will
fail DCHECKs on calls from VizProcessContextProvider::OnMemoryDump
because we will have multiple CommandBufferHelpers in the same process
with the same ring_buffer_id_.

https://cs.chromium.org/chromium/src/gpu/command_buffer/client/cmd_buffer_helper.cc?rcl=9c52bb1d0f58d02879f4373f5db09aa625c590a7&l=365

This CL makes the transfer buffer IDs generated by InProcCmdBuffer
unique within a process and avoids the failing check.

Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel
Change-Id: I204098af24c6148c1abe71724dbc5b176ee1a29f
Reviewed-on: https://chromium-review.googlesource.com/1243672
Reviewed-by: Antoine Labour <piman@chromium.org>
Commit-Queue: Jonathan Backer <backer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#594084}
This commit is contained in:
Jonathan Backer
2018-09-25 20:36:58 +00:00
committed by Commit Bot
parent 7490c3bf3f
commit 6b4ccf33a5
2 changed files with 2 additions and 2 deletions

@ -89,6 +89,7 @@ namespace {
base::AtomicSequenceNumber g_next_route_id;
base::AtomicSequenceNumber g_next_image_id;
base::AtomicSequenceNumber g_next_transfer_buffer_id;
CommandBufferId NextCommandBufferId() {
return CommandBufferIdFromChannelAndRoute(kInProcessCommandBufferClientId,
@ -934,7 +935,7 @@ scoped_refptr<Buffer> InProcessCommandBuffer::CreateTransferBuffer(
size_t size,
int32_t* id) {
scoped_refptr<Buffer> buffer = MakeMemoryBuffer(size);
*id = ++next_transfer_buffer_id_;
*id = g_next_transfer_buffer_id.GetNext() + 1;
ScheduleGpuTask(
base::BindOnce(&InProcessCommandBuffer::RegisterTransferBufferOnGpuThread,
gpu_thread_weak_ptr_factory_.GetWeakPtr(), *id, buffer));

@ -330,7 +330,6 @@ class GL_IN_PROCESS_CONTEXT_EXPORT InProcessCommandBuffer
int32_t last_put_offset_ = -1;
Capabilities capabilities_;
GpuMemoryBufferManager* gpu_memory_buffer_manager_ = nullptr;
int32_t next_transfer_buffer_id_ = 1;
uint64_t next_fence_sync_release_ = 1;
uint64_t flushed_fence_sync_release_ = 0;
std::vector<SyncToken> next_flush_sync_token_fences_;