Jetson Linux API Reference

32.7.4 Release
Buffer Manager

Detailed Description

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...
 

Enumerations

enum  NvBufferPayloadType {
  NvBufferPayload_SurfArray,
  NvBufferPayload_MemHandle
}
 Defines Payload types for NvBuffer. More...
 
enum  NvBufferDisplayScanFormat {
  NvBufferDisplayScanFormat_Progressive = 0,
  NvBufferDisplayScanFormat_Interlaced
}
 Defines display scan formats for NvBuffer video planes. More...
 
enum  NvBufferLayout {
  NvBufferLayout_Pitch,
  NvBufferLayout_BlockLinear
}
 Defines Layout formats for NvBuffer video planes. More...
 
enum  NvBufferMemFlags {
  NvBufferMem_Read,
  NvBufferMem_Write,
  NvBufferMem_Read_Write
}
 Defines memory access flags for NvBuffer. More...
 
enum  NvBufferTag {
  NvBufferTag_NONE = 0x0,
  NvBufferTag_CAMERA = 0x200,
  NvBufferTag_JPEG = 0x1500,
  NvBufferTag_PROTECTED = 0x1504,
  NvBufferTag_VIDEO_ENC = 0x1200,
  NvBufferTag_VIDEO_DEC = 0x1400,
  NvBufferTag_VIDEO_CONVERT = 0xf01
}
 Defines tags that identify the components requesting a memory allocation. More...
 
enum  NvBufferColorFormat {
  NvBufferColorFormat_YUV420,
  NvBufferColorFormat_YVU420,
  NvBufferColorFormat_YUV422,
  NvBufferColorFormat_YUV420_ER,
  NvBufferColorFormat_YVU420_ER,
  NvBufferColorFormat_NV12,
  NvBufferColorFormat_NV12_ER,
  NvBufferColorFormat_NV21,
  NvBufferColorFormat_NV21_ER,
  NvBufferColorFormat_UYVY,
  NvBufferColorFormat_UYVY_ER,
  NvBufferColorFormat_VYUY,
  NvBufferColorFormat_VYUY_ER,
  NvBufferColorFormat_YUYV,
  NvBufferColorFormat_YUYV_ER,
  NvBufferColorFormat_YVYU,
  NvBufferColorFormat_YVYU_ER,
  NvBufferColorFormat_ABGR32,
  NvBufferColorFormat_XRGB32,
  NvBufferColorFormat_ARGB32,
  NvBufferColorFormat_NV12_10LE,
  NvBufferColorFormat_NV12_10LE_709,
  NvBufferColorFormat_NV12_10LE_709_ER,
  NvBufferColorFormat_NV12_10LE_2020,
  NvBufferColorFormat_NV21_10LE,
  NvBufferColorFormat_NV12_12LE,
  NvBufferColorFormat_NV12_12LE_2020,
  NvBufferColorFormat_NV21_12LE,
  NvBufferColorFormat_YUV420_709,
  NvBufferColorFormat_YUV420_709_ER,
  NvBufferColorFormat_NV12_709,
  NvBufferColorFormat_NV12_709_ER,
  NvBufferColorFormat_YUV420_2020,
  NvBufferColorFormat_NV12_2020,
  NvBufferColorFormat_YUV444,
  NvBufferColorFormat_SignedR16G16,
  NvBufferColorFormat_A32,
  NvBufferColorFormat_GRAY8,
  NvBufferColorFormat_NV16,
  NvBufferColorFormat_NV16_10LE,
  NvBufferColorFormat_NV24,
  NvBufferColorFormat_NV24_10LE,
  NvBufferColorFormat_NV16_ER,
  NvBufferColorFormat_NV24_ER,
  NvBufferColorFormat_NV16_709,
  NvBufferColorFormat_NV24_709,
  NvBufferColorFormat_NV16_709_ER,
  NvBufferColorFormat_NV24_709_ER,
  NvBufferColorFormat_NV24_10LE_709,
  NvBufferColorFormat_NV24_10LE_709_ER,
  NvBufferColorFormat_NV24_10LE_2020,
  NvBufferColorFormat_NV24_12LE_2020,
  NvBufferColorFormat_RGBA_10_10_10_2_709,
  NvBufferColorFormat_RGBA_10_10_10_2_2020,
  NvBufferColorFormat_BGRA_10_10_10_2_709,
  NvBufferColorFormat_BGRA_10_10_10_2_2020,
  NvBufferColorFormat_Invalid
}
 Defines color formats for NvBuffer. More...
 
