PlusLib  2.9.0
Software library for tracked ultrasound image acquisition, calibration, and processing.
DVPAPI.h
Go to the documentation of this file.
1 /*
2  * Copyright 1993-2012 NVIDIA Corporation. All rights reserved.
3  *
4  * NOTICE TO LICENSEE:
5  *
6  * This source code and/or documentation ("Licensed Deliverables") are
7  * subject to NVIDIA intellectual property rights under U.S. and
8  * international Copyright laws.
9  *
10  * These Licensed Deliverables contained herein is PROPRIETARY and
11  * CONFIDENTIAL to NVIDIA and is being provided under the terms and
12  * conditions of a form of NVIDIA software license agreement by and
13  * between NVIDIA and Licensee ("License Agreement") or electronically
14  * accepted by Licensee. Notwithstanding any terms or conditions to
15  * the contrary in the License Agreement, reproduction or disclosure
16  * of the Licensed Deliverables to any third party without the express
17  * written consent of NVIDIA is prohibited.
18  *
19  * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
20  * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
21  * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
22  * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
23  * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
24  * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
25  * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
26  * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
27  * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
28  * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
29  * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
30  * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
31  * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
32  * OF THESE LICENSED DELIVERABLES.
33  *
34  * U.S. Government End Users. These Licensed Deliverables are a
35  * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
36  * 1995), consisting of "commercial computer software" and "commercial
37  * computer software documentation" as such terms are used in 48
38  * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
39  * only as a commercial end item. Consistent with 48 C.F.R.12.212 and
40  * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
41  * U.S. Government End Users acquire the Licensed Deliverables with
42  * only those rights set forth herein.
43  *
44  * Any use of the Licensed Deliverables in individual and commercial
45  * software must include, in the user documentation and internal
46  * comments to the code, the above Disclaimer and U.S. Government End
47  * Users Notice.
48  */
49 
50 #ifndef __DVAPI_H_
51 #define __DVAPI_H_
52 
53 #include <stdint.h>
54 
55 #if defined(WIN32)
56 #define DVPAPI_INTERFACE __declspec( dllexport ) DVPStatus
57 #if defined(DVP_STATIC)
58 // If using a static build, force the linker to include the
59 // DVP CRT call back, so the DVP can properly cleanup thread
60 // data. For dynamic library linkage, this is handled by Dllmain.
61 // Dynamic linkage is recommended.
62  #ifdef _WIN64
63  #pragma comment(linker, "/INCLUDE:_tls_used")
64  #pragma comment(linker, "/INCLUDE:dvp_callback")
65 
66  #else // _WIN64
67 
68  #pragma comment(linker, "/INCLUDE:__tls_used")
69  #pragma comment(linker, "/INCLUDE:_dvp_callback")
70 
71  #endif // _WIN64
72 #endif
73 #else
74 #define DVPAPI_INTERFACE extern DVPStatus
75 #endif
76 
77 #define DVP_MAJOR_VERSION 1
78 #define DVP_MINOR_VERSION 70
79 
80 typedef uint64_t DVPBufferHandle;
81 typedef uint64_t DVPSyncObjectHandle;
82 
83 typedef enum
84 {
101 } DVPStatus;
102 
103 // Pixel component formats stored in the system memory buffer
104 // analogous to those defined in the OpenGL API, except for
105 // DVP_BUFFER and the DVP_CUDA_* types. DVP_BUFFER provides
106 // an unspecified format type to allow for general interpretation
107 // of the bytes at a later stage (in GPU shader). Note that not
108 // all paths will achieve optimal speeds due to lack of HW support
109 // for the transformation. The CUDA types are to be used when
110 // copying to/from a system memory buffer from-to a CUDA array, as the
111 // CUDA array implies a memory layout that matches the array.
112 typedef enum
113 {
114  DVP_BUFFER, // Buffer treated as a raw buffer
115  // and copied directly into GPU buffer
116  // without any interpretation of the
117  // stored bytes.
143 
144 // Possible pixel component storage types for system memory buffers
145 typedef enum
146 {
168 
169 // System memory descriptor describing the size and storage formats
170 // of the buffer
171 typedef struct DVPSysmemBufferDescRec {
172  uint32_t width; // Buffer Width
173  uint32_t height; // Buffer Height
174  uint32_t stride; // Stride
175  uint32_t size; // Specifies the surface size if
176  // format == DVP_BUFFER
177  DVPBufferFormats format; // see enum above
178  DVPBufferTypes type; // see enum above
179  void *bufAddr; // Buffer memory address
181 
182 // Flags specified at sync object creation:
183 // ----------------------------------------
184 // Tells the implementation to use events wherever
185 // possible instead of software spin loops. Note if HW
186 // wait operations are supported by the implementation
187 // then events will not be used in the dvpMemcpy*
188 // functions. In such a case, events may still be used
189 // in dvpSyncObjClientWait* functions.
190 #define DVP_SYNC_OBJECT_FLAGS_USE_EVENTS 0x00000001
191 
192 typedef struct DVPSyncObjectDescRec {
193  uint32_t *sem; // Location to write semaphore value
194  uint32_t flags; // See above DVP_SYNC_OBJECT_FLAGS_* bits
196  uint32_t value,
197  bool GEQ, // If true then the function should wait for the sync value to be
198  // greater than or equal to the value parameter. Otherwise just a
199  // straight forward equality comparison should be performed.
200  uint64_t timeout);
201  // If non-null, externalClientWaitFunc allows the DVP library
202  // to call the application to wait for a sync object to be
203  // released. This allows the application to create events,
204  // which can be triggered on device interrupts instead of
205  // using spin loops inside the DVP library. Upon succeeding
206  // the function must return DVP_STATUS_OK, non-zero for failure
207  // and DVP_STATUS_TIMEOUT on timeout. The externalClientWaitFunc should
208  // not alter the current GL or CUDA context state
210 
211 // Time used when event timeouts should be ignored
212 #define DVP_TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFFull
213 
214 // Flags supplied to the dvpInit* functions:
215 //
216 // DVP_DEVICE_FLAGS_SHARE_APP_CONTEXT is only supported for OpenGL
217 // contexts and is the only supported flag for CUDA. It allows for
218 // certain cases to be optimized by sharing the context
219 // of the application for the DVP operations. This removes the
220 // need to do certain synchronizations. See issue 5 for parallel
221 // issues. When used, the app's GL context must be current for all calls
222 // to the DVP library.
223 // the DVP library.
224 #define DVP_DEVICE_FLAGS_SHARE_APP_CONTEXT 0x000000001
225 
226 //------------------------------------------------------------------------
227 // Function: dvpInit*
228 //
229 // To be called before any DVP resources are allocated.
230 // This call allows for specification of flags that may
231 // change the way DVP operations are performed. See above
232 // for the list of flags.
233 //
234 // If OpenGL or CUDA is used, the OpenGL/CUDA context
235 // must be current at time of call.
236 //
237 // Parameters: flags[IN] - Buffer description structure
238 //
239 // Returns: DVP_STATUS_OK
240 // DVP_STATUS_INVALID_PARAMETER
241 // DVP_STATUS_ERROR
242 //------------------------------------------------------------------------
243 
244 //------------------------------------------------------------------------
245 // Function: dvpClose*
246 //
247 // Function to be called when app closes to allow freeing
248 // of any DVP library allocated resources.
249 //
250 // If OpenGL or CUDA is used, the OpenGL/CUDA context
251 // must be current at time of call.
252 //
253 // Parameters: none
254 //
255 // Returns: DVP_STATUS_OK
256 // DVP_STATUS_INVALID_PARAMETER
257 // DVP_STATUS_ERROR
258 //------------------------------------------------------------------------
259 
260 //------------------------------------------------------------------------
261 // Function: dvpBegin
262 //
263 // Description: dvpBegin must be called before any combination of DVP
264 // function calls dvpMemCpy*, dvpMapBufferWaitDVP,
265 // dvpSyncObjClientWait*, and dvpMapBufferEndDVP. After
266 // the last of these functions has been called is dvpEnd
267 // must be called. This allows for more efficient batched
268 // DVP operations.
269 //
270 // Parameters: none
271 //
272 // Returns: DVP_STATUS_OK
273 // DVP_STATUS_ERROR
274 //------------------------------------------------------------------------
276 dvpBegin();
277 
278 //------------------------------------------------------------------------
279 // Function: dvpEnd
280 //
281 // Description: dvpEnd signals the end of a batch of DVP function calls
282 // that began with dvpBegin
283 //
284 // Parameters: none
285 //
286 // Returns: DVP_STATUS_OK
287 // DVP_STATUS_ERROR
288 //------------------------------------------------------------------------
290 dvpEnd();
291 
292 //------------------------------------------------------------------------
293 // Function: dvpCreateBuffer
294 //
295 // Description: Create a DVP buffer using system memory, wrapping a user
296 // passed pointer. The pointer must be aligned
297 // to values returned by dvpGetRequiredAlignments*
298 //
299 // Parameters: desc[IN] - Buffer description structure
300 // hBuf[OUT] - DVP Buffer handle
301 //
302 // Returns: DVP_STATUS_OK
303 // DVP_STATUS_INVALID_PARAMETER
304 // DVP_STATUS_ERROR
305 //------------------------------------------------------------------------
308  DVPBufferHandle *hBuf);
309 
310 //------------------------------------------------------------------------
311 // Function: dvpDestroyBuffer
312 //
313 // Description: Destroy a previously created DVP buffer.
314 //
315 // Parameters: hBuf[IN] - DVP Buffer handle
316 //
317 // Returns: DVP_STATUS_OK
318 // DVP_STATUS_INVALID_PARAMETER
319 // DVP_STATUS_ERROR
320 //------------------------------------------------------------------------
323 
324 //------------------------------------------------------------------------
325 // Function: dvpBindTo*
326 //
327 // Description: Bind a previously created system memory buffer to an
328 // OpenGL context, CUDA context or D3D[9,10,11] device.
329 // For OpenGL and CUDA the context must be current at
330 // the time of bind.
331 //
332 // Parameters: hBuf[IN] - DVP Buffer handle
333 // device[IN] - D3D device if used
334 //
335 // Returns: DVP_STATUS_OK
336 // DVP_STATUS_INVALID_PARAMETER
337 // DVP_STATUS_ERROR
338 //------------------------------------------------------------------------
339 
340 //------------------------------------------------------------------------
341 // Function: dvpUnbindFrom*
342 //
343 // Description: Unbind a previously bound buffer from an API context.
344 // For OpenGL and CUDA the context must be current at
345 // the time of bind.
346 //
347 // Parameters: hBuf[IN] - DVP Buffer handle
348 // device[IN] - D3D device if used
349 //
350 // Returns: DVP_STATUS_OK
351 // DVP_STATUS_INVALID_PARAMETER
352 // DVP_STATUS_ERROR
353 //------------------------------------------------------------------------
354 
355 //------------------------------------------------------------------------
356 // Function: dvpCreateGPU*
357 //
358 // Description: dvpCreateGPU* creates a DVP buffer reference from a named
359 // [buffer,texture,resource]. If OpenGL or CUDA is used, the
360 // OpenGL/CUDA context must be current at time of call.
361 //
362 // For D3D resources, as soon as dvpCreateGPUD3D* is called
363 // the resource is mapped for use by the DVP library.
364 // dvpMapBufferWaitAPI must be called before the resource
365 // is used.
366 //
367 // Parameters: bufferID[IN] - [buffer,texture,resource] to import
368 // bufferHandle[OUT] - DVP Buffer handle
369 //
370 // Returns: DVP_STATUS_OK
371 // DVP_STATUS_INVALID_PARAMETER
372 // DVP_STATUS_ERROR
373 //------------------------------------------------------------------------
374 
375 //------------------------------------------------------------------------
376 // Function: dvpFreeBuffer
377 //
378 // Description: dvpFreeBuffer frees the DVP buffer reference
379 //
380 // Parameters: gpuBufferHandle[IN] - DVP Buffer handle
381 //
382 // Returns: DVP_STATUS_OK
383 // DVP_STATUS_INVALID_PARAMETER
384 // DVP_STATUS_ERROR
385 //------------------------------------------------------------------------
387 dvpFreeBuffer(DVPBufferHandle gpuBufferHandle);
388 
389 //------------------------------------------------------------------------
390 // Function: dvpGetRequiredConstants*
391 //
392 // Description: dvpGetRequiredConstants* returns, for the associated
393 // API context or device:
394 // - Alignments required for the start address of the
395 // buffer.
396 // - An alignment recommendation for the stride (pitch)
397 // of the buffer, as the performance might vary based
398 // on the stride alignment. This is a conservative value
399 // so smaller values may still give optimal performance.
400 // Please refer to the SDK for more details.
401 // - Semaphore Addr alignment
402 // - Semaphore allocation size
403 // - Semaphore payload offset
404 // - Semaphore payload size in bytes
405 //
406 // If OpenGL or CUDA is used, the OpenGL/CUDA context
407 // must be current at time of call.
408 //
409 // On Windows Vista and later dvpGetRequiredConstants*
410 // may return DVP_STATUS_OUT_OF_MEMORY when the system
411 // limit for graphics contexts has been reached. To avoid
412 // this, spurious graphics/compute contexts should be avoided.
413 //
414 // Parameters: bufferAddrAlignment[OUT]
415 // bufferGPUStrideAlignment[OUT]
416 // semaphoreAddrAlignment[OUT]
417 // semaphoreAllocSize[OUT]
418 // semaphorePayloadOffset[OUT]
419 // semaphorePayloadSize[OUT]
420 // device[IN] - D3D device if used
421 //
422 // Returns: DVP_STATUS_OK
423 // DVP_STATUS_INVALID_PARAMETER
424 // DVP_STATUS_ERROR
425 // DVP_STATUS_OUT_OF_MEMORY
426 //------------------------------------------------------------------------
427 
428 //------------------------------------------------------------------------
429 // Function: dvpMemcpy* general comments that apply to all the the
430 // memcpy functions.
431 //
432 // dvpMemcpyLined acquire the srcSync and then initiates
433 // a DMA transfer of the given amount of lines from the
434 // srcBuffer to the dstBuffer at a given line.
435 // Upon completion of a transfer, a release operation is
436 // performed on dstSync. The buffer is only usable once the
437 // release operation is complete.
438 //
439 // For OpenGL and CUDA sources or destinations the correct
440 // context must be current.
441 //
442 // When possible the implementation will use HW based
443 // synchronization and in these cases the timeout parameter
444 // is not supported, as the call will return immediately and
445 // the HW will perform the wait. When SW synchronization is
446 // in use, the wait will timeout after the specified time.
447 // The actual implementation time resolution may differ from
448 // the nanoseconds resolution of the parameter. To ignore
449 // the time out use the value DVP_TIMEOUT_IGNORED.
450 //
451 // If the timeout is hit, the corresponding copy is not
452 // performed.
453 //------------------------------------------------------------------------
454 
455 //------------------------------------------------------------------------
456 // Function: dvpMemcpyLined
457 //
458 // Description: dvpMemcpyLined provides buffer copies between a
459 // DVP sysmem buffer and a graphics API texture (as opposed to
460 // a buffer type). Other buffer types (such
461 // as graphics API buffers) return DVP_STATUS_INVALID_PARAMETER.
462 //
463 // In addition, see "dvpMemcpy* general comments" above.
464 //
465 // Parameters: srcBuffer[IN] - src buffer handle
466 // srcSync[IN] - sync to acquire on before transfer
467 // srcAcquireValue[IN] - value to acquire on before transfer
468 // timeout[IN] - time out value in nanoseconds.
469 // dstBuffer[IN] - src buffer handle
470 // dstSync[IN] - sync to release on transfer completion
471 // dstReleaseValue[IN] - value to release on completion
472 // startingLine[IN] - starting line of buffer
473 // numberOfLines[IN] - number of lines to copy
474 //
475 // Returns: DVP_STATUS_OK
476 // DVP_STATUS_INVALID_PARAMETER
477 // DVP_STATUS_ERROR
478 //
479 // GL state effected: The following GL state may be altered by this
480 // function (not relevant if no GL source or destination
481 // is used):
482 // -GL_PACK_SKIP_ROWS, GL_PACK_SKIP_PIXELS,
483 // GL_PACK_ROW_LENGTH
484 // -The buffer bound to GL_PIXEL_PACK_BUFFER
485 // -The current bound framebuffer (GL_FRAMEBUFFER_EXT)
486 // -GL_UNPACK_SKIP_ROWS, GL_UNPACK_SKIP_PIXELS,
487 // GL_UNPACK_ROW_LENGTH
488 // -The buffer bound to GL_PIXEL_UNPACK_BUFFER
489 // -The texture bound to GL_TEXTURE_2D
490 //------------------------------------------------------------------------
493  DVPSyncObjectHandle srcSync,
494  uint32_t srcAcquireValue,
495  uint64_t timeout,
496  DVPBufferHandle dstBuffer,
497  DVPSyncObjectHandle dstSync,
498  uint32_t dstReleaseValue,
499  uint32_t startingLine,
500  uint32_t numberOfLines);
501 
502 //------------------------------------------------------------------------
503 // Function: dvpMemcpy
504 //
505 // Description: dvpMemcpy provides buffer copies between a
506 // DVP sysmem buffer and a graphics API pure buffer (as
507 // opposed to a texture type). Other buffer types (such
508 // as graphics API textures) return
509 // DVP_STATUS_INVALID_PARAMETER.
510 //
511 // The start address of the srcBuffer is given by srcOffset
512 // and the dstBuffer start address is given by dstOffset.
513 //
514 // In addition, see "dvpMemcpy* general comments" above.
515 //
516 // Parameters: srcBuffer[IN] - src buffer handle
517 // srcSync[IN] - sync to acquire on before transfer
518 // srcAcquireValue[IN] - value to acquire on before transfer
519 // timeout[IN] - time out value in nanoseconds.
520 // dstBuffer[IN] - src buffer handle
521 // dstSync[IN] - sync to release on completion
522 // dstReleaseValue[IN] - value to release on completion
523 // uint32_t srcOffset[IN] - byte offset of srcBuffer
524 // uint32_t dstOffset[IN] - byte offset of dstBuffer
525 // uint32_t count[IN] - number of bytes to copy
526 //
527 // Returns: DVP_STATUS_OK
528 // DVP_STATUS_INVALID_PARAMETER
529 // DVP_STATUS_ERROR
530 //
531 // GL state effected: The following GL state may be altered by this
532 // function (not relevant if no GL source or destination
533 // is used):
534 // - The buffer bound to GL_COPY_WRITE_BUFFER
535 // - The buffer bound to GL_COPY_READ_BUFFER
536 //
537 //------------------------------------------------------------------------
539 dvpMemcpy(DVPBufferHandle srcBuffer,
540  DVPSyncObjectHandle srcSync,
541  uint32_t srcAcquireValue,
542  uint64_t timeout,
543  DVPBufferHandle dstBuffer,
544  DVPSyncObjectHandle dstSync,
545  uint32_t dstReleaseValue,
546  uint32_t srcOffset,
547  uint32_t dstOffset,
548  uint32_t count);
549 
550 //------------------------------------------------------------------------
551 // Function: dvpMemcpy2D
552 //
553 // Description: dvpMemcpy2D provides buffer copies between a
554 // DVP sysmem buffer and a graphics API texture (as opposed
555 // to a buffer type). Other buffer types (such
556 // as graphics API buffers) return
557 // DVP_STATUS_INVALID_PARAMETER.
558 //
559 // The start address of the copy is calculated as
560 // startPtr = baseAddress + pitch*startY + startX*elementSize,
561 // where the baseAdress and pitch are taken from the src
562 // and dst buffer properties.
563 //
564 // In addition, see "dvpMemcpy* general comments" above.
565 //
566 // Parameters: srcBuffer[IN] - src buffer handle
567 // srcSync[IN] - sync to acquire before transfer
568 // srcAcquireValue[IN] - value to acquire before transfer
569 // timeout[IN] - time out value in nanoseconds.
570 // dstBuffer[IN] - src buffer handle
571 // dstSync[IN] - sync to release on completion
572 // dstReleaseValue[IN] - value to release on completion
573 // uint32_t startY[IN] - Y position of src rectangle
574 // uint32_t startX[IN] - starting X position in bytes
575 // uint32_t height[IN] - height of sub rectangle
576 // uint32_t width[IN] - width of sub rectangle in bytes
577 //
578 // Returns: DVP_STATUS_OK
579 // DVP_STATUS_INVALID_PARAMETER
580 // DVP_STATUS_ERROR
581 //
582 // GL state effected: The following GL state may be altered by this
583 // function (not relevant if no GL source or destination
584 // is used):
585 // -GL_PACK_SKIP_ROWS, GL_PACK_SKIP_PIXELS,
586 // GL_PACK_ROW_LENGTH
587 // -The buffer bound to GL_PIXEL_PACK_BUFFER
588 // -The current bound framebuffer (GL_FRAMEBUFFER_EXT)
589 // -GL_UNPACK_SKIP_ROWS, GL_UNPACK_SKIP_PIXELS,
590 // GL_UNPACK_ROW_LENGTH
591 // -The buffer bound to GL_PIXEL_UNPACK_BUFFER
592 // -The texture bound to GL_TEXTURE_2D
593 //------------------------------------------------------------------------
595 dvpMemcpy2D(DVPBufferHandle srcBuffer,
596  DVPSyncObjectHandle srcSync,
597  uint32_t srcAcquireValue,
598  uint64_t timeout,
599  DVPBufferHandle dstBuffer,
600  DVPSyncObjectHandle dstSync,
601  uint32_t dstReleaseValue,
602  uint32_t startY,
603  uint32_t startX,
604  uint32_t height,
605  uint32_t width);
606 
607 //------------------------------------------------------------------------
608 // Function: dvpMapBufferEndAPI
609 //
610 // Description: Tells DVP to setup a signal for this buffer in the
611 // callers API context or device. The signal follows all
612 // previous API operations up to this point and, thus,
613 // allows subsequent DVP calls to know when then this buffer
614 // is ready for use within the DVP library. This function
615 // would be followed by a call to dvpMapBufferWaitDVP to
616 // synchronize rendering in the API stream and the DVP
617 // stream.
618 //
619 // If OpenGL or CUDA is used, the OpenGL/CUDA context
620 // must be current at time of call.
621 //
622 // The use of dvpMapBufferEndAPI is NOT recommended for
623 // CUDA synchronisation, as it is more optimal to use a
624 // applcation CUDA stream in conjunction with
625 // dvpMapBufferEndCUDAStream. This allows the driver to
626 // do optimisations, such as parllelise the copy operations
627 // and compute.
628 //
629 // This must be called outside the dvpBegin/dvpEnd pair. In
630 // addition, this call is not thread safe and must be called
631 // from or fenced against the rendering thread associated with
632 // the context or device.
633 //
634 // Parameters: gpuBufferHandle[IN] - buffer to track
635 //
636 // Returns: DVP_STATUS_OK
637 // DVP_STATUS_INVALID_PARAMETER
638 // DVP_STATUS_ERROR
639 // DVP_STATUS_UNSIGNALED - returned if the API is
640 // unable to place a signal in the API context queue
641 //------------------------------------------------------------------------
643 dvpMapBufferEndAPI(DVPBufferHandle gpuBufferHandle);
644 
645 //------------------------------------------------------------------------
646 // Function: dvpMapBufferEndDVP
647 //
648 // Description: Tells DVP to setup a signal for this buffer after
649 // DVP operations are complete. The signal allows
650 // the API to know when then this buffer is
651 // ready for use within a API stream. This function would
652 // be followed by a call to dvpMapBufferWaitAPI to
653 // synchronize copies in the DVP stream and the API
654 // rendering stream.
655 //
656 // This must be called inside the dvpBegin/dvpEnd pair.
657 //
658 // Parameters: gpuBufferHandle[IN] - buffer to track
659 //
660 // Returns: DVP_STATUS_OK
661 // DVP_STATUS_INVALID_PARAMETER
662 // DVP_STATUS_ERROR
663 //------------------------------------------------------------------------
665 dvpMapBufferEndDVP(DVPBufferHandle gpuBufferHandle);
666 
667 //------------------------------------------------------------------------
668 // Function: dvpMapBufferWaitAPI
669 //
670 // Description: Tells DVP to make the current API context or device to
671 // wait for a previous signal triggered by a
672 // dvpMapBufferEndDVP call.
673 //
674 // The use of dvpMapBufferWaitCUDAStream is NOT recommended for
675 // CUDA synchronisation, as it is more optimal to use a
676 // applcation CUDA stream in conjunction with
677 // dvpMapBufferEndCUDAStream. This allows the driver to
678 // do optimisations, such as parllelise the copy operations
679 // and compute.
680 //
681 // If OpenGL or CUDA is used, the OpenGL/CUDA context
682 // must be current at time of call.
683 //
684 // This must be called outside the dvpBegin/dvpEnd pair. In
685 // addition, this call is not thread safe and must be called
686 // from or fenced against the rendering thread associated with
687 // the context or device.
688 //
689 // Parameters: gpuBufferHandle[IN] - buffer to track
690 //
691 // Returns: DVP_STATUS_OK
692 // DVP_STATUS_INVALID_PARAMETER
693 // DVP_STATUS_ERROR
694 //------------------------------------------------------------------------
696 dvpMapBufferWaitAPI(DVPBufferHandle gpuBufferHandle);
697 
698 //------------------------------------------------------------------------
699 // Function: dvpMapBufferWaitDVP
700 //
701 // Description: Tells DVP to make the DVP stream wait for a previous
702 // signal triggered by a dvpMapBufferEndAPI call.
703 //
704 // This must be called inside the dvpBegin/dvpEnd pair.
705 //
706 // Parameters: gpuBufferHandle[IN] - buffer to track
707 //
708 // Returns: DVP_STATUS_OK
709 // DVP_STATUS_INVALID_PARAMETER
710 // DVP_STATUS_ERROR
711 //------------------------------------------------------------------------
713 dvpMapBufferWaitDVP(DVPBufferHandle gpuBufferHandle);
714 
715 //------------------------------------------------------------------------
716 // Function: dvpSyncObjCompletion
717 //
718 // Description: dvpSyncObjCompletion returns the time of completion
719 // of the last completed GPU release operation. This time is
720 // nanoseconds from and is in the same time domain as that
721 // defined in GL_ARB_timer_query.
722 //
723 // Parameters: syncObject[IN] - syncObject
724 // timeStamp[OUT] - return time in nanoseconds
725 //
726 // Returns: DVP_STATUS_OK
727 // DVP_STATUS_INVALID_PARAMETER
728 // DVP_STATUS_ERROR
729 //------------------------------------------------------------------------
732  uint64_t *timeStamp);
733 
734 //------------------------------------------------------------------------
735 // Function: dvpImportSyncObject
736 //
737 // Description: dvpImportSyncObject creates a DVPSyncObject from the
738 // DVPSyncObjectDesc. Note that a sync object is not
739 // supported for copy operations targeting different APIs.
740 // This means, for example, it is illegal to call dvpMemCpy*
741 // for source or target GL texture with sync object A and
742 // then later use that same sync object in dvpMemCpy*
743 // operation for a source or target CUDA buffer. The same
744 // semaphore memory can still be used for two different sync
745 // objects.
746 //
747 // Parameters: desc[IN] - data describing the sync object
748 // syncObject[OUT] - handle to sync object
749 //
750 // Returns: DVP_STATUS_OK
751 // DVP_STATUS_INVALID_PARAMETER
752 // DVP_STATUS_ERROR
753 //------------------------------------------------------------------------
756  DVPSyncObjectHandle *syncObject);
757 
758 //------------------------------------------------------------------------
759 // Function: dvpFreeSyncObject
760 //
761 // Description: dvpFreeSyncObject waits for any outstanding releases on
762 // this sync object before freeing the resources allocated for
763 // the specified sync object. The application must make sure
764 // any outstanding acquire operations have already been
765 // completed.
766 //
767 // If OpenGL is being used and the app's GL context is being
768 // shared (via the DVP_DEVICE_FLAGS_SHARE_APP_CONTEXT flag),
769 // then dvpFreeSyncObject needs to be called while each context,
770 // on which the sync object was used, is current. If
771 // DVP_DEVICE_FLAGS_SHARE_APP_CONTEXT is used and there are out
772 // standing contexts from which this sync object must be free'd
773 // then dvpFreeSyncObject will return DVP_STATUS_SYNC_STILL_BOUND.
774 //
775 // Parameters: syncObject[IN] - handle to sync object to be free'd
776 //
777 // Returns: DVP_STATUS_OK
778 // DVP_STATUS_INVALID_PARAMETER
779 // DVP_STATUS_ERROR
780 // DVP_STATUS_SYNC_STILL_BOUND
781 //------------------------------------------------------------------------
782 
785 
786 //------------------------------------------------------------------------
787 // Function: dvpSyncObjClientWaitComplete
788 //
789 // Description: dvpSyncObjClientWaitComplete blocks until the
790 // corresponding sync object's semaphore is greater than
791 // or equal to the last release value issued by the
792 // DVP library. If the sync object has not yet been
793 // released, then the return value will be
794 // DVP_STATUS_INVALID_OPERATION.
795 //
796 // Function definition changes with library version 1.30:
797 // This must be called inside a dvpBegin/dvpEnd pair.
798 //
799 // Parameters: syncObject[IN] - handle to sync object
800 // timeout[IN] - time out value in nanoseconds.
801 //
802 // Returns: DVP_STATUS_OK
803 // DVP_STATUS_INVALID_PARAMETER
804 // DVP_STATUS_INVALID_OPERATION
805 // DVP_STATUS_ERROR
806 //------------------------------------------------------------------------
809  uint64_t timeout);
810 
811 //------------------------------------------------------------------------
812 // Function: dvpSyncObjClientWaitPartial
813 //
814 // Description: dvpSyncObjClientWaitPartial blocks until the
815 // corresponding sync object's semaphore greater than
816 // or equal to the supplied value. If the sync object
817 // has not yet been released, then the return value
818 // will be DVP_STATUS_INVALID_OPERATION.
819 //
820 // Parameters: syncObject[IN] - handle to sync object
821 // value[IN] - value to wait for
822 // timeout[IN] - time out value in nanoseconds.
823 //
824 // Returns: DVP_STATUS_OK
825 // DVP_STATUS_INVALID_PARAMETER
826 // DVP_STATUS_INVALID_OPERATION
827 // DVP_STATUS_ERROR
828 //------------------------------------------------------------------------
831  uint32_t value,
832  uint64_t timeout);
833 
834 //------------------------------------------------------------------------
835 // Function: dvpGetLibrayVersion
836 //
837 // Description: Returns the current version of the library
838 //
839 // Parameters: major[OUT] - returned major version
840 // minor[OUT] - returned minor version
841 //
842 // Returns: DVP_STATUS_OK
843 //------------------------------------------------------------------------
845 dvpGetLibrayVersion(uint32_t *major,
846  uint32_t *minor);
847 
848 #endif // __DVAPI_H_
849 
DVPAPI_INTERFACE dvpMapBufferEndDVP(DVPBufferHandle gpuBufferHandle)
#define DVPAPI_INTERFACE
Definition: DVPAPI.h:74
DVPAPI_INTERFACE dvpMemcpy(DVPBufferHandle srcBuffer, DVPSyncObjectHandle srcSync, uint32_t srcAcquireValue, uint64_t timeout, DVPBufferHandle dstBuffer, DVPSyncObjectHandle dstSync, uint32_t dstReleaseValue, uint32_t srcOffset, uint32_t dstOffset, uint32_t count)
DVPAPI_INTERFACE dvpSyncObjClientWaitPartial(DVPSyncObjectHandle syncObject, uint32_t value, uint64_t timeout)
struct DVPSysmemBufferDescRec DVPSysmemBufferDesc
DVPBufferTypes
Definition: DVPAPI.h:145
uint64_t DVPSyncObjectHandle
Definition: DVPAPI.h:81
DVPAPI_INTERFACE dvpImportSyncObject(DVPSyncObjectDesc *desc, DVPSyncObjectHandle *syncObject)
DVPAPI_INTERFACE dvpFreeSyncObject(DVPSyncObjectHandle syncObject)
DVPAPI_INTERFACE dvpMapBufferWaitAPI(DVPBufferHandle gpuBufferHandle)
DVPAPI_INTERFACE dvpMemcpyLined(DVPBufferHandle srcBuffer, DVPSyncObjectHandle srcSync, uint32_t srcAcquireValue, uint64_t timeout, DVPBufferHandle dstBuffer, DVPSyncObjectHandle dstSync, uint32_t dstReleaseValue, uint32_t startingLine, uint32_t numberOfLines)
DVPAPI_INTERFACE dvpMapBufferEndAPI(DVPBufferHandle gpuBufferHandle)
DVPAPI_INTERFACE dvpBegin()
DVPAPI_INTERFACE dvpFreeBuffer(DVPBufferHandle gpuBufferHandle)
uint32_t flags
Definition: DVPAPI.h:194
DVPBufferFormats
Definition: DVPAPI.h:112
struct DVPSyncObjectDescRec DVPSyncObjectDesc
DVPAPI_INTERFACE dvpMemcpy2D(DVPBufferHandle srcBuffer, DVPSyncObjectHandle srcSync, uint32_t srcAcquireValue, uint64_t timeout, DVPBufferHandle dstBuffer, DVPSyncObjectHandle dstSync, uint32_t dstReleaseValue, uint32_t startY, uint32_t startX, uint32_t height, uint32_t width)
DVPStatus
Definition: DVPAPI.h:83
DVPAPI_INTERFACE dvpDestroyBuffer(DVPBufferHandle hBuf)
uint32_t * sem
Definition: DVPAPI.h:193
DVPAPI_INTERFACE dvpSyncObjClientWaitComplete(DVPSyncObjectHandle syncObject, uint64_t timeout)
PhidgetLCD_Font int * width
Definition: phidget22.h:4275
DVPBufferFormats format
Definition: DVPAPI.h:177
const char const char * value
Definition: phidget22.h:5111
DVPBufferTypes type
Definition: DVPAPI.h:178
DVPStatus(* externalClientWaitFunc)(DVPSyncObjectHandle sync, uint32_t value, bool GEQ, uint64_t timeout)
Definition: DVPAPI.h:195
Phidget_ChannelClass uint32_t * count
Definition: phidget22.h:1321
uint64_t DVPBufferHandle
Definition: DVPAPI.h:80
PhidgetLCD_Font int int * height
Definition: phidget22.h:4275
DVPAPI_INTERFACE dvpMapBufferWaitDVP(DVPBufferHandle gpuBufferHandle)
DVPAPI_INTERFACE dvpCreateBuffer(DVPSysmemBufferDesc *desc, DVPBufferHandle *hBuf)
DVPAPI_INTERFACE dvpGetLibrayVersion(uint32_t *major, uint32_t *minor)
DVPAPI_INTERFACE dvpSyncObjCompletion(DVPSyncObjectHandle syncObject, uint64_t *timeStamp)
DVPAPI_INTERFACE dvpEnd()