diff options
author | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-27 10:14:46 +0000 |
---|---|---|
committer | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-27 10:14:46 +0000 |
commit | d5c76964829a028d352ffbef642ae96303e98de6 (patch) | |
tree | 3b954b239b7e99cdf62b8b768164ab4820011a16 /ppapi/native_client | |
parent | 52fe647480a3846fe82183b4221a336f2736d52a (diff) | |
download | chromium_src-d5c76964829a028d352ffbef642ae96303e98de6.zip chromium_src-d5c76964829a028d352ffbef642ae96303e98de6.tar.gz chromium_src-d5c76964829a028d352ffbef642ae96303e98de6.tar.bz2 |
Make transferbuffer increase in size dynamically
TEST=unit tests
BUG=101431
Review URL: http://codereview.chromium.org/9113069
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@119430 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/native_client')
3 files changed, 20 insertions, 16 deletions
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_3d.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_3d.cc index 2fc4bd6..a3220f9 100644 --- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_3d.cc +++ b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_3d.cc @@ -7,6 +7,7 @@ #include "native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_3d.h" #include "gpu/command_buffer/client/gles2_implementation.h" +#include "gpu/command_buffer/client/transfer_buffer.h" #include "native_client/src/shared/ppapi_proxy/command_buffer_nacl.h" #include "native_client/src/shared/ppapi_proxy/object_serialize.h" #include "native_client/src/shared/ppapi_proxy/plugin_callback.h" @@ -25,8 +26,10 @@ namespace ppapi_proxy { namespace { -const int32 kRingBufferSize = 4096 * 1024; -const int32 kTransferBufferSize = 4096 * 1024; +const size_t kRingBufferSize = 4 * 1024 * 1024; +const size_t kStartTransferBufferSize = 4 * 1024 * 1024; +const size_t kMinTransferBufferSize = 256 * 1024; +const size_t kMaxTransferBufferSize = 16 * 1024 * 1024; int32_t GetNumAttribs(const int32_t* attrib_list) { int32_t num = 0; @@ -181,6 +184,7 @@ PluginGraphics3D::~PluginGraphics3D() { DebugPrintf("PluginGraphics3D::~PluginGraphics3D()\n"); // Explicitly tear down scopted pointers; ordering below matters. gles2_implementation_.reset(); + transfer_buffer_.reset(); gles2_helper_.reset(); command_buffer_.reset(); // Invalidate the cache. @@ -213,19 +217,16 @@ bool PluginGraphics3D::InitFromBrowserResource(PP_Resource res) { if (command_buffer_->Initialize()) { gles2_helper_.reset(new gpu::gles2::GLES2CmdHelper(command_buffer_.get())); if (gles2_helper_->Initialize(kRingBufferSize)) { - // Request id -1 to signify 'don't care' - int32 transfer_buffer_id = - command_buffer_->CreateTransferBuffer(kTransferBufferSize, -1); - gpu::Buffer transfer_buffer = - command_buffer_->GetTransferBuffer(transfer_buffer_id); - if (transfer_buffer.ptr) { - gles2_implementation_.reset(new gpu::gles2::GLES2Implementation( - gles2_helper_.get(), - transfer_buffer.size, - transfer_buffer.ptr, - transfer_buffer_id, - false, - true)); + transfer_buffer_.reset(new gpu::TransferBuffer(gles2_helper_.get())); + gles2_implementation_.reset(new gpu::gles2::GLES2Implementation( + gles2_helper_.get(), + transfer_buffer_.get(), + false, + true)); + if (gles2_implementation_->Initialize( + kStartTransferBufferSize, + kMinTransferBufferSize, + kMaxTransferBufferSize)) { return true; } } diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_3d.h b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_3d.h index 115cc25..84af986 100644 --- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_3d.h +++ b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_3d.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -15,6 +15,7 @@ namespace gpu { class CommandBuffer; +class TransferBuffer; namespace gles2 { class GLES2CmdHelper; class GLES2Implementation; @@ -63,6 +64,7 @@ class PluginGraphics3D : public PluginResource { // GLES2 Implementation objects. scoped_ptr<gpu::CommandBuffer> command_buffer_; scoped_ptr<gpu::gles2::GLES2Implementation> gles2_implementation_; + scoped_ptr<gpu::TransferBuffer> transfer_buffer_; scoped_ptr<gpu::gles2::GLES2CmdHelper> gles2_helper_; PP_Instance instance_id_; diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppapi_proxy_untrusted.gyp b/ppapi/native_client/src/shared/ppapi_proxy/ppapi_proxy_untrusted.gyp index 58dad08..80f2a11 100644 --- a/ppapi/native_client/src/shared/ppapi_proxy/ppapi_proxy_untrusted.gyp +++ b/ppapi/native_client/src/shared/ppapi_proxy/ppapi_proxy_untrusted.gyp @@ -34,6 +34,7 @@ '<(DEPTH)/gpu/command_buffer/client/gles2_cmd_helper.cc', '<(DEPTH)/gpu/command_buffer/client/gles2_implementation.cc', '<(DEPTH)/gpu/command_buffer/client/program_info_manager.cc', + '<(DEPTH)/gpu/command_buffer/client/transfer_buffer.cc', '<(DEPTH)/gpu/command_buffer/client/gles2_lib.cc', '<(DEPTH)/gpu/command_buffer/client/mapped_memory.cc', '<(DEPTH)/gpu/command_buffer/client/ring_buffer.cc', |