xref: /OK3568_Linux_fs/external/libmali/include/CL/cl_egl.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*******************************************************************************
2*4882a593Smuzhiyun  * Copyright (c) 2008-2015 The Khronos Group Inc.
3*4882a593Smuzhiyun  *
4*4882a593Smuzhiyun  * Permission is hereby granted, free of charge, to any person obtaining a
5*4882a593Smuzhiyun  * copy of this software and/or associated documentation files (the
6*4882a593Smuzhiyun  * "Materials"), to deal in the Materials without restriction, including
7*4882a593Smuzhiyun  * without limitation the rights to use, copy, modify, merge, publish,
8*4882a593Smuzhiyun  * distribute, sublicense, and/or sell copies of the Materials, and to
9*4882a593Smuzhiyun  * permit persons to whom the Materials are furnished to do so, subject to
10*4882a593Smuzhiyun  * the following conditions:
11*4882a593Smuzhiyun  *
12*4882a593Smuzhiyun  * The above copyright notice and this permission notice shall be included
13*4882a593Smuzhiyun  * in all copies or substantial portions of the Materials.
14*4882a593Smuzhiyun  *
15*4882a593Smuzhiyun  * MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
16*4882a593Smuzhiyun  * KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
17*4882a593Smuzhiyun  * SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
18*4882a593Smuzhiyun  *    https://www.khronos.org/registry/
19*4882a593Smuzhiyun  *
20*4882a593Smuzhiyun  * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21*4882a593Smuzhiyun  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22*4882a593Smuzhiyun  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23*4882a593Smuzhiyun  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
24*4882a593Smuzhiyun  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25*4882a593Smuzhiyun  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26*4882a593Smuzhiyun  * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
27*4882a593Smuzhiyun  ******************************************************************************/
28*4882a593Smuzhiyun 
29*4882a593Smuzhiyun #ifndef __OPENCL_CL_EGL_H
30*4882a593Smuzhiyun #define __OPENCL_CL_EGL_H
31*4882a593Smuzhiyun 
32*4882a593Smuzhiyun #ifdef __APPLE__
33*4882a593Smuzhiyun 
34*4882a593Smuzhiyun #else
35*4882a593Smuzhiyun #include <CL/cl.h>
36*4882a593Smuzhiyun #endif
37*4882a593Smuzhiyun 
38*4882a593Smuzhiyun #ifdef __cplusplus
39*4882a593Smuzhiyun extern "C" {
40*4882a593Smuzhiyun #endif
41*4882a593Smuzhiyun 
42*4882a593Smuzhiyun 
43*4882a593Smuzhiyun /* Command type for events created with clEnqueueAcquireEGLObjectsKHR */
44*4882a593Smuzhiyun #define CL_COMMAND_EGL_FENCE_SYNC_OBJECT_KHR  0x202F
45*4882a593Smuzhiyun #define CL_COMMAND_ACQUIRE_EGL_OBJECTS_KHR    0x202D
46*4882a593Smuzhiyun #define CL_COMMAND_RELEASE_EGL_OBJECTS_KHR    0x202E
47*4882a593Smuzhiyun 
48*4882a593Smuzhiyun /* Error type for clCreateFromEGLImageKHR */
49*4882a593Smuzhiyun #define CL_INVALID_EGL_OBJECT_KHR             -1093
50*4882a593Smuzhiyun #define CL_EGL_RESOURCE_NOT_ACQUIRED_KHR      -1092
51*4882a593Smuzhiyun 
52*4882a593Smuzhiyun /* CLeglImageKHR is an opaque handle to an EGLImage */
53*4882a593Smuzhiyun typedef void* CLeglImageKHR;
54*4882a593Smuzhiyun 
55*4882a593Smuzhiyun /* CLeglDisplayKHR is an opaque handle to an EGLDisplay */
56*4882a593Smuzhiyun typedef void* CLeglDisplayKHR;
57*4882a593Smuzhiyun 
58*4882a593Smuzhiyun /* CLeglSyncKHR is an opaque handle to an EGLSync object */
59*4882a593Smuzhiyun typedef void* CLeglSyncKHR;
60*4882a593Smuzhiyun 
61*4882a593Smuzhiyun /* properties passed to clCreateFromEGLImageKHR */
62*4882a593Smuzhiyun typedef intptr_t cl_egl_image_properties_khr;
63*4882a593Smuzhiyun 
64*4882a593Smuzhiyun 
65*4882a593Smuzhiyun #define cl_khr_egl_image 1
66*4882a593Smuzhiyun 
67*4882a593Smuzhiyun extern CL_API_ENTRY cl_mem CL_API_CALL
68*4882a593Smuzhiyun clCreateFromEGLImageKHR(cl_context                  /* context */,
69*4882a593Smuzhiyun                         CLeglDisplayKHR             /* egldisplay */,
70*4882a593Smuzhiyun                         CLeglImageKHR               /* eglimage */,
71*4882a593Smuzhiyun                         cl_mem_flags                /* flags */,
72*4882a593Smuzhiyun                         const cl_egl_image_properties_khr * /* properties */,
73*4882a593Smuzhiyun                         cl_int *                    /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
74*4882a593Smuzhiyun 
75*4882a593Smuzhiyun typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromEGLImageKHR_fn)(
76*4882a593Smuzhiyun 	cl_context                  context,
77*4882a593Smuzhiyun 	CLeglDisplayKHR             egldisplay,
78*4882a593Smuzhiyun 	CLeglImageKHR               eglimage,
79*4882a593Smuzhiyun 	cl_mem_flags                flags,
80*4882a593Smuzhiyun 	const cl_egl_image_properties_khr * properties,
81*4882a593Smuzhiyun 	cl_int *                    errcode_ret);
82*4882a593Smuzhiyun 
83*4882a593Smuzhiyun 
84*4882a593Smuzhiyun extern CL_API_ENTRY cl_int CL_API_CALL
85*4882a593Smuzhiyun clEnqueueAcquireEGLObjectsKHR(cl_command_queue /* command_queue */,
86*4882a593Smuzhiyun                               cl_uint          /* num_objects */,
87*4882a593Smuzhiyun                               const cl_mem *   /* mem_objects */,
88*4882a593Smuzhiyun                               cl_uint          /* num_events_in_wait_list */,
89*4882a593Smuzhiyun                               const cl_event * /* event_wait_list */,
90*4882a593Smuzhiyun                               cl_event *       /* event */) CL_API_SUFFIX__VERSION_1_0;
91*4882a593Smuzhiyun 
92*4882a593Smuzhiyun typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueAcquireEGLObjectsKHR_fn)(
93*4882a593Smuzhiyun 	cl_command_queue command_queue,
94*4882a593Smuzhiyun 	cl_uint          num_objects,
95*4882a593Smuzhiyun 	const cl_mem *   mem_objects,
96*4882a593Smuzhiyun 	cl_uint          num_events_in_wait_list,
97*4882a593Smuzhiyun 	const cl_event * event_wait_list,
98*4882a593Smuzhiyun 	cl_event *       event);
99*4882a593Smuzhiyun 
100*4882a593Smuzhiyun 
101*4882a593Smuzhiyun extern CL_API_ENTRY cl_int CL_API_CALL
102*4882a593Smuzhiyun clEnqueueReleaseEGLObjectsKHR(cl_command_queue /* command_queue */,
103*4882a593Smuzhiyun                               cl_uint          /* num_objects */,
104*4882a593Smuzhiyun                               const cl_mem *   /* mem_objects */,
105*4882a593Smuzhiyun                               cl_uint          /* num_events_in_wait_list */,
106*4882a593Smuzhiyun                               const cl_event * /* event_wait_list */,
107*4882a593Smuzhiyun                               cl_event *       /* event */) CL_API_SUFFIX__VERSION_1_0;
108*4882a593Smuzhiyun 
109*4882a593Smuzhiyun typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueReleaseEGLObjectsKHR_fn)(
110*4882a593Smuzhiyun 	cl_command_queue command_queue,
111*4882a593Smuzhiyun 	cl_uint          num_objects,
112*4882a593Smuzhiyun 	const cl_mem *   mem_objects,
113*4882a593Smuzhiyun 	cl_uint          num_events_in_wait_list,
114*4882a593Smuzhiyun 	const cl_event * event_wait_list,
115*4882a593Smuzhiyun 	cl_event *       event);
116*4882a593Smuzhiyun 
117*4882a593Smuzhiyun 
118*4882a593Smuzhiyun #define cl_khr_egl_event 1
119*4882a593Smuzhiyun 
120*4882a593Smuzhiyun extern CL_API_ENTRY cl_event CL_API_CALL
121*4882a593Smuzhiyun clCreateEventFromEGLSyncKHR(cl_context      /* context */,
122*4882a593Smuzhiyun                             CLeglSyncKHR    /* sync */,
123*4882a593Smuzhiyun                             CLeglDisplayKHR /* display */,
124*4882a593Smuzhiyun                             cl_int *        /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
125*4882a593Smuzhiyun 
126*4882a593Smuzhiyun typedef CL_API_ENTRY cl_event (CL_API_CALL *clCreateEventFromEGLSyncKHR_fn)(
127*4882a593Smuzhiyun 	cl_context      context,
128*4882a593Smuzhiyun 	CLeglSyncKHR    sync,
129*4882a593Smuzhiyun 	CLeglDisplayKHR display,
130*4882a593Smuzhiyun 	cl_int *        errcode_ret);
131*4882a593Smuzhiyun 
132*4882a593Smuzhiyun #ifdef __cplusplus
133*4882a593Smuzhiyun }
134*4882a593Smuzhiyun #endif
135*4882a593Smuzhiyun 
136*4882a593Smuzhiyun #endif /* __OPENCL_CL_EGL_H */
137