Commit 12d34adf authored by kylechar's avatar kylechar Committed by Commit Bot

Fix DisplayResourceProvider memory dumps

Change DisplayResourceProvider so that it records memory dumps when used
with SkiaRenderer. Also shared ownership edges were broken with shared
image backed resources, so update both GLRenderer and SkiaRenderer to
make a GUID based on mailbox. This might break shared ownership in
GLRenderer with things that aren't on shared image yet, but it fixes
shared ownership for everything that uses shared image.

Bug: 1058974
Change-Id: Iaaf981f28212cabe4d5e4535158afabaff2bd6af
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2131016Reviewed-by: default avatarJonathan Backer <backer@chromium.org>
Commit-Queue: kylechar <kylechar@chromium.org>
Cr-Commit-Position: refs/heads/master@{#755388}
parent 5954f48b
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "gpu/GLES2/gl2extchromium.h" #include "gpu/GLES2/gl2extchromium.h"
#include "gpu/command_buffer/client/context_support.h" #include "gpu/command_buffer/client/context_support.h"
#include "gpu/command_buffer/client/gles2_interface.h" #include "gpu/command_buffer/client/gles2_interface.h"
#include "gpu/command_buffer/common/shared_image_trace_utils.h"
#include "third_party/skia/include/gpu/GrBackendSurface.h" #include "third_party/skia/include/gpu/GrBackendSurface.h"
#include "ui/gl/trace_util.h" #include "ui/gl/trace_util.h"
...@@ -117,7 +118,7 @@ bool DisplayResourceProvider::OnMemoryDump( ...@@ -117,7 +118,7 @@ bool DisplayResourceProvider::OnMemoryDump(
if (resource.transferable.is_software) if (resource.transferable.is_software)
backing_memory_allocated = !!resource.shared_bitmap; backing_memory_allocated = !!resource.shared_bitmap;
else else
backing_memory_allocated = !!resource.gl_id; backing_memory_allocated = resource.gl_id != 0 || resource.image_context;
if (!backing_memory_allocated) { if (!backing_memory_allocated) {
// Don't log unallocated resources - they have no backing memory. // Don't log unallocated resources - they have no backing memory.
...@@ -144,28 +145,23 @@ bool DisplayResourceProvider::OnMemoryDump( ...@@ -144,28 +145,23 @@ bool DisplayResourceProvider::OnMemoryDump(
// Resources may be shared across processes and require a shared GUID to // Resources may be shared across processes and require a shared GUID to
// prevent double counting the memory. // prevent double counting the memory.
base::trace_event::MemoryAllocatorDumpGuid guid;
base::UnguessableToken shared_memory_guid;
if (resource.transferable.is_software) {
shared_memory_guid = resource.shared_bitmap_tracing_guid;
} else {
guid = gl::GetGLTextureClientGUIDForTracing(
compositor_context_provider_->ContextSupport()
->ShareGroupTracingGUID(),
resource.gl_id);
}
DCHECK(!shared_memory_guid.is_empty() || !guid.empty());
// The client that owns the resource will use a higher importance (2), and // The client that owns the resource will use a higher importance (2), and
// the GPU service will use a lower one (0). // the GPU service will use a lower one (0).
const int importance = 1; constexpr int kImportance = 1;
if (!shared_memory_guid.is_empty()) {
pmd->CreateSharedMemoryOwnershipEdge(dump->guid(), shared_memory_guid, if (resource.transferable.is_software) {
importance); pmd->CreateSharedMemoryOwnershipEdge(
dump->guid(), resource.shared_bitmap_tracing_guid, kImportance);
} else { } else {
// Shared ownership edges for legacy mailboxes aren't supported.
if (!resource.transferable.mailbox_holder.mailbox.IsSharedImage())
continue;
auto guid = GetSharedImageGUIDForTracing(
resource.transferable.mailbox_holder.mailbox);
pmd->CreateSharedGlobalAllocatorDump(guid); pmd->CreateSharedGlobalAllocatorDump(guid);
pmd->AddOwnershipEdge(dump->guid(), guid, importance); pmd->AddOwnershipEdge(dump->guid(), guid, kImportance);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment