Vision Apps User Guide
app_gl_egl_utils.h
Go to the documentation of this file.
1 /*
2 Copyright (c) [2012 - 2019] Texas Instruments Incorporated
3 
4 All rights reserved not granted herein.
5 
6 Limited License.
7 
8  Texas Instruments Incorporated grants a world-wide, royalty-free, non-exclusive
9  license under copyrights and patents it now or hereafter owns or controls to
10  make, have made, use, import, offer to sell and sell ("Utilize") this software
11  subject to the terms herein. With respect to the foregoing patent license,
12  such license is granted solely to the extent that any such patent is necessary
13  to Utilize the software alone. The patent license shall not apply to any
14  combinations which include this software, other than combinations with devices
15  manufactured by or for TI ("TI Devices"). No hardware patent is licensed
16  hereunder.
17 
18  Redistributions must preserve existing copyright notices and reproduce this
19  license (including the above copyright notice and the disclaimer and
20  (if applicable) source code license limitations below) in the documentation
21  and/or other materials provided with the distribution
22 
23  Redistribution and use in binary form, without modification, are permitted
24  provided that the following conditions are met:
25 
26  * No reverse engineering, decompilation, or disassembly of this software
27  is permitted with respect to any software provided in binary form.
28 
29  * Any redistribution and use are licensed by TI for use only with TI Devices.
30 
31  * Nothing shall obligate TI to provide you with source code for the software
32  licensed and provided to you in object code.
33 
34  If software source code is provided to you, modification and redistribution of
35  the source code are permitted provided that the following conditions are met:
36 
37  * Any redistribution and use of the source code, including any resulting
38  derivative works, are licensed by TI for use only with TI Devices.
39 
40  * Any redistribution and use of any object code compiled from the source code
41  and any resulting derivative works, are licensed by TI for use only with TI
42  Devices.
43 
44  Neither the name of Texas Instruments Incorporated nor the names of its
45  suppliers may be used to endorse or promote products derived from this software
46  without specific prior written permission.
47 
48  DISCLAIMER.
49 
50  THIS SOFTWARE IS PROVIDED BY TI AND TI’S LICENSORS "AS IS" AND ANY EXPRESS OR
51  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
52  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
53  IN NO EVENT SHALL TI AND TI’S LICENSORS BE LIABLE FOR ANY DIRECT, INDIRECT,
54  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
55  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
56  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
57  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
58  OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
59  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
60 */
61 
62 #ifndef _APP_GL_EGL_UTILS_H_
63 #define _APP_GL_EGL_UTILS_H_
64 
76 #ifndef GL_GLEXT_PROTOTYPES
77 #define GL_GLEXT_PROTOTYPES 1
78 #endif
79 
80 #include <stdint.h>
81 #include <EGL/egl.h>
82 #include <EGL/eglext.h>
83 #include <GLES2/gl2.h>
84 #include <GLES2/gl2ext.h>
85 
86 #define APP_EGL_TEX_MAX_PLANES (2)
87 
88 #define APP_EGL_DF_RGBX (0)
89 #define APP_EGL_DF_RGB (1)
90 #define APP_EGL_DF_NV12 (2)
91 #define APP_EGL_DF_YUYV (3)
92 #define APP_EGL_DF_UYVY (4)
93 
94 typedef struct
95 {
96  uint32_t dataFormat;
98  uint32_t width;
100  uint32_t height;
102  uint32_t pitch[APP_EGL_TEX_MAX_PLANES];
104 #ifdef x86_64
105  int64_t dmaBufFd[APP_EGL_TEX_MAX_PLANES];
106 #else
107  int32_t dmaBufFd[APP_EGL_TEX_MAX_PLANES];
108 #endif
109 
110  uint32_t dmaBufFdOffset[APP_EGL_TEX_MAX_PLANES];
112  void* bufAddr[APP_EGL_TEX_MAX_PLANES];
115 
116 #ifdef __cplusplus
117 extern "C" {
118 #endif
119 
120 void appEglCheckGlError(const char* op);
121 void appEglCheckEglError(const char* op, EGLBoolean returnVal);
122 void appEglPrintGLString(const char *name, GLenum s);
123 
124 void *appEglWindowOpen();
125 uint32_t appEglWindowGetTexYuv(void *eglWindow, app_egl_tex_prop_t *pProp);
126 void appEglSwap(void *eglWindow);
127 void appEglBindFrameBuffer(void *eglWindow, app_egl_tex_prop_t *prop);
128 int32_t appEglWindowClose(void *eglWindow);
129 
130 #ifdef __cplusplus
131 }
132 #endif /* __cplusplus */
133 
134 /* @} */
135 #endif
void appEglPrintGLString(const char *name, GLenum s)
void * appEglWindowOpen()
#define APP_EGL_TEX_MAX_PLANES
Definition: app_gl_egl_utils.h:86
Definition: app_gl_egl_utils.h:94
uint32_t height
Definition: app_gl_egl_utils.h:100
uint32_t dataFormat
Definition: app_gl_egl_utils.h:96
uint32_t appEglWindowGetTexYuv(void *eglWindow, app_egl_tex_prop_t *pProp)
void appEglCheckEglError(const char *op, EGLBoolean returnVal)
void appEglCheckGlError(const char *op)
void appEglSwap(void *eglWindow)
uint32_t width
Definition: app_gl_egl_utils.h:98
int32_t appEglWindowClose(void *eglWindow)
void appEglBindFrameBuffer(void *eglWindow, app_egl_tex_prop_t *prop)