New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 704792 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Mar 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug



Sign in to add a comment

Add Memory Dump Provider for CVPixelBufferRefs

Project Member Reported by ericrk@chromium.org, Mar 24 2017

Issue description

CVPixelBufferRefs refer to IOSurfaces and contribute to Chrome's memory usage. These aren't currently tracked in memory_infra, which is problematic as they are a potential source of leaks.

We should add this instrumentation in, keeping in mind:
 - We want to avoid double-counting things (if these are ever used as GL textures, or referenced from more than one place, we should make sure to alias them).
 - Ideally we wouldn't have a memory dump provider per ref (although we could if the number of refs isn't too extreme).

 

Comment 1 by ericrk@chromium.org, Mar 24 2017

Owner: ccameron@chromium.org
Assigning to ccameron@, as I'm not familiar with CVPixelBufferRefs. I'm happy to help with any of the memory-infra specific parts of this CL. https://chromium.googlesource.com/chromium/src/+/master/docs/memory-infra/adding_memory_infra_tracing.md also has some info.

It's not immediately clear where we create / store CVPixelBufferRefs (we seem to use them both in video encode operations for cast as well as video decode).

Ideally, we'd have a single object which knows about all outstanding CVPixelBufferRefs and dumps the memory to memory-infra. If this doesn't exist, we'd need to either:
 a) create such an object (or objects), or
 b) instrument each object we own that can hold a CVPixelBufferRef (or at least the common ones)

There don't seem to be to many cases of (b), so this might not be too bad.

Comment 2 by shrike@chromium.org, Mar 24 2017

Labels: Performance-Memory
Hmm, doing a memory-infra dump on a debug build while playing accelerated video blows up with 

[19775:775:0324/153531.129496:FATAL:process_memory_dump.cc(183)] Check failed: insertion_result.second. Duplicate name: gpu/gl/textures/share_group_17179869188/texture_5/face_0/level_0

(oh, that's not a big deal -- the image binding for CVPixelBufferRefs is a little odd).
So that I don't have to spelunk to find it, 

https://cs.chromium.org/chromium/src/media/gpu/ipc/service/gpu_video_decode_accelerator.cc?rcl=9e0bad82923e80164de225930fefe0986c1aa98d&l=63

    texture_manager->SetLevelImage(ref, texture_target, 0, image.get(),
                                   can_bind_to_sampler
                                       ? gpu::gles2::Texture::BOUND
                                       : gpu::gles2::Texture::UNBOUND);

So, 4:2:0 decoded frames will be UNBOUND even though they have an image pointer.
Project Member

Comment 6 by bugdroid1@chromium.org, Mar 29 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/4bb4e7702c8432bd1ec6843a9b7dee6f3e6e2eb3

commit 4bb4e7702c8432bd1ec6843a9b7dee6f3e6e2eb3
Author: ccameron <ccameron@chromium.org>
Date: Wed Mar 29 23:03:22 2017

Add CVPixelBufferRef memory tracking

Create a separate sequence number for GLImages created from
CVPixelBufferRefs (previously they had no sequence number, so they
would alias each other).

Make VTVideoDecodeAccelerator be a dump provider. This dumps through
the GLImage interface, and so it will correctly link the
CVPixelBufferRefs that with the command buffer textures.

Fix TextureManager's dump code to not assume that GLImage presence
and texture state BOUND are related (a texture can have a GLImage but
not be BOUND because it can't be textured out of directly).

BUG= 704792 
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel

Review-Url: https://codereview.chromium.org/2771923006
Cr-Commit-Position: refs/heads/master@{#460566}

[modify] https://crrev.com/4bb4e7702c8432bd1ec6843a9b7dee6f3e6e2eb3/gpu/command_buffer/service/texture_manager.cc
[modify] https://crrev.com/4bb4e7702c8432bd1ec6843a9b7dee6f3e6e2eb3/media/gpu/vt_video_decode_accelerator_mac.cc
[modify] https://crrev.com/4bb4e7702c8432bd1ec6843a9b7dee6f3e6e2eb3/media/gpu/vt_video_decode_accelerator_mac.h
[modify] https://crrev.com/4bb4e7702c8432bd1ec6843a9b7dee6f3e6e2eb3/ui/gl/gl_image_io_surface.mm

Status: Fixed (was: Available)

Sign in to add a comment