diff options
author | boliu@chromium.org <boliu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-20 04:25:05 +0000 |
---|---|---|
committer | boliu@chromium.org <boliu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-20 04:26:43 +0000 |
commit | 469239e77f20c4ab2656f0f69b8793076a867120 (patch) | |
tree | 4bf0424ca2eeb22861fbe3f8966235ca3468d9a6 /webkit | |
parent | 338caf0fe6dd106964a84e43f90145f658c2c490 (diff) | |
download | chromium_src-469239e77f20c4ab2656f0f69b8793076a867120.zip chromium_src-469239e77f20c4ab2656f0f69b8793076a867120.tar.gz chromium_src-469239e77f20c4ab2656f0f69b8793076a867120.tar.bz2 |
Add memory limits struct to in-process context
Add SharedMemoryLimits struct to in-process command buffer
context. Pick a reasonable value for the reclaim limit for
synchronous compositor
BUG=402086
Review URL: https://codereview.chromium.org/455083002
Cr-Commit-Position: refs/heads/master@{#290764}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@290764 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
3 files changed, 28 insertions, 9 deletions
diff --git a/webkit/common/gpu/context_provider_in_process.cc b/webkit/common/gpu/context_provider_in_process.cc index 3785d38a..e4ca1d8 100644 --- a/webkit/common/gpu/context_provider_in_process.cc +++ b/webkit/common/gpu/context_provider_in_process.cc @@ -110,6 +110,13 @@ bool ContextProviderInProcess::BindToCurrentThread() { void ContextProviderInProcess::InitializeCapabilities() { capabilities_.gpu = context3d_->GetImplementation()->capabilities(); + + size_t mapped_memory_limit = context3d_->GetMappedMemoryLimit(); + capabilities_.max_transfer_buffer_usage_bytes = + mapped_memory_limit == + WebGraphicsContext3DInProcessCommandBufferImpl::kNoLimit + ? std::numeric_limits<size_t>::max() + : mapped_memory_limit; } cc::ContextProvider::Capabilities diff --git a/webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc b/webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc index afd843a..2dc7dc8 100644 --- a/webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc +++ b/webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc @@ -118,6 +118,10 @@ WebGraphicsContext3DInProcessCommandBufferImpl:: ~WebGraphicsContext3DInProcessCommandBufferImpl() { } +size_t WebGraphicsContext3DInProcessCommandBufferImpl::GetMappedMemoryLimit() { + return context_->GetMappedMemoryLimit(); +} + bool WebGraphicsContext3DInProcessCommandBufferImpl::MaybeInitializeGL() { if (initialized_) return true; @@ -135,15 +139,17 @@ bool WebGraphicsContext3DInProcessCommandBufferImpl::MaybeInitializeGL() { // will need to be lost either when the first context requesting the // discrete GPU is created, or the last one is destroyed. gfx::GpuPreference gpu_preference = gfx::PreferDiscreteGpu; - context_.reset(GLInProcessContext::Create(NULL, /* service */ - NULL, /* surface */ - is_offscreen_, - window_, - gfx::Size(1, 1), - NULL, /* share_context */ - share_resources_, - attribs_, - gpu_preference)); + context_.reset(GLInProcessContext::Create( + NULL, /* service */ + NULL, /* surface */ + is_offscreen_, + window_, + gfx::Size(1, 1), + NULL, /* share_context */ + share_resources_, + attribs_, + gpu_preference, + ::gpu::GLInProcessContextSharedMemoryLimits())); } if (context_) { diff --git a/webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h b/webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h index 54d7f17..0248dff 100644 --- a/webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h +++ b/webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h @@ -36,6 +36,10 @@ namespace gpu { class WEBKIT_GPU_EXPORT WebGraphicsContext3DInProcessCommandBufferImpl : public WebGraphicsContext3DImpl { public: + enum MappedMemoryReclaimLimit { + kNoLimit = 0, + }; + static scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> CreateViewContext( const blink::WebGraphicsContext3D::Attributes& attributes, @@ -54,6 +58,8 @@ class WEBKIT_GPU_EXPORT WebGraphicsContext3DInProcessCommandBufferImpl virtual ~WebGraphicsContext3DInProcessCommandBufferImpl(); + size_t GetMappedMemoryLimit(); + //---------------------------------------------------------------------- // WebGraphicsContext3D methods virtual bool makeContextCurrent(); |