summaryrefslogtreecommitdiffstats
path: root/gpu/command_buffer
diff options
context:
space:
mode:
authorzmo@chromium.org <zmo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-14 01:37:17 +0000
committerzmo@chromium.org <zmo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-14 01:37:17 +0000
commitd5d77fcfbdaced23d4d8dcd493a45765389ccd06 (patch)
treed89366d1155a1fbe8bab21da7ca4a9a6c0db78da /gpu/command_buffer
parent3275fd9ea089e9464370bc01411ae0a4fde8341e (diff)
downloadchromium_src-d5d77fcfbdaced23d4d8dcd493a45765389ccd06.zip
chromium_src-d5d77fcfbdaced23d4d8dcd493a45765389ccd06.tar.gz
chromium_src-d5d77fcfbdaced23d4d8dcd493a45765389ccd06.tar.bz2
Expose video memory usage estimation (textures, renderbuffers, buffers) in command buffer.
This will be used by GpuMemoryManager BUG=129739 TEST=bots R=gman Review URL: https://chromiumcodereview.appspot.com/10548034 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@142061 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu/command_buffer')
-rw-r--r--gpu/command_buffer/service/buffer_manager.h4
-rw-r--r--gpu/command_buffer/service/context_group.cc11
-rw-r--r--gpu/command_buffer/service/context_group.h2
-rw-r--r--gpu/command_buffer/service/renderbuffer_manager.h4
-rw-r--r--gpu/command_buffer/service/texture_manager.h4
5 files changed, 25 insertions, 0 deletions
diff --git a/gpu/command_buffer/service/buffer_manager.h b/gpu/command_buffer/service/buffer_manager.h
index b3b4ede..49715cc 100644
--- a/gpu/command_buffer/service/buffer_manager.h
+++ b/gpu/command_buffer/service/buffer_manager.h
@@ -183,6 +183,10 @@ class GPU_EXPORT BufferManager {
allow_buffers_on_multiple_targets_ = allow;
}
+ size_t mem_represented() const {
+ return mem_represented_;
+ }
+
private:
void UpdateMemRepresented();
diff --git a/gpu/command_buffer/service/context_group.cc b/gpu/command_buffer/service/context_group.cc
index 81fd606..cc86ce5 100644
--- a/gpu/command_buffer/service/context_group.cc
+++ b/gpu/command_buffer/service/context_group.cc
@@ -239,6 +239,17 @@ IdAllocatorInterface* ContextGroup::GetIdAllocator(unsigned namespace_id) {
return id_namespaces_[namespace_id].get();
}
+uint32 ContextGroup::GetMemRepresented() const {
+ uint32 total = 0;
+ if (buffer_manager_.get())
+ total += buffer_manager_->mem_represented();
+ if (renderbuffer_manager_.get())
+ total += renderbuffer_manager_->mem_represented();
+ if (texture_manager_.get())
+ total += texture_manager_->mem_represented();
+ return total;
+}
+
ContextGroup::~ContextGroup() {
CHECK(num_contexts_ == 0);
}
diff --git a/gpu/command_buffer/service/context_group.h b/gpu/command_buffer/service/context_group.h
index bf76308..2f3eaf9 100644
--- a/gpu/command_buffer/service/context_group.h
+++ b/gpu/command_buffer/service/context_group.h
@@ -122,6 +122,8 @@ class GPU_EXPORT ContextGroup : public base::RefCounted<ContextGroup> {
IdAllocatorInterface* GetIdAllocator(unsigned namespace_id);
+ uint32 GetMemRepresented() const;
+
private:
friend class base::RefCounted<ContextGroup>;
~ContextGroup();
diff --git a/gpu/command_buffer/service/renderbuffer_manager.h b/gpu/command_buffer/service/renderbuffer_manager.h
index 483c193..6a99e2f 100644
--- a/gpu/command_buffer/service/renderbuffer_manager.h
+++ b/gpu/command_buffer/service/renderbuffer_manager.h
@@ -160,6 +160,10 @@ class GPU_EXPORT RenderbufferManager {
// Gets a client id for a given service id.
bool GetClientId(GLuint service_id, GLuint* client_id) const;
+ size_t mem_represented() const {
+ return mem_represented_;
+ }
+
private:
void UpdateMemRepresented();
diff --git a/gpu/command_buffer/service/texture_manager.h b/gpu/command_buffer/service/texture_manager.h
index 927711c..a157146 100644
--- a/gpu/command_buffer/service/texture_manager.h
+++ b/gpu/command_buffer/service/texture_manager.h
@@ -509,6 +509,10 @@ class GPU_EXPORT TextureManager {
}
}
+ uint32 mem_represented() const {
+ return mem_represented_;
+ }
+
private:
// Helper for Initialize().
TextureInfo::Ref CreateDefaultAndBlackTextures(