VPI - Vision Programming Interface

1.0 Release

NvBuffer Interoperability

Declaration of functions for NvBuffer interoperability. More...

Data Structures

struct  VPIWrapNvBufferParams
 Parameters for customizing NvBuffer wrapping. More...
 
VPIStatus vpiImageCreateNvBufferWrapper (int32_t dmabuf_fd, const VPIWrapNvBufferParams *params, uint32_t flags, VPIImage *img)
 Create an image object by wrapping an existing NvBuffer given its dmabuf_fd handle. More...
 
VPIStatus vpiImageSetWrappedNvBuffer (VPIImage img, int dmabuf_fd)
 Redefines the wrapped NvBuffer memory in an existing VPIImage wrapper. More...
 

Detailed Description

Declaration of functions for NvBuffer interoperability.

The provided methods allows wrapping user-created NvBuffer objects (also known as dmabuf_fd) to be used in VPI compute pipelines. NvBuffers are sometimes used to interface with Jetson Linux Multimedia API.


Data Structure Documentation

◆ VPIWrapNvBufferParams

struct VPIWrapNvBufferParams

Parameters for customizing NvBuffer wrapping.

These parameters are used to customize how NvBuffer wrapping will be made. Make sure to call vpiInitWrapNvBufferParams to initialize this structure before updating its attributes. This guarantees that new attributes added in future versions will have a suitable default value assigned.

Definition at line 81 of file NvBufferInterop.h.

+ Collaboration diagram for VPIWrapNvBufferParams:
Data Fields
VPIColorSpec colorSpec Overriden VPIColorSpec of the wrapped Nvbuffer.

It it's a valid color spec, override the color spec information in the wrapped NvBuffer. If VPI_COLOR_SPEC_DEFAULT, infer the color spec from the wrapped NvBuffer.

Function Documentation

◆ vpiImageCreateNvBufferWrapper()

VPIStatus vpiImageCreateNvBufferWrapper ( int32_t  dmabuf_fd,
const VPIWrapNvBufferParams params,
uint32_t  flags,
VPIImage img 
)

#include <vpi/NvBufferInterop.h>

Create an image object by wrapping an existing NvBuffer given its dmabuf_fd handle.

The underlying image object does not own/claim the memory block.

Parameters
[in]dmabuf_fdHandle to the NvBuffer to be wrapped.
[in]paramsIf not NULL, use the parameters to modify how the NvBuffer is wrapped. Otherwise, it'll use default NvBuffer handling.
[in]flagsImage flags. Here it can be specified in what backends the image can be used by or-ing together VPIBackend flags. Set flags to 0 to enable it in all backends supported by the active VPI context.
[out]imgPointer to memory that will receive the created image handle.
Returns
an error code on failure else VPI_SUCCESS

◆ vpiImageSetWrappedNvBuffer()

VPIStatus vpiImageSetWrappedNvBuffer ( VPIImage  img,
int  dmabuf_fd 
)

#include <vpi/NvBufferInterop.h>

Redefines the wrapped NvBuffer memory in an existing VPIImage wrapper.

The old wrapped NvBuffer and the new one must have same dimensions and format.

The VPIImage must have been created by vpiImageCreateNvBufferWrapper.

This operation is efficient and does not allocate memory. The wrapped NvBuffer will be accessible to the same backends specified during wrapper creation.

The wrapped NvBuffer must not be deallocated while it's still being wrapped.

Parameters
[in]imgHandle to image created by vpiImageCreateNvBufferWrapper.
[in]dmabuf_fdThe new NvBuffer to be wrapped.
Returns
an error code on failure else VPI_SUCCESS