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