android_webview
apps
ash
base
build
build_overrides
buildtools
cc
chrome
chromecast
chromeos
clank
codelabs
components
content
crypto
dbus
device
docs
accessibility
autofill
chromeos
design
enterprise
experiments
fuchsia
gpu
graphics
images
infra
intl
ios
linux
login
mac
media
memory
memory-infra
DIR_METADATA
README.md
adding_memory_infra_tracing.md
heap_profiler.md
memory_benchmarks.md
memory_infra_startup_tracing.md
probe-cc.md
probe-gpu.md
probe-net.md
patterns
privacy
privacy_budget
process
security
speed
speed_metrics
standards
telemetry_extension
testing
transcripts
ui
updater
webapps
website
webui
workflow
DIR_METADATA
OWNERS
README.md
accessibility.md
ad_tagging.md
adding_to_third_party.md
android_accessing_cpp_enums_in_java.md
android_accessing_cpp_features_in_java.md
android_accessing_cpp_switches_in_java.md
android_build_instructions.md
android_cast_build_instructions.md
android_debugging_instructions.md
android_dynamic_feature_modules.md
android_emulator.md
android_isolated_splits.md
android_jni_ownership_best_practices.md
android_logging.md
android_native_libraries.md
android_studio.md
angle_in_chromium.md
api_keys.md
asan.md
atom.md
benchmark_performance_regressions.md
bfcache.md
bitmap_pipeline.md
branch_gardener.md
building_old_revisions.md
callback.md
ccache_mac.md
chrome_browser_design_principles.md
chrome_os_logging.md
chrome_settings.md
chromedriver_status.md
chromeos_build_instructions.md
chromeos_glossary.md
chromium_browser_vs_google_chrome.md
cipd_and_3pp.md
cl_respect.md
cl_tips.md
clang.md
clang_code_coverage_wrapper.md
clang_format.md
clang_gardening.md
clang_sheriffing.md
clang_static_analyzer.md
clang_tidy.md
clang_tool_refactoring.md
clangd.md
clion.md
closure_compilation.md
cocoa_tips_and_tricks.md
code_review_owners.md
code_reviews.md
commit_checklist.md
component_build.md
configuration.md
contributing.md
cq_fault_attribution.md
cr_respect.md
cr_user_manual.md
cross_platform_ui.md
cygwin_dll_remapping_failure.md
dangling_ptr.md
dangling_ptr_guide.md
dbus_mojo_connection_service.md
debugging_with_crash_keys.md
dependencies.md
deterministic_builds.md
disassemble_code.md
documentation_best_practices.md
documentation_guidelines.md
early-hints.md
eclipse.md
emacs.md
erc_irc.md
flag_expiry.md
flag_guarding_guidelines.md
flag_ownership.md
frame_trees.md
gardener.md
gcs_dependencies.md
gdbinit.md
gerrit_guide.md
get_the_code.md
git_cookbook.md
git_submodules.md
git_tips.md
google_chrome_branded_builds.md
google_play_services.md
graphical_debugging_aid_chromium_views.md
gwp_asan.md
history_manipulation_intervention.md
how_cc_works.md
how_to_add_your_feature_flag.md
how_to_extend_web_test_framework.md
idn.md
initialize_blink_features.md
inlined_stack_traces.md
installation_at_vmware.md
ios_build_instructions.md
ios_infra.md
ios_voiceover.md
kiosk_mode.md
life_of_a_frame.md
lldbinit.md
mac_arm64.md
mac_build_instructions.md
mac_lld.md
modifying_session_history_serialization.md
modules.md
mojo_and_services.md
mojo_ipc_conversion.md
mojo_testing.md
native_relocations.md
navbar.md
navigation-request-navigation-state.gv
navigation-request-navigation-state.png
navigation.md
navigation_concepts.md
network_traffic_annotations.md
no_sources_assignment_filter.md
orderfile.md
origin_trials_integration.md
ozone_overview.md
parsing_test_results.md
pgo.md
piranha_plant.md
process_model_and_site_isolation.md
profiling.md
profiling_content_shell_on_android.md
proxy_auto_config.md
qtcreator.md
release_branch_guidance.md
render-frame-host-lifecycle-state.gv
render-frame-host-lifecycle-state.png
render_document.md
rust-ffi.md
rust.md
seccomp_sandbox_crash_dumping.md
servicification.md
session_history.md
sheriff.md
shutdown.md
special_case_urls.md
static_initializers.md
sublime_ide.md
system_hardening_features.md
tab_helpers.md
threading_and_tasks.md
threading_and_tasks_faq.md
threading_and_tasks_testing.md
toolchain_support.md
tour_of_luci_ui.md
tpm_quick_ref.md
translation_screenshots.md
unretained_dangling_ptr_guide.md
unsafe_buffers.md
updating_clang.md
updating_clang_format_binaries.md
use_counter_wiki.md
useful_urls.md
user_data_dir.md
user_data_storage.md
user_handle_mapping.md
vanilla_msysgit_workflow.md
vscode.md
vscode_python.md
webview_policies.md
win_cross.md
win_order_files.md
windows_build_instructions.md
windows_native_window_occlusion_tracking.md
windows_pwa_integration.md
windows_shortcut_and_taskbar_handling.md
windows_split_dll.md
windows_virtual_desktop_handling.md
wmax_tokens.md
working_remotely_with_android.md
writing_clang_plugins.md
extensions
fuchsia_web
gin
google_apis
gpu
headless
infra
internal
ios
ios_internal
ipc
media
mojo
native_client
native_client_sdk
net
pdf
ppapi
printing
remoting
rlz
sandbox
services
signing_keys
skia
sql
storage
styleguide
testing
third_party
tools
ui
url
v8
webkit
.clang-format
.clang-tidy
.clangd
.git-blame-ignore-revs
.gitallowed
.gitattributes
.gitignore
.gitmodules
.gn
.mailmap
.rustfmt.toml
.vpython3
.yapfignore
ATL_OWNERS
AUTHORS
BUILD.gn
CODE_OF_CONDUCT.md
CPPLINT.cfg
CRYPTO_OWNERS
DEPS
DIR_METADATA
LICENSE
LICENSE.chromium_os
OWNERS
PRESUBMIT.py
PRESUBMIT_test.py
PRESUBMIT_test_mocks.py
README.md
WATCHLISTS
codereview.settings

