|
Jetson Linux API Reference
|
32.7.6 Release
|
Go to the documentation of this file.
26 #ifndef _NVBUF_UTILS_H_
27 #define _NVBUF_UTILS_H_
35 #include <EGL/eglext.h>
39 #include <cutils/native_handle.h>
45 #define MAX_NUM_PLANES 4
50 #define MAX_COMPOSITE_FRAME 16
56 #define NVBUF_CHROMA_SUBSAMPLING_HORIZ_DEFAULT 0
57 #define NVBUF_CHROMA_SUBSAMPLING_VERT_DEFAULT 1
62 #define NVBUF_MAX_SYNCOBJ_PARAMS 5
70 #define NVBUFFER_SYNCPOINT_WAIT_INFINITE 0xFFFFFFFF
425 #define NVBUF_CHROMA_SUBSAMPLING_PARAMS_DEFAULT \
427 NVBUF_CHROMA_SUBSAMPLING_HORIZ_DEFAULT, \
428 NVBUF_CHROMA_SUBSAMPLING_VERT_DEFAULT \
865 int NvBuffer2Raw (
int dmabuf_fd,
unsigned int plane,
unsigned int out_width,
unsigned int out_height,
unsigned char *ptr);
877 int Raw2NvBuffer (
unsigned char *ptr,
unsigned int plane,
unsigned int in_width,
unsigned int in_height,
int dmabuf_fd);
972 int NvBufferImportGetBufferId(uint64_t *out_buf_id, buffer_handle_t handle);
983 int NvBufferImportGraphicBufferFd(
int *out_dmabuf_fd, buffer_handle_t *handle,
NvBufferParamsEx *exparams);
uint32_t secondfieldoffset[MAX_NUM_PLANES]
offset of the second field for interlaced buffer.
NvBufferDisplayScanFormat scanformat[MAX_NUM_PLANES]
display scan format - progressive/interlaced.
@ NvBufferColorFormat_NV12_12LE_2020
BT.2020 colorspace - Y/CbCr 4:2:0 12-bit multi-planar.
uint32_t psize[MAX_NUM_PLANES]
size of each vodeo planes of hardware buffer.
#define NVBUF_MAX_SYNCOBJ_PARAMS
Defines the maximum number of sync object parameters.
float b
background color value for b.
int NvBufferSyncObjParamsFromFile(int file, NvBufferSyncObjParams *syncobjparams, unsigned int *nparams)
This method can be used to get sync point object parameters from sync point FD.
@ NvBufferColorFormat_NV24_12LE_2020
BT.2020 colorspace - Y/CbCr 12 bit 4:4:4 multi-planar.
@ NVBUFFER_BLEND
flag to set for blending.
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.
@ NvBufferColorFormat_NV16_10LE
BT.601 colorspace - Y/CbCr 4:2:2 10-bit semi-planar.
NvBufferLayout
Defines Layout formats for NvBuffer video planes.
EGLImageKHR NvEGLImageFromFd(EGLDisplay display, int dmabuf_fd)
Creates an instance of EGLImage from a DMABUF FD.
NvBufferTag
Defines tags that identify the components requesting a memory allocation.
NvBufferSyncObjParams outsyncobj
@ NvBufferColorFormat_RGBA_10_10_10_2_709
Non-linear RGB BT.709 colorspace - RGBA-10-10-10-2 planar.
@ NvBufferColorFormat_NV12
BT.601 colorspace - Y/CbCr 4:2:0 multi-planar.
@ NvBufferColorFormat_NV12_10LE_2020
BT.2020 colorspace - Y/CbCr 4:2:0 10-bit multi-planar.
int NvBufferComposite(int *src_dmabuf_fds, int dst_dmabuf_fd, NvBufferCompositeParams *composite_params)
Composites multiple input DMA buffers to one output DMA buffer.
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.
@ NVBUFFER_TRANSFORM_CROP_DST
transform flag to crop destination rectangle.
@ NvBufferMem_Write
Memory write.
@ NvBufferColorFormat_YUV420
BT.601 colorspace - YUV420 multi-planar.
struct _NvBufferCDEParams NvBufferCDEParams
Holds CDE parameters.
uint32_t offset[MAX_NUM_PLANES]
memory offset values of each video planes of hardware buffer.
@ NvBufferTransform_Filter_Nearest
transform filter nearest.
NvBufferTransform_Flip
Defines video flip methods.
@ NvBufferColorFormat_NV24
BT.601 colorspace - Y/CbCr 4:4:4 multi-planar.
int32_t memsize
size of the memory.
struct _NvBufferTransformParams NvBufferTransformParams
Holds parameters for buffer transform functions.
uint32_t dmabuf_fd
Holds the DMABUF FD of the hardware buffer.
@ NvBufferColorFormat_NV24_709
BT.709 colorspace - Y/CbCr 4:4:4 multi-planar.
@ NvBufferColorFormat_NV16
BT.601 colorspace - Y/CbCr 4:2:2 multi-planar.
@ NvBufferMem_Read_Write
Memory read & write.
@ NvBufferColorFormat_NV21_ER
BT.601 colorspace - Y/CbCr ER 4:2:0 multi-planar.
@ NvBufferColorFormat_YUYV_ER
BT.601 colorspace - YUV ER 4:2:2 planar.
NvBufferRect dst_rect
destination rectangle coordinates for crop opeartion.
@ NvBufferColorFormat_NV12_10LE_709
BT.709 colorspace - Y/CbCr 4:2:0 10-bit multi-planar.
NvBufferPayloadType payloadType
payload type of the buffer.
int NvBufferGetParamsEx(int dmabuf_fd, NvBufferParamsEx *exparams)
Gets buffer extended parameters.
float g
background color value for g.
@ NvBufferColorFormat_A32
Optical flow SAD calculation Buffer format.
@ NvBufferColorFormat_XRGB32
LegacyRGBA colorspace - XRGB-8-8-8-8 planar.
@ NvBufferColorFormat_NV16_ER
BT.601_ER colorspace - Y/CbCr 4:2:2 multi-planar.
int NvBufferGetSize(void)
This method can be used to get hardware Buffer struct size.
Holds parameters related to compositing/blending.
struct _NvBufferParamsEx NvBufferParamsEx
Holds extended parameters for a hardware buffer.
@ NvBufferColorFormat_YUV420_709_ER
BT.709 colorspace - YUV420 ER multi-planar.
int ExtractFdFromNvBuffer(void *nvbuf, int *dmabuf_fd)
Extracts the dmabuf_fd from the hardware buffer.
int32_t width
width of the buffer.
@ NvBufferTransform_Filter_Smart
transform filter smart.
@ NvBufferMem_Read
Memory read.
uint32_t height
rectangle height.
int NvBufferMemUnMap(int dmabuf_fd, unsigned int plane, void **pVirtAddr)
Unmaps the mapped virtual address of the plane.
int32_t startofvaliddata
offset in bytes from the start of the buffer to the first valid byte.
Holds parameters for a hardware buffer.
int NvBufferTransform(int src_dmabuf_fd, int dst_dmabuf_fd, NvBufferTransformParams *transform_params)
Transforms one DMA buffer to another DMA buffer.
struct _NvBufferChromaSubSamplingParams NvBufferChromaSubsamplingParams
Holds Chroma Subsampling parameters.
@ NvBufferColorFormat_NV21
BT.601 colorspace - Y/CbCr 4:2:0 multi-planar.
@ NvBufferTransform_FlipY
Video flip with respect to Y-axis.
@ NVBUFFER_COMPOSITE
flag to set for composition.
@ NVBUFFER_TRANSFORM_FILTER
transform flag to set filter type.
@ NVBUFFER_TRANSFORM_CROP_SRC
transform flag to crop source rectangle.
@ NvBufferTransform_Filter_Bilinear
transform filter bilinear.
@ NvBufferColorFormat_NV16_709
BT.709 colorspace - Y/CbCr 4:2:2 multi-planar.
NvBufferCompression
Defines Compression flag for NvBuffer.
@ 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.
NvBufferPayloadType payloadType
payload type of the buffer.
NvBufferSession NvBufferSessionCreate(void)
Creates a new NvBufferSession for parallel scheduling of buffer transformations and compositions.
@ NvBufferColorFormat_BGRA_10_10_10_2_709
Non-linear RGB BT.709 colorspace - BGRA-10-10-10-2 planar.
Holds extended parameters for a hardware buffer.
int NvBufferDestroy(int dmabuf_fd)
Destroys a hardware buffer.
@ NvBufferColorFormat_NV12_709_ER
BT.709 colorspace - Y/CbCr ER 4:2:0 multi-planar.
uint32_t CdeScatterBufferOffset[MAX_NUM_PLANES]
CDE scatter buffer offset.
NvBufferTransform_Filter
Defines transform video filter types.
@ NvBufferTransform_Rotate90
Video flip rotate 90 degree counter-clockwise.
uint32_t layout[MAX_NUM_PLANES]
layout type of each planes of hardware buffer.
void * nv_buffer
pointer to hardware buffer memory.
@ NvBufferLayout_BlockLinear
BlockLinear Layout.
int NvBufferMemSyncForDevice(int dmabuf_fd, unsigned int plane, void **pVirtAddr)
Syncs the hardware memory cache for the device.
Holds parameters for buffer sync point object.
@ NVBUFFER_TRANSFORM_FLIP
transform flag to set flip method.
@ NvBufferTransform_InvTranspose
Video flip inverse transpode.
int32_t memsize
size of the memory.
@ NvBufferColorFormat_NV24_ER
BT.601_ER colorspace - Y/CbCr 4:4:4 multi-planar.
void * payloadmetaInfo
metadata associated with the hardware buffer.
NvBufferTransform_Filter composite_filter[MAX_COMPOSITE_FRAME]
filters to use for composition.
Holds the input parameters for hardware buffer creation.
uint32_t height[MAX_NUM_PLANES]
height of each planes of hardware buffer.
@ NvBufferColorFormat_YVYU
BT.601 colorspace - YUV 4:2:2 planar.
NvBufferColorFormat
Defines color formats for NvBuffer.
NvBufferDisplayScanFormat
Defines display scan formats for NvBuffer video planes.
@ NvBufferColorFormat_YVYU_ER
BT.601 colorspace - YUV ER 4:2:2 planar.
@ NvBufferDisplayScanFormat_Interlaced
Interlaced scan formats.
@ NvBufferColorFormat_NV12_12LE
BT.601 colorspace - Y/CbCr 4:2:0 12-bit multi-planar.
NvBufferRect src_comp_rect[MAX_COMPOSITE_FRAME]
source rectangle coordinates of input buffers for composition.
NvBufferColorFormat pixel_format
video format type of hardware buffer.
uint32_t nv_buffer_size
size of hardware buffer.
@ NvBufferTransform_Rotate270
Video flip rotate 270 degree counter-clockwise.
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.
NvBufferTransform_Flag
Defines flags to indicate for valid transform.
@ NvBufferColorFormat_RGBA_10_10_10_2_2020
Non-linear RGB BT.2020 colorspace - RGBA-10-10-10-2 planar.
int NvBufferCreateInterlace(int *dmabuf_fd, NvBufferCreateParams *input_params)
Allocates a hardware buffer for interlace scan format.
int NvReleaseFd(int dmabuf_fd)
Releases the dmabuf_fd buffer.
@ NvBufferColorFormat_SignedR16G16
Optical flow.
uint32_t left
rectangle left.
@ NvBufferCompression_Disabled
Compression disabled.
int NvBufferMemSyncForCpu(int dmabuf_fd, unsigned int plane, void **pVirtAddr)
Syncs the hardware memory cache for the CPU.
@ NvBufferColorFormat_GRAY8
8-bit grayscale.
@ NvBufferCompression_Enabled
GPU compression enabled.
float r
background color value for r.
@ NvBufferTag_VIDEO_DEC
tag for H264/H265/VP9 Video Decoder.
@ NvBufferColorFormat_VYUY
BT.601 colorspace - YUV 4:2:2 planar.
@ NvBufferTag_JPEG
tag for Jpeg Encoder/Decoder.
#define MAX_COMPOSITE_FRAME
Defines the maximum number of input video frames that can be used for composition.
int NvBufferSyncObjWait(NvBufferSyncObjParams *syncobj_params, unsigned int timeout)
This method can be used to wait on sync point ID.
NvBufferSession session
NvBufferSession to be used for transform.
@ NvBufferColorFormat_NV12_2020
BT.2020 colorspace - Y/CbCr 4:2:0 multi-planar.
NvBufferParams params
nvbuffer basic parameters.
@ NvBufferTransform_Filter_10_Tap
transform filter 10 tap.
uint32_t CdeCompbitsSize[MAX_NUM_PLANES]
CDE compression bits size.
NvBufferLayout layout
layout of the buffer.
@ NvBufferColorFormat_BGRA_10_10_10_2_2020
Non-linear RGB BT.2020 colorspace - BGRA-10-10-10-2 planar.
uint32_t top
rectangle top.
int NvBufferCreateCompressed(int *dmabuf_fd, NvBufferCreateParams *input_params)
Allocates a hardware buffer with compression enabled.
uint32_t pitch[MAX_NUM_PLANES]
pitch of each planes of hardware buffer.
@ NvBufferTag_VIDEO_CONVERT
tag for Video Transform/Composite.
@ NvBufferTag_NONE
tag None.
int NvBufferImportFd(int in_dmabuf_fd, int *out_dmabuf_fd, NvBufferParamsEx *in_params)
Imports DMA buffer FD received from another process and create hardware buffer using the input params...
uint32_t width[MAX_NUM_PLANES]
width of each planes of hardware buffer.
NvBufferRect src_rect
source rectangle coordinates for crop opeartion.
int NvBufferGetParams(int dmabuf_fd, NvBufferParams *params)
Gets buffer parameters.
@ NvBufferColorFormat_NV24_10LE
BT.601 colorspace - Y/CrCb 4:4:4 10-bit multi-planar.
NvBufferRect dst_comp_rect[MAX_COMPOSITE_FRAME]
destination rectangle coordinates of input buffers for composition.
Holds Chroma Subsampling parameters.
NvBufferColorFormat colorFormat
colorformat of the buffer.
NvBufferComposite_Flag
Defines flags that specify valid composition/blending operations.
@ NvBufferColorFormat_UYVY_ER
BT.601 colorspace - YUV ER 4:2:2 planar.
NvBufferCompositeBackground composite_bgcolor
background color values for composition.
@ NvBufferColorFormat_YUV444
BT.601 colorspace - YUV444 multi-planar.
@ NvBufferTransform_Rotate180
Video flip rotate 180 degree.
@ NvBufferColorFormat_ABGR32
LegacyRGBA colorspace - BGRA-8-8-8-8 planar.
uint32_t physicaladdress[MAX_NUM_PLANES]
physical address of allocated planes.
@ NvBufferColorFormat_NV24_10LE_709_ER
BT.709 ER colorspace - Y/CbCr 10 bit 4:4:4 multi-planar.
struct _NvBufferSyncObjParams NvBufferSyncObjParams
Holds parameters for buffer sync point object.
@ NvBufferTag_CAMERA
tag for Camera.
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.
@ NvBufferColorFormat_VYUY_ER
BT.601 colorspace - YUV ER 4:2:2 planar.
@ NvBufferColorFormat_YUV422
BT.601 colorspace - YUV422 multi-planar.
uint32_t transform_flag
flag to indicate which of the transform parameters are valid.
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.
NvBufferSyncObjParams insyncobj[NVBUF_MAX_SYNCOBJ_PARAMS]
uint32_t CdeHorizontalCompbitsOffset[MAX_NUM_PLANES]
CDE horizontal compression bits offset.
uint32_t CdeVerticalCompbitsOffset[MAX_NUM_PLANES]
CDE vertical compression bits offset.
@ NvBufferColorFormat_UYVY
BT.601 colorspace - YUV 4:2:2 planar.
Holds composition background r,g,b colors.
uint32_t width
rectangle width.
void NvBufferSessionDestroy(NvBufferSession session)
Destroys an existing NvBufferSession.
@ NvBufferColorFormat_YUV420_2020
BT.2020 colorspace - YUV420 multi-planar.
NvBufferTransform_Filter transform_filter
transform filter.
uint32_t blockheightlog2[MAX_NUM_PLANES]
block height of the planes for blockLinear layout hardware buffer.
@ NvBufferColorFormat_Invalid
Invalid color format.
@ NvBufferTransform_FlipX
Video flip with respect to X-axis.
@ NvBufferTransform_Transpose
Video flip transpose.
@ NvBufferColorFormat_NV12_10LE_709_ER
BT.709_ER colorspace - Y/CbCr 4:2:0 10-bit multi-planar.
uint8_t chromaLocHoriz
location settings
@ NvBufferColorFormat_NV16_709_ER
BT.709_ER colorspace - Y/CbCr 4:2:2 multi-planar.
uint32_t composite_flag
flag to indicate which of the composition/blending parameters are valid.
int32_t sizeofvaliddatainbytes
size of the valid data from the first to the last valid byte.
int NvDestroyEGLImage(EGLDisplay display, EGLImageKHR eglImage)
Destroys an EGLImage object.
NvBufferSession session
NvBufferSession to be used for composition.
@ NvBufferColorFormat_NV12_709
BT.709 colorspace - Y/CbCr 4:2:0 multi-planar.
@ NvBufferLayout_Pitch
Pitch Layout.
struct _NvBufferSyncObjRec NvBufferSyncObj
buffer sync point object.
Holds coordinates for a rectangle.
NvBufferChromaSubsamplingParams chromaSubsampling
chroma subsampling parameters
@ NvBufferColorFormat_YUV420_709
BT.709 colorspace - YUV420 multi-planar.
int NvBufferCreate(int *dmabuf_fd, int width, int height, NvBufferLayout layout, NvBufferColorFormat colorFormat)
Allocates a hardware buffer (deprecated).
int NvBufferMemMap(int dmabuf_fd, unsigned int plane, NvBufferMemFlags memflag, void **pVirtAddr)
Gets the memory-mapped virtual address of the plane.
NvBufferTag nvbuf_tag
tag to associate with the buffer.
uint32_t num_planes
number of planes of hardware buffer.
@ NvBufferTag_PROTECTED
tag for VPR Buffers.
struct _NvBufferSession * NvBufferSession
Holds an opaque NvBuffer session type required for parallel buffer tranformations and compositions.
@ NvBufferTransform_None
Video flip none.
struct _NvBufferCreateParams NvBufferCreateParams
Holds the input parameters for hardware buffer creation.
@ NvBufferColorFormat_ARGB32
LegacyRGBA colorspace - ARGB-8-8-8-8 planar.
uint64_t flags[MAX_NUM_PLANES]
flags associated with planes
@ NvBufferDisplayScanFormat_Progressive
Progessive scan formats.
NvBufferCDEParams * cde_params
CDE parameters.
NvBufferPayloadType
Defines Payload types for NvBuffer.
@ NVBUFFER_COMPOSITE_FILTER
composition flag to set filter type.
@ NvBufferTag_VIDEO_ENC
tag for H264/H265 Video Encoder.
float dst_comp_rect_alpha[MAX_COMPOSITE_FRAME]
alpha values of input buffers for the blending.
@ NvBufferPayload_SurfArray
buffer payload with hardware memory handle for set of planes.
int NvBufferCreateEx(int *dmabuf_fd, NvBufferCreateParams *input_params)
Allocates a hardware buffer.
struct _NvBufferParams NvBufferParams
Holds parameters for a hardware buffer.
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).
@ NvBufferColorFormat_YVU420
BT.601 colorspace - YUV420 multi-planar.
buffer sync point object.
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.
@ NvBufferTransform_Filter_Nicest
transform filter nicest.
NvBufferMemFlags
Defines memory access flags for NvBuffer.
@ NvBufferColorFormat_YUYV
BT.601 colorspace - YUV 4:2:2 planar.
@ NvBufferColorFormat_YUV420_ER
BT.601 colorspace - YUV420 ER multi-planar.
@ NvBufferColorFormat_NV21_10LE
BT.601 colorspace - Y/CrCb 4:2:0 10-bit multi-planar.
uint32_t input_buf_count
number of the input buffers to be composited.
struct _NvBufferCompositeParams NvBufferCompositeParams
Holds parameters related to compositing/blending.
int NvBufferCreateWithChromaLoc(int *dmabuf_fd, NvBufferCreateParams *input_params, NvBufferChromaSubsamplingParams *chromaSubsampling)
Allocates a hardware buffer with a given chroma subsampling location.
@ NvBufferColorFormat_NV24_10LE_2020
BT.2020 colorspace - Y/CbCr 10 bit 4:4:4 multi-planar.
@ NvBufferColorFormat_NV12_ER
BT.601 colorspace - Y/CbCr ER 4:2:0 multi-planar.
@ NvBufferColorFormat_NV21_12LE
BT.601 colorspace - Y/CrCb 4:2:0 12-bit multi-planar.
Holds parameters for buffer transform functions.
@ NvBufferTransform_Filter_5_Tap
transform filter 5 tap.
NvBufferSyncObj syncobj
buffer sync point object parameters
#define MAX_NUM_PLANES
Defines the maximum number of planes for a video frame.
@ NvBufferColorFormat_NV12_10LE
BT.601 colorspace - Y/CbCr 4:2:0 10-bit multi-planar.
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.
int32_t height
height of the buffer.
NvBufferTransform_Flip transform_flip
flip method.
@ NvBufferPayload_MemHandle
buffer payload with hardware memory handle for specific memory size.
bool is_protected
get buffer vpr information.
@ NvBufferColorFormat_YVU420_ER
BT.601 colorspace - YVU420 ER multi-planar.