diff options
author | mmocny@chromium.org <mmocny@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-14 20:35:51 +0000 |
---|---|---|
committer | mmocny@chromium.org <mmocny@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-14 20:35:51 +0000 |
commit | 8cc980c55238ee905bededbfa1397cc09efd5bb0 (patch) | |
tree | bd60a3c3136a104751fa7f73d35ea60494a8d965 /content/renderer/gpu | |
parent | feed1d1a4f07a77f8db0b04e96fdb605574bb688 (diff) | |
download | chromium_src-8cc980c55238ee905bededbfa1397cc09efd5bb0.zip chromium_src-8cc980c55238ee905bededbfa1397cc09efd5bb0.tar.gz chromium_src-8cc980c55238ee905bededbfa1397cc09efd5bb0.tar.bz2 |
Adding gl command to change surface visibility, so that the gpu process can appropriately release/reacquire resources.
BUG=5175544
TEST=None
Review URL: http://codereview.chromium.org/7890046
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@105563 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/renderer/gpu')
6 files changed, 27 insertions, 0 deletions
diff --git a/content/renderer/gpu/command_buffer_proxy.cc b/content/renderer/gpu/command_buffer_proxy.cc index 4cc5cde..4e68cb1 100644 --- a/content/renderer/gpu/command_buffer_proxy.cc +++ b/content/renderer/gpu/command_buffer_proxy.cc @@ -367,6 +367,15 @@ bool CommandBufferProxy::Echo(const base::Closure& callback) { return true; } +bool CommandBufferProxy::SetSurfaceVisible(bool visible) { + if (last_state_.error != gpu::error::kNoError) { + return false; + } + + return Send(new GpuCommandBufferMsg_SetSurfaceVisible(route_id_, visible)); +} + + bool CommandBufferProxy::SetParent(CommandBufferProxy* parent_command_buffer, uint32 parent_texture_id) { if (last_state_.error != gpu::error::kNoError) diff --git a/content/renderer/gpu/command_buffer_proxy.h b/content/renderer/gpu/command_buffer_proxy.h index efb89fe..a65f882 100644 --- a/content/renderer/gpu/command_buffer_proxy.h +++ b/content/renderer/gpu/command_buffer_proxy.h @@ -70,6 +70,9 @@ class CommandBufferProxy : public gpu::CommandBuffer, // the task whether the echo succeeds or not. bool Echo(const base::Closure& callback); + // Sends an IPC message with the new state of surface visibility + bool SetSurfaceVisible(bool visible); + // Reparent a command buffer. TODO(apatrick): going forward, the notion of // the parent / child relationship between command buffers is going away in // favor of the notion of surfaces that can be drawn to in one command buffer diff --git a/content/renderer/gpu/renderer_gl_context.cc b/content/renderer/gpu/renderer_gl_context.cc index 994f085..97b100f 100644 --- a/content/renderer/gpu/renderer_gl_context.cc +++ b/content/renderer/gpu/renderer_gl_context.cc @@ -266,6 +266,10 @@ CommandBufferProxy* RendererGLContext::GetCommandBufferProxy() { return command_buffer_; } +bool RendererGLContext::SetSurfaceVisible(bool visible) { + return GetCommandBufferProxy()->SetSurfaceVisible(visible); +} + // TODO(gman): Remove This void RendererGLContext::DisableShaderTranslation() { NOTREACHED(); diff --git a/content/renderer/gpu/renderer_gl_context.h b/content/renderer/gpu/renderer_gl_context.h index a138b54..16834cb 100644 --- a/content/renderer/gpu/renderer_gl_context.h +++ b/content/renderer/gpu/renderer_gl_context.h @@ -160,6 +160,9 @@ class RendererGLContext : public base::SupportsWeakPtr<RendererGLContext>, // task whether the echo succeeds or not. bool Echo(const base::Closure& task); + // Sends an IPC message with the new state of surface visibility + bool SetSurfaceVisible(bool visibility); + // Create a TransportTextureHost object associated with the context. scoped_refptr<TransportTextureHost> CreateTransportTextureHost(); diff --git a/content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.cc b/content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.cc index 2defa137..caf17d3 100644 --- a/content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.cc +++ b/content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.cc @@ -24,6 +24,7 @@ #include "base/metrics/histogram.h" #include "base/synchronization/lock.h" #include "content/public/common/content_switches.h" +#include "content/renderer/gpu/command_buffer_proxy.h" #include "content/renderer/gpu/gpu_channel_host.h" #include "content/renderer/render_thread_impl.h" #include "content/renderer/render_view_impl.h" @@ -300,6 +301,11 @@ void WebGraphicsContext3DCommandBufferImpl::reshape(int width, int height) { #endif // FLIP_FRAMEBUFFER_VERTICALLY } +void WebGraphicsContext3DCommandBufferImpl::setVisibility(bool visible) { + gl_->Flush(); + context_->SetSurfaceVisible(visible); +} + #ifdef FLIP_FRAMEBUFFER_VERTICALLY void WebGraphicsContext3DCommandBufferImpl::FlipVertically( uint8* framebuffer, diff --git a/content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.h b/content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.h index 25585c0..f16af94 100644 --- a/content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.h +++ b/content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.h @@ -74,6 +74,8 @@ class WebGraphicsContext3DCommandBufferImpl virtual void reshape(int width, int height); + virtual void setVisibility(bool visible); + virtual bool readBackFramebuffer(unsigned char* pixels, size_t buffer_size); virtual bool readBackFramebuffer(unsigned char* pixels, size_t buffer_size, WebGLId framebuffer, int width, int height); |