NVIDIA DriveOS Linux NSR SDK API Reference

7.0.3.0 Release
NvSciBuf Initialization APIs

Detailed Description

List of APIs to initialize/de-initialize NvSciBuf module.

Functions

NvSciError NvSciBufModuleOpen (NvSciBufModule *newModule)
 Initializes and returns a new NvSciBufModule with no NvSciBufAttrLists, buffers, or NvSciBufObjs bound to it. More...
 
void NvSciBufModuleClose (NvSciBufModule module)
 Releases the NvSciBufModule obtained through an earlier call to NvSciBufModuleOpen(). More...
 
NvSciError NvSciBufCheckVersionCompatibility (uint32_t majorVer, uint32_t minorVer, bool *isCompatible)
 Checks if loaded NvSciBuf library version is compatible with NvSciBuf library version with which elements dependent on NvSciBuf were built. More...
 
NvSciError NvSciBufObjValidate (NvSciBufObj bufObj)
 Validates the NvSciBufObj satisfies the constraints of the NvSciBufAttrList that it is associated with. More...
 
NvSciError NvSciBufAttrListValidateReconciledAgainstAttrs (const NvSciBufAttrList reconciledAttrList, const NvSciBufAttrKeyValuePair *pairArray, const size_t pairCount)
 Validate the reconciled NvSciBufAttrList against the set of all attributes that the user has set in the unreconciled NvSciBufAttrList(s). More...
 
NvSciError NvSciBufObjGetMaxPerm (const NvSciBufObj bufObj, const NvSciIpcEndpoint ipcEndpoint, NvSciBufAttrValAccessPerm *accPerm)
 Retrieve the NvSciBufAttrValAccessPerm of an NvSciBufObj for given NvSciIpcEndpoint. More...
 
NvSciError NvSciBufObjGetDmaBufFd (NvSciBufObj bufObj, int *fd)
 Generate a new dma-buf file descriptor corresponding to the provided NvSciBufObj. More...
 

Function Documentation

◆ NvSciBufAttrListValidateReconciledAgainstAttrs()

NvSciError NvSciBufAttrListValidateReconciledAgainstAttrs ( const NvSciBufAttrList  reconciledAttrList,
const NvSciBufAttrKeyValuePair pairArray,
const size_t  pairCount 
)

Validate the reconciled NvSciBufAttrList against the set of all attributes that the user has set in the unreconciled NvSciBufAttrList(s).

This API provides the safety mechanism to detect and report any reconciliation errors.

Parameters
[in]reconciledAttrListreconciled NvSciBufAttrList that need to be validated
[in]pairArrayArray of NvSciBufAttrKeyValuePair structures that the user has used to set in the unreconciled NvSciBufAttrList. Valid value: pairArray is valid input if it is not NULL and key member of every NvSciBufAttrKeyValuePair in the array is a valid enumeration value defined by the NvSciBufAttrKey enum and value member of every NvSciBufAttrKeyValuePair in the array is not NULL.
[in]pairCountNumber of elements/entries in pairArray. Valid value: pairCount is valid input if it is non-zero.
Returns
NvSciError, the completion code of the operation:
  • NvSciError_Success if successful.

◆ NvSciBufCheckVersionCompatibility()

NvSciError NvSciBufCheckVersionCompatibility ( uint32_t  majorVer,
uint32_t  minorVer,
bool *  isCompatible 
)

Checks if loaded NvSciBuf library version is compatible with NvSciBuf library version with which elements dependent on NvSciBuf were built.

This function checks loaded NvSciBuf library version with input NvSciBuf library version and sets output variable true provided major version of the loaded library is same as majorVer and minor version of the loaded library is not less than minorVer. Additionally, this function also checks the versions of libraries that NvSciBuf depends on and sets the output variable to true if all libraries are compatible, else sets output to false.

Parameters
[in]majorVerbuild major version. Valid value: majorVer is NvSciBufMajorVersion.
[in]minorVerbuild minor version. Valid value: [0 - <= NvSciBufMajorVersion].
[out]isCompatibleboolean value stating if loaded NvSciBuf library is compatible or not.
Returns
NvSciError, the completion code of the operation:
  • NvSciError_Success if successful.
  • failed to check dependent library versions.
    Usage considerations
  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes
    • Re-entrant: No
    • Async/Sync: Sync
  • Required privileges: None
  • API group
    • Init: Yes
    • Runtime: No
    • De-Init: No

◆ NvSciBufModuleClose()

void NvSciBufModuleClose ( NvSciBufModule  module)

