NVIDIA DRIVE OS Linux SDK API Reference

5.1.12.0 Release

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
nvscisync.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
3  *
4  * NVIDIA Corporation and its licensors retain all intellectual property
5  * and proprietary rights in and to this software, related documentation
6  * and any modifications thereto. Any use, reproduction, disclosure or
7  * distribution of this software and related documentation without an express
8  * license agreement from NVIDIA Corporation is strictly prohibited.
9  */
18 #ifndef INCLUDED_NVSCISYNC_H
19 #define INCLUDED_NVSCISYNC_H
20 
80 #if !defined (__cplusplus)
81 #include <stddef.h>
82 #include <stdbool.h>
83 #include <stdint.h>
84 #endif
85 
86 #include <nvscierror.h>
87 #include <nvsciipc.h>
88 
89 #if defined (__cplusplus)
90 extern "C"
91 {
92 #endif
93 
97 static const uint32_t NvSciSyncMajorVersion = 1U;
98 static const uint32_t NvSciSyncMinorVersion = 1U;
99 
111 typedef struct NvSciSyncModuleRec* NvSciSyncModule;
112 
123 typedef struct NvSciSyncCpuWaitContextRec* NvSciSyncCpuWaitContext;
124 
140 typedef struct {
141  uint64_t payload[6];
143 
149 
154 typedef struct {
155  uint64_t payload[7];
157 
162 typedef struct {
163  uint64_t payload[128];
165 
173 typedef struct NvSciSyncObjRec* NvSciSyncObj;
174 
182 typedef struct NvSciSyncAttrListRec* NvSciSyncAttrList;
183 
187 typedef enum {
211 
215 typedef enum {
245 
249 typedef struct {
256  const void* value;
258  size_t len;
260 
276  NvSciSyncModule* newModule);
277 
291  NvSciSyncModule module);
292 
309  NvSciSyncModule module,
310  NvSciSyncCpuWaitContext* newContext);
311 
320  NvSciSyncCpuWaitContext context);
321 
336  NvSciSyncModule module,
337  NvSciSyncAttrList* attrList);
338 
346  NvSciSyncAttrList attrList);
347 
359  NvSciSyncAttrList attrList,
360  bool* isReconciled);
361 
386  NvSciSyncAttrList reconciledAttrList,
387  const NvSciSyncAttrList inputUnreconciledAttrListArray[],
388  size_t inputUnreconciledAttrListCount,
389  bool* isReconciledListValid);
390 
412  NvSciSyncAttrList attrList,
413  const NvSciSyncAttrKeyValuePair* pairArray,
414  size_t pairCount);
415 
433  NvSciSyncAttrList attrList,
434  NvSciSyncAttrKeyValuePair* pairArray,
435  size_t pairCount);
436 
451  NvSciSyncAttrList attrList);
452 
477  const NvSciSyncAttrList inputUnreconciledAttrListArray[],
478  size_t inputUnreconciledAttrListCount,
479  NvSciSyncAttrList* newUnreconciledAttrList);
480 
498  NvSciSyncAttrList origAttrList,
499  NvSciSyncAttrList* newAttrList);
500 
530  NvSciSyncAttrList attrList,
531  size_t slotIndex,
532  NvSciSyncAttrKeyValuePair* pairArray,
533  size_t pairCount);
534 
568  const NvSciSyncAttrList inputArray[],
569  size_t inputCount,
570  NvSciSyncAttrList* newReconciledList,
571  NvSciSyncAttrList* newConflictList);
572 
586  NvSciSyncAttrList attrList,
587  void** buf,
588  size_t* len);
589 
616  const NvSciSyncAttrList unreconciledAttrListArray[],
617  size_t unreconciledAttrListCount,
618  NvSciIpcEndpoint ipcEndpoint,
619  void** descBuf,
620  size_t* descLen);
621 
639  const NvSciSyncAttrList reconciledAttrList,
640  NvSciIpcEndpoint ipcEndpoint,
641  void** descBuf,
642  size_t* descLen);
643 
664  NvSciSyncModule module,
665  NvSciIpcEndpoint ipcEndpoint,
666  const void* descBuf,
667  size_t descLen,
668  NvSciSyncAttrList* importedUnreconciledAttrList);
669 
716  NvSciSyncModule module,
717  NvSciIpcEndpoint ipcEndpoint,
718  const void* descBuf,
719  size_t descLen,
720  const NvSciSyncAttrList inputUnreconciledAttrListArray[],
721  size_t inputUnreconciledAttrListCount,
722  NvSciSyncAttrList* importedReconciledAttrList);
723 
732  void* descBuf);
733 
744  NvSciSyncFence* syncFence);
745 
759  const NvSciSyncFence* srcSyncFence,
760  NvSciSyncFence* dstSyncFence);
761 
781  NvSciSyncAttrList reconciledList,
782  NvSciSyncObj* syncObj);
783 
794  NvSciSyncObj syncObj,
795  NvSciSyncObj* dupObj);
796 
814  NvSciSyncObj syncObj,
815  NvSciSyncAttrList* syncAttrList);
816 
824 void NvSciSyncObjFree(
825  NvSciSyncObj syncObj);
826 
851  NvSciSyncObj syncObj,
852  NvSciSyncAccessPerm permissions,
853  NvSciIpcEndpoint ipcEndpoint,
855 
895  NvSciIpcEndpoint ipcEndpoint,
897  NvSciSyncAttrList inputAttrList,
898  NvSciSyncAccessPerm permissions,
899  int64_t timeoutUs,
900  NvSciSyncObj* syncObj);
901 
920  const NvSciSyncFence* syncFence,
921  NvSciIpcEndpoint ipcEndpoint,
923 
938  NvSciSyncObj syncObj,
940  NvSciSyncFence* syncFence);
941 
956  NvSciSyncObj syncObj,
957  NvSciSyncFence* syncFence);
958 
972  NvSciSyncObj syncObj);
973 
998  const NvSciSyncFence* syncFence,
999  NvSciSyncCpuWaitContext context,
1000  int64_t timeoutUs);
1001 
1014  const NvSciSyncFence* syncFence,
1015  uint64_t* timestampUS);
1016 
1036  NvSciSyncAttrList attrList,
1037  NvSciSyncAttrKey key,
1038  const void** value,
1039  size_t* len);
1040 
1064  const NvSciSyncAttrList inputArray[],
1065  size_t inputCount,
1066  NvSciSyncObj* syncObj,
1067  NvSciSyncAttrList* newConflictList);
1068 
1094  NvSciSyncObj syncObj,
1095  NvSciSyncAccessPerm permissions,
1096  NvSciIpcEndpoint ipcEndpoint,
1097  void** attrListAndObjDesc,
1098  size_t* attrListAndObjDescSize);
1099 
1109  void* attrListAndObjDescBuf);
1110 
1149  NvSciSyncModule module,
1150  NvSciIpcEndpoint ipcEndpoint,
1151  const void* attrListAndObjDesc,
1152  size_t attrListAndObjDescSize,
1153  NvSciSyncAttrList const attrList[],
1154  size_t attrListCount,
1155  NvSciSyncAccessPerm minPermissions,
1156  int64_t timeoutUs,
1157  NvSciSyncObj* syncObj);
1158 
1177  uint32_t majorVer,
1178  uint32_t minorVer,
1179  bool* isCompatible);
1180 
1181 #if defined(__cplusplus)
1182 }
1183 #endif // __cplusplus
1184 
1185 #endif // INCLUDED_NVSCISYNC_H
struct NvSciSyncCpuWaitContextRec * NvSciSyncCpuWaitContext
Represents the right to perform a CPU wait on an NvSciSyncFence.
Definition: nvscisync.h:123
Defines the exported form of NvSciSyncFence shared across an NvSciIpc channel.
Definition: nvscisync.h:154
NvSciError NvSciSyncAttrListIpcExportReconciled(const NvSciSyncAttrList reconciledAttrList, NvSciIpcEndpoint ipcEndpoint, void **descBuf, size_t *descLen)
Translates the reconciled attribute list to an exported attribute list descriptor that can potentiall...
void NvSciSyncFenceClear(NvSciSyncFence *syncFence)
Frees any resources allocated for the specified fence.
void NvSciSyncAttrListAndObjFreeDesc(void *attrListAndObjDescBuf)
Frees an exported attribute-list-and-sync-object descriptor returned by NvSciSyncIpcExportAttrListAnd...
Describes the NvSciSyncAttrKey-Value pair.
Definition: nvscisync.h:249
NvSciError NvSciSyncAttrListAppendUnreconciled(const NvSciSyncAttrList inputUnreconciledAttrListArray[], size_t inputUnreconciledAttrListCount, NvSciSyncAttrList *newUnreconciledAttrList)
Appends multiple unreconciled attribute lists together, forming a single new unreconciled attribute l...
static const uint32_t NvSciSyncMajorVersion
NvSciSync version.
Definition: nvscisync.h:97
NvSciError NvSciSyncObjIpcImport(NvSciIpcEndpoint ipcEndpoint, const NvSciSyncObjIpcExportDescriptor *desc, NvSciSyncAttrList inputAttrList, NvSciSyncAccessPerm permissions, int64_t timeoutUs, NvSciSyncObj *syncObj)
Creates an NvSciSync object based on supplied binary descriptor and returns the sync object...
NvSciError NvSciSyncObjGenerateFence(NvSciSyncObj syncObj, NvSciSyncFence *syncFence)
Generates next point on sync timeline of an NvSciSync object and fills in the supplied NvSciSyncFence...
void NvSciSyncCpuWaitContextFree(NvSciSyncCpuWaitContext context)
Releases a CPU wait context.
NVIDIA Software Communications Interface (SCI): Error Handling
NvSciError NvSciSyncIpcImportAttrListAndObj(NvSciSyncModule module, NvSciIpcEndpoint ipcEndpoint, const void *attrListAndObjDesc, size_t attrListAndObjDescSize, NvSciSyncAttrList const attrList[], size_t attrListCount, NvSciSyncAccessPerm minPermissions, int64_t timeoutUs, NvSciSyncObj *syncObj)
Creates an NvSciSync object based on the supplied binary descriptor and returns the sync object...
NvSciError NvSciSyncAttrListIpcImportReconciled(NvSciSyncModule module, NvSciIpcEndpoint ipcEndpoint, const void *descBuf, size_t descLen, const NvSciSyncAttrList inputUnreconciledAttrListArray[], size_t inputUnreconciledAttrListCount, NvSciSyncAttrList *importedReconciledAttrList)
Translates an exported attribute list descriptor (potentially received from any process) into an attr...
uint64_t NvSciIpcEndpoint
Handle to the IPC endpoint.
Definition: nvsciipc.h:62
NvSciError NvSciSyncObjIpcExport(NvSciSyncObj syncObj, NvSciSyncAccessPerm permissions, NvSciIpcEndpoint ipcEndpoint, NvSciSyncObjIpcExportDescriptor *desc)
Exports a NvSciSync object into an NvSciIpc-transferable object binary descriptor.
This represents the capability to advance an NvSciSync object to its next point on its sync timeline ...
Definition: nvscisync.h:203
(bool) Importing and then exporting an NvSciSyncFenceIpcExportDescriptor has no side effects and yiel...
Definition: nvscisync.h:239
void NvSciSyncAttrListFreeDesc(void *descBuf)
Frees an exported attribute list descriptor previously returned by NvSciSyncAttrListExport().
This represents the capability to advance an NvSciSync object to its next point on its sync timeline...
Definition: nvscisync.h:197
void NvSciSyncObjFree(NvSciSyncObj syncObj)
Destroys the NvSciSync object and all memory that was allocated for it.
struct NvSciSyncAttrListRec * NvSciSyncAttrList
Holds a pointer to an opaque NvSciSync attribute list.
Definition: nvscisync.h:182
NvSciError NvSciSyncIpcExportFence(const NvSciSyncFence *syncFence, NvSciIpcEndpoint ipcEndpoint, NvSciSyncFenceIpcExportDescriptor *desc)
Exports a NvSciSyncFence into a binary descriptor shareable across the NvSciIpc channel.
NvSciError NvSciSyncAttrListIpcExportUnreconciled(const NvSciSyncAttrList unreconciledAttrListArray[], size_t unreconciledAttrListCount, NvSciIpcEndpoint ipcEndpoint, void **descBuf, size_t *descLen)
Translates the unreconciled attribute list(s) to an exported attribute list descriptor that can poten...
NvSciSyncAttrKey attrKey
Specifies the attribute key to set.
Definition: nvscisync.h:251
NvSciError NvSciSyncFenceGetTimestamp(const NvSciSyncFence *syncFence, uint64_t *timestampUS)
Read the timestamp associated with the fence.
static const uint32_t NvSciSyncMinorVersion
Definition: nvscisync.h:98
Usage of Auto permissions is restricted only for export/ import APIs and shouldn’t be used as val...
Definition: nvscisync.h:209
NvSciError NvSciSyncAttrListSetAttrs(NvSciSyncAttrList attrList, const NvSciSyncAttrKeyValuePair *pairArray, size_t pairCount)
Sets the value of an attribute in an unreconciled attribute list that has not already been set...
NvSciError NvSciSyncObjDup(NvSciSyncObj syncObj, NvSciSyncObj *dupObj)
Duplicates a valid NvSciSyncObj.
NvSciError NvSciSyncAttrListGetAttrs(NvSciSyncAttrList attrList, NvSciSyncAttrKeyValuePair *pairArray, size_t pairCount)
Gets the value of attributes from an attribute list.
NvSciError NvSciSyncCpuWaitContextAlloc(NvSciSyncModule module, NvSciSyncCpuWaitContext *newContext)
Allocates a CPU wait context that can be used to perform a CPU wait with NvSciSyncFenceWait().
NvSciSyncAttrKey
Describes the types of NvSciSyncAttr keys.
Definition: nvscisync.h:215
NVIDIA Software Communications Interface (SCI) : NvSci Inter-Process Communication ...
NvSciError NvSciSyncObjAlloc(NvSciSyncAttrList reconciledList, NvSciSyncObj *syncObj)
Allocates a sync object that meets all the constraints in the specified reconciled attribute list...
NvSciError NvSciSyncCheckVersionCompatibility(uint32_t majorVer, uint32_t minorVer, bool *isCompatible)
API to check if loaded library version is compatible with passed library build version.
size_t len
Specifies the buffer length, or 0 if there is no value assigned to attrKey.
Definition: nvscisync.h:258
void NvSciSyncModuleClose(NvSciSyncModule module)
Releases an instance of the NvSciSync module that was obtained through an earlier call to NvSciSyncMo...
NvSciError NvSciSyncModuleOpen(NvSciSyncModule *newModule)
Initializes an instance of the NvSciSync module within the calling process and provides an NvSciSyncM...
const void * value
Specifies the pointer to the attribute value, or NULL if there is no value assigned to attrKey...
Definition: nvscisync.h:256
NvSciSyncAccessPerm
Describes sync object access permissions.
Definition: nvscisync.h:187
NvSciError NvSciSyncAttrListIsReconciled(NvSciSyncAttrList attrList, bool *isReconciled)
Returns whether the attribute list is reconciled or unreconciled.
NvSciError NvSciSyncAttrListIpcImportUnreconciled(NvSciSyncModule module, NvSciIpcEndpoint ipcEndpoint, const void *descBuf, size_t descLen, NvSciSyncAttrList *importedUnreconciledAttrList)
Translates an exported attribute list descriptor (potentially received from any process) into an attr...
(bool) Specifies if timestamps are required.
Definition: nvscisync.h:241
enum NvSciErrorRec NvSciError
Return/error codes for all NvSci functions.
(NvSciSyncAccessPerm) Actual permission granted after reconciliation.
Definition: nvscisync.h:232
Specifies the upper bound - for NvSciSync internal use only.
Definition: nvscisync.h:243
NvSciError NvSciSyncAttrListDebugDump(NvSciSyncAttrList attrList, void **buf, size_t *len)
Dumps the attribute list into a binary blob.
NvSciError NvSciSyncAttrListSlotGetAttrs(NvSciSyncAttrList attrList, size_t slotIndex, NvSciSyncAttrKeyValuePair *pairArray, size_t pairCount)
Gets the value of attributes from an attribute list at given index in a multi-slot unreconciled attri...
(NvSciSyncAccessPerm) Specifies the required access permissions.
Definition: nvscisync.h:227
This represents the capability to monitor an NvSciSync object as it progresses through points on its ...
Definition: nvscisync.h:192
NvSciError NvSciSyncAttrListReconcileAndObjAlloc(const NvSciSyncAttrList inputArray[], size_t inputCount, NvSciSyncObj *syncObj, NvSciSyncAttrList *newConflictList)
Reconcile the input unreconciled attribute list(s) into a new reconciled attribute list and allocate ...
NvSciError NvSciSyncAttrListReconcile(const NvSciSyncAttrList inputArray[], size_t inputCount, NvSciSyncAttrList *newReconciledList, NvSciSyncAttrList *newConflictList)
Reconciles the input unreconciled attribute list(s) into a new reconciled attribute list...
NvSciError NvSciSyncAttrListGetAttr(NvSciSyncAttrList attrList, NvSciSyncAttrKey key, const void **value, size_t *len)
NvSciSync Utility functions.
size_t NvSciSyncAttrListGetSlotCount(NvSciSyncAttrList attrList)
Gets the total number of slots contained in a NvSciSyncAttrList.
static const NvSciSyncFence NvSciSyncFenceInitializer
Defines the value used to zero-initialize the NvSciSyncFence object.
Definition: nvscisync.h:148
NvSciError NvSciSyncObjSignal(NvSciSyncObj syncObj)
Signal the NvSciSync object.
struct NvSciSyncObjRec * NvSciSyncObj
Holds a pointer to an opaque NvSciSync object.
Definition: nvscisync.h:173
NvSciError NvSciSyncFenceWait(const NvSciSyncFence *syncFence, NvSciSyncCpuWaitContext context, int64_t timeoutUs)
Performs a synchronous wait on the NvSciSyncFence object until the fence has been signaled or the tim...
(bool) Specifies if CPU access is required.
Definition: nvscisync.h:219
NvSciError NvSciSyncAttrListCreate(NvSciSyncModule module, NvSciSyncAttrList *attrList)
Creates an attribute list holding the attributes of the NvSciSyncObj to be allocated.
Defines the exported form of NvSciSyncObj shared across an NvSciIpc channel.
Definition: nvscisync.h:162
Defines the opaque NvSciSyncFence.
Definition: nvscisync.h:140
struct NvSciSyncModuleRec * NvSciSyncModule
Represents an instance of the NvSciSync module.
Definition: nvscisync.h:111
NvSciError NvSciSyncIpcExportAttrListAndObj(NvSciSyncObj syncObj, NvSciSyncAccessPerm permissions, NvSciIpcEndpoint ipcEndpoint, void **attrListAndObjDesc, size_t *attrListAndObjDescSize)
Exports an NvSciSync attribute list and object into an NvSciIpc-transferable object binary blob point...
NvSciError NvSciSyncAttrListClone(NvSciSyncAttrList origAttrList, NvSciSyncAttrList *newAttrList)
Clones an unreconciled/reconciled attribute list.
void NvSciSyncAttrListFree(NvSciSyncAttrList attrList)
Frees the memory of an attribute list.
NvSciError NvSciSyncFenceDup(const NvSciSyncFence *srcSyncFence, NvSciSyncFence *dstSyncFence)
Duplicates srcSyncFence into dstSyncFence, such that any wait on destSyncFence will complete at the s...
NvSciError NvSciSyncObjGetAttrList(NvSciSyncObj syncObj, NvSciSyncAttrList *syncAttrList)
Retrieves the attribute list from an allocated NvSciSync Object.
NvSciError NvSciSyncIpcImportFence(NvSciSyncObj syncObj, const NvSciSyncFenceIpcExportDescriptor *desc, NvSciSyncFence *syncFence)
Fills in the NvSciSyncFence object based on supplied binary descriptor.
Specifies the lower bound - for NvSciSync internal use only.
Definition: nvscisync.h:217
NvSciError NvSciSyncAttrListValidateReconciled(NvSciSyncAttrList reconciledAttrList, const NvSciSyncAttrList inputUnreconciledAttrListArray[], size_t inputUnreconciledAttrListCount, bool *isReconciledListValid)
Validates a reconciled attribute list against a set of input unreconciled attribute lists...