diff options
author | kinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-27 11:46:45 +0000 |
---|---|---|
committer | kinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-27 11:46:45 +0000 |
commit | 2f38c45427c68fe731c1f5c05256b6c141a6a590 (patch) | |
tree | 3a7aeefef2e2d4f7dd936907b7966fad85639dfe /webkit | |
parent | f6813d1566dec10663c1492d517f45b5c0b9d546 (diff) | |
download | chromium_src-2f38c45427c68fe731c1f5c05256b6c141a6a590.zip chromium_src-2f38c45427c68fe731c1f5c05256b6c141a6a590.tar.gz chromium_src-2f38c45427c68fe731c1f5c05256b6c141a6a590.tar.bz2 |
Revert 119430 - Make transferbuffer increase in size dynamically
TEST=unit tests
BUG=101431
Review URL: http://codereview.chromium.org/9113069
TBR=gman@chromium.org
Review URL: https://chromiumcodereview.appspot.com/9298005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@119436 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc | 43 |
1 files changed, 27 insertions, 16 deletions
diff --git a/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc b/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc index c2c0f39..510f642 100644 --- a/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc +++ b/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc @@ -28,7 +28,6 @@ #include "base/synchronization/lock.h" #include "gpu/command_buffer/client/gles2_lib.h" #include "gpu/command_buffer/client/gles2_implementation.h" -#include "gpu/command_buffer/client/transfer_buffer.h" #include "gpu/command_buffer/common/constants.h" #include "gpu/command_buffer/service/context_group.h" #include "gpu/command_buffer/service/gpu_scheduler.h" @@ -47,7 +46,6 @@ using gpu::CommandBufferService; using gpu::gles2::GLES2CmdHelper; using gpu::gles2::GLES2Implementation; using gpu::GpuScheduler; -using gpu::TransferBuffer; namespace webkit { namespace gpu { @@ -192,7 +190,7 @@ class GLInProcessContext : public base::SupportsWeakPtr<GLInProcessContext> { scoped_refptr<gfx::GLContext> context_; scoped_refptr<gfx::GLSurface> surface_; scoped_ptr<GLES2CmdHelper> gles2_helper_; - scoped_ptr<TransferBuffer> transfer_buffer_; + int32 transfer_buffer_id_; scoped_ptr<GLES2Implementation> gles2_implementation_; Error last_error_; @@ -204,9 +202,7 @@ namespace { const int32 kCommandBufferSize = 1024 * 1024; // TODO(kbr): make the transfer buffer size configurable via context // creation attributes. -const size_t kStartTransferBufferSize = 4 * 1024 * 1024; -const size_t kMinTransferBufferSize = 1 * 256 * 1024; -const size_t kMaxTransferBufferSize = 16 * 1024 * 1024; +const int32 kTransferBufferSize = 1024 * 1024; static base::LazyInstance< std::set<WebGraphicsContext3DInProcessCommandBufferImpl*> > @@ -396,6 +392,7 @@ GLInProcessContext::GLInProcessContext(GLInProcessContext* parent) : parent_(parent ? parent->AsWeakPtr() : base::WeakPtr<GLInProcessContext>()), parent_texture_id_(0), + transfer_buffer_id_(-1), last_error_(SUCCESS) { } @@ -532,22 +529,31 @@ bool GLInProcessContext::Initialize(bool onscreen, } // Create a transfer buffer. - transfer_buffer_.reset(new TransferBuffer(gles2_helper_.get())); + transfer_buffer_id_ = + command_buffer_->CreateTransferBuffer( + kTransferBufferSize, ::gpu::kCommandBufferSharedMemoryId); + if (transfer_buffer_id_ < 0) { + Destroy(); + return false; + } + + // Map the buffer. + Buffer transfer_buffer = + command_buffer_->GetTransferBuffer(transfer_buffer_id_); + if (!transfer_buffer.ptr) { + Destroy(); + return false; + } // Create the object exposing the OpenGL API. gles2_implementation_.reset(new GLES2Implementation( gles2_helper_.get(), - transfer_buffer_.get(), + transfer_buffer.size, + transfer_buffer.ptr, + transfer_buffer_id_, true, false)); - if (!gles2_implementation_->Initialize( - kStartTransferBufferSize, - kMinTransferBufferSize, - kMaxTransferBufferSize)) { - return false; - } - return true; } @@ -568,8 +574,13 @@ void GLInProcessContext::Destroy() { gles2_implementation_.reset(); } - transfer_buffer_.reset(); + if (command_buffer_.get() && transfer_buffer_id_ != -1) { + command_buffer_->DestroyTransferBuffer(transfer_buffer_id_); + transfer_buffer_id_ = -1; + } + gles2_helper_.reset(); + command_buffer_.reset(); } |