diff options
author | ccameron@chromium.org <ccameron@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-13 01:16:48 +0000 |
---|---|---|
committer | ccameron@chromium.org <ccameron@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-13 01:16:48 +0000 |
commit | 68e81a4a69fcfd394e4e5e86e59c9b5db17c4370 (patch) | |
tree | aebf1a486dadc15ef9640079c550b9ecc5f688ed /content/common/gpu/gpu_memory_manager.h | |
parent | 04b5defa857ffd767aa5827e9dc6b3d847c328de (diff) | |
download | chromium_src-68e81a4a69fcfd394e4e5e86e59c9b5db17c4370.zip chromium_src-68e81a4a69fcfd394e4e5e86e59c9b5db17c4370.tar.gz chromium_src-68e81a4a69fcfd394e4e5e86e59c9b5db17c4370.tar.bz2 |
Track managed memory usage in the command buffer.
This adds infrastructure necessary to support tracking which allocations
are through the compositor (or, more generally, any managed allocator that
the GPU memory manager affect) and allocations that are not (e.g, WebGL).
This is part of a scheme which will add a GL extension where the compositor
can mark a texture as being managed by a call to glTexParameteri.
This information had previously been tracked by an IPC being sent by the
compositor to the GPU process informing it of the managed memory usage (in
addition to the usage required for all visible content, etc). This had
the two problems. First, the information was not accurate -- the data sent
about managed allocations to the GPU memory manager would always lag the
actual allocations. Second, these IPCs were expensive and needed to be
throttled. The more we throttle the IPCs, the less accurate the information
would become, making the GPU memory manager's behavior less precise and
predictable.
BUG=164947
Review URL: https://chromiumcodereview.appspot.com/11516014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@172754 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/common/gpu/gpu_memory_manager.h')
-rw-r--r-- | content/common/gpu/gpu_memory_manager.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/content/common/gpu/gpu_memory_manager.h b/content/common/gpu/gpu_memory_manager.h index bbd4cd2..4e585a9 100644 --- a/content/common/gpu/gpu_memory_manager.h +++ b/content/common/gpu/gpu_memory_manager.h @@ -77,7 +77,10 @@ class CONTENT_EXPORT GpuMemoryManager : void RemoveTrackingGroup(GpuMemoryTrackingGroup* tracking_group); // Track a change in memory allocated by any context - void TrackMemoryAllocatedChange(size_t old_size, size_t new_size); + void TrackMemoryAllocatedChange( + size_t old_size, + size_t new_size, + gpu::gles2::MemoryTracker::Pool tracking_pool); private: friend class GpuMemoryManagerTest; @@ -175,6 +178,12 @@ class CONTENT_EXPORT GpuMemoryManager : // Send memory usage stats to the browser process. void SendUmaStatsToBrowser(); + // Get the current number of bytes allocated. + size_t GetCurrentUsage() const { + return bytes_allocated_managed_current_ + + bytes_allocated_unmanaged_current_; + } + // Interfaces for testing void TestingSetClientVisible(GpuMemoryManagerClient* client, bool visible); void TestingSetClientLastUsedTime(GpuMemoryManagerClient* client, @@ -216,9 +225,10 @@ class CONTENT_EXPORT GpuMemoryManager : size_t bytes_backgrounded_available_gpu_memory_; // The current total memory usage, and historical maximum memory usage - size_t bytes_allocated_current_; + size_t bytes_allocated_managed_current_; size_t bytes_allocated_managed_visible_; size_t bytes_allocated_managed_backgrounded_; + size_t bytes_allocated_unmanaged_current_; size_t bytes_allocated_historical_max_; // The number of browser windows that exist. If we ever receive a |