enum  NvBufferTransform_Flip {
  NvBufferTransform_None,
  NvBufferTransform_Rotate90,
  NvBufferTransform_Rotate180,
  NvBufferTransform_Rotate270,
  NvBufferTransform_FlipX,
  NvBufferTransform_FlipY,
  NvBufferTransform_Transpose,
  NvBufferTransform_InvTranspose
}
 Defines video flip methods. More...
 
enum  NvBufferTransform_Filter {
  NvBufferTransform_Filter_Nearest,
  NvBufferTransform_Filter_Bilinear,
  NvBufferTransform_Filter_5_Tap,
  NvBufferTransform_Filter_10_Tap,
  NvBufferTransform_Filter_Smart,
  NvBufferTransform_Filter_Nicest
}
 Defines transform video filter types. More...
 
enum  NvBufferTransform_Flag {
  NVBUFFER_TRANSFORM_CROP_SRC = 1,
  NVBUFFER_TRANSFORM_CROP_DST = 1 << 1,
  NVBUFFER_TRANSFORM_FILTER = 1 << 2,
  NVBUFFER_TRANSFORM_FLIP = 1 << 3
}
 Defines flags to indicate for valid transform. More...
 
enum  NvBufferComposite_Flag {
  NVBUFFER_COMPOSITE = 1,
  NVBUFFER_BLEND = 1 << 1,
  NVBUFFER_COMPOSITE_FILTER = 1 << 2
}
 Defines flags that specify valid composition/blending operations. 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 hardware 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 hardware 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 hardware 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 hardware memory cache for the CPU. More...
 
int NvBufferMemSyncForCpuEx (int dmabuf_fd, NvBufferParamsEx *exparams, unsigned int plane, void **pVirtAddr)
 Syncs the hardware memory cache for the CPU, API to be used for another process. More...
 
int NvBufferMemSyncForDevice (int dmabuf_fd, unsigned int plane, void **pVirtAddr)
 Syncs the hardware memory cache for the device. More...
 
int NvBufferMemSyncForDeviceEx (int dmabuf_fd, NvBufferParamsEx *exparams, unsigned int plane, void **pVirtAddr)
 Syncs the hardware memory cache for the device, API to be used for another process. More...
 
int NvBufferMemMap (int dmabuf_fd, unsigned int plane, NvBufferMemFlags memflag, void **pVirtAddr)
 Gets the memory-mapped virtual address of the plane. More...
 
int NvBufferMemMapEx (int dmabuf_fd, NvBufferParamsEx *exparams, unsigned int plane, NvBufferMemFlags memflag, void **pVirtAddr)
 Gets the memory-mapped virtual address of the plane, API to be used for another process. More...
 
int NvBufferMemUnMap (int dmabuf_fd, unsigned int plane, void **pVirtAddr)
 Unmaps the mapped virtual address of the plane. More...
 
int NvBufferMemUnMapEx (int dmabuf_fd, NvBufferParamsEx *exparams, unsigned int plane, void **pVirtAddr)
 Unmaps the mapped virtual address of the plane, API to be used for another process. 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 NvBufferTransformEx (int src_dmabuf_fd, NvBufferParamsEx *input_params, int dst_dmabuf_fd, NvBufferParamsEx *output_params, NvBufferTransformParams *transform_params)
 Transforms one DMA buffer to another DMA buffer, API to be used for another process. 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...
 

Macro Definition Documentation

◆ MAX_COMPOSITE_FRAME

#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.

◆ MAX_NUM_PLANES

#define MAX_NUM_PLANES   4

Defines the maximum number of planes for a video frame.

Definition at line 41 of file nvbuf_utils.h.

◆ NVBUF_CHROMA_SUBSAMPLING_HORIZ_DEFAULT

#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.

◆ NVBUF_CHROMA_SUBSAMPLING_PARAMS_DEFAULT

