| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef PPAPI_C_DEV_PPB_GRAPHICS_3D_TRUSTED_DEV_H_ | |
| 6 #define PPAPI_C_DEV_PPB_GRAPHICS_3D_TRUSTED_DEV_H_ | |
| 7 | |
| 8 #include "ppapi/c/pp_bool.h" | |
| 9 #include "ppapi/c/pp_instance.h" | |
| 10 #include "ppapi/c/pp_resource.h" | |
| 11 #include "ppapi/c/pp_stdint.h" | |
| 12 | |
| 13 #define PPB_GRAPHICS_3D_TRUSTED_DEV_INTERFACE_0_1 \ | |
| 14 "PPB_Graphics3DTrusted(Dev);0.1" | |
| 15 #define PPB_GRAPHICS_3D_TRUSTED_DEV_INTERFACE \ | |
| 16 PPB_GRAPHICS_3D_TRUSTED_DEV_INTERFACE_0_1 | |
| 17 | |
| 18 typedef enum { | |
| 19 PPB_GRAPHICS3D_TRUSTED_ERROR_OK, | |
| 20 PPB_GRAPHICS3D_TRUSTED_ERROR_GENERICERROR, | |
| 21 PPB_GRAPHICS3D_TRUSTED_ERROR_INVALIDARGUMENTS, | |
| 22 PPB_GRAPHICS3D_TRUSTED_ERROR_INVALIDSIZE, | |
| 23 PPB_GRAPHICS3D_TRUSTED_ERROR_LOSTCONTEXT, | |
| 24 PPB_GRAPHICS3D_TRUSTED_ERROR_OUTOFBOUNDS, | |
| 25 PPB_GRAPHICS3D_TRUSTED_ERROR_UNKNOWNCOMMAND | |
| 26 } PPB_Graphics3DTrustedError; | |
| 27 | |
| 28 struct PP_Graphics3DTrustedState { | |
| 29 // Size of the command buffer in command buffer entries. | |
| 30 int32_t num_entries; | |
| 31 | |
| 32 // The offset (in entries) from which the reader is reading. | |
| 33 int32_t get_offset; | |
| 34 | |
| 35 // The offset (in entries) at which the writer is writing. | |
| 36 int32_t put_offset; | |
| 37 | |
| 38 // The current token value. This is used by the writer to defer | |
| 39 // changes to shared memory objects until the reader has reached a certain | |
| 40 // point in the command buffer. The reader is responsible for updating the | |
| 41 // token value, for example in response to an asynchronous set token command | |
| 42 // embedded in the command buffer. The default token value is zero. | |
| 43 int32_t token; | |
| 44 | |
| 45 // Error status. | |
| 46 PPB_Graphics3DTrustedError error; | |
| 47 | |
| 48 // Generation index of this state. The generation index is incremented every | |
| 49 // time a new state is retrieved from the command processor, so that | |
| 50 // consistency can be kept even if IPC messages are processed out-of-order. | |
| 51 uint32_t generation; | |
| 52 }; | |
| 53 | |
| 54 struct PPB_Graphics3DTrusted_Dev { | |
| 55 // Creates a raw Graphics3D resource. A raw Graphics3D is intended to be used | |
| 56 // with the trusted interface, through the command buffer (for proxying). | |
| 57 PP_Resource (*CreateRaw)(PP_Instance instance_id, | |
| 58 PP_Config3D_Dev config, | |
| 59 PP_Resource share_context, | |
| 60 const int32_t* attrib_list); | |
| 61 | |
| 62 // Initializes the command buffer with the given size. | |
| 63 PP_Bool (*InitCommandBuffer)(PP_Resource context_id, int32_t size); | |
| 64 | |
| 65 // Gets the ring buffer for the command buffer. | |
| 66 PP_Bool (*GetRingBuffer)(PP_Resource context_id, | |
| 67 int* shm_handle, | |
| 68 uint32_t* shm_size); | |
| 69 | |
| 70 // Returns the current state. | |
| 71 struct PP_Graphics3DTrustedState (*GetState)(PP_Resource context); | |
| 72 | |
| 73 // Create a transfer buffer and return a handle that uniquely | |
| 74 // identifies it or -1 on error. | |
| 75 int32_t (*CreateTransferBuffer)(PP_Resource context, uint32_t size); | |
| 76 | |
| 77 // Destroy a transfer buffer and recycle the handle. | |
| 78 PP_Bool (*DestroyTransferBuffer)(PP_Resource context, int32_t id); | |
| 79 | |
| 80 // Get the transfer buffer associated with a handle. | |
| 81 PP_Bool (*GetTransferBuffer)(PP_Resource context, | |
| 82 int32_t id, | |
| 83 int* shm_handle, | |
| 84 uint32_t* shm_size); | |
| 85 | |
| 86 // The writer calls this to update its put offset. | |
| 87 PP_Bool (*Flush)(PP_Resource context, int32_t put_offset); | |
| 88 | |
| 89 // The writer calls this to update its put offset. This function returns the | |
| 90 // reader's most recent get offset. Does not return until after the put offset | |
| 91 // change callback has been invoked. | |
| 92 struct PP_Graphics3DTrustedState (*FlushSync)(PP_Resource context, | |
| 93 int32_t put_offset); | |
| 94 | |
| 95 // Like FlushSync, but returns before processing commands if the get offset is | |
| 96 // different than last_known_get. Allows synchronization with the command | |
| 97 // processor without forcing immediate command execution. | |
| 98 struct PP_Graphics3DTrustedState (*FlushSyncFast)(PP_Resource context, | |
| 99 int32_t put_offset, | |
| 100 int32_t last_known_get); | |
| 101 }; | |
| 102 | |
| 103 #endif // PPAPI_C_DEV_PPB_GRAPHICS_3D_TRUSTED_DEV_H_ | |
| 104 | |
| OLD | NEW |