1/*
2Copyright (c) 2012, Broadcom Europe Ltd
3All rights reserved.
4
5Redistribution and use in source and binary forms, with or without
6modification, are permitted provided that the following conditions are met:
7 * Redistributions of source code must retain the above copyright
8 notice, this list of conditions and the following disclaimer.
9 * Redistributions in binary form must reproduce the above copyright
10 notice, this list of conditions and the following disclaimer in the
11 documentation and/or other materials provided with the distribution.
12 * Neither the name of the copyright holder nor the
13 names of its contributors may be used to endorse or promote products
14 derived from this software without specific prior written permission.
15
16THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
20DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*/
27
28#ifndef EGLEXT_BRCM_H
29#define EGLEXT_BRCM_H
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
35#define EGL_NATIVE_PIXMAP_CLIENT_SIDE_BRCM 0x99930B0 /* eglCreateImageKHR server-side target */
36#define EGL_IMAGE_FROM_SURFACE_BRCM 0x99930B1 /* eglCreateImageKHR server-side target */
37/* Multimedia target - created by gralloc */
38#define EGL_IMAGE_BRCM_MULTIMEDIA 0x99930B2
39#define EGL_IMAGE_BRCM_DUPLICATE 0x99930B3 /* a new EGL Image pointing at the same underlying object */
40#define EGL_IMAGE_BRCM_RAW_PIXELS 0x99930B4 /* Raw YUV multimedia pixels */
41
42/* Fastpath for creating greyscale textures from a single plane of a
43 * MMAL opaque buffers. */
44#define EGL_IMAGE_BRCM_MULTIMEDIA_Y 0x99930C0
45#define EGL_IMAGE_BRCM_MULTIMEDIA_U 0x99930C1
46#define EGL_IMAGE_BRCM_MULTIMEDIA_V 0x99930C2
47
48/* EGL image buffer allocated in shared memory */
49#define EGL_IMAGE_BRCM_VCSM 0x99930C3
50struct egl_image_brcm_vcsm_info {
51 unsigned width;
52 unsigned height;
53 unsigned int vcsm_handle;
54};
55
56#ifndef EGL_BRCM_sane_choose_config
57#define EGL_BRCM_sane_choose_config 1
58#endif
59#if EGL_BRCM_sane_choose_config
60#ifdef EGL_EGLEXT_PROTOTYPES
61EGLAPI EGLBoolean EGLAPIENTRY eglSaneChooseConfigBRCM(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config);
62#endif /* EGL_EGLEXT_PROTOTYPES */
63typedef EGLBoolean (EGLAPIENTRYP PFNEGLSANECHOOSECONFIGBRCM)(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config);
64#endif
65
66#ifndef EGL_BRCM_global_image
67#define EGL_BRCM_global_image 1
68#endif
69#if EGL_BRCM_global_image
70#define EGL_PIXEL_FORMAT_ARGB_8888_PRE_BRCM 0
71#define EGL_PIXEL_FORMAT_ARGB_8888_BRCM 1
72#define EGL_PIXEL_FORMAT_XRGB_8888_BRCM 2
73#define EGL_PIXEL_FORMAT_RGB_565_BRCM 3
74#define EGL_PIXEL_FORMAT_A_8_BRCM 4
75#define EGL_PIXEL_FORMAT_RENDER_GL_BRCM (1 << 3)
76#define EGL_PIXEL_FORMAT_RENDER_GLES_BRCM (1 << 4)
77#define EGL_PIXEL_FORMAT_RENDER_GLES2_BRCM (1 << 5)
78#define EGL_PIXEL_FORMAT_RENDER_VG_BRCM (1 << 6)
79#define EGL_PIXEL_FORMAT_RENDER_MASK_BRCM 0x78
80#define EGL_PIXEL_FORMAT_VG_IMAGE_BRCM (1 << 7)
81#define EGL_PIXEL_FORMAT_GLES_TEXTURE_BRCM (1 << 8)
82#define EGL_PIXEL_FORMAT_GLES2_TEXTURE_BRCM (1 << 9)
83#define EGL_PIXEL_FORMAT_TEXTURE_MASK_BRCM 0x380
84#define EGL_PIXEL_FORMAT_USAGE_MASK_BRCM 0x3f8
85#ifdef EGL_EGLEXT_PROTOTYPES
86EGLAPI void EGLAPIENTRY eglCreateGlobalImageBRCM(EGLint width, EGLint height, EGLint pixel_format, const void *data, EGLint data_stride, EGLint *id);
87EGLAPI void EGLAPIENTRY eglCreateCopyGlobalImageBRCM(const EGLint *src_id, EGLint *id);
88EGLAPI EGLBoolean EGLAPIENTRY eglDestroyGlobalImageBRCM(const EGLint *id);
89EGLAPI EGLBoolean EGLAPIENTRY eglQueryGlobalImageBRCM(const EGLint *id, EGLint *width_height_pixel_format);
90#endif /* EGL_EGLEXT_PROTOTYPES */
91typedef void (EGLAPIENTRYP PFNEGLCREATEGLOBALIMAGEBRCMPROC)(EGLint width, EGLint height, EGLint pixel_format, const void *data, EGLint data_stride, EGLint *id);
92typedef void (EGLAPIENTRYP PFNEGLCREATECOPYGLOBALIMAGEBRCMPROC)(const EGLint *src_id, EGLint *id);
93typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYGLOBALIMAGEBRCMPROC)(const EGLint *id);
94typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYGLOBALIMAGEBRCMPROC)(const EGLint *id, EGLint *width_height_pixel_format);
95#endif
96
97#ifndef EGL_BRCM_perf_monitor
98#define EGL_BRCM_perf_monitor 0
99#endif
100#if EGL_BRCM_perf_monitor
101#ifdef EGL_EGLEXT_PROTOTYPES
102EGLAPI EGLBoolean EGLAPIENTRY eglInitPerfMonitorBRCM(EGLDisplay display);
103EGLAPI EGLBoolean EGLAPIENTRY eglTermPerfMonitorBRCM(EGLDisplay display);
104#endif /* EGL_EGLEXT_PROTOTYPES */
105typedef void (EGLAPIENTRYP PFNEGLINITPERFMONITORBRCMPROC)(EGLDisplay display);
106typedef void (EGLAPIENTRYP PFNEGLTERMPERFMONITORBRCMPROC)(EGLDisplay display);
107#endif
108
109#ifndef EGL_BRCM_driver_monitor
110#define EGL_BRCM_driver_monitor 1
111#endif
112#if EGL_BRCM_driver_monitor
113#ifdef EGL_EGLEXT_PROTOTYPES
114EGLAPI EGLBoolean EGLAPIENTRY eglInitDriverMonitorBRCM(EGLDisplay display, EGLint hw_bank, EGLint l3c_bank);
115EGLAPI void EGLAPIENTRY eglGetDriverMonitorXMLBRCM(EGLDisplay display, EGLint bufSize, EGLint *length, char *xmlStats);
116EGLAPI EGLBoolean EGLAPIENTRY eglTermDriverMonitorBRCM(EGLDisplay display);
117#endif /* EGL_EGLEXT_PROTOTYPES */
118typedef void (EGLAPIENTRYP PFNEGLINITDRIVERMONITORBRCMPROC)(EGLDisplay display, EGLint hw_bank, EGLint l3c_bank);
119typedef void (EGLAPIENTRYP PFNEGLGETDRIVERMONITORXMLBRCMPROC)(EGLDisplay display, EGLint bufSize, EGLint *length, char *xmlStats);
120typedef void (EGLAPIENTRYP PFNEGLTERMDRIVERMONITORBRCMPROC)(EGLDisplay display);
121#endif
122
123#ifndef EGL_BRCM_perf_stats
124#define EGL_BRCM_perf_stats 0
125#endif
126#if EGL_BRCM_perf_stats
127#ifdef EGL_EGLEXT_PROTOTYPES
128EGLAPI void eglPerfStatsResetBRCM(void);
129EGLAPI void eglPerfStatsGetBRCM(char *buffer, EGLint buffer_len, EGLBoolean reset);
130#endif
131typedef void (EGLAPIENTRYP PFNEGLPERFSTATSRESETBRCM) (void);
132typedef void (EGLAPIENTRYP PFNEGLPERFSTATSGETBRCM) (char *buffer, EGLint buffer_len, EGLBoolean reset);
133#endif
134
135#ifndef EGL_proc_state_valid
136#define EGL_proc_state_valid 1
137#endif
138#if EGL_proc_state_valid
139#ifdef EGL_EGLEXT_PROTOTYPES
140EGLAPI void EGLAPIENTRY eglProcStateValid( EGLDisplay dpy, EGLBoolean *result );
141#endif
142typedef void (EGLAPIENTRYP PFNEGLPROCSTATEVALID) ( EGLDisplay dpy, EGLBoolean *valid );
143#endif
144
145#ifndef EGL_BRCM_flush
146#define EGL_BRCM_flush 1
147#endif
148#if EGL_BRCM_flush
149#ifdef EGL_EGLEXT_PROTOTYPES
150EGLAPI void EGLAPIENTRY eglFlushBRCM(void);
151#endif /* EGL_EGLEXT_PROTOTYPES */
152typedef void (EGLAPIENTRYP PFNEGLFLUSHBRCMPROC)(void);
153#endif
154
155#ifndef EGL_BRCM_image_wrap
156#define EGL_BRCM_image_wrap 1
157#define EGL_IMAGE_WRAP_BRCM 0x9993140
158#endif
159
160#ifndef EGL_BRCM_image_wrap_bcg
161#define EGL_BRCM_image_wrap_bcg 0
162#define EGL_IMAGE_WRAP_BRCM_BCG 0x9993141
163
164#if EGL_BRCM_image_wrap_bcg
165typedef struct {
166 BEGL_BufferFormat format;
167
168 uint16_t width;
169 uint16_t height;
170
171 int32_t stride; /* in bytes */
172
173 void *storage;
174} EGL_IMAGE_WRAP_BRCM_BCG_IMAGE_T;
175#endif
176
177#endif
178
179#ifndef EGL_BRCM_mem_usage
180#define EGL_BRCM_mem_usage 0
181#endif
182#if EGL_BRCM_mem_usage
183#ifdef EGL_EGLEXT_PROTOTYPES
184EGLAPI void eglProcessMemUsageGetBRCM(uint32_t id_0, uint32_t id_1, char *buffer, uint32_t buffer_len);
185#endif
186typedef void (EGLAPIENTRYP PFNEGLPROCESSMEMUSAGEGETBRCM) (uint32_t id_0, uint32_t id_1, char *buffer, uint32_t buffer_len);
187#endif
188
189/*
190Only enable this #define if the application (or wrapper layer) is going to call eglDirectRenderingPointer
191when appropriate (i.e. the first time eglMakeCurrent is called, and then at eglSwapBuffers)
192
193Only used for testing purposes on 2763
194*/
195//#define DIRECT_RENDERING
196
197#ifdef DIRECT_RENDERING
198EGLAPI EGLBoolean EGLAPIENTRY eglDirectRenderingPointer(EGLDisplay dpy, EGLSurface surf, void *image /* KHRN_IMAGE_WRAP_T */);
199#endif
200
201#ifdef __cplusplus
202}
203#endif
204
205#endif
206