#define NVBUF_CHROMA_SUBSAMPLING_PARAMS_DEFAULT
Value:
{ \
NVBUF_CHROMA_SUBSAMPLING_HORIZ_DEFAULT, \
NVBUF_CHROMA_SUBSAMPLING_VERT_DEFAULT \
}

Definition at line 394 of file nvbuf_utils.h.

◆ NVBUF_CHROMA_SUBSAMPLING_VERT_DEFAULT

#define NVBUF_CHROMA_SUBSAMPLING_VERT_DEFAULT   1

Definition at line 53 of file nvbuf_utils.h.

◆ NVBUF_MAX_SYNCOBJ_PARAMS

#define NVBUF_MAX_SYNCOBJ_PARAMS   5

Defines the maximum number of sync object parameters.

Definition at line 58 of file nvbuf_utils.h.

◆ NVBUFFER_SYNCPOINT_WAIT_INFINITE

#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 Documentation

◆ NvBufferChromaSubsamplingParams

Holds Chroma Subsampling parameters.

◆ NvBufferCompositeParams

Holds parameters related to compositing/blending.

◆ NvBufferCreateParams

Holds the input parameters for hardware buffer creation.

◆ NvBufferParams

Holds parameters for a hardware buffer.

◆ NvBufferParamsEx

Holds extended parameters for a hardware buffer.

◆ NvBufferSession

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 382 of file nvbuf_utils.h.

◆ NvBufferSyncObj

buffer sync point object.

◆ 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.

◆ NvBufferTransformParams

Holds parameters for buffer transform functions.

Enumeration Type Documentation

◆ NvBufferColorFormat

Defines color formats for NvBuffer.

Enumerator
NvBufferColorFormat_YUV420 

BT.601 colorspace - YUV420 multi-planar.

NvBufferColorFormat_YVU420 

BT.601 colorspace - YUV420 multi-planar.

NvBufferColorFormat_YUV422 

BT.601 colorspace - YUV422 multi-planar.

NvBufferColorFormat_YUV420_ER 

BT.601 colorspace - YUV420 ER multi-planar.

NvBufferColorFormat_YVU420_ER 

BT.601 colorspace - YVU420 ER multi-planar.

NvBufferColorFormat_NV12 

BT.601 colorspace - Y/CbCr 4:2:0 multi-planar.

NvBufferColorFormat_NV12_ER 

BT.601 colorspace - Y/CbCr ER 4:2:0 multi-planar.

NvBufferColorFormat_NV21 

BT.601 colorspace - Y/CbCr 4:2:0 multi-planar.

NvBufferColorFormat_NV21_ER 

BT.601 colorspace - Y/CbCr ER 4:2:0 multi-planar.

NvBufferColorFormat_UYVY 

BT.601 colorspace - YUV 4:2:2 planar.

NvBufferColorFormat_UYVY_ER 

BT.601 colorspace - YUV ER 4:2:2 planar.

NvBufferColorFormat_VYUY 

BT.601 colorspace - YUV 4:2:2 planar.

NvBufferColorFormat_VYUY_ER 

BT.601 colorspace - YUV ER 4:2:2 planar.

NvBufferColorFormat_YUYV 

BT.601 colorspace - YUV 4:2:2 planar.

NvBufferColorFormat_YUYV_ER 

BT.601 colorspace - YUV ER 4:2:2 planar.

NvBufferColorFormat_YVYU 

BT.601 colorspace - YUV 4:2:2 planar.

NvBufferColorFormat_YVYU_ER 

BT.601 colorspace - YUV ER 4:2:2 planar.

NvBufferColorFormat_ABGR32 

LegacyRGBA colorspace - BGRA-8-8-8-8 planar.

NvBufferColorFormat_XRGB32 

LegacyRGBA colorspace - XRGB-8-8-8-8 planar.

NvBufferColorFormat_ARGB32 

LegacyRGBA colorspace - ARGB-8-8-8-8 planar.

NvBufferColorFormat_NV12_10LE 

BT.601 colorspace - Y/CbCr 4:2:0 10-bit multi-planar.

NvBufferColorFormat_NV12_10LE_709 

BT.709 colorspace - Y/CbCr 4:2:0 10-bit multi-planar.

