21 #ifndef NVBUFSURFACE_H_
22 #define NVBUFSURFACE_H_
40 #define STRUCTURE_PADDING 4
43 #define NVBUF_MAX_PLANES 4
ABGR-8-8-8-8 single plane.
BT.709 colorspace - YUV420 multi-planar.
BT.601 colorspace - Y/CbCr 4:2:0 10-bit multi-planar.
uint32_t size
optional but if set memory of that size will be allocated and all other parameters (width...
NVBUF_MEM_CUDA_DEVICE type for dGpu and NVBUF_MEM_SURFACE_ARRAY type for Jetson.
NvBufSurfaceLayout layout
BL or PL for Jetson, ONLY PL in case of dGPU.
BT.601 colorspace - YUV ER 4:2:2 planar.
void * _reserved[STRUCTURE_PADDING]
void * _reserved[STRUCTURE_PADDING]
uint32_t pitch[NVBUF_MAX_PLANES]
pitch of planes in bytes
BT.601 colorspace - YUV 4:2:2 planar.
CUDA Unified memory type.
void * dataPtr
pointer to allocated memory, Not valid for NVBUF_MEM_SURFACE_ARRAY and NVBUF_MEM_HANDLE ...
BT.601 colorspace - YUV420 multi-planar.
BT.2020 colorspace - YUV420 multi-planar.
NvBufSurfaceColorFormat colorFormat
color format
int NvBufSurfaceUnMapEglImage(NvBufSurface *surf, int index)
Destroy the previously created EGLImage(s).
int NvBufSurfaceMemSet(NvBufSurface *surf, int index, int plane, uint8_t value)
Fill each byte of buffer(s) in NvBufSurface with provided value.
uint32_t num_planes
Number of planes.
BT.601 colorspace - YUV444 multi-planar.
uint32_t bytesPerPix[NVBUF_MAX_PLANES]
bytes taken for each pixel
BT.601 colorspace - YUV 4:2:2 planar.
Hold the information of single buffer in the batch.
#define NVBUF_MAX_PLANES
Maximum number of planes.
BT.709 colorspace - Y/CbCr ER 4:2:0 multi-planar.
bool isContiguous
optional but if set contiguous memory is allocated for batch.
NvBufSurfaceLayout
Defines Layout formats for NvBufSurface video planes.
int NvBufSurfaceMapEglImage(NvBufSurface *surf, int index)
Creates an EGLImage from memory of NvBufSurface buffer(s).
int NvBufSurfaceMap(NvBufSurface *surf, int index, int plane, NvBufSurfaceMemMapFlags type)
Map HW batched buffers to HOST / CPU address space.
BT.601 colorspace - YUV420 ER multi-planar.
void * addr[NVBUF_MAX_PLANES]
plane wise pointers to CPU mapped buffer
NvBufSurfaceMappedAddr mappedAddr
pointers of mapped buffers.
RGBx-8-8-8-8 single plane.
BT.601 colorspace - YUV420 multi-planar.
int NvBufSurfaceFromFd(int dmabuf_fd, void **buffer)
Get the NvBufSurface from the dmabuf fd.
BT.601 colorspace - Y/CbCr ER 4:2:0 multi-planar.
uint32_t numFilled
valid / filled buffers, Zero initialized
NVRM Handle type - valid only for Jetson.
BT.601 colorspace - Y/CbCr 4:2:0 12-bit multi-planar.
RGBA-8-8-8-8 single plane.
uint32_t pitch
pitch of buffer
uint32_t psize[NVBUF_MAX_PLANES]
size of planes in bytes
NvBufSurfaceParams * surfaceList
Pointer to array of batched buffers.
uint32_t batchSize
batch size
ARGB-8-8-8-8 single plane.
int NvBufSurfaceDestroy(NvBufSurface *surf)
Free the batched buffers previously allocated through NvBufSurfaceCreate.
Hold parameters required to allocate NvBufSurface.
struct NvBufSurfacePlaneParams NvBufSurfacePlaneParams
Holds plane wise parameters of a buffer.
int NvBufSurfaceCopy(NvBufSurface *srcSurf, NvBufSurface *dstSurf)
Copy the memory content of source batched buffer(s) to memory of destination batched buffer(s)...
NvBufSurfaceMemType memType
type of memory of buffers in batch
BT.601 colorspace - YUV ER 4:2:2 planar.
BT.709 colorspace - YUV420 ER multi-planar.
NvBufSurfaceMemType
Defines memory types of NvBufSurface.
NvBufSurfacePlaneParams planeParams
plane wise info (w, h, p, offset etc.)
int NvBufSurfaceUnMap(NvBufSurface *surf, int index, int plane)
Unmap the previously mapped buffer(s).
Holds plane wise parameters of a buffer.
uint32_t width
width of buffer
uint32_t height
height of buffer
BT.2020 colorspace - Y/CbCr 4:2:0 multi-planar.
uint64_t bufferDesc
dmabuf fd in case of NVBUF_MEM_SURFACE_ARRAY and NVBUF_MEM_HANDLE type memory.
uint32_t height
height of buffer
Hold the information of batched buffers.
NVRM Surface Array type - valid only for Jetson.
uint32_t offset[NVBUF_MAX_PLANES]
offsets of planes in bytes
#define STRUCTURE_PADDING
Default padding for reserved fields of structures.
uint32_t width[NVBUF_MAX_PLANES]
width of planes
uint32_t gpuId
GPU id - valid for multi GPU system.
uint32_t gpuId
GPU id - valid for multiple GPU system.
xBGR-8-8-8-8 single plane.
BT.601 colorspace - YUV ER 4:2:2 planar.
struct NvBufSurfaceMappedAddr NvBufSurfaceMappedAddr
Hold the pointers of mapped buffer.
NvBufSurfaceMemType memType
type of memory to be allocated
uint32_t height[NVBUF_MAX_PLANES]
height of planes
int NvBufSurfaceSyncForCpu(NvBufSurface *surf, int index, int plane)
Syncs the HW memory cache for the CPU.
struct NvBufSurfaceParams NvBufSurfaceParams
Hold the information of single buffer in the batch.
BT.601 colorspace - YUV 4:2:2 planar.
BGRx-8-8-8-8 single plane.
BGRA-8-8-8-8 single plane.
void * _reserved[STRUCTURE_PADDING]
uint32_t width
width of buffer
NvBufSurfaceLayout layout
BL or PL for Jetson, ONLY PL in case of dGPU.
bool isContiguous
check if memory allocated for batch is contiguous.
BT.601 colorspace - Y/CbCr 4:2:0 multi-planar.
void * eglImage
pointer to mapped EGLImage
struct NvBufSurfaceCreateParams NvBufSurfaceCreateParams
Hold parameters required to allocate NvBufSurface.
NvBufSurfaceColorFormat colorFormat
color format of buffer
8 bit GRAY scale - single plane
BT.601 colorspace - YVU420 ER multi-planar.
NvBufSurfaceMemMapFlags
Defines mapping types of NvBufSurface.
BT.601 colorspace - YUV 4:2:2 planar.
NvBufSurfaceColorFormat
Defines color formats for NvBufSurface.
BT.601 colorspace - Y/CbCr 4:2:0 multi-planar.
Hold the pointers of mapped buffer.
uint32_t dataSize
size of allocated memory
struct NvBufSurface NvBufSurface
Hold the information of batched buffers.
int NvBufSurfaceCreate(NvBufSurface **surf, uint32_t batchSize, NvBufSurfaceCreateParams *params)
Allocate batch of buffers.
BT.601 colorspace - Y/CbCr ER 4:2:0 multi-planar.
BT.601 colorspace - YUV ER 4:2:2 planar.
BT.709 colorspace - Y/CbCr 4:2:0 multi-planar.
void * _reserved[STRUCTURE_PADDING *NVBUF_MAX_PLANES]
xRGB-8-8-8-8 single plane.
int NvBufSurfaceSyncForDevice(NvBufSurface *surf, int index, int plane)
Syncs the HW memory cache for the device.