1 /* Copyright (c) 2012 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.
6 /* Graphics 3D trusted interfaces. */
12 enum PPB_Graphics3DTrustedError
{
13 PPB_GRAPHICS3D_TRUSTED_ERROR_OK
,
14 PPB_GRAPHICS3D_TRUSTED_ERROR_GENERICERROR
,
15 PPB_GRAPHICS3D_TRUSTED_ERROR_INVALIDARGUMENTS
,
16 PPB_GRAPHICS3D_TRUSTED_ERROR_INVALIDSIZE
,
17 PPB_GRAPHICS3D_TRUSTED_ERROR_LOSTCONTEXT
,
18 PPB_GRAPHICS3D_TRUSTED_ERROR_OUTOFBOUNDS
,
19 PPB_GRAPHICS3D_TRUSTED_ERROR_UNKNOWNCOMMAND
23 struct PP_Graphics3DTrustedState
{
24 // Size of the command buffer in command buffer entries.
27 // The offset (in entries) from which the reader is reading.
30 // The offset (in entries) at which the writer is writing.
33 // The current token value. This is used by the writer to defer
34 // changes to shared memory objects until the reader has reached a certain
35 // point in the command buffer. The reader is responsible for updating the
36 // token value, for example in response to an asynchronous set token command
37 // embedded in the command buffer. The default token value is zero.
41 PPB_Graphics3DTrustedError error
;
43 // Generation index of this state. The generation index is incremented every
44 // time a new state is retrieved from the command processor, so that
45 // consistency can be kept even if IPC messages are processed out-of-order.
49 [macro
="PPB_GRAPHICS_3D_TRUSTED_INTERFACE"]
50 interface PPB_Graphics3DTrusted
{
51 // Creates a raw Graphics3D resource. A raw Graphics3D is intended to be used
52 // with the trusted interface, through the command buffer (for proxying).
53 PP_Resource CreateRaw
([in] PP_Instance instance_id
,
54 [in] PP_Resource share_context
,
55 [in] int32_t
[] attrib_list
);
57 // Initializes the command buffer with the given size.
58 PP_Bool InitCommandBuffer
([in] PP_Resource context_id
);
60 // Sets the buffer used for commands.
61 PP_Bool SetGetBuffer
([in] PP_Resource context
,
62 [in] int32_t transfer_buffer_id
);
64 // Returns the current state.
65 PP_Graphics3DTrustedState GetState
([in] PP_Resource context
);
67 // Create a transfer buffer and return a handle that uniquely
68 // identifies it or -1 on error.
69 int32_t CreateTransferBuffer
([in] PP_Resource context
,
72 // Destroy a transfer buffer and recycle the handle.
73 PP_Bool DestroyTransferBuffer
([in] PP_Resource context
,
76 // Get the transfer buffer associated with a handle.
77 PP_Bool GetTransferBuffer
([in] PP_Resource context
,
79 [out] handle_t shm_handle
,
80 [out] uint32_t shm_size
);
82 // The writer calls this to update its put offset.
83 PP_Bool Flush
([in] PP_Resource context
,
84 [in] int32_t put_offset
);
86 // The writer calls this to update its put offset. This function returns the
87 // reader's most recent get offset. Does not return until after the put offset
88 // change callback has been invoked.
89 // Note: This function remains for backwards compatibility; FlushSyncFast
90 // is now the preferred way to sync.
91 PP_Graphics3DTrustedState FlushSync
([in] PP_Resource context
,
92 [in] int32_t put_offset
);
94 // Like FlushSync, but returns before processing commands if the get offset is
95 // different than last_known_get. Allows synchronization with the command
96 // processor without forcing immediate command execution.
97 PP_Graphics3DTrustedState FlushSyncFast
([in] PP_Resource context
,
98 [in] int32_t put_offset
,
99 [in] int32_t last_known_get
);