NvBufferColorFormat_NV12_10LE_709_ER 

BT.709_ER colorspace - Y/CbCr 4:2:0 10-bit multi-planar.

NvBufferColorFormat_NV12_10LE_2020 

BT.2020 colorspace - Y/CbCr 4:2:0 10-bit multi-planar.

NvBufferColorFormat_NV21_10LE 

BT.601 colorspace - Y/CrCb 4:2:0 10-bit multi-planar.

NvBufferColorFormat_NV12_12LE 

BT.601 colorspace - Y/CbCr 4:2:0 12-bit multi-planar.

NvBufferColorFormat_NV12_12LE_2020 

BT.2020 colorspace - Y/CbCr 4:2:0 12-bit multi-planar.

NvBufferColorFormat_NV21_12LE 

BT.601 colorspace - Y/CrCb 4:2:0 12-bit multi-planar.

NvBufferColorFormat_YUV420_709 

BT.709 colorspace - YUV420 multi-planar.

NvBufferColorFormat_YUV420_709_ER 

BT.709 colorspace - YUV420 ER multi-planar.

NvBufferColorFormat_NV12_709 

BT.709 colorspace - Y/CbCr 4:2:0 multi-planar.

NvBufferColorFormat_NV12_709_ER 

BT.709 colorspace - Y/CbCr ER 4:2:0 multi-planar.

NvBufferColorFormat_YUV420_2020 

BT.2020 colorspace - YUV420 multi-planar.

NvBufferColorFormat_NV12_2020 

BT.2020 colorspace - Y/CbCr 4:2:0 multi-planar.

NvBufferColorFormat_YUV444 

BT.601 colorspace - YUV444 multi-planar.

NvBufferColorFormat_SignedR16G16 

Optical flow.

NvBufferColorFormat_A32 

Optical flow SAD calculation Buffer format.

NvBufferColorFormat_GRAY8 

8-bit grayscale.

NvBufferColorFormat_NV16 

BT.601 colorspace - Y/CbCr 4:2:2 multi-planar.

NvBufferColorFormat_NV16_10LE 

BT.601 colorspace - Y/CbCr 4:2:2 10-bit semi-planar.

NvBufferColorFormat_NV24 

BT.601 colorspace - Y/CbCr 4:4:4 multi-planar.

NvBufferColorFormat_NV24_10LE 

BT.601 colorspace - Y/CrCb 4:4:4 10-bit multi-planar.

NvBufferColorFormat_NV16_ER 

BT.601_ER colorspace - Y/CbCr 4:2:2 multi-planar.

NvBufferColorFormat_NV24_ER 

BT.601_ER colorspace - Y/CbCr 4:4:4 multi-planar.

NvBufferColorFormat_NV16_709 

BT.709 colorspace - Y/CbCr 4:2:2 multi-planar.

NvBufferColorFormat_NV24_709 

BT.709 colorspace - Y/CbCr 4:4:4 multi-planar.

NvBufferColorFormat_NV16_709_ER 

BT.709_ER colorspace - Y/CbCr 4:2:2 multi-planar.

NvBufferColorFormat_NV24_709_ER 

BT.709_ER colorspace - Y/CbCr 4:4:4 multi-planar.

NvBufferColorFormat_NV24_10LE_709 

BT.709 colorspace - Y/CbCr 10 bit 4:4:4 multi-planar.

NvBufferColorFormat_NV24_10LE_709_ER 

BT.709 ER colorspace - Y/CbCr 10 bit 4:4:4 multi-planar.

NvBufferColorFormat_NV24_10LE_2020 

BT.2020 colorspace - Y/CbCr 10 bit 4:4:4 multi-planar.

NvBufferColorFormat_NV24_12LE_2020 

BT.2020 colorspace - Y/CbCr 12 bit 4:4:4 multi-planar.

NvBufferColorFormat_RGBA_10_10_10_2_709 

Non-linear RGB BT.709 colorspace - RGBA-10-10-10-2 planar.

NvBufferColorFormat_RGBA_10_10_10_2_2020 

Non-linear RGB BT.2020 colorspace - RGBA-10-10-10-2 planar.

NvBufferColorFormat_BGRA_10_10_10_2_709 

