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 /ppapi | |
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 'ppapi')
5 files changed, 45 insertions, 40 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 a3220f9..2fc4bd6 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,7 +7,6 @@ #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" @@ -26,10 +25,8 @@ namespace ppapi_proxy { namespace { -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; +const int32 kRingBufferSize = 4096 * 1024; +const int32 kTransferBufferSize = 4096 * 1024; int32_t GetNumAttribs(const int32_t* attrib_list) { int32_t num = 0; @@ -184,7 +181,6 @@ 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. @@ -217,16 +213,19 @@ 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)) { - 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)) { + // 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)); 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 84af986..115cc25 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) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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,7 +15,6 @@ namespace gpu { class CommandBuffer; -class TransferBuffer; namespace gles2 { class GLES2CmdHelper; class GLES2Implementation; @@ -64,7 +63,6 @@ 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 80f2a11..58dad08 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,7 +34,6 @@ '<(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', diff --git a/ppapi/shared_impl/ppb_graphics_3d_shared.cc b/ppapi/shared_impl/ppb_graphics_3d_shared.cc index 37b3d0b..d444516 100644 --- a/ppapi/shared_impl/ppb_graphics_3d_shared.cc +++ b/ppapi/shared_impl/ppb_graphics_3d_shared.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -7,23 +7,24 @@ #include "base/logging.h" #include "gpu/command_buffer/client/gles2_cmd_helper.h" #include "gpu/command_buffer/client/gles2_implementation.h" -#include "gpu/command_buffer/client/transfer_buffer.h" #include "ppapi/c/pp_errors.h" namespace ppapi { PPB_Graphics3D_Shared::PPB_Graphics3D_Shared(PP_Instance instance) - : Resource(instance) { + : Resource(instance), + transfer_buffer_id_(-1) { } PPB_Graphics3D_Shared::PPB_Graphics3D_Shared(const HostResource& host_resource) - : Resource(host_resource) { + : Resource(host_resource), + transfer_buffer_id_(-1) { } PPB_Graphics3D_Shared::~PPB_Graphics3D_Shared() { // Make sure that GLES2 implementation has already been destroyed. + DCHECK_EQ(transfer_buffer_id_, -1); DCHECK(!gles2_helper_.get()); - DCHECK(!transfer_buffer_.get()); DCHECK(!gles2_impl_.get()); } @@ -109,30 +110,39 @@ bool PPB_Graphics3D_Shared::CreateGLES2Impl(int32 command_buffer_size, // Create a transfer buffer used to copy resources between the renderer // process and the GPU process. - const int32 kMinTransferBufferSize = 256 * 1024; - const int32 kMaxTransferBufferSize = 16 * 1024 * 1024; - transfer_buffer_.reset(new gpu::TransferBuffer(gles2_helper_.get())); + transfer_buffer_id_ = + command_buffer->CreateTransferBuffer(transfer_buffer_size, -1); + if (transfer_buffer_id_ < 0) + return false; + + // Map the buffer into the renderer process's address space. + gpu::Buffer transfer_buffer = + command_buffer->GetTransferBuffer(transfer_buffer_id_); + if (!transfer_buffer.ptr) + return false; // Create the object exposing the OpenGL API. gles2_impl_.reset(new gpu::gles2::GLES2Implementation( gles2_helper_.get(), - transfer_buffer_.get(), + transfer_buffer.size, + transfer_buffer.ptr, + transfer_buffer_id_, false, true)); - if (!gles2_impl_->Initialize( - transfer_buffer_size, - kMinTransferBufferSize, - std::max(kMaxTransferBufferSize, transfer_buffer_size))) { - return false; - } - return true; } void PPB_Graphics3D_Shared::DestroyGLES2Impl() { gles2_impl_.reset(); - transfer_buffer_.reset(); + + if (transfer_buffer_id_ != -1) { + gpu::CommandBuffer* command_buffer = GetCommandBuffer(); + DCHECK(command_buffer); + command_buffer->DestroyTransferBuffer(transfer_buffer_id_); + transfer_buffer_id_ = -1; + } + gles2_helper_.reset(); } diff --git a/ppapi/shared_impl/ppb_graphics_3d_shared.h b/ppapi/shared_impl/ppb_graphics_3d_shared.h index 2a89e40..8804181 100644 --- a/ppapi/shared_impl/ppb_graphics_3d_shared.h +++ b/ppapi/shared_impl/ppb_graphics_3d_shared.h @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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,7 +15,6 @@ namespace gpu { class CommandBuffer; -class TransferBuffer; namespace gles2 { class GLES2CmdHelper; class GLES2Implementation; @@ -69,8 +68,8 @@ class PPAPI_SHARED_EXPORT PPB_Graphics3D_Shared void DestroyGLES2Impl(); private: + int32 transfer_buffer_id_; scoped_ptr<gpu::gles2::GLES2CmdHelper> gles2_helper_; - scoped_ptr<gpu::TransferBuffer> transfer_buffer_; scoped_ptr<gpu::gles2::GLES2Implementation> gles2_impl_; // Callback that needs to be executed when swap-buffers is completed. |