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 /gpu/command_buffer/service/texture_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 'gpu/command_buffer/service/texture_manager.h')
-rw-r--r-- | gpu/command_buffer/service/texture_manager.h | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/gpu/command_buffer/service/texture_manager.h b/gpu/command_buffer/service/texture_manager.h index f2e7963..8c3100b 100644 --- a/gpu/command_buffer/service/texture_manager.h +++ b/gpu/command_buffer/service/texture_manager.h @@ -13,6 +13,7 @@ #include "base/memory/ref_counted.h" #include "gpu/command_buffer/service/feature_info.h" #include "gpu/command_buffer/service/gl_utils.h" +#include "gpu/command_buffer/service/memory_tracking.h" #include "gpu/gpu_export.h" #include "ui/gl/gl_image.h" @@ -22,8 +23,6 @@ namespace gles2 { class GLES2Decoder; class Display; class TextureDefinition; -class MemoryTracker; -class MemoryTypeTracker; // This class keeps track of the textures and their sizes so we can do NPOT and // texture complete checking. @@ -312,6 +311,11 @@ class GPU_EXPORT TextureManager { GLenum wrap_t_; GLenum usage_; + // The accounting pool towards which the memory for this allocation should + // be charged. This will be rolled into a new GLenum texture parameter in + // a separate change. + MemoryTracker::Pool tracking_pool_; + // The maximum level that has been set. GLint max_level_set_; @@ -508,8 +512,10 @@ class GPU_EXPORT TextureManager { } } - uint32 mem_represented() const { - return mem_represented_; + size_t mem_represented() const { + return + memory_tracker_managed_->GetMemRepresented() + + memory_tracker_unmanaged_->GetMemRepresented(); } void SetLevelImage( @@ -530,12 +536,12 @@ class GPU_EXPORT TextureManager { GLenum target, GLuint* black_texture); - void UpdateMemRepresented(); - void StartTracking(TextureInfo* info); void StopTracking(TextureInfo* info); - scoped_ptr<MemoryTypeTracker> texture_memory_tracker_; + MemoryTypeTracker* GetMemTracker(MemoryTracker::Pool tracking_pool); + scoped_ptr<MemoryTypeTracker> memory_tracker_managed_; + scoped_ptr<MemoryTypeTracker> memory_tracker_unmanaged_; FeatureInfo::Ref feature_info_; @@ -556,8 +562,6 @@ class GPU_EXPORT TextureManager { // Allows to check no TextureInfo will outlive this. unsigned int texture_info_count_; - uint32 mem_represented_; - bool have_context_; // Black (0,0,0,1) textures for when non-renderable textures are used. |