Non-linear RGB BT.709 colorspace - BGRA-10-10-10-2 planar.

NvBufferColorFormat_BGRA_10_10_10_2_2020 

Non-linear RGB BT.2020 colorspace - BGRA-10-10-10-2 planar.

NvBufferColorFormat_Invalid 

Invalid color format.

Definition at line 140 of file nvbuf_utils.h.

◆ NvBufferComposite_Flag

Defines flags that specify valid composition/blending operations.

Enumerator
NVBUFFER_COMPOSITE 

flag to set for composition.

NVBUFFER_BLEND 

flag to set for blending.

NVBUFFER_COMPOSITE_FILTER 

composition flag to set filter type.

Definition at line 317 of file nvbuf_utils.h.

◆ NvBufferDisplayScanFormat

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.

◆ 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.

◆ 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.

◆ NvBufferPayloadType

Defines Payload types for NvBuffer.

Enumerator
NvBufferPayload_SurfArray 

buffer payload with hardware memory handle for set of planes.

NvBufferPayload_MemHandle 

buffer payload with hardware memory handle for specific memory size.

Definition at line 71 of file nvbuf_utils.h.

◆ 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.

Enumerator
NvBufferTag_NONE 

tag None.

NvBufferTag_CAMERA 

tag for Camera.

NvBufferTag_JPEG 

tag for Jpeg Encoder/Decoder.

NvBufferTag_PROTECTED 

tag for VPR Buffers.

NvBufferTag_VIDEO_ENC 

tag for H264/H265 Video Encoder.

NvBufferTag_VIDEO_DEC 

tag for H264/H265/VP9 Video Decoder.

NvBufferTag_VIDEO_CONVERT 

tag for Video Transform/Composite.

Definition at line 119 of file nvbuf_utils.h.

◆ NvBufferTransform_Filter

Defines transform video filter types.

Enumerator
NvBufferTransform_Filter_Nearest 

transform filter nearest.

NvBufferTransform_Filter_Bilinear 

transform filter bilinear.

NvBufferTransform_Filter_5_Tap 

transform filter 5 tap.

NvBufferTransform_Filter_10_Tap 

transform filter 10 tap.

NvBufferTransform_Filter_Smart 

transform filter smart.

NvBufferTransform_Filter_Nicest 

transform filter nicest.

Definition at line 284 of file nvbuf_utils.h.

◆ NvBufferTransform_Flag

Defines flags to indicate for valid transform.

Enumerator
NVBUFFER_TRANSFORM_CROP_SRC 

transform flag to crop source rectangle.

NVBUFFER_TRANSFORM_CROP_DST 

transform flag to crop destination rectangle.

NVBUFFER_TRANSFORM_FILTER 

transform flag to set filter type.

NVBUFFER_TRANSFORM_FLIP 

transform flag to set flip method.

Definition at line 303 of file nvbuf_utils.h.

◆ NvBufferTransform_Flip

Defines video flip methods.

Enumerator
NvBufferTransform_None 

Video flip none.

NvBufferTransform_Rotate90 

Video flip rotate 90 degree counter-clockwise.

NvBufferTransform_Rotate180 

Video flip rotate 180 degree.

NvBufferTransform_Rotate270 

Video flip rotate 270 degree counter-clockwise.

NvBufferTransform_FlipX 

Video flip with respect to X-axis.

NvBufferTransform_FlipY 

Video flip with respect to Y-axis.

NvBufferTransform_Transpose 

Video flip transpose.

NvBufferTransform_InvTranspose 

Video flip inverse transpode.

Definition at line 261 of file nvbuf_utils.h.

Function Documentation

◆ ExtractFdFromNvBuffer()

int ExtractFdFromNvBuffer ( void *  nvbuf,
int *  dmabuf_fd 
)

Extracts the dmabuf_fd from the hardware buffer.

Parameters
[in]nvbufSpecifies the hw_buffer.
[out]dmabuf_fdReturns DMABUF FD of hw_buffer.
Returns
0 for success, -1 for failure.

◆ NvBuffer2Raw()

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.

