|
Jetson Linux API Reference
|
35.3.1 Release
|
Go to the documentation of this file.
28 #ifndef NVBUFSURFACE_H_
29 #define NVBUFSURFACE_H_
46 #define STRUCTURE_PADDING 4
49 #define NVBUF_MAX_PLANES 4
55 #define NVBUFSURFACE_CHROMA_SUBSAMPLING_HORIZ_DEFAULT 0
56 #define NVBUFSURFACE_CHROMA_SUBSAMPLING_VERT_DEFAULT 1
58 #define NVBUFSURFACE_CHROMA_SUBSAMPLING_PARAMS_DEFAULT \
60 NVBUFSURFACE_CHROMA_SUBSAMPLING_HORIZ_DEFAULT, \
61 NVBUFSURFACE_CHROMA_SUBSAMPLING_VERT_DEFAULT \
678 int NvBufSurface2Raw (
NvBufSurface *Surf,
unsigned int index,
unsigned int plane,
unsigned int out_width,
unsigned int out_height,
unsigned char *ptr);
696 int Raw2NvBufSurface (
unsigned char *ptr,
unsigned int index,
unsigned int plane,
unsigned int in_width,
unsigned int in_height,
NvBufSurface *Surf);
struct NvBufSurfaceParamsEx NvBufSurfaceParamsEx
Hold the information(extended) of single buffer in the batch.
NvBufSurfaceLayout layout
Holds BL or PL layout.
@ NVBUF_COLOR_FORMAT_NV12_10LE
Specifies BT.601 colorspace - Y/CbCr 4:2:0 10-bit multi-planar.
@ NVBUF_COLOR_FORMAT_YUV420_709_ER
Specifies BT.709 colorspace - YUV420 ER multi-planar.
@ NvBufSurfaceTag_VIDEO_DEC
tag for H264/H265/VP9 Video Decoder.
@ NVBUF_COLOR_FORMAT_NV12_709
Specifies BT.709 colorspace - Y/CbCr 4:2:0 multi-planar.
struct NvBufSurfaceMappedAddr NvBufSurfaceMappedAddr
Hold the pointers of mapped buffer.
uint64_t fd
Holds a DMABUF FD.
NvBufSurfaceColorFormat colorFormat
Holds the color format of the buffer.
uint64_t flags
Holds flags associated with the planes.
@ NVBUF_COLOR_FORMAT_YUV420_2020
Specifies BT.2020 colorspace - YUV420 multi-planar.
int32_t sizeofvaliddatainbytes
size of the valid data from the first to the last valid byte.
Holds Chroma Subsampling parameters for NvBufSurface allocation.
Holds plane wise parameters(extended) of a buffer.
uint32_t height
Holds the height of the buffer.
@ NVBUF_MEM_CUDA_PINNED
Specifies CUDA Host memory type.
@ NVBUF_COLOR_FORMAT_A32
Specifies Optical flow SAD calculation Buffer format.
Holds plane parameters to map the buffer received from another process.
uint32_t offset
Holds the offsets of planes in bytes.
int NvBufSurfaceSyncForDevice(NvBufSurface *surf, int index, int plane)
Syncs the hardware memory cache for the device.
@ NvBufSurfaceTag_PROTECTED
tag for VPR Buffers.
void * _reserved[STRUCTURE_PADDING *NVBUF_MAX_PLANES]
int NvBufSurfaceMap(NvBufSurface *surf, int index, int plane, NvBufSurfaceMemMapFlags type)
Maps hardware batched buffers to the HOST or CPU address space.
@ NVBUF_COLOR_FORMAT_VYUY
Specifies BT.601 colorspace - YUV 4:2:2 planar.
@ NVBUF_DISPLAYSCANFORMAT_INTERLACED
Interlaced scan formats.
NvBufSurfaceDisplayScanFormat scanformat[NVBUF_MAX_PLANES]
display scan format - progressive/interlaced.
uint32_t psize[NVBUF_MAX_PLANES]
Holds the sizes of planes in bytes.
uint32_t _reservedParam
Used void* from custom param for 64 bit machine, using other uint32_t param.
@ NVBUF_COLOR_FORMAT_B8_G8_R8
Specifies BGR- unsigned 8 bit multiplanar plane.
@ NVBUF_COLOR_FORMAT_UYVY
Specifies BT.601 colorspace - YUV 4:2:2 planar.
@ NVBUF_COLOR_FORMAT_VYUY_ER
Specifies BT.601 colorspace - YUV ER 4:2:2 planar.
NvBufSurfaceDisplayScanFormat
Defines display scan formats for NvBufSurface video planes.
@ NvBufSurfaceTag_CAMERA
tag for Camera.
@ NVBUF_COLOR_FORMAT_GRAY8
Specifies 8 bit GRAY scale - single plane.
@ NVBUF_COLOR_FORMAT_BGRA
Specifies BGRA-8-8-8-8 single plane.
NvBufSurfaceParams * surfaceList
Holds a pointer to an array of batched buffers.
bool is_protected
get buffer vpr information.
uint32_t width[NVBUF_MAX_PLANES]
Holds the widths of planes.
int NvBufSurfaceMemSet(NvBufSurface *surf, int index, int plane, uint8_t value)
Fills each byte of the buffer(s) in an NvBufSurface with a provided value.
@ NVBUF_COLOR_FORMAT_NV12_12LE
Specifies BT.601 colorspace - Y/CbCr 4:2:0 12-bit multi-planar.
struct NvBufSurfaceAllocateParams NvBufSurfaceAllocateParams
Hold extended parameters required to allocate NvBufSurface.
@ NVBUF_COLOR_FORMAT_NV16
Specifies BT.601 colorspace - Y/CbCr 4:2:2 multi-planar.
@ NVBUF_COLOR_FORMAT_YUV420_ER
Specifies BT.601 colorspace - YUV420 ER multi-planar.
Holds information about batched buffers.
@ NVBUF_COLOR_FORMAT_NV24_709_ER
Specifies BT.709_ER colorspace - Y/CbCr 4:4:4 multi-planar.
uint32_t secondfieldoffset[NVBUF_MAX_PLANES]
offset of the second field for interlaced buffer.
uint32_t height[NVBUF_MAX_PLANES]
Holds the heights of planes.
@ NvBufSurfaceTag_VIDEO_CONVERT
tag for Video Transform/Composite/Blend.
@ NVBUF_MEM_HANDLE
Specifies NVRM Handle type.
struct NvBufSurface NvBufSurface
Holds information about batched buffers.
@ NVBUF_COLOR_FORMAT_BGRx
Specifies BGRx-8-8-8-8 single plane.
@ NVBUF_COLOR_FORMAT_NV16_10LE
Specifies BT.601 colorspace - Y/CbCr 4:2:2 10-bit semi-planar.
@ NVBUF_COLOR_FORMAT_NV16_709_ER
Specifies BT.709_ER colorspace - Y/CbCr 4:2:2 multi-planar.
uint32_t height
Holds the heights of planes.
uint32_t width
Holds the width of the buffer.
void * dataPtr
Holds a pointer to allocated memory.
NvBufSurfaceMemType memType
Holds type of memory for buffers in the batch.
int NvBufSurfaceUnMapEglImage(NvBufSurface *surf, int index)
Destroys the previously created EGLImage object(s).
Holds buffer parameters to map the buffer received from another process.
@ NVBUF_MEM_CUDA_UNIFIED
Specifies CUDA Unified memory type.
NvBufSurfaceMemType memType
Holds the type of memory to be allocated.
@ NVBUF_COLOR_FORMAT_NV12_10LE_709_ER
Specifies BT.709 colorspace - Y/CbCr ER 4:2:0 10-bit multi-planar.
bool disablePitchPadding
disable pitch padding allocation only applicable for cuda and system memory allocation pitch would ...
int NvBufSurfaceAllocate(NvBufSurface **surf, uint32_t batchSize, NvBufSurfaceAllocateParams *paramsext)
Allocate batch of buffers.
@ NVBUF_MEM_CUDA_DEVICE
Specifies CUDA Device memory type.
uint32_t offset[NVBUF_MAX_PLANES]
Holds the offsets of planes in bytes.
uint8_t reserved[64]
Reserved.
@ NVBUF_COLOR_FORMAT_YVU420_ER
Specifies BT.601 colorspace - YVU420 ER multi-planar.
@ NVBUF_COLOR_FORMAT_YUV420_709
Specifies BT.709 colorspace - YUV420 multi-planar.
@ NVBUF_COLOR_FORMAT_UYVP
Specifies BT.601 colorspace - 10 bit YUV 4:2:2 interleaved.
@ NVBUF_COLOR_FORMAT_xRGB
Specifies xRGB-8-8-8-8 single plane.
@ NVBUF_COLOR_FORMAT_NV24_709
Specifies BT.709 colorspace - Y/CbCr 4:4:4 multi-planar.
NvBufSurfaceLayout layout
Holds the surface layout.
#define NVBUF_MAX_PLANES
Defines the maximum number of planes.
@ NVBUF_LAYOUT_PITCH
Specifies pitch layout.
NvBufSurfaceDisplayScanFormat displayscanformat
Display scan format.
NvBufSurfacePlaneParamsEx planeParamsex
plane wise extended info
@ NVBUF_MEM_DEFAULT
Specifies the default memory type, i.e.
@ NVBUF_COLOR_FORMAT_YUYV_ER
Specifies BT.601 colorspace - YUV ER 4:2:2 planar.
@ NVBUF_MEM_SYSTEM
Specifies memory allocated by malloc().
void * _reserved[STRUCTURE_PADDING *NVBUF_MAX_PLANES]
int NvBufSurfaceDestroy(NvBufSurface *surf)
Free the batched buffers previously allocated through NvBufSurfaceCreate.
@ NVBUF_COLOR_FORMAT_NV21_12LE
Specifies BT.601 colorspace - Y/CrCb 4:2:0 12-bit multi-planar.
NvBufSurfaceColorFormat colorFormat
Holds the color format of the buffer.
struct NvBufSurfaceMapParams NvBufSurfaceMapParams
Holds buffer parameters to map the buffer received from another process.
@ NVBUF_COLOR_FORMAT_NV24
Specifies BT.601 colorspace - Y/CbCr 4:4:4 multi-planar.
struct NvBufSurfacePlaneParams NvBufSurfacePlaneParams
Holds plane wise parameters of a buffer.
void * _reserved[STRUCTURE_PADDING-1]
NvBufSurfaceMemType memType
Holds type of memory.
@ NVBUF_COLOR_FORMAT_ARGB
Specifies ARGB-8-8-8-8 single plane.
@ NVBUF_COLOR_FORMAT_YVYU
Specifies BT.601 colorspace - YUV 4:2:2 planar.
@ NVBUF_COLOR_FORMAT_NV12_10LE_ER
Specifies BT.601 colorspace - Y/CbCr ER 4:2:0 10-bit multi-planar.
@ NVBUF_COLOR_FORMAT_NV12_2020
Specifies BT.2020 colorspace - Y/CbCr 4:2:0 multi-planar.
@ NVBUF_COLOR_FORMAT_xBGR
Specifies xBGR-8-8-8-8 single plane.
@ NVBUF_COLOR_FORMAT_YUYV
Specifies BT.601 colorspace - YUV 4:2:2 planar.
@ NVBUF_COLOR_FORMAT_NV16_709
Specifies BT.709 colorspace - Y/CbCr 4:2:2 multi-planar.
@ NVBUF_COLOR_FORMAT_B32F_G32F_R32F
Specifies BGR-32bit Floating point multiplanar plane.
uint64_t bufferDesc
Holds a DMABUF FD.
bool isContiguous
Holds an "is contiguous" flag.
#define STRUCTURE_PADDING
Defines the default padding length for reserved fields of structures.
NvBufSurfaceParamsEx * paramex
pointers of extended parameters of single buffer in the batch.
NvBufSurfaceLayout layout
Holds BL or PL.
struct NvBufSurfaceParams NvBufSurfaceParams
Hold the information of single buffer in the batch.
Hold the information of single buffer in the batch.
Hold the information(extended) of single buffer in the batch.
uint32_t psize
Holds the sizes of planes in bytes.
@ NVBUF_COLOR_FORMAT_NV21
Specifies BT.601 colorspace - Y/CbCr 4:2:0 multi-planar.
int NvBufSurfaceGetMapParams(const NvBufSurface *surf, int index, NvBufSurfaceMapParams *params)
Get buffer information to map the buffer in another process.
NvBufSurfaceChromaSubsamplingParams chromaSubsampling
Chroma Subsampling parameters.
@ NVBUF_COLOR_FORMAT_BGRA_10_10_10_2_709
Specifies Non-linear RGB BT.709 colorspace - BGRA-10-10-10-2 planar.
Hold the pointers of mapped buffer.
int NvBufSurface2Raw(NvBufSurface *Surf, unsigned int index, unsigned int plane, unsigned int out_width, unsigned int out_height, unsigned char *ptr)
Copies the NvBufSurface plane memory content to a raw buffer plane for a specific batched buffer.
void * addr[NVBUF_MAX_PLANES]
Holds planewise pointers to a CPU mapped buffer.
@ NVBUF_COLOR_FORMAT_SIGNED_R16G16
Specifies color format for packed 2 signed shorts
@ NVBUF_COLOR_FORMAT_RGBA_10_10_10_2_2020
Specifies Non-linear RGB BT.2020 colorspace - RGBA-10-10-10-2 planar.
@ NVBUF_COLOR_FORMAT_INVALID
Specifies an invalid color format.
uint32_t pitch
Holds the pitches of planes in bytes.
@ NVBUF_COLOR_FORMAT_RGB
Specifies RGB-8-8-8 single plane.
@ NVBUF_COLOR_FORMAT_RGBA_10_10_10_2_709
Specifies Non-linear RGB BT.709 colorspace - RGBA-10-10-10-2 planar.
NvBufSurfaceMappedAddr mappedAddr
Holds pointers to mapped buffers.
@ NVBUF_COLOR_FORMAT_R8_G8_B8
Specifies RGB- unsigned 8 bit multiplanar plane.
uint32_t gpuId
Holds a GPU ID.
uint32_t pitch
Holds the pitch of the buffer.
uint32_t numFilled
Holds the number valid and filled buffers.
NvBufSurfaceChromaSubsamplingParams chromaSubsampling
chroma subsampling parameters.
int NvBufSurfaceFromFd(int dmabuf_fd, void **buffer)
Gets the NvBufSurface from the DMABUF FD.
int NvBufSurfaceUnMap(NvBufSurface *surf, int index, int plane)
Unmaps previously mapped buffer(s).
uint32_t totalSize
Holds the total size of allocated memory.
@ NVBUF_DISPLAYSCANFORMAT_PROGRESSIVE
Progessive scan formats.
uint32_t blockheightlog2
Holds block height of the planes for blockLinear layout buffer.
@ NVBUF_COLOR_FORMAT_UYVY_ER
Specifies BT.601 colorspace - YUV ER 4:2:2 planar.
struct NvBufSurfaceMapPlaneParams NvBufSurfaceMapPlaneParams
Holds plane parameters to map the buffer received from another process.
@ NVBUF_COLOR_FORMAT_NV24_10LE_709
Specifies BT.709 colorspace - Y/CbCr 10 bit 4:4:4 multi-planar.
@ NVBUF_MAP_READ_WRITE
Specifies NvBufSurface mapping type "read/write.".
NvBufSurfaceTag
Defines tags that identify the components requesting a memory allocation.
@ NVBUF_COLOR_FORMAT_LAST
NvBufSurfaceMemType
Specifies memory types for NvBufSurface.
Hold extended parameters required to allocate NvBufSurface.
struct NvBufSurfacePlaneParamsEx NvBufSurfacePlaneParamsEx
Holds plane wise parameters(extended) of a buffer.
@ NVBUF_COLOR_FORMAT_YVU420
Specifies BT.601 colorspace - YUV420 multi-planar.
int Raw2NvBufSurface(unsigned char *ptr, unsigned int index, unsigned int plane, unsigned int in_width, unsigned int in_height, NvBufSurface *Surf)
Copies the raw buffer plane memory content to the NvBufSurface plane memory of a specific batched buf...
NvBufSurfacePlaneParams planeParams
Holds planewise information (width, height, pitch, offset, etc.).
@ NVBUF_COLOR_FORMAT_UYVP_ER
Specifies BT.601 colorspace - 10 bit YUV ER 4:2:2 interleaved.
NvBufSurfaceColorFormat colorFormat
Holds the color format.
@ NVBUF_COLOR_FORMAT_YVYU_ER
Specifies BT.601 colorspace - YUV ER 4:2:2 planar.
uint32_t height
Holds the height of the buffer.
@ NVBUF_COLOR_FORMAT_NV21_10LE
Specifies BT.601 colorspace - Y/CrCb 4:2:0 10-bit multi-planar.
NvBufSurfaceTag memtag
components tag to be used for memory allocation
int NvBufSurfaceCopy(NvBufSurface *srcSurf, NvBufSurface *dstSurf)
Copies the content of source batched buffer(s) to destination batched buffer(s).
NvBufSurfaceLayout
Specifies layout formats for NvBufSurface video planes.
uint32_t num_planes
Holds the number of planes.
uint32_t blockheightlog2[NVBUF_MAX_PLANES]
block height of the planes for blockLinear layout buffer.
int NvBufSurfaceSyncForCpu(NvBufSurface *surf, int index, int plane)
Syncs the HW memory cache for the CPU.
int32_t startofvaliddata
offset in bytes from the start of the buffer to the first valid byte.
uint8_t reserved[64]
Reserved.
uint32_t size
Holds the amount of memory to be allocated.
@ NVBUF_COLOR_FORMAT_YUV422
Specifies BT.601 colorspace - YUV422 multi-planar.
@ NVBUF_COLOR_FORMAT_NV21_ER
Specifies BT.601 colorspace - Y/CbCr ER 4:2:0 multi-planar.
@ NVBUF_COLOR_FORMAT_NV12_ER
Specifies BT.601 colorspace - Y/CbCr ER 4:2:0 multi-planar.
uint32_t dataSize
Holds the amount of allocated memory.
uint32_t gpuId
Holds a GPU ID.
struct NvBufSurfaceCreateParams NvBufSurfaceCreateParams
Holds parameters required to allocate an NvBufSurface.
@ NVBUF_MAP_READ
Specifies NvBufSurface mapping type "read.".
@ NVBUF_LAYOUT_BLOCK_LINEAR
Specifies block linear layout.
uint32_t batchSize
Holds the batch size.
uint32_t physicaladdress[NVBUF_MAX_PLANES]
physical address of allocated planes.
@ NVBUF_COLOR_FORMAT_NV24_ER
Specifies BT.601_ER colorspace - Y/CbCr 4:4:4 multi-planar.
uint32_t pitch[NVBUF_MAX_PLANES]
Holds the pitches of planes in bytes.
@ NVBUF_COLOR_FORMAT_YUV444
Specifies BT.601 colorspace - YUV444 multi-planar.
@ NVBUF_COLOR_FORMAT_NV24_10LE
Specifies BT.601 colorspace - Y/CrCb 4:4:4 10-bit multi-planar.
NvBufSurfaceMapPlaneParams planes[NVBUF_MAX_PLANES]
Holds plane parameters.
void * _reserved[STRUCTURE_PADDING]
bool isContiguous
Holds a "contiguous memory" flag.
void * eglImage
Holds a pointer to a mapped EGLImage.
@ NVBUF_COLOR_FORMAT_ABGR
Specifies ABGR-8-8-8-8 single plane.
int NvBufSurfaceImport(NvBufSurface **out_nvbuf_surf, const NvBufSurfaceMapParams *in_params)
Import parameters received from another process and create hardware buffer.
@ NVBUF_COLOR_FORMAT_NV12_10LE_709
Specifies BT.709 colorspace - Y/CbCr 4:2:0 10-bit multi-planar.
@ NVBUF_MAP_WRITE
Specifies NvBufSurface mapping type "write.".
Holds plane wise parameters of a buffer.
uint32_t width
Holds the widths of planes.
@ NVBUF_COLOR_FORMAT_NV16_ER
Specifies BT.601_ER colorspace - Y/CbCr 4:2:2 multi-planar.
void * _reserved[STRUCTURE_PADDING - 1]
@ NVBUF_COLOR_FORMAT_NV12
Specifies BT.601 colorspace - Y/CbCr 4:2:0 multi-planar.
@ NvBufSurfaceTag_VIDEO_ENC
tag for H264/H265 Video Encoder.
int NvBufSurfaceCreate(NvBufSurface **surf, uint32_t batchSize, NvBufSurfaceCreateParams *params)
Allocates a batch of buffers.
@ NVBUF_COLOR_FORMAT_NV12_12LE_2020
Specifies BT.2020 colorspace - Y/CbCr 4:2:0 12-bit multi-planar.
uint32_t num_planes
Holds the number of planes.
void * _reserved[STRUCTURE_PADDING]
@ NVBUF_COLOR_FORMAT_BGR
Specifies BGR-8-8-8 single plane.
@ NvBufSurfaceTag_JPEG
tag for Jpeg Encoder/Decoder.
struct NvBufSurfaceChromaSubsamplingParams NvBufSurfaceChromaSubsamplingParams
Holds Chroma Subsampling parameters for NvBufSurface allocation.
@ NVBUF_MEM_SURFACE_ARRAY
Specifies NVRM Surface Array type.
@ NVBUF_COLOR_FORMAT_NV12_10LE_2020
Specifies BT.2020 colorspace - Y/CbCr 4:2:0 10-bit multi-planar.
int NvBufSurfaceMapEglImage(NvBufSurface *surf, int index)
Creates an EGLImage from the memory of one or more NvBufSurface buffers.
@ NVBUF_COLOR_FORMAT_RGBA
Specifies RGBA-8-8-8-8 single plane.
uint64_t flags[NVBUF_MAX_PLANES]
flags associated with planes
@ NVBUF_COLOR_FORMAT_BGRA_10_10_10_2_2020
Specifies Non-linear RGB BT.2020 colorspace - BGRA-10-10-10-2 planar.
NvBufSurfaceCreateParams params
Hold legacy NvBufSurface creation parameters.
uint32_t bytesPerPix[NVBUF_MAX_PLANES]
Holds the number of bytes occupied by a pixel in each plane.
uint32_t secondfieldoffset
Holds offset of the second field for interlaced buffer.
Holds parameters required to allocate an NvBufSurface.
NvBufSurfaceDisplayScanFormat scanformat
Holds display scan format.
uint32_t width
Holds the width of the buffer.
NvBufSurfaceChromaSubsamplingParams chromaSubsampling
Holds chroma subsampling parameters.
NvBufSurfaceMemMapFlags
Defines mapping types of NvBufSurface.
@ NVBUF_COLOR_FORMAT_NV24_10LE_2020
Specifies BT.2020 colorspace - Y/CbCr 10 bit 4:4:4 multi-planar.
uint32_t gpuId
Holds the GPU ID.
@ NVBUF_COLOR_FORMAT_NV12_709_ER
Specifies BT.709 colorspace - Y/CbCr ER 4:2:0 multi-planar.
@ NVBUF_COLOR_FORMAT_YUV420
Specifies BT.601 colorspace - YUV420 multi-planar.
void * _reserved[STRUCTURE_PADDING]
NvBufSurfaceColorFormat
Defines color formats for NvBufSurface.
uint8_t chromaLocHoriz
location settings
@ NvBufSurfaceTag_NONE
tag None.
@ NVBUF_COLOR_FORMAT_R32F_G32F_B32F
Specifies RGB-32bit Floating point multiplanar plane.
@ NVBUF_COLOR_FORMAT_NV24_12LE_2020
Specifies BT.2020 colorspace - Y/CbCr 12 bit 4:4:4 multi-planar.
@ NVBUF_COLOR_FORMAT_RGBx
Specifies RGBx-8-8-8-8 single plane.
@ NVBUF_COLOR_FORMAT_NV24_10LE_709_ER
Specifies BT.709 ER colorspace - Y/CbCr 10 bit 4:4:4 multi-planar.