Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(302)

Side by Side Diff: third_party/npapi/bindings/npapi_extensions.h

Issue 1529005: New experimental Pepper device API.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 1 /* Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be 2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file. 3 * found in the LICENSE file.
4 */ 4 */
5 5
6 #ifndef _NP_EXTENSIONS_H_ 6 #ifndef _NP_EXTENSIONS_H_
7 #define _NP_EXTENSIONS_H_ 7 #define _NP_EXTENSIONS_H_
8 8
9 // Use the shorter include path here so that this file can be used in non- 9 // Use the shorter include path here so that this file can be used in non-
10 // Chromium projects, such as the Native Client SDK. 10 // Chromium projects, such as the Native Client SDK.
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 150
151 151
152 /* forward decl typdef structs */ 152 /* forward decl typdef structs */
153 typedef struct NPDevice NPDevice; 153 typedef struct NPDevice NPDevice;
154 typedef struct NPNExtensions NPNExtensions; 154 typedef struct NPNExtensions NPNExtensions;
155 155
156 // DEPRECATED: this typedef is just for the NaCl code until they switch to NPNEx tensions. 156 // DEPRECATED: this typedef is just for the NaCl code until they switch to NPNEx tensions.
157 // PLEASE REMOVE THIS WHEN THE NACL CODE IS UPDATED. 157 // PLEASE REMOVE THIS WHEN THE NACL CODE IS UPDATED.
158 typedef struct NPNExtensions NPExtensions; 158 typedef struct NPNExtensions NPExtensions;
159 159
160
161 /* New experimental device API. */
162
163 /* Mode for calls to NPDeviceSynchronizeContext. */
164 typedef enum {
165 /* Get or set locally cached state without synchronizing or communicating */
166 /* with the service process (or thread). */
167 NPDeviceSynchronizationMode_Cached,
168
169 /* Exchanges state with service process (or thread). Does not wait for any */
170 /* progress before returning. */
171 NPDeviceSynchronizationMode_Immediate,
172
173 /* Exchanges state with service process (or thread). Blocks caller until */
174 /* further progress can be made. */
175 NPDeviceSynchronizationMode_Flush
176 } NPDeviceSynchronizationMode;
177
178 /* Get the number of configs supported by a given device. */
179 typedef NPError (*NPDeviceGetNumConfigsPtr)(NPP instance,
180 int32* numConfigs);
181
182 /* Get attribute values from a config. NPDeviceGetConfigs might return */
183 /* multiple configs. This function can be used to examine them to */
184 /* find the most suitable. For example, NPDeviceGetConfigs might return one */
185 /* config with antialiasing enabled and one without. This can be determined */
186 /* using this function. */
187 /* Inputs: */
188 /* config: The config index to extract the attributes from. */
189 /* attribList: Array of input config attribute / value pairs */
190 /* terminated with NPAttrib_End. */
191 /* Outputs: */
192 /* attribList: The values paired up with each attribute are filled in */
193 /* on return. */
194 typedef NPError (*NPDeviceGetConfigAttribsPtr)(NPP instance,
195 int32 config,
196 int32* attribList);
197
198 /* Create a device context based on a particular device configuration and a */
199 /* list config input attributes. */
200 /* Inputs: */
201 /* config: The device configuration to use. */
202 /* attribList: NULL or an array of context specific attribute / value */
203 /* pairs terminated with NPAttrib_End. */
204 /* Outputs: */
205 /* context: The created context. */
206 typedef NPError (*NPDeviceCreateContextPtr)(NPP instance,
207 int32 config,
208 const int32* attribList,
209 NPDeviceContext** context);
210
211 /* Destroy a context. */
212 /* Inputs: */
213 /* context: The context to destroy. */
214 /*typedef NPError (*NPDestroyContext)(NPP instance, */
215 /* NPDeviceContext* context); */
216
217 /* This type should be cast to the type associated with the particular */
218 /* callback type */
219 typedef void (*NPDeviceGenericCallbackPtr)(void);
220
221 /* Register a callback with a context. Callbacks are never invoked after the */
222 /* associated context has been destroyed. The semantics of the particular */
223 /* callback type determine which thread the callback is invoked on. It might */
224 /* be the plugin thread, the thread RegisterCallback is invoked on or a */
225 /* special thread created for servicing callbacks, such as an audio thread */
226 /* Inputs: */
227 /* callbackType: The device specific callback type */
228 /* callback: The callback to invoke. The signature varies by type. Use */
229 /* NULL to unregister the callback for a particular type. */
230 /* callbackData: A value that is passed to the callback function. Other */
231 /* callback arguments vary by type. */
232 typedef NPError (*NPDeviceRegisterCallbackPtr)(
233 NPP instance,
234 NPDeviceContext* context,
235 int32 callbackType,
236 NPDeviceGenericCallbackPtr callback,
237 void* callbackData);
238
239 /* Callback for NPDeviceSynchronizeContext. */
240 /* Inputs: */
241 /* instance: The associated plugin instance. */
242 /* context: The context that was flushed. */
243 /* error: Indicates success of flush operation. */
244 /* data: The completion callback data that was passed to */
245 /* NPDeviceSynchronizeContext. */
246 typedef void (*NPDeviceSynchronizeContextCallbackPtr)(
247 NPP instance,
248 NPDeviceContext* context,
249 NPError error,
250 void* data);
251
252 /* Synchronize the state of a device context. Takes lists of input and output */
253 /* attributes. Generally, the input attributes are copied into the context */
254 /* and the output attributes are filled in the state of the context either */
255 /* after (before) the synchronization depending on whether it is synchronous */
256 /* (asynchronous). The get the state of the context after an asynchronous */
257 /* synchronization, call this function a second time with Cached mode after */
258 /* the callback has been invoked. */
259 /* Inputs: */
260 /* context: The context to synchronize. */
261 /* mode: The type of synchronization to perform. */
262 /* inputAttribList: NULL or an array of input synchronization attribute / */
263 /* value pairs terminated with NPAttrib_End. */
264 /* outputAttribList: NULL or an array of output synchronization */
265 /* attributes / uninitialized value pairs terminated */
266 /* with NPAttrib_End. */
267 /* callback: NULL for synchronous operation or completion callback function */
268 /* for asynchronous operation. */
269 /* callbackData: Argument passed to callback function. */
270 /* Outputs: */
271 /* outputAttribList: The values paired up with each attribute are filled */
272 /* in on return for synchronous operation. */
273 typedef NPError (*NPDeviceSynchronizeContextPtr)(
274 NPP instance,
275 NPDeviceContext* context,
276 NPDeviceSynchronizationMode mode,
277 const int32* inputAttribList,
278 int32* outputAttribList,
279 NPDeviceSynchronizeContextCallbackPtr callback,
280 void* callbackData);
281
282 /* All attributes shared between devices, with the exception of */
283 /* NPDeviceContextAttrib_End, have bit 31 set. Device specific attributes */
284 /* have the bit clear. */
285 enum {
286 /* Used to terminate arrays of attribute / value pairs. */
287 NPAttrib_End = 0,
288
289 /* Error status of context. Non-zero means error. Shared by all devices, */
290 /* though error values are device specific. */
291 NPAttrib_Error = 0x80000000,
292 };
293
160 /* generic device interface */ 294 /* generic device interface */
161 struct NPDevice { 295 struct NPDevice {
162 NPDeviceQueryCapabilityPtr queryCapability; 296 NPDeviceQueryCapabilityPtr queryCapability;
163 NPDeviceQueryConfigPtr queryConfig; 297 NPDeviceQueryConfigPtr queryConfig;
164 NPDeviceInitializeContextPtr initializeContext; 298 NPDeviceInitializeContextPtr initializeContext;
165 NPDeviceSetStateContextPtr setStateContext; 299 NPDeviceSetStateContextPtr setStateContext;
166 NPDeviceGetStateContextPtr getStateContext; 300 NPDeviceGetStateContextPtr getStateContext;
167 NPDeviceFlushContextPtr flushContext; 301 NPDeviceFlushContextPtr flushContext;
168 NPDeviceDestroyContextPtr destroyContext; 302 NPDeviceDestroyContextPtr destroyContext;
169 NPDeviceCreateBufferPtr createBuffer; 303 NPDeviceCreateBufferPtr createBuffer;
170 NPDeviceDestroyBufferPtr destroyBuffer; 304 NPDeviceDestroyBufferPtr destroyBuffer;
171 NPDeviceMapBufferPtr mapBuffer; 305 NPDeviceMapBufferPtr mapBuffer;
172 NPDeviceThemeGetSize themeGetSize; 306 NPDeviceThemeGetSize themeGetSize;
173 NPDeviceThemePaint themePaint; 307 NPDeviceThemePaint themePaint;
308
309 /* Experimental device API */
310 NPDeviceGetNumConfigsPtr getNumConfigs;
311 NPDeviceGetConfigAttribsPtr getConfigAttribs;
312 NPDeviceCreateContextPtr createContext;
313 /* NPDeviceDestroyContextPtr destroyContext; */
314 NPDeviceRegisterCallbackPtr registerCallback;
315 NPDeviceSynchronizeContextPtr synchronizeContext;
316 /* NPDeviceCreateBufferPtr createBuffer; */
317 /* NPDeviceDestroyBufferPtr destroyBuffer; */
318 /* NPDeviceMapBufferPtr mapBuffer; */
174 }; 319 };
175 320
176 /* returns NULL if deviceID unavailable / unrecognized */ 321 /* returns NULL if deviceID unavailable / unrecognized */
177 typedef NPDevice* (*NPAcquireDevicePtr)( 322 typedef NPDevice* (*NPAcquireDevicePtr)(
178 NPP instance, 323 NPP instance,
179 NPDeviceID device); 324 NPDeviceID device);
180 325
181 /* Copy UTF-8 string into clipboard */ 326 /* Copy UTF-8 string into clipboard */
182 typedef void (*NPCopyTextToClipboardPtr)( 327 typedef void (*NPCopyTextToClipboardPtr)(
183 NPP instance, 328 NPP instance,
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 579
435 // Any other error. 580 // Any other error.
436 NPDeviceContext3DError_GenericError 581 NPDeviceContext3DError_GenericError
437 } NPDeviceContext3DError; 582 } NPDeviceContext3DError;
438 583
439 typedef struct _NPDeviceContext3D NPDeviceContext3D; 584 typedef struct _NPDeviceContext3D NPDeviceContext3D;
440 585
441 typedef void (*NPDeviceContext3DRepaintPtr)(NPP npp, 586 typedef void (*NPDeviceContext3DRepaintPtr)(NPP npp,
442 NPDeviceContext3D* context); 587 NPDeviceContext3D* context);
443 588
589 // TODO(apatrick): this need not be exposed when we switch over to the new
590 // device API. It's layout can also be implementation dependent.
444 typedef struct _NPDeviceContext3D 591 typedef struct _NPDeviceContext3D
445 { 592 {
446 void* reserved; 593 void* reserved;
447 594
448 // If true, then a flush will only complete once the get offset has advanced 595 // If true, then a flush will only complete once the get offset has advanced
449 // on the GPU thread. If false, then the get offset might have changed but 596 // on the GPU thread. If false, then the get offset might have changed but
450 // the GPU thread will respond as quickly as possible without guaranteeing 597 // the GPU thread will respond as quickly as possible without guaranteeing
451 // having made any progress in executing pending commands. Set to true 598 // having made any progress in executing pending commands. Set to true
452 // to ensure that progress is made or when flushing in a loop waiting for the 599 // to ensure that progress is made or when flushing in a loop waiting for the
453 // GPU to reach a certain state, for example in advancing beyond a particular 600 // GPU to reach a certain state, for example in advancing beyond a particular
(...skipping 16 matching lines...) Expand all
470 617
471 // Callback invoked on the main thread when the context must be repainted. 618 // Callback invoked on the main thread when the context must be repainted.
472 // TODO(apatrick): move this out of the context struct like the rest of the 619 // TODO(apatrick): move this out of the context struct like the rest of the
473 // fields. 620 // fields.
474 NPDeviceContext3DRepaintPtr repaintCallback; 621 NPDeviceContext3DRepaintPtr repaintCallback;
475 622
476 // Error status. Synchronized on flush. 623 // Error status. Synchronized on flush.
477 NPDeviceContext3DError error; 624 NPDeviceContext3DError error;
478 } NPDeviceContext3D; 625 } NPDeviceContext3D;
479 626
627
628 /* Begin 3D specific portion of experimental device API */
629
630 /* Device buffer ID reserved for command buffer */
631 enum {
632 NP3DCommandBufferId = 0
633 };
634
635 /* 3D attributes */
636 enum {
637 /* Example GetConfigAttribs attributes. See EGL 1.4 spec. */
638 /* These may be passed to GetConfigAttribs. */
639 NP3DAttrib_BufferSize = 0x3020,
640 NP3DAttrib_AlphaSize = 0x3021,
641 NP3DAttrib_BlueSize = 0x3022,
642 NP3DAttrib_GreenSize = 0x3023,
643 NP3DAttrib_RedSize = 0x3024,
644 NP3DAttrib_DepthSize = 0x3025,
645 NP3DAttrib_StencilSize = 0x3026,
646 NP3DAttrib_SurfaceType = 0x3033,
647
648 /* Example CreateContext attributes. See EGL 1.4 spec. */
649 /* These may be passed to CreateContext. */
650 NP3DAttrib_SwapBehavior = 0x3093,
651 NP3DAttrib_MultisampleResolve = 0x3099,
652
653 /* Size of command buffer in 32-bit entries. */
654 /* This may be passed to CreateContext as an input or SynchronizeContext as */
655 /* an output. */
656 NP3DAttrib_CommandBufferSize = 0x10000000,
657
658 /* These may be passed to SynchronizeContext. */
659
660 /* Offset in command buffer writer has reached. In / out.*/
661 NP3DAttrib_PutOffset,
662
663 /* Offset in command buffer reader has reached. Out only. */
664 NP3DAttrib_GetOffset,
665
666 /* Last processed token. Out only. */
667 NP3DAttrib_Token,
668 };
669
670 /* 3D callbacks */
671 enum {
672 /* This callback is invoked whenever the plugin must repaint everything. */
673 /* This might be because the window manager must repaint a window or */
674 /* the context has been lost, for example a power management event. */
675 NP3DCallback_Repaint = 1
676 };
677
678 /* Flags for NPConfig3DOutAttrib_SurfaceType */
679 enum {
680 NP3DSurfaceType_MultisampleResolveBox = 0x0200,
681 NP3DSurfaceType_SwapBehaviorPreserved = 0x0400
682 };
683
684 /* Values for NPConfig3DInAttrib_SwapBehavior */
685 enum {
686 NP3DSwapBehavior_Preserved = 0x3094,
687 NP3DSwapBehavior_Destroyed = 0x3095
688 };
689
690 /* Values for NPConfig3DInAttrib_MultisampleResolve */
691 enum {
692 NP3DMultisampleResolve_Default = 0x309A,
693 NP3DMultisampleResolve_Box = 0x309B,
694 };
695
696 /* End 3D specific API */
697
480 /* Audio --------------------------------------------------------------------*/ 698 /* Audio --------------------------------------------------------------------*/
481 699
482 #define NPPepperAudioDevice 3 700 #define NPPepperAudioDevice 3
483 701
484 /* min & max sample frame count */ 702 /* min & max sample frame count */
485 typedef enum { 703 typedef enum {
486 NPAudioMinSampleFrameCount = 64, 704 NPAudioMinSampleFrameCount = 64,
487 NPAudioMaxSampleFrameCount = 32768 705 NPAudioMaxSampleFrameCount = 32768
488 } NPAudioSampleFrameCounts; 706 } NPAudioSampleFrameCounts;
489 707
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 NPP instance, 855 NPP instance,
638 int factor); 856 int factor);
639 857
640 typedef struct _NPPExtensions { 858 typedef struct _NPPExtensions {
641 NPPGetPrintExtensionsPtr getPrintExtensions; 859 NPPGetPrintExtensionsPtr getPrintExtensions;
642 NPPGetFindExtensionsPtr getFindExtensions; 860 NPPGetFindExtensionsPtr getFindExtensions;
643 NPPZoomPtr zoom; 861 NPPZoomPtr zoom;
644 } NPPExtensions; 862 } NPPExtensions;
645 863
646 #endif /* _NP_EXTENSIONS_H_ */ 864 #endif /* _NP_EXTENSIONS_H_ */
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698