summaryrefslogtreecommitdiffstats
path: root/ppapi
diff options
context:
space:
mode:
authoralokp@chromium.org <alokp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-18 21:18:27 +0000
committeralokp@chromium.org <alokp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-18 21:18:27 +0000
commite5eb5c46fa4a9b3412f6dc41cbbc636fe23490f1 (patch)
tree981d68c305778f15a3dd4a821fd69b359e148450 /ppapi
parent764b80591d30619821b3c6c78bad6cae8ece82d2 (diff)
downloadchromium_src-e5eb5c46fa4a9b3412f6dc41cbbc636fe23490f1.zip
chromium_src-e5eb5c46fa4a9b3412f6dc41cbbc636fe23490f1.tar.gz
chromium_src-e5eb5c46fa4a9b3412f6dc41cbbc636fe23490f1.tar.bz2
Revert 92885 - Completed the implementation for PPB_Graphics3D interface.
- Mostly copied from the implementations for PPB_Surface3D and PPB_Context3D. - Added the proxy implementation - Refactored common code between host and plugin side into a common class. I will send the changes to bind Graphics3D with Instance and OpenGLES2 interface in a separate patch. BUG=86370,78087 Review URL: http://codereview.chromium.org/6824006 TBR=alokp@chromium.org Review URL: http://codereview.chromium.org/7398033 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@92891 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r--ppapi/c/dev/ppb_graphics_3d_trusted_dev.h104
-rw-r--r--ppapi/ppapi_cpp.gypi1
-rw-r--r--ppapi/ppapi_proxy.gypi2
-rw-r--r--ppapi/ppapi_shared.gypi4
-rw-r--r--ppapi/proxy/interface_id.h1
-rw-r--r--ppapi/proxy/plugin_resource.h1
-rw-r--r--ppapi/proxy/ppapi_messages.h49
-rw-r--r--ppapi/proxy/ppb_graphics_3d_proxy.cc612
-rw-r--r--ppapi/proxy/ppb_graphics_3d_proxy.h125
-rw-r--r--ppapi/proxy/resource_creation_proxy.cc13
-rw-r--r--ppapi/proxy/resource_creation_proxy.h4
-rw-r--r--ppapi/shared_impl/DEPS1
-rw-r--r--ppapi/shared_impl/graphics_3d_impl.cc104
-rw-r--r--ppapi/shared_impl/graphics_3d_impl.h63
-rw-r--r--ppapi/tests/all_c_includes.h1
-rw-r--r--ppapi/thunk/ppb_graphics_3d_api.h20
-rw-r--r--ppapi/thunk/ppb_graphics_3d_trusted_thunk.cc125
-rw-r--r--ppapi/thunk/resource_creation_api.h4
18 files changed, 1 insertions, 1233 deletions
diff --git a/ppapi/c/dev/ppb_graphics_3d_trusted_dev.h b/ppapi/c/dev/ppb_graphics_3d_trusted_dev.h
deleted file mode 100644
index faae1d4..0000000
--- a/ppapi/c/dev/ppb_graphics_3d_trusted_dev.h
+++ /dev/null
@@ -1,104 +0,0 @@
-// 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.
-
-#ifndef PPAPI_C_DEV_PPB_GRAPHICS_3D_TRUSTED_DEV_H_
-#define PPAPI_C_DEV_PPB_GRAPHICS_3D_TRUSTED_DEV_H_
-
-#include "ppapi/c/pp_bool.h"
-#include "ppapi/c/pp_instance.h"
-#include "ppapi/c/pp_resource.h"
-#include "ppapi/c/pp_stdint.h"
-
-#define PPB_GRAPHICS_3D_TRUSTED_DEV_INTERFACE_0_1 \
- "PPB_Graphics3DTrusted(Dev);0.1"
-#define PPB_GRAPHICS_3D_TRUSTED_DEV_INTERFACE \
- PPB_GRAPHICS_3D_TRUSTED_DEV_INTERFACE_0_1
-
-typedef enum {
- PPB_GRAPHICS3D_TRUSTED_ERROR_OK,
- PPB_GRAPHICS3D_TRUSTED_ERROR_GENERICERROR,
- PPB_GRAPHICS3D_TRUSTED_ERROR_INVALIDARGUMENTS,
- PPB_GRAPHICS3D_TRUSTED_ERROR_INVALIDSIZE,
- PPB_GRAPHICS3D_TRUSTED_ERROR_LOSTCONTEXT,
- PPB_GRAPHICS3D_TRUSTED_ERROR_OUTOFBOUNDS,
- PPB_GRAPHICS3D_TRUSTED_ERROR_UNKNOWNCOMMAND
-} PPB_Graphics3DTrustedError;
-
-struct PP_Graphics3DTrustedState {
- // Size of the command buffer in command buffer entries.
- int32_t num_entries;
-
- // The offset (in entries) from which the reader is reading.
- int32_t get_offset;
-
- // The offset (in entries) at which the writer is writing.
- int32_t put_offset;
-
- // The current token value. This is used by the writer to defer
- // changes to shared memory objects until the reader has reached a certain
- // point in the command buffer. The reader is responsible for updating the
- // token value, for example in response to an asynchronous set token command
- // embedded in the command buffer. The default token value is zero.
- int32_t token;
-
- // Error status.
- PPB_Graphics3DTrustedError error;
-
- // Generation index of this state. The generation index is incremented every
- // time a new state is retrieved from the command processor, so that
- // consistency can be kept even if IPC messages are processed out-of-order.
- uint32_t generation;
-};
-
-struct PPB_Graphics3DTrusted_Dev {
- // Creates a raw Graphics3D resource. A raw Graphics3D is intended to be used
- // with the trusted interface, through the command buffer (for proxying).
- PP_Resource (*CreateRaw)(PP_Instance instance_id,
- PP_Config3D_Dev config,
- PP_Resource share_context,
- const int32_t* attrib_list);
-
- // Initializes the command buffer with the given size.
- PP_Bool (*InitCommandBuffer)(PP_Resource context_id, int32_t size);
-
- // Gets the ring buffer for the command buffer.
- PP_Bool (*GetRingBuffer)(PP_Resource context_id,
- int* shm_handle,
- uint32_t* shm_size);
-
- // Returns the current state.
- struct PP_Graphics3DTrustedState (*GetState)(PP_Resource context);
-
- // Create a transfer buffer and return a handle that uniquely
- // identifies it or -1 on error.
- int32_t (*CreateTransferBuffer)(PP_Resource context, uint32_t size);
-
- // Destroy a transfer buffer and recycle the handle.
- PP_Bool (*DestroyTransferBuffer)(PP_Resource context, int32_t id);
-
- // Get the transfer buffer associated with a handle.
- PP_Bool (*GetTransferBuffer)(PP_Resource context,
- int32_t id,
- int* shm_handle,
- uint32_t* shm_size);
-
- // The writer calls this to update its put offset.
- PP_Bool (*Flush)(PP_Resource context, int32_t put_offset);
-
- // The writer calls this to update its put offset. This function returns the
- // reader's most recent get offset. Does not return until after the put offset
- // change callback has been invoked.
- struct PP_Graphics3DTrustedState (*FlushSync)(PP_Resource context,
- int32_t put_offset);
-
- // Like FlushSync, but returns before processing commands if the get offset is
- // different than last_known_get. Allows synchronization with the command
- // processor without forcing immediate command execution.
- struct PP_Graphics3DTrustedState (*FlushSyncFast)(PP_Resource context,
- int32_t put_offset,
- int32_t last_known_get);
-};
-
-#endif // PPAPI_C_DEV_PPB_GRAPHICS_3D_TRUSTED_DEV_H_
-
diff --git a/ppapi/ppapi_cpp.gypi b/ppapi/ppapi_cpp.gypi
index 8ef3001..80d0966 100644
--- a/ppapi/ppapi_cpp.gypi
+++ b/ppapi/ppapi_cpp.gypi
@@ -70,7 +70,6 @@
'c/dev/ppb_font_dev.h',
'c/dev/ppb_fullscreen_dev.h',
'c/dev/ppb_graphics_3d_dev.h',
- 'c/dev/ppb_graphics_3d_trusted_dev.h',
'c/dev/ppb_memory_dev.h',
'c/dev/ppb_opengles_dev.h',
'c/dev/ppb_scrollbar_dev.h',
diff --git a/ppapi/ppapi_proxy.gypi b/ppapi/ppapi_proxy.gypi
index 550dec8..db9dc29 100644
--- a/ppapi/ppapi_proxy.gypi
+++ b/ppapi/ppapi_proxy.gypi
@@ -96,8 +96,6 @@
'proxy/ppb_font_proxy.h',
'proxy/ppb_graphics_2d_proxy.cc',
'proxy/ppb_graphics_2d_proxy.h',
- 'proxy/ppb_graphics_3d_proxy.cc',
- 'proxy/ppb_graphics_3d_proxy.h',
'proxy/ppb_image_data_proxy.cc',
'proxy/ppb_image_data_proxy.h',
'proxy/ppb_input_event_proxy.cc',
diff --git a/ppapi/ppapi_shared.gypi b/ppapi/ppapi_shared.gypi
index 04cb41f..b86c77e 100644
--- a/ppapi/ppapi_shared.gypi
+++ b/ppapi/ppapi_shared.gypi
@@ -12,7 +12,6 @@
'../base/base.gyp:base',
'../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
'../build/temp_gyp/googleurl.gyp:googleurl',
- '../gpu/gpu.gyp:gles2_implementation',
'../skia/skia.gyp:skia',
'../third_party/icu/icu.gyp:icuuc',
'../ui/gfx/surface/surface.gyp:surface',
@@ -36,8 +35,6 @@
'shared_impl/font_impl.h',
'shared_impl/function_group_base.cc',
'shared_impl/function_group_base.h',
- 'shared_impl/graphics_3d_impl.cc',
- 'shared_impl/graphics_3d_impl.h',
'shared_impl/image_data_impl.cc',
'shared_impl/image_data_impl.h',
'shared_impl/input_event_impl.cc',
@@ -110,7 +107,6 @@
'thunk/ppb_graphics_2d_thunk.cc',
'thunk/ppb_graphics_3d_api.h',
'thunk/ppb_graphics_3d_thunk.cc',
- 'thunk/ppb_graphics_3d_trusted_thunk.cc',
'thunk/ppb_image_data_api.h',
'thunk/ppb_image_data_thunk.cc',
'thunk/ppb_image_data_trusted_thunk.cc',
diff --git a/ppapi/proxy/interface_id.h b/ppapi/proxy/interface_id.h
index ba31aaa..26ef71f6a 100644
--- a/ppapi/proxy/interface_id.h
+++ b/ppapi/proxy/interface_id.h
@@ -36,7 +36,6 @@ enum InterfaceID {
INTERFACE_ID_PPB_FLASH_TCPSOCKET,
INTERFACE_ID_PPB_FONT,
INTERFACE_ID_PPB_GRAPHICS_2D,
- INTERFACE_ID_PPB_GRAPHICS_3D,
INTERFACE_ID_PPB_IMAGE_DATA,
INTERFACE_ID_PPB_INSTANCE,
INTERFACE_ID_PPB_INSTANCE_PRIVATE,
diff --git a/ppapi/proxy/plugin_resource.h b/ppapi/proxy/plugin_resource.h
index 8646189..eff74b4 100644
--- a/ppapi/proxy/plugin_resource.h
+++ b/ppapi/proxy/plugin_resource.h
@@ -26,7 +26,6 @@
F(FlashNetConnector) \
F(Font) \
F(Graphics2D) \
- F(Graphics3D) \
F(ImageData) \
F(MockResource) \
F(PrivateFontFile) \
diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h
index 41853ae..c516514 100644
--- a/ppapi/proxy/ppapi_messages.h
+++ b/ppapi/proxy/ppapi_messages.h
@@ -202,11 +202,6 @@ IPC_MESSAGE_ROUTED2(PpapiMsg_PPBGraphics2D_FlushACK,
pp::proxy::HostResource /* graphics_2d */,
int32_t /* pp_error */)
-// PPB_Graphics3D.
-IPC_MESSAGE_ROUTED2(PpapiMsg_PPBGraphics3D_SwapBuffersACK,
- pp::proxy::HostResource /* graphics_3d */,
- int32_t /* pp_error */)
-
// PPB_Surface3D.
IPC_MESSAGE_ROUTED2(PpapiMsg_PPBSurface3D_SwapBuffersACK,
pp::proxy::HostResource /* surface_3d */,
@@ -638,50 +633,6 @@ IPC_MESSAGE_ROUTED2(PpapiHostMsg_PPBGraphics2D_ReplaceContents,
IPC_MESSAGE_ROUTED1(PpapiHostMsg_PPBGraphics2D_Flush,
pp::proxy::HostResource /* graphics_2d */)
-// PPB_Graphics3D.
-IPC_SYNC_MESSAGE_ROUTED3_1(PpapiHostMsg_PPBGraphics3D_Create,
- PP_Instance /* instance */,
- int32_t /* config */,
- std::vector<int32_t> /* attrib_list */,
- pp::proxy::HostResource /* result */)
-
-IPC_SYNC_MESSAGE_ROUTED2_1(PpapiHostMsg_PPBGraphics3D_InitCommandBuffer,
- pp::proxy::HostResource /* context */,
- int32 /* size */,
- base::SharedMemoryHandle /* ring_buffer */)
-
-IPC_SYNC_MESSAGE_ROUTED1_1(PpapiHostMsg_PPBGraphics3D_GetState,
- pp::proxy::HostResource /* context */,
- gpu::CommandBuffer::State /* state */)
-
-IPC_SYNC_MESSAGE_ROUTED3_1(PpapiHostMsg_PPBGraphics3D_Flush,
- pp::proxy::HostResource /* context */,
- int32 /* put_offset */,
- int32 /* last_known_get */,
- gpu::CommandBuffer::State /* state */)
-
-IPC_MESSAGE_ROUTED2(PpapiHostMsg_PPBGraphics3D_AsyncFlush,
- pp::proxy::HostResource /* context */,
- int32 /* put_offset */)
-
-IPC_SYNC_MESSAGE_ROUTED2_1(PpapiHostMsg_PPBGraphics3D_CreateTransferBuffer,
- pp::proxy::HostResource /* context */,
- int32 /* size */,
- int32 /* id */)
-
-IPC_SYNC_MESSAGE_ROUTED2_0(PpapiHostMsg_PPBGraphics3D_DestroyTransferBuffer,
- pp::proxy::HostResource /* context */,
- int32 /* id */)
-
-IPC_SYNC_MESSAGE_ROUTED2_2(PpapiHostMsg_PPBGraphics3D_GetTransferBuffer,
- pp::proxy::HostResource /* context */,
- int32 /* id */,
- base::SharedMemoryHandle /* transfer_buffer */,
- uint32 /* size */)
-
-IPC_MESSAGE_ROUTED1(PpapiHostMsg_PPBGraphics3D_SwapBuffers,
- pp::proxy::HostResource /* graphics_3d */)
-
// PPB_Instance.
IPC_SYNC_MESSAGE_ROUTED1_1(PpapiHostMsg_PPBInstance_GetWindowObject,
PP_Instance /* instance */,
diff --git a/ppapi/proxy/ppb_graphics_3d_proxy.cc b/ppapi/proxy/ppb_graphics_3d_proxy.cc
deleted file mode 100644
index d3947e4..0000000
--- a/ppapi/proxy/ppb_graphics_3d_proxy.cc
+++ /dev/null
@@ -1,612 +0,0 @@
-// 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.
-
-#include "ppapi/proxy/ppb_graphics_3d_proxy.h"
-
-#include "gpu/command_buffer/client/gles2_implementation.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/proxy/enter_proxy.h"
-#include "ppapi/proxy/plugin_dispatcher.h"
-#include "ppapi/proxy/ppapi_messages.h"
-#include "ppapi/thunk/enter.h"
-#include "ppapi/thunk/resource_creation_api.h"
-#include "ppapi/thunk/thunk.h"
-
-using ppapi::thunk::EnterFunctionNoLock;
-using ppapi::thunk::EnterResourceNoLock;
-using ppapi::thunk::PPB_Graphics3D_API;
-using ppapi::thunk::ResourceCreationAPI;
-
-namespace pp {
-namespace proxy {
-
-namespace {
-const int32 kCommandBufferSize = 1024 * 1024;
-const int32 kTransferBufferSize = 1024 * 1024;
-
-class CommandBuffer : public gpu::CommandBuffer {
- public:
- CommandBuffer(const HostResource& resource, PluginDispatcher* dispatcher);
- virtual ~CommandBuffer();
-
- // gpu::CommandBuffer implementation:
- virtual bool Initialize(int32 size);
- virtual bool Initialize(base::SharedMemory* buffer, int32 size);
- virtual gpu::Buffer GetRingBuffer();
- virtual State GetState();
- virtual void Flush(int32 put_offset);
- virtual State FlushSync(int32 put_offset, int32 last_known_get);
- virtual void SetGetOffset(int32 get_offset);
- virtual int32 CreateTransferBuffer(size_t size, int32 id_request);
- virtual int32 RegisterTransferBuffer(base::SharedMemory* shared_memory,
- size_t size,
- int32 id_request);
- virtual void DestroyTransferBuffer(int32 id);
- virtual gpu::Buffer GetTransferBuffer(int32 handle);
- virtual void SetToken(int32 token);
- virtual void SetParseError(gpu::error::Error error);
- virtual void SetContextLostReason(gpu::error::ContextLostReason reason);
-
- private:
- bool Send(IPC::Message* msg);
- void UpdateState(const gpu::CommandBuffer::State& state);
-
- int32 num_entries_;
- scoped_ptr<base::SharedMemory> ring_buffer_;
-
- typedef base::hash_map<int32, gpu::Buffer> TransferBufferMap;
- TransferBufferMap transfer_buffers_;
-
- State last_state_;
-
- HostResource resource_;
- PluginDispatcher* dispatcher_;
-
- DISALLOW_COPY_AND_ASSIGN(CommandBuffer);
-};
-
-CommandBuffer::CommandBuffer(const HostResource& resource,
- PluginDispatcher* dispatcher)
- : num_entries_(0),
- resource_(resource),
- dispatcher_(dispatcher) {
-}
-
-CommandBuffer::~CommandBuffer() {
- // Delete all the locally cached shared memory objects, closing the handle
- // in this process.
- for (TransferBufferMap::iterator it = transfer_buffers_.begin();
- it != transfer_buffers_.end(); ++it) {
- delete it->second.shared_memory;
- it->second.shared_memory = NULL;
- }
-}
-
-bool CommandBuffer::Initialize(int32 size) {
- DCHECK(!ring_buffer_.get());
-
- // Initialize the service. Assuming we are sandboxed, the GPU
- // process is responsible for duplicating the handle. This might not be true
- // for NaCl.
- base::SharedMemoryHandle handle;
- if (Send(new PpapiHostMsg_PPBGraphics3D_InitCommandBuffer(
- INTERFACE_ID_PPB_GRAPHICS_3D, resource_, size, &handle)) &&
- base::SharedMemory::IsHandleValid(handle)) {
- ring_buffer_.reset(new base::SharedMemory(handle, false));
- if (ring_buffer_->Map(size)) {
- num_entries_ = size / sizeof(gpu::CommandBufferEntry);
- return true;
- }
-
- ring_buffer_.reset();
- }
-
- return false;
-}
-
-bool CommandBuffer::Initialize(base::SharedMemory* buffer, int32 size) {
- // Not implemented in proxy.
- NOTREACHED();
- return false;
-}
-
-gpu::Buffer CommandBuffer::GetRingBuffer() {
- // Return locally cached ring buffer.
- gpu::Buffer buffer;
- buffer.ptr = ring_buffer_->memory();
- buffer.size = num_entries_ * sizeof(gpu::CommandBufferEntry);
- buffer.shared_memory = ring_buffer_.get();
- return buffer;
-}
-
-gpu::CommandBuffer::State CommandBuffer::GetState() {
- // Send will flag state with lost context if IPC fails.
- if (last_state_.error == gpu::error::kNoError) {
- gpu::CommandBuffer::State state;
- if (Send(new PpapiHostMsg_PPBGraphics3D_GetState(
- INTERFACE_ID_PPB_GRAPHICS_3D, resource_, &state)))
- UpdateState(state);
- }
-
- return last_state_;
-}
-
-void CommandBuffer::Flush(int32 put_offset) {
- if (last_state_.error != gpu::error::kNoError)
- return;
-
- IPC::Message* message = new PpapiHostMsg_PPBGraphics3D_AsyncFlush(
- INTERFACE_ID_PPB_GRAPHICS_3D, resource_, put_offset);
-
- // Do not let a synchronous flush hold up this message. If this handler is
- // deferred until after the synchronous flush completes, it will overwrite the
- // cached last_state_ with out-of-date data.
- message->set_unblock(true);
- Send(message);
-}
-
-gpu::CommandBuffer::State CommandBuffer::FlushSync(int32 put_offset,
- int32 last_known_get) {
- if (last_known_get == last_state_.get_offset) {
- // Send will flag state with lost context if IPC fails.
- if (last_state_.error == gpu::error::kNoError) {
- gpu::CommandBuffer::State state;
- if (Send(new PpapiHostMsg_PPBGraphics3D_Flush(
- INTERFACE_ID_PPB_GRAPHICS_3D, resource_, put_offset,
- last_known_get, &state)))
- UpdateState(state);
- }
- } else {
- Flush(put_offset);
- }
-
- return last_state_;
-}
-
-void CommandBuffer::SetGetOffset(int32 get_offset) {
- // Not implemented in proxy.
- NOTREACHED();
-}
-
-int32 CommandBuffer::CreateTransferBuffer(size_t size, int32 id_request) {
- if (last_state_.error == gpu::error::kNoError) {
- int32 id;
- if (Send(new PpapiHostMsg_PPBGraphics3D_CreateTransferBuffer(
- INTERFACE_ID_PPB_GRAPHICS_3D, resource_, size, &id))) {
- return id;
- }
- }
-
- return -1;
-}
-
-int32 CommandBuffer::RegisterTransferBuffer(
- base::SharedMemory* shared_memory,
- size_t size,
- int32 id_request) {
- // Not implemented in proxy.
- NOTREACHED();
- return -1;
-}
-
-void CommandBuffer::DestroyTransferBuffer(int32 id) {
- if (last_state_.error != gpu::error::kNoError)
- return;
-
- // Remove the transfer buffer from the client side4 cache.
- TransferBufferMap::iterator it = transfer_buffers_.find(id);
- DCHECK(it != transfer_buffers_.end());
-
- // Delete the shared memory object, closing the handle in this process.
- delete it->second.shared_memory;
-
- transfer_buffers_.erase(it);
-
- Send(new PpapiHostMsg_PPBGraphics3D_DestroyTransferBuffer(
- INTERFACE_ID_PPB_GRAPHICS_3D, resource_, id));
-}
-
-gpu::Buffer CommandBuffer::GetTransferBuffer(int32 id) {
- if (last_state_.error != gpu::error::kNoError)
- return gpu::Buffer();
-
- // Check local cache to see if there is already a client side shared memory
- // object for this id.
- TransferBufferMap::iterator it = transfer_buffers_.find(id);
- if (it != transfer_buffers_.end()) {
- return it->second;
- }
-
- // Assuming we are in the renderer process, the service is responsible for
- // duplicating the handle. This might not be true for NaCl.
- base::SharedMemoryHandle handle;
- uint32 size;
- if (!Send(new PpapiHostMsg_PPBGraphics3D_GetTransferBuffer(
- INTERFACE_ID_PPB_GRAPHICS_3D, resource_, id, &handle, &size))) {
- return gpu::Buffer();
- }
-
- // Cache the transfer buffer shared memory object client side.
- scoped_ptr<base::SharedMemory> shared_memory(
- new base::SharedMemory(handle, false));
-
- // Map the shared memory on demand.
- if (!shared_memory->memory()) {
- if (!shared_memory->Map(size)) {
- return gpu::Buffer();
- }
- }
-
- gpu::Buffer buffer;
- buffer.ptr = shared_memory->memory();
- buffer.size = size;
- buffer.shared_memory = shared_memory.release();
- transfer_buffers_[id] = buffer;
-
- return buffer;
-}
-
-void CommandBuffer::SetToken(int32 token) {
- NOTREACHED();
-}
-
-void CommandBuffer::SetParseError(gpu::error::Error error) {
- NOTREACHED();
-}
-
-void CommandBuffer::SetContextLostReason(
- gpu::error::ContextLostReason reason) {
- NOTREACHED();
-}
-
-bool CommandBuffer::Send(IPC::Message* msg) {
- DCHECK(last_state_.error == gpu::error::kNoError);
-
- if (dispatcher_->Send(msg))
- return true;
-
- last_state_.error = gpu::error::kLostContext;
- return false;
-}
-
-void CommandBuffer::UpdateState(const gpu::CommandBuffer::State& state) {
- // Handle wraparound. It works as long as we don't have more than 2B state
- // updates in flight across which reordering occurs.
- if (state.generation - last_state_.generation < 0x80000000U)
- last_state_ = state;
-}
-
-base::SharedMemoryHandle TransportSHMHandleFromInt(Dispatcher* dispatcher,
- int shm_handle) {
- // TODO(piman): Change trusted interface to return a PP_FileHandle, those
- // casts are ugly.
- base::PlatformFile source =
-#if defined(OS_WIN)
- reinterpret_cast<HANDLE>(static_cast<intptr_t>(shm_handle));
-#elif defined(OS_POSIX)
- shm_handle;
-#else
- #error Not implemented.
-#endif
- // Don't close the handle, it doesn't belong to us.
- return dispatcher->ShareHandleWithRemote(source, false);
-}
-
-PP_Graphics3DTrustedState GetErrorState() {
- PP_Graphics3DTrustedState error_state = { 0 };
- error_state.error = PPB_GRAPHICS3D_TRUSTED_ERROR_GENERICERROR;
- return error_state;
-}
-
-gpu::CommandBuffer::State GPUStateFromPPState(
- const PP_Graphics3DTrustedState& s) {
- gpu::CommandBuffer::State state;
- state.num_entries = s.num_entries;
- state.get_offset = s.get_offset;
- state.put_offset = s.put_offset;
- state.token = s.token;
- state.error = static_cast<gpu::error::Error>(s.error);
- state.generation = s.generation;
- return state;
-}
-
-InterfaceProxy* CreateGraphics3DProxy(Dispatcher* dispatcher,
- const void* target_interface) {
- return new PPB_Graphics3D_Proxy(dispatcher, target_interface);
-}
-} // namespace
-
-Graphics3D::Graphics3D(const HostResource& resource)
- : PluginResource(resource) {
-}
-
-Graphics3D::~Graphics3D() {
- DestroyGLES2Impl();
-}
-
-bool Graphics3D::Init() {
- PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance());
- if (!dispatcher)
- return false;
-
- command_buffer_.reset(new CommandBuffer(host_resource(), dispatcher));
-
- return CreateGLES2Impl(kCommandBufferSize, kTransferBufferSize);
-}
-
-PP_Bool Graphics3D::InitCommandBuffer(int32_t size) {
- return PP_FALSE;
-}
-
-PP_Bool Graphics3D::GetRingBuffer(int* shm_handle, uint32_t* shm_size) {
- return PP_FALSE;
-}
-
-PP_Graphics3DTrustedState Graphics3D::GetState() {
- return GetErrorState();
-}
-
-PP_Bool Graphics3D::Flush(int32_t put_offset) {
- return PP_FALSE;
-}
-
-PP_Graphics3DTrustedState Graphics3D::FlushSync(int32_t put_offset) {
- return GetErrorState();
-}
-
-int32_t Graphics3D::CreateTransferBuffer(uint32_t size) {
- return PP_FALSE;
-}
-
-PP_Bool Graphics3D::DestroyTransferBuffer(int32_t id) {
- return PP_FALSE;
-}
-
-PP_Bool Graphics3D::GetTransferBuffer(int32_t id,
- int* shm_handle,
- uint32_t* shm_size) {
- return PP_FALSE;
-}
-
-PP_Graphics3DTrustedState Graphics3D::FlushSyncFast(int32_t put_offset,
- int32_t last_known_get) {
- return GetErrorState();
-}
-
-gpu::CommandBuffer* Graphics3D::GetCommandBuffer() {
- return command_buffer_.get();
-}
-
-int32 Graphics3D::DoSwapBuffers() {
- IPC::Message* msg = new PpapiHostMsg_PPBGraphics3D_SwapBuffers(
- INTERFACE_ID_PPB_GRAPHICS_3D, host_resource());
- msg->set_unblock(true);
- GetDispatcher()->Send(msg);
-
- gles2_impl()->SwapBuffers();
- return PP_OK_COMPLETIONPENDING;
-}
-
-PPB_Graphics3D_Proxy::PPB_Graphics3D_Proxy(Dispatcher* dispatcher,
- const void* target_interface)
- : InterfaceProxy(dispatcher, target_interface) {
-}
-
-PPB_Graphics3D_Proxy::~PPB_Graphics3D_Proxy() {
-}
-
-// static
-const InterfaceProxy::Info* PPB_Graphics3D_Proxy::GetInfo() {
- static const Info info = {
- ::ppapi::thunk::GetPPB_Graphics3D_Thunk(),
- PPB_GRAPHICS_3D_DEV_INTERFACE,
- INTERFACE_ID_PPB_GRAPHICS_3D,
- false,
- &CreateGraphics3DProxy,
- };
- return &info;
-}
-
-// static
-PP_Resource PPB_Graphics3D_Proxy::CreateProxyResource(
- PP_Instance instance,
- PP_Config3D_Dev config,
- PP_Resource share_context,
- const int32_t* attrib_list) {
- PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
- if (!dispatcher)
- return PP_ERROR_BADARGUMENT;
-
- // TODO(alokp): Support shared context.
- DCHECK_EQ(0, share_context);
- if (share_context != 0)
- return 0;
-
- std::vector<int32_t> attribs;
- if (attrib_list) {
- for (const int32_t* attr = attrib_list;
- *attr != PP_GRAPHICS3DATTRIB_NONE;
- ++attr) {
- attribs.push_back(*attr);
- }
- attribs.push_back(PP_GRAPHICS3DATTRIB_NONE);
- }
-
- HostResource result;
- dispatcher->Send(new PpapiHostMsg_PPBGraphics3D_Create(
- INTERFACE_ID_PPB_GRAPHICS_3D, instance, config, attribs, &result));
- if (result.is_null())
- return 0;
-
- linked_ptr<Graphics3D> graphics_3d(new Graphics3D(result));
- if (!graphics_3d->Init())
- return 0;
-
- return PluginResourceTracker::GetInstance()->AddResource(graphics_3d);
-}
-
-bool PPB_Graphics3D_Proxy::OnMessageReceived(const IPC::Message& msg) {
- bool handled = true;
- IPC_BEGIN_MESSAGE_MAP(PPB_Graphics3D_Proxy, msg)
- IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_Create,
- OnMsgCreate)
- IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_InitCommandBuffer,
- OnMsgInitCommandBuffer)
- IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_GetState,
- OnMsgGetState)
- IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_Flush,
- OnMsgFlush)
- IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_AsyncFlush,
- OnMsgAsyncFlush)
- IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_CreateTransferBuffer,
- OnMsgCreateTransferBuffer)
- IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_DestroyTransferBuffer,
- OnMsgDestroyTransferBuffer)
- IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_GetTransferBuffer,
- OnMsgGetTransferBuffer)
- IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_SwapBuffers,
- OnMsgSwapBuffers)
-
- IPC_MESSAGE_HANDLER(PpapiMsg_PPBGraphics3D_SwapBuffersACK,
- OnMsgSwapBuffersACK)
- IPC_MESSAGE_UNHANDLED(handled = false)
-
- IPC_END_MESSAGE_MAP()
- // FIXME(brettw) handle bad messages!
- return handled;
-}
-
-void PPB_Graphics3D_Proxy::OnMsgCreate(PP_Instance instance,
- PP_Config3D_Dev config,
- const std::vector<int32_t>& attribs,
- HostResource* result) {
- if (attribs.empty() || attribs.back() != 0)
- return; // Bad message.
-
- EnterFunctionNoLock<ResourceCreationAPI> enter(instance, true);
- if (enter.succeeded()) {
- result->SetHostResource(
- instance,
- enter.functions()->CreateGraphics3DRaw(instance, config, 0,
- &attribs.front()));
- }
-}
-
-void PPB_Graphics3D_Proxy::OnMsgInitCommandBuffer(
- const HostResource& context,
- int32 size,
- base::SharedMemoryHandle* ring_buffer) {
- *ring_buffer = base::SharedMemory::NULLHandle();
- EnterHostFromHostResource<PPB_Graphics3D_API> enter(context);
- if (enter.failed())
- return;
-
- if (!enter.object()->InitCommandBuffer(size))
- return;
-
- int shm_handle;
- uint32_t shm_size;
- if (!enter.object()->GetRingBuffer(&shm_handle, &shm_size))
- return;
- *ring_buffer = TransportSHMHandleFromInt(dispatcher(), shm_handle);
-}
-
-void PPB_Graphics3D_Proxy::OnMsgGetState(const HostResource& context,
- gpu::CommandBuffer::State* state) {
- EnterHostFromHostResource<PPB_Graphics3D_API> enter(context);
- if (enter.failed())
- return;
- PP_Graphics3DTrustedState pp_state = enter.object()->GetState();
- *state = GPUStateFromPPState(pp_state);
-}
-
-void PPB_Graphics3D_Proxy::OnMsgFlush(const HostResource& context,
- int32 put_offset,
- int32 last_known_get,
- gpu::CommandBuffer::State* state) {
- EnterHostFromHostResource<PPB_Graphics3D_API> enter(context);
- if (enter.failed())
- return;
- PP_Graphics3DTrustedState pp_state = enter.object()->FlushSyncFast(
- put_offset, last_known_get);
- *state = GPUStateFromPPState(pp_state);
-}
-
-void PPB_Graphics3D_Proxy::OnMsgAsyncFlush(const HostResource& context,
- int32 put_offset) {
- EnterHostFromHostResource<PPB_Graphics3D_API> enter(context);
- if (enter.succeeded())
- enter.object()->Flush(put_offset);
-}
-
-void PPB_Graphics3D_Proxy::OnMsgCreateTransferBuffer(
- const HostResource& context,
- int32 size,
- int32* id) {
- EnterHostFromHostResource<PPB_Graphics3D_API> enter(context);
- if (enter.succeeded())
- *id = enter.object()->CreateTransferBuffer(size);
- else
- *id = 0;
-}
-
-void PPB_Graphics3D_Proxy::OnMsgDestroyTransferBuffer(
- const HostResource& context,
- int32 id) {
- EnterHostFromHostResource<PPB_Graphics3D_API> enter(context);
- if (enter.succeeded())
- enter.object()->DestroyTransferBuffer(id);
-}
-
-void PPB_Graphics3D_Proxy::OnMsgGetTransferBuffer(
- const HostResource& context,
- int32 id,
- base::SharedMemoryHandle* transfer_buffer,
- uint32* size) {
- *transfer_buffer = base::SharedMemory::NULLHandle();
- *size = 0;
-
- EnterHostFromHostResource<PPB_Graphics3D_API> enter(context);
- int shm_handle = 0;
- uint32_t shm_size = 0;
- if (enter.succeeded() &&
- enter.object()->GetTransferBuffer(id, &shm_handle, &shm_size)) {
- *transfer_buffer = TransportSHMHandleFromInt(dispatcher(), shm_handle);
- *size = shm_size;
- }
-}
-
-void PPB_Graphics3D_Proxy::OnMsgSwapBuffers(const HostResource& context) {
- CompletionCallback callback = callback_factory_.NewOptionalCallback(
- &PPB_Graphics3D_Proxy::SendSwapBuffersACKToPlugin, context);
-
- EnterHostFromHostResource<PPB_Graphics3D_API> enter(context);
- int32_t result = PP_ERROR_BADRESOURCE;
- if (enter.succeeded())
- result = enter.object()->SwapBuffers(callback.pp_completion_callback());
- if (result != PP_OK_COMPLETIONPENDING) {
- // There was some error, so we won't get a flush callback. We need to now
- // issue the ACK to the plugin hears about the error. This will also clean
- // up the data associated with the callback.
- callback.Run(result);
- }
-}
-
-void PPB_Graphics3D_Proxy::OnMsgSwapBuffersACK(const HostResource& resource,
- int32_t pp_error) {
- EnterPluginFromHostResource<PPB_Graphics3D_API> enter(resource);
- if (enter.succeeded())
- static_cast<Graphics3D*>(enter.object())->SwapBuffersACK(pp_error);
-}
-
-void PPB_Graphics3D_Proxy::SendSwapBuffersACKToPlugin(
- int32_t result,
- const HostResource& context) {
- dispatcher()->Send(new PpapiMsg_PPBGraphics3D_SwapBuffersACK(
- INTERFACE_ID_PPB_GRAPHICS_3D, context, result));
-}
-
-} // namespace proxy
-} // namespace pp
-
diff --git a/ppapi/proxy/ppb_graphics_3d_proxy.h b/ppapi/proxy/ppb_graphics_3d_proxy.h
deleted file mode 100644
index 6ff3a10..0000000
--- a/ppapi/proxy/ppb_graphics_3d_proxy.h
+++ /dev/null
@@ -1,125 +0,0 @@
-// 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.
-
-#ifndef PPAPI_PROXY_PPB_GRAPHICS_3D_PROXY_H_
-#define PPAPI_PROXY_PPB_GRAPHICS_3D_PROXY_H_
-
-#include <vector>
-
-#include "base/shared_memory.h"
-#include "gpu/command_buffer/common/command_buffer.h"
-#include "ppapi/c/dev/pp_graphics_3d_dev.h"
-#include "ppapi/c/pp_instance.h"
-#include "ppapi/cpp/completion_callback.h"
-#include "ppapi/proxy/interface_proxy.h"
-#include "ppapi/proxy/plugin_resource.h"
-#include "ppapi/proxy/proxy_non_thread_safe_ref_count.h"
-#include "ppapi/shared_impl/graphics_3d_impl.h"
-
-namespace pp {
-namespace proxy {
-
-class HostResource;
-
-class Graphics3D : public PluginResource,
- public ppapi::Graphics3DImpl {
- public:
- explicit Graphics3D(const HostResource& resource);
- virtual ~Graphics3D();
-
- bool Init();
-
- // PluginResource overrides.
- virtual ::ppapi::thunk::PPB_Graphics3D_API* AsPPB_Graphics3D_API() OVERRIDE {
- return this;
- }
-
- // Graphics3DTrusted API. These are not implemented in the proxy.
- virtual PP_Bool InitCommandBuffer(int32_t size) OVERRIDE;
- virtual PP_Bool GetRingBuffer(int* shm_handle, uint32_t* shm_size) OVERRIDE;
- virtual PP_Graphics3DTrustedState GetState() OVERRIDE;
- virtual PP_Bool Flush(int32_t put_offset) OVERRIDE;
- virtual PP_Graphics3DTrustedState FlushSync(int32_t put_offset) OVERRIDE;
- virtual int32_t CreateTransferBuffer(uint32_t size) OVERRIDE;
- virtual PP_Bool DestroyTransferBuffer(int32_t id) OVERRIDE;
- virtual PP_Bool GetTransferBuffer(int32_t id,
- int* shm_handle,
- uint32_t* shm_size) OVERRIDE;
- virtual PP_Graphics3DTrustedState FlushSyncFast(
- int32_t put_offset,
- int32_t last_known_get) OVERRIDE;
-
- protected:
- // ppapi::Graphics3DImpl overrides.
- virtual gpu::CommandBuffer* GetCommandBuffer() OVERRIDE;
- virtual int32 DoSwapBuffers() OVERRIDE;
-
- private:
- scoped_ptr<gpu::CommandBuffer> command_buffer_;
-
- DISALLOW_COPY_AND_ASSIGN(Graphics3D);
-};
-
-class PPB_Graphics3D_Proxy : public InterfaceProxy {
- public:
- PPB_Graphics3D_Proxy(Dispatcher* dispatcher, const void* target_interface);
- virtual ~PPB_Graphics3D_Proxy();
-
- static const Info* GetInfo();
-
- static PP_Resource CreateProxyResource(PP_Instance instance,
- PP_Config3D_Dev config,
- PP_Resource share_context,
- const int32_t* attrib_list);
-
- const PPB_Graphics3D_Dev* ppb_graphics_3d_target() const {
- return static_cast<const PPB_Graphics3D_Dev*>(target_interface());
- }
-
- // InterfaceProxy implementation.
- virtual bool OnMessageReceived(const IPC::Message& msg);
-
- private:
- void OnMsgCreate(PP_Instance instance,
- PP_Config3D_Dev config,
- const std::vector<int32_t>& attribs,
- HostResource* result);
- void OnMsgInitCommandBuffer(const HostResource& context,
- int32 size,
- base::SharedMemoryHandle* ring_buffer);
- void OnMsgGetState(const HostResource& context,
- gpu::CommandBuffer::State* state);
- void OnMsgFlush(const HostResource& context,
- int32 put_offset,
- int32 last_known_get,
- gpu::CommandBuffer::State* state);
- void OnMsgAsyncFlush(const HostResource& context,
- int32 put_offset);
- void OnMsgCreateTransferBuffer(const HostResource& context,
- int32 size,
- int32* id);
- void OnMsgDestroyTransferBuffer(const HostResource& context,
- int32 id);
- void OnMsgGetTransferBuffer(const HostResource& context,
- int32 id,
- base::SharedMemoryHandle* transfer_buffer,
- uint32* size);
- void OnMsgSwapBuffers(const HostResource& context);
- // Renderer->plugin message handlers.
- void OnMsgSwapBuffersACK(const HostResource& context, int32_t pp_error);
-
- void SendSwapBuffersACKToPlugin(int32_t result,
- const HostResource& context);
-
- CompletionCallbackFactory<PPB_Graphics3D_Proxy,
- ProxyNonThreadSafeRefCount> callback_factory_;
-
- DISALLOW_COPY_AND_ASSIGN(PPB_Graphics3D_Proxy);
-};
-
-} // namespace proxy
-} // namespace pp
-
-#endif // PPAPI_PROXY_PPB_GRAPHICS_3D_PROXY_H_
-
diff --git a/ppapi/proxy/resource_creation_proxy.cc b/ppapi/proxy/resource_creation_proxy.cc
index c498002..20e6735 100644
--- a/ppapi/proxy/resource_creation_proxy.cc
+++ b/ppapi/proxy/resource_creation_proxy.cc
@@ -25,7 +25,6 @@
#include "ppapi/proxy/ppb_flash_tcp_socket_proxy.h"
#include "ppapi/proxy/ppb_font_proxy.h"
#include "ppapi/proxy/ppb_graphics_2d_proxy.h"
-#include "ppapi/proxy/ppb_graphics_3d_proxy.h"
#include "ppapi/proxy/ppb_image_data_proxy.h"
#include "ppapi/proxy/ppb_surface_3d_proxy.h"
#include "ppapi/proxy/ppb_url_loader_proxy.h"
@@ -194,17 +193,7 @@ PP_Resource ResourceCreationProxy::CreateGraphics3D(
PP_Config3D_Dev config,
PP_Resource share_context,
const int32_t* attrib_list) {
- return PPB_Graphics3D_Proxy::CreateProxyResource(
- instance, config, share_context, attrib_list);
-}
-
-PP_Resource ResourceCreationProxy::CreateGraphics3DRaw(
- PP_Instance instance,
- PP_Config3D_Dev config,
- PP_Resource share_context,
- const int32_t* attrib_list) {
- // Not proxied. The raw creation function is used only in the implementation
- // of the proxy on the host side.
+ NOTIMPLEMENTED(); // Not proxied yet.
return 0;
}
diff --git a/ppapi/proxy/resource_creation_proxy.h b/ppapi/proxy/resource_creation_proxy.h
index 4336f85..e6b609f 100644
--- a/ppapi/proxy/resource_creation_proxy.h
+++ b/ppapi/proxy/resource_creation_proxy.h
@@ -76,10 +76,6 @@ class ResourceCreationProxy : public ::ppapi::FunctionGroupBase,
PP_Config3D_Dev config,
PP_Resource share_context,
const int32_t* attrib_list) OVERRIDE;
- virtual PP_Resource CreateGraphics3DRaw(PP_Instance instance,
- PP_Config3D_Dev config,
- PP_Resource share_context,
- const int32_t* attrib_list) OVERRIDE;
virtual PP_Resource CreateImageData(PP_Instance instance,
PP_ImageDataFormat format,
const PP_Size& size,
diff --git a/ppapi/shared_impl/DEPS b/ppapi/shared_impl/DEPS
index 013d2acf..512b07b 100644
--- a/ppapi/shared_impl/DEPS
+++ b/ppapi/shared_impl/DEPS
@@ -1,6 +1,5 @@
include_rules = [
"+base",
- "+gpu",
"+skia",
"+webkit/glue",
diff --git a/ppapi/shared_impl/graphics_3d_impl.cc b/ppapi/shared_impl/graphics_3d_impl.cc
deleted file mode 100644
index e7f5c70..0000000
--- a/ppapi/shared_impl/graphics_3d_impl.cc
+++ /dev/null
@@ -1,104 +0,0 @@
-// 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.
-
-#include "ppapi/shared_impl/graphics_3d_impl.h"
-
-#include "gpu/command_buffer/client/gles2_cmd_helper.h"
-#include "gpu/command_buffer/client/gles2_implementation.h"
-#include "ppapi/c/pp_errors.h"
-
-namespace ppapi {
-
-Graphics3DImpl::Graphics3DImpl()
- : transfer_buffer_id_(-1),
- swap_callback_(PP_BlockUntilComplete()) {
-}
-
-Graphics3DImpl::~Graphics3DImpl() {
- // Make sure that GLES2 implementation has already been destroyed.
- DCHECK_EQ(transfer_buffer_id_, -1);
- DCHECK(!gles2_helper_.get());
- DCHECK(!gles2_impl_.get());
-}
-
-int32_t Graphics3DImpl::GetAttribs(int32_t* attrib_list) {
- // TODO(alokp): Implement me.
- return PP_ERROR_FAILED;
-}
-
-int32_t Graphics3DImpl::SetAttribs(int32_t* attrib_list) {
- // TODO(alokp): Implement me.
- return PP_ERROR_FAILED;
-}
-
-int32_t Graphics3DImpl::SwapBuffers(PP_CompletionCallback callback) {
- if (!callback.func) {
- // Blocking SwapBuffers isn't supported (since we have to be on the main
- // thread).
- return PP_ERROR_BADARGUMENT;
- }
-
- if (HasPendingSwap()) {
- // Already a pending SwapBuffers that hasn't returned yet.
- return PP_ERROR_INPROGRESS;
- }
-
- swap_callback_ = callback;
- return DoSwapBuffers();
-}
-
-void Graphics3DImpl::SwapBuffersACK(int32_t pp_error) {
- DCHECK(HasPendingSwap());
- PP_RunAndClearCompletionCallback(&swap_callback_, pp_error);
-}
-
-bool Graphics3DImpl::CreateGLES2Impl(int32 command_buffer_size,
- int32 transfer_buffer_size) {
- gpu::CommandBuffer* command_buffer = GetCommandBuffer();
- DCHECK(command_buffer);
-
- // Create the GLES2 helper, which writes the command buffer protocol.
- gles2_helper_.reset(new gpu::gles2::GLES2CmdHelper(command_buffer));
- if (!gles2_helper_->Initialize(command_buffer_size))
- return false;
-
- // Create a transfer buffer used to copy resources between the renderer
- // process and the GPU process.
- 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.size,
- transfer_buffer.ptr,
- transfer_buffer_id_,
- false));
-
- return true;
-}
-
-void Graphics3DImpl::DestroyGLES2Impl() {
- gles2_impl_.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();
-}
-
-} // namespace ppapi
-
diff --git a/ppapi/shared_impl/graphics_3d_impl.h b/ppapi/shared_impl/graphics_3d_impl.h
deleted file mode 100644
index 41a71af..0000000
--- a/ppapi/shared_impl/graphics_3d_impl.h
+++ /dev/null
@@ -1,63 +0,0 @@
-// 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.
-
-#ifndef PPAPI_SHARED_IMPL_GRAPHICS_3D_IMPL_H_
-#define PPAPI_SHARED_IMPL_GRAPHICS_3D_IMPL_H_
-
-#include "base/basictypes.h"
-#include "base/memory/scoped_ptr.h"
-#include "ppapi/c/pp_completion_callback.h"
-#include "ppapi/thunk/ppb_graphics_3d_api.h"
-
-namespace gpu {
-class CommandBuffer;
-namespace gles2 {
-class GLES2CmdHelper;
-class GLES2Implementation;
-} // namespace gles2
-} // namespace gpu.
-
-namespace ppapi {
-
-class Graphics3DImpl : public thunk::PPB_Graphics3D_API {
- public:
- // PPB_Graphics3D_API implementation.
- virtual int32_t GetAttribs(int32_t* attrib_list) OVERRIDE;
- virtual int32_t SetAttribs(int32_t* attrib_list) OVERRIDE;
- virtual int32_t SwapBuffers(PP_CompletionCallback callback) OVERRIDE;
-
- gpu::gles2::GLES2Implementation* gles2_impl() {
- return gles2_impl_.get();
- }
-
- // Sends swap-buffers notification to the plugin.
- void SwapBuffersACK(int32_t pp_error);
-
- protected:
- Graphics3DImpl();
- virtual ~Graphics3DImpl();
-
- virtual gpu::CommandBuffer* GetCommandBuffer() = 0;
- virtual int32 DoSwapBuffers() = 0;
-
- bool HasPendingSwap() { return swap_callback_.func != NULL; }
- bool CreateGLES2Impl(int32 command_buffer_size,
- int32 transfer_buffer_size);
- void DestroyGLES2Impl();
-
- private:
- int32 transfer_buffer_id_;
- scoped_ptr<gpu::gles2::GLES2CmdHelper> gles2_helper_;
- scoped_ptr<gpu::gles2::GLES2Implementation> gles2_impl_;
-
- // Callback that needs to be executed when swap-buffers is completed.
- PP_CompletionCallback swap_callback_;
-
- DISALLOW_COPY_AND_ASSIGN(Graphics3DImpl);
-};
-
-} // namespace ppapi
-
-#endif // PPAPI_SHARED_IMPL_GRAPHICS_3D_IMPL_H_
-
diff --git a/ppapi/tests/all_c_includes.h b/ppapi/tests/all_c_includes.h
index eae0b86..7b95220 100644
--- a/ppapi/tests/all_c_includes.h
+++ b/ppapi/tests/all_c_includes.h
@@ -25,7 +25,6 @@
#include "ppapi/c/dev/ppb_font_dev.h"
#include "ppapi/c/dev/ppb_fullscreen_dev.h"
#include "ppapi/c/dev/ppb_graphics_3d_dev.h"
-#include "ppapi/c/dev/ppb_graphics_3d_trusted_dev.h"
#include "ppapi/c/dev/ppb_layer_compositor_dev.h"
#include "ppapi/c/dev/ppb_memory_dev.h"
#include "ppapi/c/dev/ppb_opengles_dev.h"
diff --git a/ppapi/thunk/ppb_graphics_3d_api.h b/ppapi/thunk/ppb_graphics_3d_api.h
index 8871d6b..99fe935 100644
--- a/ppapi/thunk/ppb_graphics_3d_api.h
+++ b/ppapi/thunk/ppb_graphics_3d_api.h
@@ -6,7 +6,6 @@
#define PPAPI_THUNK_PPB_GRAPHICS_3D_API_H_
#include "ppapi/c/dev/ppb_graphics_3d_dev.h"
-#include "ppapi/c/dev/ppb_graphics_3d_trusted_dev.h"
namespace ppapi {
namespace thunk {
@@ -15,28 +14,9 @@ class PPB_Graphics3D_API {
public:
virtual ~PPB_Graphics3D_API() {}
- // Graphics3D API.
virtual int32_t GetAttribs(int32_t* attrib_list) = 0;
virtual int32_t SetAttribs(int32_t* attrib_list) = 0;
virtual int32_t SwapBuffers(PP_CompletionCallback callback) = 0;
-
- // Graphics3DTrusted API.
- virtual PP_Bool InitCommandBuffer(int32_t size) = 0;
- virtual PP_Bool GetRingBuffer(int* shm_handle,
- uint32_t* shm_size) = 0;
- virtual PP_Graphics3DTrustedState GetState() = 0;
- virtual int32_t CreateTransferBuffer(uint32_t size) = 0;
- virtual PP_Bool DestroyTransferBuffer(int32_t id) = 0;
- virtual PP_Bool GetTransferBuffer(int32_t id,
- int* shm_handle,
- uint32_t* shm_size) = 0;
- virtual PP_Bool Flush(int32_t put_offset) = 0;
- virtual PP_Graphics3DTrustedState FlushSync(int32_t put_offset) = 0;
- virtual PP_Graphics3DTrustedState FlushSyncFast(int32_t put_offset,
- int32_t last_known_get) = 0;
-
- // TODO(alokp): Implement GLESChromiumTextureMapping here after
- // deprecating Context3D.
};
} // namespace thunk
diff --git a/ppapi/thunk/ppb_graphics_3d_trusted_thunk.cc b/ppapi/thunk/ppb_graphics_3d_trusted_thunk.cc
deleted file mode 100644
index 1910dcd..0000000
--- a/ppapi/thunk/ppb_graphics_3d_trusted_thunk.cc
+++ /dev/null
@@ -1,125 +0,0 @@
-// 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.
-
-#include "ppapi/thunk/thunk.h"
-#include "ppapi/thunk/enter.h"
-#include "ppapi/thunk/ppb_graphics_3d_api.h"
-#include "ppapi/thunk/resource_creation_api.h"
-
-namespace ppapi {
-namespace thunk {
-
-namespace {
-
-typedef EnterResource<PPB_Graphics3D_API> EnterGraphics3D;
-
-PP_Graphics3DTrustedState GetErrorState() {
- PP_Graphics3DTrustedState error_state = { 0 };
- error_state.error = PPB_GRAPHICS3D_TRUSTED_ERROR_GENERICERROR;
- return error_state;
-}
-
-PP_Resource CreateRaw(PP_Instance instance,
- PP_Config3D_Dev config,
- PP_Resource share_context,
- const int32_t* attrib_list) {
- EnterFunction<ResourceCreationAPI> enter(instance, true);
- if (enter.failed())
- return 0;
- return enter.functions()->CreateGraphics3DRaw(
- instance, config, share_context, attrib_list);
-}
-
-PP_Bool InitCommandBuffer(PP_Resource context, int32_t size) {
- EnterGraphics3D enter(context, true);
- if (enter.failed())
- return PP_FALSE;
- return enter.object()->InitCommandBuffer(size);
-}
-
-PP_Bool GetRingBuffer(PP_Resource context,
- int* shm_handle,
- uint32_t* shm_size) {
- EnterGraphics3D enter(context, true);
- if (enter.failed())
- return PP_FALSE;
- return enter.object()->GetRingBuffer(shm_handle, shm_size);
-}
-
-PP_Graphics3DTrustedState GetState(PP_Resource context) {
- EnterGraphics3D enter(context, true);
- if (enter.failed())
- return GetErrorState();
- return enter.object()->GetState();
-}
-
-int32_t CreateTransferBuffer(PP_Resource context, uint32_t size) {
- EnterGraphics3D enter(context, true);
- if (enter.failed())
- return PP_FALSE;
- return enter.object()->CreateTransferBuffer(size);
-}
-
-PP_Bool DestroyTransferBuffer(PP_Resource context, int32_t id) {
- EnterGraphics3D enter(context, true);
- if (enter.failed())
- return PP_FALSE;
- return enter.object()->DestroyTransferBuffer(id);
-}
-
-PP_Bool GetTransferBuffer(PP_Resource context,
- int32_t id,
- int* shm_handle,
- uint32_t* shm_size) {
- EnterGraphics3D enter(context, true);
- if (enter.failed())
- return PP_FALSE;
- return enter.object()->GetTransferBuffer(id, shm_handle, shm_size);
-}
-
-PP_Bool Flush(PP_Resource context, int32_t put_offset) {
- EnterGraphics3D enter(context, true);
- if (enter.failed())
- return PP_FALSE;
- return enter.object()->Flush(put_offset);
-}
-
-PP_Graphics3DTrustedState FlushSync(PP_Resource context, int32_t put_offset) {
- EnterGraphics3D enter(context, true);
- if (enter.failed())
- return GetErrorState();
- return enter.object()->FlushSync(put_offset);
-}
-
-PP_Graphics3DTrustedState FlushSyncFast(PP_Resource context,
- int32_t put_offset,
- int32_t last_known_get) {
- EnterGraphics3D enter(context, true);
- if (enter.failed())
- return GetErrorState();
- return enter.object()->FlushSyncFast(put_offset, last_known_get);
-}
-
-const PPB_Graphics3DTrusted_Dev g_ppb_graphics_3d_trusted_thunk = {
- &CreateRaw,
- &InitCommandBuffer,
- &GetRingBuffer,
- &GetState,
- &CreateTransferBuffer,
- &DestroyTransferBuffer,
- &GetTransferBuffer,
- &Flush,
- &FlushSync,
- &FlushSyncFast,
-};
-
-} // namespace
-
-const PPB_Graphics3DTrusted_Dev* GetPPB_Graphics3DTrusted_Thunk() {
- return &g_ppb_graphics_3d_trusted_thunk;
-}
-
-} // namespace thunk
-} // namespace ppapi
-
diff --git a/ppapi/thunk/resource_creation_api.h b/ppapi/thunk/resource_creation_api.h
index 15641c3..0925b59 100644
--- a/ppapi/thunk/resource_creation_api.h
+++ b/ppapi/thunk/resource_creation_api.h
@@ -75,10 +75,6 @@ class ResourceCreationAPI {
PP_Config3D_Dev config,
PP_Resource share_context,
const int32_t* attrib_list) = 0;
- virtual PP_Resource CreateGraphics3DRaw(PP_Instance instance,
- PP_Config3D_Dev config,
- PP_Resource share_context,
- const int32_t* attrib_list) = 0;
virtual PP_Resource CreateImageData(PP_Instance instance,
PP_ImageDataFormat format,
const PP_Size& size,