Parameters
[in]dmabuf_fdDMABUF FD of NvBuffer.
[in]planevideo frame plane.
[in]out_widthaligned width of the raw data plane.
[in]out_heightaligned height of the raw data plane.
[in]ptrpointer to the output raw plane data.
Returns
0 for success, -1 for failure.

◆ NvBufferComposite()

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.

Parameters
[in]src_dmabuf_fdsAn 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_fdDMABUF FD of the compositing destination buffer.
[in]composite_paramsCompositing parameters.

◆ NvBufferCreate()

int NvBufferCreate ( int *  dmabuf_fd,
int  width,
int  height,
NvBufferLayout  layout,
NvBufferColorFormat  colorFormat 
)

Allocates a hardware buffer (deprecated).

Deprecated:
Use NvBufferCreateEx() instead.
Parameters
[out]dmabuf_fdReturns the DMABUF FD of the hardware buffer.
[in]widthBuffer width, in bytes.
[in]heightBuffer height, in bytes.
[in]layoutLayout of the buffer.
[in]colorFormatColor format of the buffer.
Returns
0 if successful, or -1 otherwise.

◆ NvBufferCreateEx()

int NvBufferCreateEx ( int *  dmabuf_fd,
NvBufferCreateParams input_params 
)

Allocates a hardware buffer.

Parameters
[out]dmabuf_fdReturns the DMABUF FD of the hardware buffer.
[in]input_paramsInput parameters for hardware buffer creation.
Returns
0 for success, -1 for failure

◆ NvBufferCreateInterlace()

int NvBufferCreateInterlace ( int *  dmabuf_fd,
NvBufferCreateParams input_params 
)

Allocates a hardware buffer for interlace scan format.

Parameters
[out]dmabuf_fdReturns the DMABUF FD of the hardware buffer.
[in]input_paramsInput parameters for hardware buffer creation.
Returns
0 for success, -1 for failure

◆ NvBufferCreateWithChromaLoc()

int NvBufferCreateWithChromaLoc ( int *  dmabuf_fd,
NvBufferCreateParams input_params,
NvBufferChromaSubsamplingParams chromaSubsampling 
)

Allocates a hardware buffer with a given chroma subsampling location.

Parameters
[in]dmabuf_fdDMABUF FD of the buffer.
[in]input_paramsInput parameters for hardware buffer creation.
[in]chromaSubsamplingChroma location parameters.
Returns
0 for success, -1 for failure

◆ NvBufferDestroy()

int NvBufferDestroy ( int  dmabuf_fd)

Destroys a hardware buffer.

Parameters
[in]dmabuf_fdSpecifies the dmabuf_fd hw_buffer to destroy.
Returns
0 for success, -1 for failure.

◆ NvBufferGetParams()

int NvBufferGetParams ( int  dmabuf_fd,
NvBufferParams params 
)

Gets buffer parameters.

Parameters
[in]dmabuf_fdDMABUF FD of buffer.
[out]paramsA pointer to the structure to fill with parameters.
Returns
0 for success, -1 for failure.

◆ NvBufferGetParamsEx()

int NvBufferGetParamsEx ( int  dmabuf_fd,
NvBufferParamsEx exparams 
)

Gets buffer extended parameters.

Parameters
[in]dmabuf_fdDMABUF FD of buffer.
[out]exparamsA pointer to the structure to fill with extended parameters.
Returns
0 for success, -1 for failure.

◆ NvBufferGetSize()

int NvBufferGetSize ( void  )

This method can be used to get hardware Buffer struct size.

Returns
hardware Buffer struct size.

◆ NvBufferMemMap()

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:

  • CPU: If the CPU modifies any mapped memory, the client must call NvBufferMemSyncForDevice() before any hardware device accesses the memory.
  • Hardware device: If the mapped memory is modified by any hardware device, the client must call NvBufferMemSyncForCpu() before CPU accesses the memory.
Parameters
[in]dmabuf_fdDMABUF FD of buffer.
[in]planevideo frame plane.(Applies to NvBufferPayload_SurfArray.)
[in]memflagNvBuffer memory flag.
[out]pVirtAddrVirtual Address pointer of the memory-mapped plane.
Returns
0 for success, -1 for failure.

◆ NvBufferMemMapEx()

