summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ppapi/api/trusted/ppb_graphics_3d_trusted.idl100
-rw-r--r--ppapi/c/trusted/ppb_graphics_3d_trusted.h127
-rw-r--r--ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c86
3 files changed, 258 insertions, 55 deletions
diff --git a/ppapi/api/trusted/ppb_graphics_3d_trusted.idl b/ppapi/api/trusted/ppb_graphics_3d_trusted.idl
new file mode 100644
index 0000000..174e59f
--- /dev/null
+++ b/ppapi/api/trusted/ppb_graphics_3d_trusted.idl
@@ -0,0 +1,100 @@
+/* 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.
+ */
+
+/* Graphics 3D trusted interfaces. */
+
+label Chrome {
+ M16 = 1.0
+};
+
+enum PPB_Graphics3DTrustedError {
+ 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
+};
+
+[returnByValue]
+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;
+};
+
+[macro="PPB_GRAPHICS_3D_TRUSTED_INTERFACE"]
+interface PPB_Graphics3DTrusted {
+ // 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([in] PP_Instance instance_id,
+ [in] PP_Resource share_context,
+ [in] int32_t[] attrib_list);
+
+ // Initializes the command buffer with the given size.
+ PP_Bool InitCommandBuffer([in] PP_Resource context_id);
+
+ // Sets the buffer used for commands.
+ PP_Bool SetGetBuffer([in] PP_Resource context,
+ [in] int32_t transfer_buffer_id);
+
+ // Returns the current state.
+ PP_Graphics3DTrustedState GetState([in] PP_Resource context);
+
+ // Create a transfer buffer and return a handle that uniquely
+ // identifies it or -1 on error.
+ int32_t CreateTransferBuffer([in] PP_Resource context,
+ [in] uint32_t size);
+
+ // Destroy a transfer buffer and recycle the handle.
+ PP_Bool DestroyTransferBuffer([in] PP_Resource context,
+ [in] int32_t id);
+
+ // Get the transfer buffer associated with a handle.
+ PP_Bool GetTransferBuffer([in] PP_Resource context,
+ [in] int32_t id,
+ [out] handle_t shm_handle,
+ [out] uint32_t shm_size);
+
+ // The writer calls this to update its put offset.
+ PP_Bool Flush([in] PP_Resource context,
+ [in] 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.
+ // Note: This function remains for backwards compatibility; FlushSyncFast
+ // is now the preferred way to sync.
+ PP_Graphics3DTrustedState FlushSync([in] PP_Resource context,
+ [in] 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.
+ PP_Graphics3DTrustedState FlushSyncFast([in] PP_Resource context,
+ [in] int32_t put_offset,
+ [in] int32_t last_known_get);
+};
diff --git a/ppapi/c/trusted/ppb_graphics_3d_trusted.h b/ppapi/c/trusted/ppb_graphics_3d_trusted.h
index 099ffdc..4f1497b 100644
--- a/ppapi/c/trusted/ppb_graphics_3d_trusted.h
+++ b/ppapi/c/trusted/ppb_graphics_3d_trusted.h
@@ -1,20 +1,33 @@
-// 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.
+/* 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.
+ */
+
+/* From trusted/ppb_graphics_3d_trusted.idl,
+ * modified Mon Nov 26 15:49:46 2012.
+ */
#ifndef PPAPI_C_TRUSTED_PPB_GRAPHICS_3D_TRUSTED_H_
#define PPAPI_C_TRUSTED_PPB_GRAPHICS_3D_TRUSTED_H_
#include "ppapi/c/pp_bool.h"
#include "ppapi/c/pp_instance.h"
+#include "ppapi/c/pp_macros.h"
#include "ppapi/c/pp_resource.h"
#include "ppapi/c/pp_stdint.h"
-#define PPB_GRAPHICS_3D_TRUSTED_INTERFACE_1_0 \
- "PPB_Graphics3DTrusted;1.0"
-#define PPB_GRAPHICS_3D_TRUSTED_INTERFACE \
- PPB_GRAPHICS_3D_TRUSTED_INTERFACE_1_0
+#define PPB_GRAPHICS_3D_TRUSTED_INTERFACE_1_0 "PPB_Graphics3DTrusted;1.0"
+#define PPB_GRAPHICS_3D_TRUSTED_INTERFACE PPB_GRAPHICS_3D_TRUSTED_INTERFACE_1_0
+
+/**
+ * @file
+ * Graphics 3D trusted interfaces. */
+
+/**
+ * @addtogroup Enums
+ * @{
+ */
typedef enum {
PPB_GRAPHICS3D_TRUSTED_ERROR_OK,
PPB_GRAPHICS3D_TRUSTED_ERROR_GENERICERROR,
@@ -24,81 +37,85 @@ typedef enum {
PPB_GRAPHICS3D_TRUSTED_ERROR_OUTOFBOUNDS,
PPB_GRAPHICS3D_TRUSTED_ERROR_UNKNOWNCOMMAND
} PPB_Graphics3DTrustedError;
-
+/**
+ * @}
+ */
+
+/**
+ * @addtogroup Structs
+ * @{
+ */
struct PP_Graphics3DTrustedState {
- // Size of the command buffer in command buffer entries.
+ /* Size of the command buffer in command buffer entries. */
int32_t num_entries;
-
- // The offset (in entries) from which the reader is reading.
+ /* The offset (in entries) from which the reader is reading. */
int32_t get_offset;
-
- // The offset (in entries) at which the writer is writing.
+ /* 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.
+ /* 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.
+ /* 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.
+ /* 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;
};
-
+/**
+ * @}
+ */
+
+/**
+ * @addtogroup Interfaces
+ * @{
+ */
struct PPB_Graphics3DTrusted_1_0 {
- // Creates a raw Graphics3D resource. A raw Graphics3D is intended to be used
- // with the trusted interface, through the command buffer (for proxying).
+ /* 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_Resource share_context,
- const int32_t* attrib_list);
-
- // Initializes the command buffer with the given size.
+ const int32_t attrib_list[]);
+ /* Initializes the command buffer with the given size. */
PP_Bool (*InitCommandBuffer)(PP_Resource context_id);
-
- // Sets the buffer used for commands.
+ /* Sets the buffer used for commands. */
PP_Bool (*SetGetBuffer)(PP_Resource context, int32_t transfer_buffer_id);
-
- // Returns the current state.
+ /* 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.
+ /* 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.
+ /* 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.
+ /* 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.
+ /* 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.
- // Note: This function remains for backwards compatibility; FlushSyncFast
- // is now the preferred way to sync.
+ /* 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.
+ * Note: This function remains for backwards compatibility; FlushSyncFast
+ * is now the preferred way to sync. */
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.
+ /* 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);
};
typedef struct PPB_Graphics3DTrusted_1_0 PPB_Graphics3DTrusted;
+/**
+ * @}
+ */
+
+#endif /* PPAPI_C_TRUSTED_PPB_GRAPHICS_3D_TRUSTED_H_ */
-#endif // PPAPI_C_TRUSTED_PPB_GRAPHICS_3D_TRUSTED_H_
diff --git a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c
index 750fa32..209736a 100644
--- a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c
+++ b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c
@@ -100,6 +100,7 @@
#include "ppapi/c/trusted/ppb_char_set_trusted.h"
#include "ppapi/c/trusted/ppb_file_chooser_trusted.h"
#include "ppapi/c/trusted/ppb_file_io_trusted.h"
+#include "ppapi/c/trusted/ppb_graphics_3d_trusted.h"
#include "ppapi/c/trusted/ppb_image_data_trusted.h"
#include "ppapi/c/trusted/ppb_url_loader_trusted.h"
@@ -162,6 +163,7 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_CharSet_Trusted_1_0;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileChooserTrusted_0_5;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileChooserTrusted_0_6;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileIOTrusted_0_4;
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Graphics3DTrusted_1_0;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_ImageDataTrusted_0_4;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_URLLoaderTrusted_0_3;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_2;
@@ -1391,6 +1393,70 @@ int32_t Pnacl_M14_PPB_FileIOTrusted_WillSetLength(PP_Resource file_io, int64_t l
/* End wrapper methods for PPB_FileIOTrusted_0_4 */
+/* Begin wrapper methods for PPB_Graphics3DTrusted_1_0 */
+
+static __attribute__((pnaclcall))
+PP_Resource Pnacl_M16_PPB_Graphics3DTrusted_CreateRaw(PP_Instance instance_id, PP_Resource share_context, const int32_t attrib_list[]) {
+ const struct PPB_Graphics3DTrusted_1_0 *iface = Pnacl_WrapperInfo_PPB_Graphics3DTrusted_1_0.real_iface;
+ return iface->CreateRaw(instance_id, share_context, attrib_list);
+}
+
+static __attribute__((pnaclcall))
+PP_Bool Pnacl_M16_PPB_Graphics3DTrusted_InitCommandBuffer(PP_Resource context_id) {
+ const struct PPB_Graphics3DTrusted_1_0 *iface = Pnacl_WrapperInfo_PPB_Graphics3DTrusted_1_0.real_iface;
+ return iface->InitCommandBuffer(context_id);
+}
+
+static __attribute__((pnaclcall))
+PP_Bool Pnacl_M16_PPB_Graphics3DTrusted_SetGetBuffer(PP_Resource context, int32_t transfer_buffer_id) {
+ const struct PPB_Graphics3DTrusted_1_0 *iface = Pnacl_WrapperInfo_PPB_Graphics3DTrusted_1_0.real_iface;
+ return iface->SetGetBuffer(context, transfer_buffer_id);
+}
+
+static __attribute__((pnaclcall))
+struct PP_Graphics3DTrustedState Pnacl_M16_PPB_Graphics3DTrusted_GetState(PP_Resource context) {
+ const struct PPB_Graphics3DTrusted_1_0 *iface = Pnacl_WrapperInfo_PPB_Graphics3DTrusted_1_0.real_iface;
+ return iface->GetState(context);
+}
+
+static __attribute__((pnaclcall))
+int32_t Pnacl_M16_PPB_Graphics3DTrusted_CreateTransferBuffer(PP_Resource context, uint32_t size) {
+ const struct PPB_Graphics3DTrusted_1_0 *iface = Pnacl_WrapperInfo_PPB_Graphics3DTrusted_1_0.real_iface;
+ return iface->CreateTransferBuffer(context, size);
+}
+
+static __attribute__((pnaclcall))
+PP_Bool Pnacl_M16_PPB_Graphics3DTrusted_DestroyTransferBuffer(PP_Resource context, int32_t id) {
+ const struct PPB_Graphics3DTrusted_1_0 *iface = Pnacl_WrapperInfo_PPB_Graphics3DTrusted_1_0.real_iface;
+ return iface->DestroyTransferBuffer(context, id);
+}
+
+static __attribute__((pnaclcall))
+PP_Bool Pnacl_M16_PPB_Graphics3DTrusted_GetTransferBuffer(PP_Resource context, int32_t id, int* shm_handle, uint32_t* shm_size) {
+ const struct PPB_Graphics3DTrusted_1_0 *iface = Pnacl_WrapperInfo_PPB_Graphics3DTrusted_1_0.real_iface;
+ return iface->GetTransferBuffer(context, id, shm_handle, shm_size);
+}
+
+static __attribute__((pnaclcall))
+PP_Bool Pnacl_M16_PPB_Graphics3DTrusted_Flush(PP_Resource context, int32_t put_offset) {
+ const struct PPB_Graphics3DTrusted_1_0 *iface = Pnacl_WrapperInfo_PPB_Graphics3DTrusted_1_0.real_iface;
+ return iface->Flush(context, put_offset);
+}
+
+static __attribute__((pnaclcall))
+struct PP_Graphics3DTrustedState Pnacl_M16_PPB_Graphics3DTrusted_FlushSync(PP_Resource context, int32_t put_offset) {
+ const struct PPB_Graphics3DTrusted_1_0 *iface = Pnacl_WrapperInfo_PPB_Graphics3DTrusted_1_0.real_iface;
+ return iface->FlushSync(context, put_offset);
+}
+
+static __attribute__((pnaclcall))
+struct PP_Graphics3DTrustedState Pnacl_M16_PPB_Graphics3DTrusted_FlushSyncFast(PP_Resource context, int32_t put_offset, int32_t last_known_get) {
+ const struct PPB_Graphics3DTrusted_1_0 *iface = Pnacl_WrapperInfo_PPB_Graphics3DTrusted_1_0.real_iface;
+ return iface->FlushSyncFast(context, put_offset, last_known_get);
+}
+
+/* End wrapper methods for PPB_Graphics3DTrusted_1_0 */
+
/* Not generating wrapper methods for PPB_ImageDataTrusted_0_4 */
/* Not generating wrapper methods for PPB_URLLoaderTrusted_0_3 */
@@ -3569,6 +3635,19 @@ struct PPB_FileIOTrusted_0_4 Pnacl_Wrappers_PPB_FileIOTrusted_0_4 = {
.WillSetLength = (int32_t (*)(PP_Resource file_io, int64_t length, struct PP_CompletionCallback callback))&Pnacl_M14_PPB_FileIOTrusted_WillSetLength
};
+struct PPB_Graphics3DTrusted_1_0 Pnacl_Wrappers_PPB_Graphics3DTrusted_1_0 = {
+ .CreateRaw = (PP_Resource (*)(PP_Instance instance_id, PP_Resource share_context, const int32_t attrib_list[]))&Pnacl_M16_PPB_Graphics3DTrusted_CreateRaw,
+ .InitCommandBuffer = (PP_Bool (*)(PP_Resource context_id))&Pnacl_M16_PPB_Graphics3DTrusted_InitCommandBuffer,
+ .SetGetBuffer = (PP_Bool (*)(PP_Resource context, int32_t transfer_buffer_id))&Pnacl_M16_PPB_Graphics3DTrusted_SetGetBuffer,
+ .GetState = (struct PP_Graphics3DTrustedState (*)(PP_Resource context))&Pnacl_M16_PPB_Graphics3DTrusted_GetState,
+ .CreateTransferBuffer = (int32_t (*)(PP_Resource context, uint32_t size))&Pnacl_M16_PPB_Graphics3DTrusted_CreateTransferBuffer,
+ .DestroyTransferBuffer = (PP_Bool (*)(PP_Resource context, int32_t id))&Pnacl_M16_PPB_Graphics3DTrusted_DestroyTransferBuffer,
+ .GetTransferBuffer = (PP_Bool (*)(PP_Resource context, int32_t id, int* shm_handle, uint32_t* shm_size))&Pnacl_M16_PPB_Graphics3DTrusted_GetTransferBuffer,
+ .Flush = (PP_Bool (*)(PP_Resource context, int32_t put_offset))&Pnacl_M16_PPB_Graphics3DTrusted_Flush,
+ .FlushSync = (struct PP_Graphics3DTrustedState (*)(PP_Resource context, int32_t put_offset))&Pnacl_M16_PPB_Graphics3DTrusted_FlushSync,
+ .FlushSyncFast = (struct PP_Graphics3DTrustedState (*)(PP_Resource context, int32_t put_offset, int32_t last_known_get))&Pnacl_M16_PPB_Graphics3DTrusted_FlushSyncFast
+};
+
/* Not generating wrapper interface for PPB_ImageDataTrusted_0_4 */
/* Not generating wrapper interface for PPB_URLLoaderTrusted_0_3 */
@@ -4328,6 +4407,12 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileIOTrusted_0_4 = {
.real_iface = NULL
};
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Graphics3DTrusted_1_0 = {
+ .iface_macro = PPB_GRAPHICS_3D_TRUSTED_INTERFACE_1_0,
+ .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_Graphics3DTrusted_1_0,
+ .real_iface = NULL
+};
+
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_ImageDataTrusted_0_4 = {
.iface_macro = PPB_IMAGEDATA_TRUSTED_INTERFACE_0_4,
.wrapped_iface = NULL /* Still need slot for real_iface */,
@@ -4856,6 +4941,7 @@ static struct __PnaclWrapperInfo *s_ppb_wrappers[] = {
&Pnacl_WrapperInfo_PPB_FileChooserTrusted_0_5,
&Pnacl_WrapperInfo_PPB_FileChooserTrusted_0_6,
&Pnacl_WrapperInfo_PPB_FileIOTrusted_0_4,
+ &Pnacl_WrapperInfo_PPB_Graphics3DTrusted_1_0,
&Pnacl_WrapperInfo_PPB_ImageDataTrusted_0_4,
&Pnacl_WrapperInfo_PPB_URLLoaderTrusted_0_3,
&Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_2,