GLImage has been entirely replaced by SharedImage. Bug: 1310018 Change-Id: I54df50a986033236999fb60eb0419986534ef6bd Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4729402 Reviewed-by: Kentaro Hara <haraken@chromium.org> Commit-Queue: Colin Blundell <blundell@chromium.org> Cr-Commit-Position: refs/heads/main@{#1176483}
93 lines
4.2 KiB
Markdown
93 lines
4.2 KiB
Markdown
# GPU Memory Tracing
|
|
|
|
This is an overview of the GPU column in [MemoryInfra][memory-infra].
|
|
|
|
[TOC]
|
|
|
|
## Quick Start
|
|
|
|
If you want an overview of total GPU memory usage, select the GPU process' GPU
|
|
category and look at the _size_ column. (Not _effective size_.)
|
|
|
|
![Look at the size column for total GPU memory][gpu-size-column]
|
|
|
|
[memory-infra]: README.md
|
|
[gpu-size-column]: https://storage.googleapis.com/chromium-docs.appspot.com/c7d632c18d90d99e393ad0ade929f96e7d8243fe
|
|
|
|
## In Depth
|
|
|
|
GPU Memory in Chrome involves several different types of allocations. These
|
|
include, but are not limited to:
|
|
|
|
* **Raw OpenGL Objects**: These objects are allocated by Chrome using the
|
|
OpenGL API. Chrome itself has handles to these objects, but the actual
|
|
backing memory may live in a variety of places (CPU side in the GPU process,
|
|
CPU side in the kernel, GPU side). Because most OpenGL operations occur over
|
|
IPC, communicating with Chrome's GPU process, these allocations are almost
|
|
always shared between a renderer or browser process and the GPU process.
|
|
* **GPU Memory Buffers**: These objects provide a chunk of writable memory
|
|
which can be handed off cross-process. While GPUMemoryBuffers represent a
|
|
platform-independent way to access this memory, they have a number of
|
|
possible platform-specific implementations (EGL surfaces on Linux,
|
|
IOSurfaces on Mac, or CPU side shared memory). Because of their cross
|
|
process use case, these objects will almost always be shared between a
|
|
renderer or browser process and the GPU process.
|
|
* **SharedImages**: SharedImages are a platform-independent abstraction around GPU
|
|
memory, similar to GPU Memory Buffers. In many cases, SharedImages are created
|
|
from GPUMemoryBuffers.
|
|
|
|
GPU Memory can be found across a number of different processes, in a few
|
|
different categories.
|
|
|
|
Renderer or browser process:
|
|
|
|
* **CC Category**: The CC category contains all resource allocations used in
|
|
the Chrome Compositor. When GPU rasterization is enabled, these resource
|
|
allocations will be GPU allocations as well. See also
|
|
[docs/memory-infra/probe-cc.md][cc-memory].
|
|
* **Skia/gpu_resources Category**: All GPU resources used by Skia.
|
|
* **GPUMemoryBuffer Category**: All GPUMemoryBuffers in use in the current
|
|
process.
|
|
|
|
GPU process:
|
|
|
|
* **GPU Category**: All GPU allocations, many shared with other processes.
|
|
* **GPUMemoryBuffer Category**: All GPUMemoryBuffers.
|
|
|
|
## Example
|
|
|
|
Many of the objects listed above are shared between multiple processes.
|
|
Consider a GL texture used by CC --- this texture is shared between a renderer
|
|
and the GPU process. Additionally, the texture may be backed by a SharedImage
|
|
which was created from a GPUMemoryBuffer, which is also shared between the
|
|
renderer and GPU process. This means that the single texture may show up in the
|
|
memory logs of two different processes multiple times.
|
|
|
|
To make things easier to understand, each GPU allocation is only ever "owned"
|
|
by a single process and category. For instance, in the above example, the
|
|
texture would be owned by the CC category of the renderer process. Each
|
|
allocation has (at least) two sizes recorded --- _size_ and _effective size_.
|
|
In the owning allocation, these two numbers will match:
|
|
|
|
![Matching size and effective size][owner-size]
|
|
|
|
Note that the allocation also gives information on what other processes it is
|
|
shared with (seen by hovering over the green arrow). If we navigate to the
|
|
other allocation (in this case, gpu/gl/textures/client_25/texture_216) we will
|
|
see a non-owning allocation. In this allocation the size is the same, but the
|
|
_effective size_ is 0:
|
|
|
|
![Effective size of zero][non-owner-size]
|
|
|
|
Other types, such as GPUMemoryBuffers and SharedImages have similar sharing
|
|
patterns.
|
|
|
|
When trying to get an overview of the absolute memory usage tied to the GPU,
|
|
you can look at the size column (not effective size) of just the GPU process'
|
|
GPU category. This will show all GPU allocations, whether or not they are owned
|
|
by another process.
|
|
|
|
[cc-memory]: /docs/memory-infra/probe-cc.md
|
|
[owner-size]: https://storage.googleapis.com/chromium-docs.appspot.com/a325c4426422e53394a322d31b652cfa34231189
|
|
[non-owner-size]: https://storage.googleapis.com/chromium-docs.appspot.com/b8cf464636940d0925f29a102e99aabb9af40b13
|