int NvBufferMemMapEx ( int  dmabuf_fd,
NvBufferParamsEx exparams,
unsigned int  plane,
NvBufferMemFlags  memflag,
void **  pVirtAddr 
)

Gets the memory-mapped virtual address of the plane, API to be used for another process.

The client must call NvBufferMemSyncForCpuEx() with the virtual address returned by this function before accessing the mapped memory in CPU in another process.

After memory mapping is complete, mapped memory modification must be coordinated between the CPU and hardware device as follows:

  • CPU: If the CPU modifies any mapped memory, the client must call NvBufferMemSyncForDeviceEx() before any hardware device accesses the memory.
  • Hardware device: If the mapped memory is modified by any hardware device, the client must call NvBufferMemSyncForCpuEx() before CPU accesses the memory.
Parameters
[in]dmabuf_fdDMABUF FD of buffer.
[in]exparamsextended parameters for a hardware buffer.
[in]planevideo frame plane.(Applies to NvBufferPayload_SurfArray.)
[in]memflagNvBuffer memory flag.
[out]pVirtAddrVirtual Address pointer of the memory-mapped plane.
Returns
0 for success, -1 for failure.

◆ NvBufferMemSyncForCpu()

int NvBufferMemSyncForCpu ( int  dmabuf_fd,
unsigned int  plane,
void **  pVirtAddr 
)

Syncs the hardware memory cache for the CPU.

See also
NvBufferMemMap for the purpose of the function
Parameters
[in]dmabuf_fdDMABUF FD of buffer.
[in]planevideo frame plane.
[in]pVirtAddrVirtual Address pointer of the memory-mapped plane.
Returns
0 for success, -1 for failure.

◆ NvBufferMemSyncForCpuEx()

int NvBufferMemSyncForCpuEx ( int  dmabuf_fd,
NvBufferParamsEx exparams,
unsigned int  plane,
void **  pVirtAddr 
)

Syncs the hardware memory cache for the CPU, API to be used for another process.

See also
NvBufferMemMapEx for the purpose of the function
Parameters
[in]dmabuf_fdDMABUF FD of buffer.
[in]exparamsextended parameters for a hardware buffer.
[in]planevideo frame plane.
[in]pVirtAddrVirtual Address pointer of the memory-mapped plane.
Returns
0 for success, -1 for failure.

◆ NvBufferMemSyncForDevice()

int NvBufferMemSyncForDevice ( int  dmabuf_fd,
unsigned int  plane,
void **  pVirtAddr 
)

Syncs the hardware memory cache for the device.

See also
NvBufferMemMap for the purpose of the function
Parameters
[in]dmabuf_fdDMABUF FD of buffer.
[in]planevideo frame plane.
[in]pVirtAddrVirtual Address pointer of the memory-mapped plane.
Returns
0 for success, -1 for failure.

◆ NvBufferMemSyncForDeviceEx()

int NvBufferMemSyncForDeviceEx ( int  dmabuf_fd,
NvBufferParamsEx exparams,
unsigned int  plane,
void **  pVirtAddr 
)

Syncs the hardware memory cache for the device, API to be used for another process.

See also
NvBufferMemMapEx for the purpose of the function
Parameters
[in]dmabuf_fdDMABUF FD of buffer.
[in]exparamsextended parameters for a hardware buffer.
[in]planevideo frame plane.
[in]pVirtAddrVirtual Address pointer of the memory-mapped plane.
Returns
0 for success, -1 for failure.

◆ NvBufferMemUnMap()

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:

  • Mapped memory was modified by the CPU.
  • Mapped memory will be accessed by a hardware device.
Parameters
[in]dmabuf_fdDMABUF FD of the buffer.
[in]planeVideo frame plane. Applies to NvBufferPayload_SurfArray.
[in]pVirtAddrVirtual address pointer to the memory-mapped plane.
Returns
0 for success, -1 for failure.

◆ NvBufferMemUnMapEx()

int NvBufferMemUnMapEx ( int  dmabuf_fd,
NvBufferParamsEx exparams,
unsigned int  plane,
void **  pVirtAddr 
)

Unmaps the mapped virtual address of the plane, API to be used for another process.

If the following conditions are both true, the client must call NvBufferMemSyncForDeviceEx() before unmapping the memory in another process:

  • Mapped memory was modified by the CPU.
  • Mapped memory will be accessed by a hardware device.