Releases the NvSciBufModule obtained through an earlier call to NvSciBufModuleOpen().

Once the NvSciBufModule is closed and all NvSciBufAttrLists and NvSciBufObjs bound to it are freed, the NvSciBufModule will be de-initialized in the calling process.

Note
Every owner of the NvSciBufModule shall call NvSciBufModuleClose() only after all the functions invoked by the owner with NvSciBufModule as an input are completed.
Parameters
[in]moduleThe NvSciBufModule to close.
Returns
void
  • Panic if:
    • if Init Mode API is called in Runtime Mode.
    • module is invalid
Precondition
@id{NvSciBufModuleClose_PreCond_001} @asil{QM} Valid NvSciBufModule is obtained.


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes, with the following conditions:
      • Provided there is no active operation involving the input NvSciBufModule module
    • Re-entrant: No
    • Async/Sync: Sync
  • Required privileges: None
  • API group
    • Init: Yes
    • Runtime: No
    • De-Init: No

◆ NvSciBufModuleOpen()

NvSciError NvSciBufModuleOpen ( NvSciBufModule newModule)

Initializes and returns a new NvSciBufModule with no NvSciBufAttrLists, buffers, or NvSciBufObjs bound to it.

Note
A process may call this function multiple times. Each successful invocation will yield a new NvSciBufModule.
Parameters
[out]newModuleThe new NvSciBufModule.
Returns
NvSciError, the completion code of this operation:
  • NvSciError_Success if successful.

◆ NvSciBufObjGetDmaBufFd()

NvSciError NvSciBufObjGetDmaBufFd ( NvSciBufObj  bufObj,
int *  fd 
)

Generate a new dma-buf file descriptor corresponding to the provided NvSciBufObj.

This API is specific to Linux OS.

Parameters
[in]bufObjNvSciBufObj from which new file descriptor is generated
[out]fddma-buf File Descriptor corresponding to the underlying memory of the NvSciBufObj. The caller owns this returned file descriptor and is responsible for closing the file descriptor. Valid Value: non NULL Pointer.
Returns
NvSciError, the completion code of the operation:
  • NvSciError_Success if successful.
  • NvSciError_BadParameter if any of the following occurs:
    • bufObj is NULL
    • fd is NULL.
    • fd is NULL.
    • bufObj did not request for CPU access by setting NvSciBufGeneralAttrKey_NeedCpuAccess to true
Precondition
@id{NvSciBufObjGetDmaBufFd_PreCond_001} @asil{B} Valid NvSciBufObj is obtained. @arr @id{NvSciBufObjGetDmaBufFd_RES_001} @asil{D} The returned file descriptor shall not be shared with another process @arr @id{NvSciBufObjGetDmaBufFd_RES_002} @asil{D} The returned file descriptor shall not be duplicated


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes
    • Re-entrant: No
    • Async/Sync: Sync
  • Required privileges: None
  • API group
    • Init: Yes
    • Runtime: No
    • De-Init: No

◆ NvSciBufObjGetMaxPerm()

NvSciError NvSciBufObjGetMaxPerm ( const NvSciBufObj  bufObj,
const NvSciIpcEndpoint  ipcEndpoint,
NvSciBufAttrValAccessPerm accPerm 
)

Retrieve the NvSciBufAttrValAccessPerm of an NvSciBufObj for given NvSciIpcEndpoint.

Application can use this API to ensure that when an NvSciBufObj is exported with NvSciBufAccessPerm_Auto, the NvSciBufObj will be exported with appropriate NvSciBufAttrValAccessPerm expected by the application.

Parameters
[in]bufObjobject for which access permissions need to be retrieved.
[in]ipcEndpointNvSciIpcEndpoint of the peer for which the permissions need to retrieved. Valid value: valid NvSciIpcEndpoint returned by NvSciIpc to identify the peer.
[out]accPermaddress at which the retrieved access permissions need to be stored. Valid Value: non NULL Pointer.
Returns
NvSciError, the completion code of the operation:
  • NvSciError_Success if successful.

◆ NvSciBufObjValidate()

NvSciError NvSciBufObjValidate ( NvSciBufObj  bufObj)

Validates the NvSciBufObj satisfies the constraints of the NvSciBufAttrList that it is associated with.

Parameters
[in]bufObjUnused
Returns
NvSciError, the completion code of this operation:
  • NvSciError_Success
Note
This is a no-op.
Usage considerations
  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes
    • Re-entrant: No
    • Async/Sync: Sync
  • Required privileges: None
  • API group
    • Init: Yes
    • Runtime: No
    • De-Init: No