0

[gpu] Fix media_texture_owner dump allowlist

Memory allocator dumps in background mode have an allowlist that only
supports hex codes as wild entries and is not a proper regex supporter.
This means only "0x?" is supported. There's media_texture_owner_?
which does not work properly because of this. This change updates
to use a hex code there as well so it follows the pattern matching.

Bug: 397720827
Change-Id: Id0dbac5623d9d4bafd527548a9f66d388802f500
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6394522
Reviewed-by: Kyle Charbonneau <kylechar@chromium.org>
Commit-Queue: Saifuddin Hitawala <hitawala@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1438409}
This commit is contained in:
Saifuddin Hitawala
2025-03-26 14:35:55 -07:00
committed by Chromium LUCI CQ
parent 9a3fe1090e
commit 02e0b427ea
4 changed files with 8 additions and 7 deletions

@ -177,7 +177,7 @@ constexpr auto kAllocatorDumpNameAllowlist =
"gpu/gr_shader_cache/cache_0x?",
"gpu/mapped_memory/manager_0x?",
"gpu/shared_images",
"gpu/media_texture_owner_?",
"gpu/media_texture_owner_0x?",
"gpu/transfer_buffer_memory/buffer_0x?",
"gpu/transfer_cache/cache_0x?",
"gpu/transfer_cache/cache_0x?/avg_image_size",

@ -571,8 +571,7 @@ bool ImageReaderGLOwner::OnMemoryDump(
base::trace_event::ProcessMemoryDump* pmd) {
if (args.level_of_detail ==
base::trace_event::MemoryDumpLevelOfDetail::kBackground) {
auto dump_name =
base::StringPrintf("gpu/media_texture_owner_%d/", tracing_id());
auto dump_name = base::StringPrintf(kMemoryDumpPrefix, tracing_id());
base::trace_event::MemoryAllocatorDump* dump =
pmd->CreateAllocatorDump(dump_name);
@ -586,8 +585,9 @@ bool ImageReaderGLOwner::OnMemoryDump(
int i = 0;
base::AutoLock auto_lock(lock_);
for (const auto& image : image_refs_) {
std::string dump_name = base::StringPrintf(
"gpu/media_texture_owner_%d/image_%d", tracing_id(), i++);
auto format_runtime = absl::ParsedFormat<'d', 'd'>::New(
base::StrCat({kMemoryDumpPrefix, "/image_%d"}));
std::string dump_name = absl::StrFormat(*format_runtime, tracing_id(), i++);
// If we fail to get AImage size for any reason, we still report the image
// as a empty size, so it can be diagnosed in necessary.

@ -303,8 +303,7 @@ bool SurfaceTextureGLOwner::DecomposeTransform(float mtx[16],
bool SurfaceTextureGLOwner::OnMemoryDump(
const base::trace_event::MemoryDumpArgs& args,
base::trace_event::ProcessMemoryDump* pmd) {
auto dump_name =
base::StringPrintf("gpu/media_texture_owner_%d", tracing_id());
auto dump_name = base::StringPrintf(kMemoryDumpPrefix, tracing_id());
// We don't know the exact format of the image so we use NV12 as approximation
// as the most popular format.

@ -147,6 +147,8 @@ class GPU_GLES2_EXPORT TextureOwner
int tracing_id() const { return tracing_id_; }
static constexpr char kMemoryDumpPrefix[] = "gpu/media_texture_owner_0x%x";
private:
friend class MockTextureOwner;