NVIDIA DRIVE OS Linux SDK API Reference

5.2.3 Release
For Test and Development only
Image Locking and Unlocking

Detailed Description

Locking and unlocking controls access to the image surfaces.

Warning
These functions are for diagnostics purposes only. They are not for use in production code.

Data Structures

struct  NvMediaImageSurface
 Holds an image surface descriptor used by NvMediaImageLock(). More...
 
struct  NvMediaImageSurfaceMap
 Holds an image surface map descriptor used by NvMediaImageLock(). More...
 
struct  NvMediaTensorSurfaceMap
 Defines the tensor surface map descriptor used by NvMediaTensorLock(). More...
 

Enumerations

enum  NvMediaImageLockAccess {
  NVMEDIA_IMAGE_ACCESS_READ = (1u << 0),
  NVMEDIA_IMAGE_ACCESS_WRITE = (1u << 1),
  NVMEDIA_IMAGE_ACCESS_READ_WRITE = (NVMEDIA_IMAGE_ACCESS_READ | NVMEDIA_IMAGE_ACCESS_WRITE)
}
 Specifies image lock access types. More...
 
enum  NvMediaArrayLockAccess {
  NVMEDIA_ARRAY_ACCESS_READ = 1,
  NVMEDIA_ARRAY_ACCESS_WRITE = 2,
  NVMEDIA_ARRAY_ACCESS_READ_WRITE = 3
}
 Defines array-lock access types. More...
 
enum  NvMediaTensorLockAccess {
  NVMEDIA_TENSOR_ACCESS_READ = (1 << 0),
  NVMEDIA_TENSOR_ACCESS_WRITE = (1 << 1),
  NVMEDIA_TENSOR_ACCESS_READ_WRITE = (NVMEDIA_TENSOR_ACCESS_READ | NVMEDIA_TENSOR_ACCESS_WRITE)
}
 Defines tensor lock access types. More...
 

Functions

NvMediaStatus NvMediaImageLock (const NvMediaImage *image, NvMediaImageLockAccess lockAccessType, NvMediaImageSurfaceMap *surfaceMap)
 Locks an image and returns the associated mapped pointers to the image surface data. More...
 
void NvMediaImageUnlock (const NvMediaImage *image)
 Unlocks an image. More...
 
NvMediaStatus NvMediaArrayLock (NvMediaArray *handle, NvMediaArrayLockAccess lockAccessType, void **ptr)
 Locks an array. More...
 
void NvMediaArrayUnlock (NvMediaArray *handle)
 Unlocks an array. More...
 
NvMediaStatus NvMediaImagePyramidLock (const NvMediaImagePyramid *pyramid, uint32_t lockAccessType, NvMediaImageSurfaceMap *surfaceMap)
 Locks an image pyramid and returns the associated mapped pointers to the image pyramid surface data. More...
 
void NvMediaImagePyramidUnlock (const NvMediaImagePyramid *pyramid)
 Unlocks an image pyramid. More...
 
NvMediaStatus NvMediaTensorLock (NvMediaTensor *tensor, NvMediaTensorLockAccess lockAccessType, NvMediaTensorSurfaceMap *surfaceMap)
 Locks a tensor and returns the associated mapped pointers pointing to the tensor surface data. More...
 
void NvMediaTensorUnlock (NvMediaTensor *tensor)
 Unlocks a tensor. More...
 

Enumeration Type Documentation

◆ NvMediaArrayLockAccess

Defines array-lock access types.

Enumerator
NVMEDIA_ARRAY_ACCESS_READ 

Specifies read access.

NVMEDIA_ARRAY_ACCESS_WRITE 

Specifies write access.

NVMEDIA_ARRAY_ACCESS_READ_WRITE 

Specifies read/write access.

Definition at line 119 of file nvmedia_array.h.

◆ NvMediaImageLockAccess

Specifies image lock access types.

Enumerator
NVMEDIA_IMAGE_ACCESS_READ 

Specifies read access.

NVMEDIA_IMAGE_ACCESS_WRITE 

Specifies write access.

NVMEDIA_IMAGE_ACCESS_READ_WRITE 

Specifies read/write access.

Definition at line 371 of file nvmedia_image.h.

◆ NvMediaTensorLockAccess

Defines tensor lock access types.

Enumerator
NVMEDIA_TENSOR_ACCESS_READ 

Read access.

NVMEDIA_TENSOR_ACCESS_WRITE 

Write access.

NVMEDIA_TENSOR_ACCESS_READ_WRITE 

Read/Write access.

Definition at line 255 of file nvmedia_tensor.h.

Function Documentation

◆ NvMediaArrayLock()