Parameters
[in]dmabuf_fdDMABUF FD of the buffer.
[in]exparamsextended parameters for a hardware buffer.
[in]planeVideo frame plane. Applies to NvBufferPayload_SurfArray.
[in]pVirtAddrVirtual address pointer to the memory-mapped plane.
Returns
0 for success, -1 for failure.

◆ NvBufferSessionCreate()

NvBufferSession NvBufferSessionCreate ( void  )

Creates a new NvBufferSession for parallel scheduling of buffer transformations and compositions.

Returns
A session pointer, NULL for failure.

◆ NvBufferSessionDestroy()

void NvBufferSessionDestroy ( NvBufferSession  session)

Destroys an existing NvBufferSession.

Parameters
[in]sessionAn existing NvBufferSession.

◆ NvBufferSyncObjWait()

int NvBufferSyncObjWait ( NvBufferSyncObjParams syncobj_params,
unsigned int  timeout 
)

This method can be used to wait on sync point ID.

Parameters
[in]syncobj_paramssync point object parameters.
[in]timeoutsync point wait timeout value.
Returns
0 for success, -1 for failure

◆ NvBufferTransform()

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.

Parameters
[in]src_dmabuf_fdDMABUF FD of source buffer
[in]dst_dmabuf_fdDMABUF FD of destination buffer
[in]transform_paramstransform parameters
Returns
0 for sucess, -1 for failure.

◆ NvBufferTransformAsync()

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.

Parameters
[in]src_dmabuf_fdDMABUF FD of source buffer
[in]dst_dmabuf_fdDMABUF FD of destination buffer
[in]transform_paramstransform parameters
[in]syncobjnvbuffer sync point object
Returns
0 for sucess, -1 for failure.

◆ NvBufferTransformEx()

int NvBufferTransformEx ( int  src_dmabuf_fd,
NvBufferParamsEx input_params,
int  dst_dmabuf_fd,
NvBufferParamsEx output_params,
NvBufferTransformParams transform_params 
)

Transforms one DMA buffer to another DMA buffer, API to be used for another process.

This function can support transforms for copying, scaling, fliping, rotating, and cropping.

Parameters
[in]src_dmabuf_fdDMABUF FD of source buffer
[in]input_paramsextended input parameters for a hardware buffer.
[in]dst_dmabuf_fdDMABUF FD of destination buffer
[in]output_paramsextended output parameters for a hardware buffer.
[in]transform_paramstransform parameters
Returns
0 for sucess, -1 for failure.

◆ NvDestroyEGLImage()

int NvDestroyEGLImage ( EGLDisplay  display,
EGLImageKHR  eglImage 
)

Destroys an EGLImage object.

Parameters
[in]displayAn EGLDisplay object used to destroy the EGLImage. If NULL, nvbuf_utils() uses its own instance of EGLDisplay.
[in]eglImageThe EGLImageKHR object to be destroyed.
Returns
0 for success, -1 for failure

◆ NvEGLImageFromFd()

EGLImageKHR NvEGLImageFromFd ( EGLDisplay  display,
int  dmabuf_fd 
)

Creates an instance of EGLImage from a DMABUF FD.

Parameters
[in]displayAn EGLDisplay object used during the creation of the EGLImage. If NULL, nvbuf_utils() uses its own instance of EGLDisplay.
[in]dmabuf_fdDMABUF FD of the buffer from which the EGLImage is to be created.
Returns
EGLImageKHR for success, NULL for failure

◆ NvReleaseFd()

int NvReleaseFd ( int  dmabuf_fd)

Releases the dmabuf_fd buffer.

See also
ExtractfdFromNvBuffer()
Parameters
[in]dmabuf_fdSpecifies the dmabuf_fd to release.
Returns
0 for success, -1 for failure.

◆ Raw2NvBuffer()

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.

Parameters
[in]ptrpointer to the input raw plane data.
[in]planevideo frame plane.
[in]in_widthaligned width of the raw data plane.
[in]in_heightaligned height of the raw data plane.
[in]dmabuf_fdDMABUF FD of NvBuffer.
Returns
0 for success, -1 for failure.