L4T Multimedia API Reference

28.1 Release

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
nvbuf_utils.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved.
3  *
4  * NVIDIA Corporation and its licensors retain all intellectual property
5  * and proprietary rights in and to this software, related documentation
6  * and any modifications thereto. Any use, reproduction, disclosure or
7  * distribution of this software and related documentation without an express
8  * license agreement from NVIDIA Corporation is strictly prohibited.
9  */
10 
24 #ifndef _NVBUF_UTILS_H_
25 #define _NVBUF_UTILS_H_
26 
27 #ifdef __cplusplus
28 extern "C"
29 {
30 #endif
31 
32 #include <EGL/egl.h>
33 #include <EGL/eglext.h>
34 #include <errno.h>
35 
36 #define MAX_NUM_PLANES 3
37 
38 typedef enum
39 {
43 
44 typedef enum
45 {
50 
51 typedef enum
52 {
66 
67 typedef struct _NvBufferParams
68 {
69  uint32_t dmabuf_fd;
70  void *nv_buffer;
71  uint32_t nv_buffer_size;
72  uint32_t pixel_format;
73  uint32_t num_planes;
74  uint32_t width[MAX_NUM_PLANES];
76  uint32_t pitch[MAX_NUM_PLANES];
78  uint32_t psize[MAX_NUM_PLANES];
81 
90 EGLImageKHR NvEGLImageFromFd (EGLDisplay display, int dmabuf_fd);
91 
100 int NvDestroyEGLImage (EGLDisplay display, EGLImageKHR eglImage);
101 
112 int NvBufferCreate (int *dmabuf_fd, int width, int height,
113  NvBufferLayout layout, NvBufferColorFormat colorFormat);
114 
122 int NvBufferGetParams (int dmabuf_fd, NvBufferParams *params);
123 
130 int NvBufferDestroy (int dmabuf_fd);
131 
140 int NvBufferMemSyncForCpu (int dmabuf_fd, unsigned int plane, void **pVirtAddr);
141 
150 int NvBufferMemSyncForDevice (int dmabuf_fd, unsigned int plane, void **pVirtAddr);
151 
161 int NvBufferMemMap (int dmabuf_fd, unsigned int plane, NvBufferMemFlags memflag, void **pVirtAddr);
162 
171 int NvBufferMemUnMap (int dmabuf_fd, unsigned int plane, void **pVirtAddr);
173 #ifdef __cplusplus
174 }
175 #endif
176 
177 #endif
uint32_t layout[MAX_NUM_PLANES]
Definition: nvbuf_utils.h:79
uint32_t num_planes
Definition: nvbuf_utils.h:73
uint32_t psize[MAX_NUM_PLANES]
Definition: nvbuf_utils.h:78
int NvBufferMemUnMap(int dmabuf_fd, unsigned int plane, void **pVirtAddr)
This method must be used to Unmap the mapped virtual Address of the plane.
uint32_t nv_buffer_size
Definition: nvbuf_utils.h:71
uint32_t pixel_format
Definition: nvbuf_utils.h:72
int NvBufferMemSyncForCpu(int dmabuf_fd, unsigned int plane, void **pVirtAddr)
This method must be used for hw memory cache sync for the CPU.
int NvBufferMemMap(int dmabuf_fd, unsigned int plane, NvBufferMemFlags memflag, void **pVirtAddr)
This method must be used for getting mem mapped virtual Address of the plane.
#define MAX_NUM_PLANES
Definition: nvbuf_utils.h:36
uint32_t height[MAX_NUM_PLANES]
Definition: nvbuf_utils.h:75
struct _NvBufferParams NvBufferParams
int NvBufferMemSyncForDevice(int dmabuf_fd, unsigned int plane, void **pVirtAddr)
This method must be used for hw memory cache sync for device.
uint32_t width[MAX_NUM_PLANES]
Definition: nvbuf_utils.h:74
uint32_t pitch[MAX_NUM_PLANES]
Definition: nvbuf_utils.h:76
int NvBufferCreate(int *dmabuf_fd, int width, int height, NvBufferLayout layout, NvBufferColorFormat colorFormat)
Use this method to allocate HW buffer.
EGLImageKHR NvEGLImageFromFd(EGLDisplay display, int dmabuf_fd)
This method must be used for getting EGLImage from dmabuf-fd.
uint32_t dmabuf_fd
Definition: nvbuf_utils.h:69
uint32_t offset[MAX_NUM_PLANES]
Definition: nvbuf_utils.h:77
void * nv_buffer
Definition: nvbuf_utils.h:70
int NvBufferGetParams(int dmabuf_fd, NvBufferParams *params)
Use this method to get buffer parameters.
NvBufferLayout
Definition: nvbuf_utils.h:38
int NvBufferDestroy(int dmabuf_fd)
This method must be used for destroying hw_buffer.
NvBufferColorFormat
Definition: nvbuf_utils.h:51
int NvDestroyEGLImage(EGLDisplay display, EGLImageKHR eglImage)
This method must be used for destroying EGLImage object.
NvBufferMemFlags
Definition: nvbuf_utils.h:44