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