![]() |
Jetson Linux Multimedia API Reference32.4.3 Release |
NVIDIA buffering utility library for use by applications.
The utility also transforms, composits, and blends.
Data Structures | |
struct | _NvBufferSyncObjParams |
Holds parameters for buffer sync point object. More... | |
struct | _NvBufferSyncObjRec |
buffer sync point object. More... | |
struct | NvBufferCompositeBackground |
Holds composition background r,g,b colors. More... | |
struct | NvBufferRect |
Holds coordinates for a rectangle. More... | |
struct | _NvBufferChromaSubSamplingParams |
Holds Chroma Subsampling parameters. More... | |
struct | _NvBufferCreateParams |
Holds the input parameters for hardware buffer creation. More... | |
struct | _NvBufferParams |
Holds parameters for a hardware buffer. More... | |
struct | _NvBufferParamsEx |
Holds extended parameters for a hardware buffer. More... | |
struct | _NvBufferCompositeParams |
Holds parameters related to compositing/blending. More... | |
struct | _NvBufferTransformParams |
Holds parameters for buffer transform functions. More... | |
Macros | |
#define | MAX_NUM_PLANES 4 |
Defines the maximum number of planes for a video frame. More... | |
#define | MAX_COMPOSITE_FRAME 16 |
Defines the maximum number of input video frames that can be used for composition. More... | |
#define | NVBUF_CHROMA_SUBSAMPLING_HORIZ_DEFAULT 0 |
Defines the default values for chroma subsampling. More... | |
#define | NVBUF_CHROMA_SUBSAMPLING_VERT_DEFAULT 1 |
#define | NVBUF_MAX_SYNCOBJ_PARAMS 5 |
Defines the maximum number of sync object parameters. More... | |
#define | NVBUFFER_SYNCPOINT_WAIT_INFINITE 0xFFFFFFFF |
Use this value to represent an infinite wait interval. More... | |
#define | NVBUF_CHROMA_SUBSAMPLING_PARAMS_DEFAULT |
Typedefs | |
typedef struct _NvBufferSyncObjParams | NvBufferSyncObjParams |
Holds parameters for buffer sync point object. More... | |
typedef struct _NvBufferSyncObjRec | NvBufferSyncObj |
buffer sync point object. More... | |
typedef struct _NvBufferSession * | NvBufferSession |
Holds an opaque NvBuffer session type required for parallel buffer tranformations and compositions. More... | |
typedef struct _NvBufferChromaSubSamplingParams | NvBufferChromaSubsamplingParams |
Holds Chroma Subsampling parameters. More... | |
typedef struct _NvBufferCreateParams | NvBufferCreateParams |
Holds the input parameters for hardware buffer creation. More... | |
typedef struct _NvBufferParams | NvBufferParams |
Holds parameters for a hardware buffer. More... | |
typedef struct _NvBufferParamsEx | NvBufferParamsEx |
Holds extended parameters for a hardware buffer. More... | |
typedef struct _NvBufferCompositeParams | NvBufferCompositeParams |
Holds parameters related to compositing/blending. More... | |
typedef struct _NvBufferTransformParams | NvBufferTransformParams |
Holds parameters for buffer transform functions. More... | |
Functions | |
int | NvBufferSyncObjWait (NvBufferSyncObjParams *syncobj_params, unsigned int timeout) |
This method can be used to wait on sync point ID. More... | |
int | NvBufferGetSize (void) |
This method can be used to get HW Buffer struct size. More... | |
EGLImageKHR | NvEGLImageFromFd (EGLDisplay display, int dmabuf_fd) |
Creates an instance of EGLImage from a DMABUF FD. More... | |
int | NvDestroyEGLImage (EGLDisplay display, EGLImageKHR eglImage) |
Destroys an EGLImage object. More... | |
int | NvBufferCreate (int *dmabuf_fd, int width, int height, NvBufferLayout layout, NvBufferColorFormat colorFormat) |
Allocates a HW buffer (deprecated). More... | |
int | NvBufferCreateEx (int *dmabuf_fd, NvBufferCreateParams *input_params) |
Allocates a hardware buffer. More... | |
int | NvBufferCreateInterlace (int *dmabuf_fd, NvBufferCreateParams *input_params) |
Allocates a hardware buffer for interlace scan format. More... | |
int | NvBufferCreateWithChromaLoc (int *dmabuf_fd, NvBufferCreateParams *input_params, NvBufferChromaSubsamplingParams *chromaSubsampling) |
Allocates a hardware buffer with a given chroma subsampling location. More... | |
int | NvBufferGetParams (int dmabuf_fd, NvBufferParams *params) |
Gets buffer parameters. More... | |
int | NvBufferGetParamsEx (int dmabuf_fd, NvBufferParamsEx *exparams) |
Gets buffer extended parameters. More... | |
int | NvBufferDestroy (int dmabuf_fd) |
Destroys a HW buffer. More... | |
int | ExtractFdFromNvBuffer (void *nvbuf, int *dmabuf_fd) |
Extracts the dmabuf_fd from the hardware buffer. More... | |
int | NvReleaseFd (int dmabuf_fd) |
Releases the dmabuf_fd buffer. More... | |
int | NvBufferMemSyncForCpu (int dmabuf_fd, unsigned int plane, void **pVirtAddr) |
Syncs the HW memory cache for the CPU. More... | |
int | NvBufferMemSyncForDevice (int dmabuf_fd, unsigned int plane, void **pVirtAddr) |
Syncs the hardware memory cache for the device. More... | |
int | NvBufferMemMap (int dmabuf_fd, unsigned int plane, NvBufferMemFlags memflag, void **pVirtAddr) |
Gets the memory-mapped virtual address of the plane. More... | |
int | NvBufferMemUnMap (int dmabuf_fd, unsigned int plane, void **pVirtAddr) |
Unmaps the mapped virtual address of the plane. More... | |
int | NvBuffer2Raw (int dmabuf_fd, unsigned int plane, unsigned int out_width, unsigned int out_height, unsigned char *ptr) |
Copies the NvBuffer plane contents to a raw buffer plane. More... | |
int | Raw2NvBuffer (unsigned char *ptr, unsigned int plane, unsigned int in_width, unsigned int in_height, int dmabuf_fd) |
Copies raw buffer plane contents to an NvBuffer plane. More... | |
NvBufferSession | NvBufferSessionCreate (void) |
Creates a new NvBufferSession for parallel scheduling of buffer transformations and compositions. More... | |
void | NvBufferSessionDestroy (NvBufferSession session) |
Destroys an existing NvBufferSession. More... | |
int | NvBufferTransform (int src_dmabuf_fd, int dst_dmabuf_fd, NvBufferTransformParams *transform_params) |
Transforms one DMA buffer to another DMA buffer. More... | |
int | NvBufferTransformAsync (int src_dmabuf_fd, int dst_dmabuf_fd, NvBufferTransformParams *transform_params, NvBufferSyncObj *syncobj) |
Transforms one DMA buffer to another DMA buffer asyncroniously (non-blocking). More... | |
int | NvBufferComposite (int *src_dmabuf_fds, int dst_dmabuf_fd, NvBufferCompositeParams *composite_params) |
Composites multiple input DMA buffers to one output DMA buffer. More... | |
#define MAX_COMPOSITE_FRAME 16 |
Defines the maximum number of input video frames that can be used for composition.
Definition at line 46 of file nvbuf_utils.h.
#define MAX_NUM_PLANES 4 |
Defines the maximum number of planes for a video frame.
Definition at line 41 of file nvbuf_utils.h.
#define NVBUF_CHROMA_SUBSAMPLING_HORIZ_DEFAULT 0 |
Defines the default values for chroma subsampling.
The default value matches JPEG/MPEG use cases.
Definition at line 52 of file nvbuf_utils.h.
#define NVBUF_CHROMA_SUBSAMPLING_PARAMS_DEFAULT |
Definition at line 388 of file nvbuf_utils.h.
#define NVBUF_CHROMA_SUBSAMPLING_VERT_DEFAULT 1 |
Definition at line 53 of file nvbuf_utils.h.
#define NVBUF_MAX_SYNCOBJ_PARAMS 5 |
Defines the maximum number of sync object parameters.
Definition at line 58 of file nvbuf_utils.h.
#define NVBUFFER_SYNCPOINT_WAIT_INFINITE 0xFFFFFFFF |
Use this value to represent an infinite wait interval.
A value of zero should not be interpreted as infinite, it should be interpreted as "time out immediately" and simply check whether the event has already happened.
Definition at line 66 of file nvbuf_utils.h.
typedef struct _NvBufferChromaSubSamplingParams NvBufferChromaSubsamplingParams |
Holds Chroma Subsampling parameters.
typedef struct _NvBufferCompositeParams NvBufferCompositeParams |
Holds parameters related to compositing/blending.
typedef struct _NvBufferCreateParams NvBufferCreateParams |
Holds the input parameters for hardware buffer creation.
typedef struct _NvBufferParams NvBufferParams |
Holds parameters for a hardware buffer.
typedef struct _NvBufferParamsEx NvBufferParamsEx |
Holds extended parameters for a hardware buffer.
typedef struct _NvBufferSession* NvBufferSession |
Holds an opaque NvBuffer session type required for parallel buffer tranformations and compositions.
Operations using a single session are scheduled sequentially, after the previous operation finishes. Operations for multiple sessions are scheduled in parallel.
Definition at line 376 of file nvbuf_utils.h.
typedef struct _NvBufferSyncObjRec NvBufferSyncObj |
buffer sync point object.
typedef struct _NvBufferSyncObjParams NvBufferSyncObjParams |
Holds parameters for buffer sync point object.
sync object params is simply a data structure containing [sync point ID,value] pair. This can be used by clients to describe an event that might want to wait for.
typedef struct _NvBufferTransformParams NvBufferTransformParams |
Holds parameters for buffer transform functions.
enum NvBufferColorFormat |
Defines color formats for NvBuffer.
Definition at line 140 of file nvbuf_utils.h.
Defines flags that specify valid composition/blending operations.
Enumerator | |
---|---|
NVBUFFER_COMPOSITE |
flag to set for composition. |
NVBUFFER_BLEND |
flag to set for blending. |
Definition at line 313 of file nvbuf_utils.h.
Defines display scan formats for NvBuffer video planes.
Enumerator | |
---|---|
NvBufferDisplayScanFormat_Progressive |
Progessive scan formats. |
NvBufferDisplayScanFormat_Interlaced |
Interlaced scan formats. |
Definition at line 82 of file nvbuf_utils.h.
enum NvBufferLayout |
Defines Layout formats for NvBuffer video planes.
Enumerator | |
---|---|
NvBufferLayout_Pitch |
Pitch Layout. |
NvBufferLayout_BlockLinear |
BlockLinear Layout. |
Definition at line 93 of file nvbuf_utils.h.
enum NvBufferMemFlags |
Defines memory access flags for NvBuffer.
Enumerator | |
---|---|
NvBufferMem_Read |
Memory read. |
NvBufferMem_Write |
Memory write. |
NvBufferMem_Read_Write |
Memory read & write. |
Definition at line 104 of file nvbuf_utils.h.
enum NvBufferPayloadType |
Defines Payload types for NvBuffer.
Enumerator | |
---|---|
NvBufferPayload_SurfArray |
buffer payload with HW memory handle for set of planes. |
NvBufferPayload_MemHandle |
buffer payload with HW memory handle for specific memory size. |
Definition at line 71 of file nvbuf_utils.h.
enum NvBufferTag |
Defines tags that identify the components requesting a memory allocation.
The tags can be used later to identify the total memory allocated to particular types of components.
Definition at line 119 of file nvbuf_utils.h.
Defines transform video filter types.
Definition at line 280 of file nvbuf_utils.h.
Defines flags to indicate for valid transform.
Definition at line 299 of file nvbuf_utils.h.
Defines video flip methods.
Definition at line 257 of file nvbuf_utils.h.
int ExtractFdFromNvBuffer | ( | void * | nvbuf, |
int * | dmabuf_fd | ||
) |
Extracts the dmabuf_fd
from the hardware buffer.
[in] | nvbuf | Specifies the hw_buffer . |
[out] | dmabuf_fd | Returns DMABUF FD of hw_buffer . |
int NvBuffer2Raw | ( | int | dmabuf_fd, |
unsigned int | plane, | ||
unsigned int | out_width, | ||
unsigned int | out_height, | ||
unsigned char * | ptr | ||
) |
Copies the NvBuffer plane contents to a raw buffer plane.
[in] | dmabuf_fd | DMABUF FD of NvBuffer. |
[in] | plane | video frame plane. |
[in] | out_width | aligned width of the raw data plane. |
[in] | out_height | aligned height of the raw data plane. |
[in] | ptr | pointer to the output raw plane data. |
int NvBufferComposite | ( | int * | src_dmabuf_fds, |
int | dst_dmabuf_fd, | ||
NvBufferCompositeParams * | composite_params | ||
) |
Composites multiple input DMA buffers to one output DMA buffer.
This function can composite multiple input frames to one output.
[in] | src_dmabuf_fds | An array of DMABUF FDs of source buffers. These buffers are composited together. Output is copied to the output buffer referenced by dst_dmabuf_fd. |
[in] | dst_dmabuf_fd | DMABUF FD of the compositing destination buffer. |
[in] | composite_params | Compositing parameters. |
int NvBufferCreate | ( | int * | dmabuf_fd, |
int | width, | ||
int | height, | ||
NvBufferLayout | layout, | ||
NvBufferColorFormat | colorFormat | ||
) |
Allocates a HW buffer (deprecated).
[out] | dmabuf_fd | Returns the DMABUF FD of the hardware buffer. |
[in] | width | Buffer width, in bytes. |
[in] | height | Buffer height, in bytes. |
[in] | layout | Layout of the buffer. |
[in] | colorFormat | Color format of the buffer. |
int NvBufferCreateEx | ( | int * | dmabuf_fd, |
NvBufferCreateParams * | input_params | ||
) |
Allocates a hardware buffer.
[out] | dmabuf_fd | Returns the DMABUF FD of the hardware buffer. |
[in] | input_params | Input parameters for hardware buffer creation. |
int NvBufferCreateInterlace | ( | int * | dmabuf_fd, |
NvBufferCreateParams * | input_params | ||
) |
Allocates a hardware buffer for interlace scan format.
[out] | dmabuf_fd | Returns the DMABUF FD of the hardware buffer. |
[in] | input_params | Input parameters for hardware buffer creation. |
int NvBufferCreateWithChromaLoc | ( | int * | dmabuf_fd, |
NvBufferCreateParams * | input_params, | ||
NvBufferChromaSubsamplingParams * | chromaSubsampling | ||
) |
Allocates a hardware buffer with a given chroma subsampling location.
[in] | dmabuf_fd | DMABUF FD of the buffer. |
[in] | input_params | Input parameters for hardware buffer creation. |
[in] | chromaSubsampling | Chroma location parameters. |
int NvBufferDestroy | ( | int | dmabuf_fd | ) |
Destroys a HW buffer.
[in] | dmabuf_fd | Specifies the dmabuf_fd hw_buffer to destroy. |
int NvBufferGetParams | ( | int | dmabuf_fd, |
NvBufferParams * | params | ||
) |
Gets buffer parameters.
[in] | dmabuf_fd | DMABUF FD of buffer. |
[out] | params | A pointer to the structure to fill with parameters. |
int NvBufferGetParamsEx | ( | int | dmabuf_fd, |
NvBufferParamsEx * | exparams | ||
) |
Gets buffer extended parameters.
[in] | dmabuf_fd | DMABUF FD of buffer. |
[out] | exparams | A pointer to the structure to fill with extended parameters. |
int NvBufferGetSize | ( | void | ) |
This method can be used to get HW Buffer struct size.
int NvBufferMemMap | ( | int | dmabuf_fd, |
unsigned int | plane, | ||
NvBufferMemFlags | memflag, | ||
void ** | pVirtAddr | ||
) |
Gets the memory-mapped virtual address of the plane.
The client must call NvBufferMemSyncForCpu() with the virtual address returned by this function before accessing the mapped memory in CPU.
After memory mapping is complete, mapped memory modification must be coordinated between the CPU and hardware device as follows:
[in] | dmabuf_fd | DMABUF FD of buffer. |
[in] | plane | video frame plane.(Applies to NvBufferPayload_SurfArray.) |
[in] | memflag | NvBuffer memory flag. |
[out] | pVirtAddr | Virtual Address pointer of the memory-mapped plane. |
int NvBufferMemSyncForCpu | ( | int | dmabuf_fd, |
unsigned int | plane, | ||
void ** | pVirtAddr | ||
) |
Syncs the HW memory cache for the CPU.
[in] | dmabuf_fd | DMABUF FD of buffer. |
[in] | plane | video frame plane. |
[in] | pVirtAddr | Virtual Address pointer of the memory-mapped plane. |
int NvBufferMemSyncForDevice | ( | int | dmabuf_fd, |
unsigned int | plane, | ||
void ** | pVirtAddr | ||
) |
Syncs the hardware memory cache for the device.
[in] | dmabuf_fd | DMABUF FD of buffer. |
[in] | plane | video frame plane. |
[in] | pVirtAddr | Virtual Address pointer of the memory-mapped plane. |
int NvBufferMemUnMap | ( | int | dmabuf_fd, |
unsigned int | plane, | ||
void ** | pVirtAddr | ||
) |
Unmaps the mapped virtual address of the plane.
If the following conditions are both true, the client must call NvBufferMemSyncForDevice() before unmapping the memory:
[in] | dmabuf_fd | DMABUF FD of the buffer. |
[in] | plane | Video frame plane. Applies to NvBufferPayload_SurfArray. |
[in] | pVirtAddr | Virtual address pointer to the memory-mapped plane. |
NvBufferSession NvBufferSessionCreate | ( | void | ) |
Creates a new NvBufferSession for parallel scheduling of buffer transformations and compositions.
void NvBufferSessionDestroy | ( | NvBufferSession | session | ) |
Destroys an existing NvBufferSession.
[in] | session | An existing NvBufferSession. |
int NvBufferSyncObjWait | ( | NvBufferSyncObjParams * | syncobj_params, |
unsigned int | timeout | ||
) |
This method can be used to wait on sync point ID.
[in] | syncobj_params | sync point object parameters. |
[in] | timeout | sync point wait timeout value. |
int NvBufferTransform | ( | int | src_dmabuf_fd, |
int | dst_dmabuf_fd, | ||
NvBufferTransformParams * | transform_params | ||
) |
Transforms one DMA buffer to another DMA buffer.
This function can support transforms for copying, scaling, fliping, rotating, and cropping.
[in] | src_dmabuf_fd | DMABUF FD of source buffer |
[in] | dst_dmabuf_fd | DMABUF FD of destination buffer |
[in] | transform_params | transform parameters |
int NvBufferTransformAsync | ( | int | src_dmabuf_fd, |
int | dst_dmabuf_fd, | ||
NvBufferTransformParams * | transform_params, | ||
NvBufferSyncObj * | syncobj | ||
) |
Transforms one DMA buffer to another DMA buffer asyncroniously (non-blocking).
This function can support transforms for copying, scaling, fliping, rotating, and cropping.
[in] | src_dmabuf_fd | DMABUF FD of source buffer |
[in] | dst_dmabuf_fd | DMABUF FD of destination buffer |
[in] | transform_params | transform parameters |
[in] | syncobj | nvbuffer sync point object |
int NvDestroyEGLImage | ( | EGLDisplay | display, |
EGLImageKHR | eglImage | ||
) |
Destroys an EGLImage object.
[in] | display | An EGLDisplay object used to destroy the EGLImage. If NULL, nvbuf_utils() uses its own instance of EGLDisplay. |
[in] | eglImage | The EGLImageKHR object to be destroyed. |
EGLImageKHR NvEGLImageFromFd | ( | EGLDisplay | display, |
int | dmabuf_fd | ||
) |
Creates an instance of EGLImage from a DMABUF FD.
[in] | display | An EGLDisplay object used during the creation of the EGLImage. If NULL, nvbuf_utils() uses its own instance of EGLDisplay. |
[in] | dmabuf_fd | DMABUF FD of the buffer from which the EGLImage is to be created. |
EGLImageKHR
for success, NULL
for failure int NvReleaseFd | ( | int | dmabuf_fd | ) |
Releases the dmabuf_fd
buffer.
[in] | dmabuf_fd | Specifies the dmabuf_fd to release. |
int Raw2NvBuffer | ( | unsigned char * | ptr, |
unsigned int | plane, | ||
unsigned int | in_width, | ||
unsigned int | in_height, | ||
int | dmabuf_fd | ||
) |
Copies raw buffer plane contents to an NvBuffer plane.
[in] | ptr | pointer to the input raw plane data. |
[in] | plane | video frame plane. |
[in] | in_width | aligned width of the raw data plane. |
[in] | in_height | aligned height of the raw data plane. |
[in] | dmabuf_fd | DMABUF FD of NvBuffer. |