NvMediaStatus NvMediaArrayLock ( NvMediaArray handle,
NvMediaArrayLockAccess  lockAccessType,
void **  ptr 
)

Locks an array.

A client can read or write a locked array without interference from another thread or process.

If the array is being used by an internal engine, this function waits until the operation is completed.

Parameters
[in]handleHandle to the array to be locked.
[in]lockAccessTypeSpecifies the access type. The following access types are supported, and may be OR'd together:
[out]ptrA CPU mapped pointer which may be used to read or write data.
Returns
A status code; NVMEDIA_STATUS_OK if the call is successful, or NVMEDIA_STATUS_ERROR otherwise.

◆ NvMediaArrayUnlock()

void NvMediaArrayUnlock ( NvMediaArray handle)

Unlocks an array.

Call this function when the client has finished writing to or reading from the array.

Parameters
[in]handleHandle to the array to be unlocked.

◆ NvMediaImageLock()

NvMediaStatus NvMediaImageLock ( const NvMediaImage image,
NvMediaImageLockAccess  lockAccessType,
NvMediaImageSurfaceMap surfaceMap 
)

Locks an image and returns the associated mapped pointers to the image surface data.

Only images created without the NVM_SURF_ATTR_CPU_ACCESS_UNMAPPED attribute can be accessed by the CPU. If an image is being used by an internal engine, this function waits until the operation is completed.

Parameters
[in]imageA pointer to the image object.
[in]lockAccessTypeDetermines the access type. The following access types are supported, and may be OR'd together:
[out]surfaceMapA pointer to surface descriptors.
Returns
A status code; NVMEDIA_STATUS_OK if the call was successful, NVMEDIA_STATUS_BAD_PARAMETER if the arguments to the function are invalid, or NVMEDIA_STATUS_ERROR otherwise.

◆ NvMediaImagePyramidLock()

NvMediaStatus NvMediaImagePyramidLock ( const NvMediaImagePyramid pyramid,
uint32_t  lockAccessType,
NvMediaImageSurfaceMap surfaceMap 
)

Locks an image pyramid and returns the associated mapped pointers to the image pyramid surface data.

The CPU can only access images created without the NVM_SURF_ATTR_CPU_ACCESS_UNMAPPED attribute. If an image is being used by an internal engine. this function waits until the operation is completed.

Parameters
[in]pyramidA handle to the image pyramid object
[in]lockAccessTypeDetermines the access type. The following access types are supported, and may be OR'd together:
[out]surfaceMapPointer to an array of surface descriptors per level.
Returns
A status code; NVMEDIA_STATUS_OK if the call was successful, or NVMEDIA_STATUS_ERROR otherwise.

◆ NvMediaImagePyramidUnlock()

void NvMediaImagePyramidUnlock ( const NvMediaImagePyramid pyramid)

Unlocks an image pyramid.

Internal engines cannot use a surface until it is locked.

Parameters
[in]pyramidA handle to the pyramid object to be unlocked.

◆ NvMediaImageUnlock()

void NvMediaImageUnlock ( const NvMediaImage image)

Unlocks an image.

Internal engines cannot use a surface until it is locked.

Parameters
[in]imageA pointer to the image object to be unlocked.

◆ NvMediaTensorLock()

NvMediaStatus NvMediaTensorLock ( NvMediaTensor tensor,
NvMediaTensorLockAccess  lockAccessType,
NvMediaTensorSurfaceMap surfaceMap 
)

Locks a tensor and returns the associated mapped pointers pointing to the tensor surface data.

The CPU can only access tensors created with the NVM_TENSOR_ATTR_CPU_ACCESS_UNCACHED or NVM_TENSOR_ATTR_CPU_ACCESS_CACHED attributes.

If a tensor is currently in use by an internal engine, this function waits until the operation completes.

Parameters
[in]tensorA pointer to the tensor object.
[in]lockAccessTypeSpecifies the NvMediaTensorLockAccess type.
[out]surfaceMapA pointer to the surface descriptors.
Returns
NvMediaStatus The completion status of the operation:
Return values
NVMEDIA_STATUS_OKif the function is successful.
NVMEDIA_STATUS_BAD_PARAMETERif any of the arguments are NULL or invalid.
NVMEDIA_STATUS_TIMED_OUTif the syncpoint wait timed out
NVMEDIA_STATUS_ERRORif an error occurred.

◆ NvMediaTensorUnlock()

void NvMediaTensorUnlock ( NvMediaTensor tensor)

Unlocks a tensor.

Releases the lock applied on NvMediaTensor using NvMediaTensorLock.

Parameters
[in]tensorThe tensor object to unlock.