xref: /aosp_15_r20/external/ComputeLibrary/include/CL/cl_egl.h (revision c217d954acce2dbc11938adb493fc0abd69584f3)
1*c217d954SCole Faust /*******************************************************************************
2*c217d954SCole Faust  * Copyright (c) 2008-2020 The Khronos Group Inc.
3*c217d954SCole Faust  *
4*c217d954SCole Faust  * Licensed under the Apache License, Version 2.0 (the "License");
5*c217d954SCole Faust  * you may not use this file except in compliance with the License.
6*c217d954SCole Faust  * You may obtain a copy of the License at
7*c217d954SCole Faust  *
8*c217d954SCole Faust  *    http://www.apache.org/licenses/LICENSE-2.0
9*c217d954SCole Faust  *
10*c217d954SCole Faust  * Unless required by applicable law or agreed to in writing, software
11*c217d954SCole Faust  * distributed under the License is distributed on an "AS IS" BASIS,
12*c217d954SCole Faust  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*c217d954SCole Faust  * See the License for the specific language governing permissions and
14*c217d954SCole Faust  * limitations under the License.
15*c217d954SCole Faust  ******************************************************************************/
16*c217d954SCole Faust 
17*c217d954SCole Faust #ifndef __OPENCL_CL_EGL_H
18*c217d954SCole Faust #define __OPENCL_CL_EGL_H
19*c217d954SCole Faust 
20*c217d954SCole Faust #include <CL/cl.h>
21*c217d954SCole Faust 
22*c217d954SCole Faust #ifdef __cplusplus
23*c217d954SCole Faust extern "C" {
24*c217d954SCole Faust #endif
25*c217d954SCole Faust 
26*c217d954SCole Faust 
27*c217d954SCole Faust /* Command type for events created with clEnqueueAcquireEGLObjectsKHR */
28*c217d954SCole Faust #define CL_COMMAND_EGL_FENCE_SYNC_OBJECT_KHR  0x202F
29*c217d954SCole Faust #define CL_COMMAND_ACQUIRE_EGL_OBJECTS_KHR    0x202D
30*c217d954SCole Faust #define CL_COMMAND_RELEASE_EGL_OBJECTS_KHR    0x202E
31*c217d954SCole Faust 
32*c217d954SCole Faust /* Error type for clCreateFromEGLImageKHR */
33*c217d954SCole Faust #define CL_INVALID_EGL_OBJECT_KHR             -1093
34*c217d954SCole Faust #define CL_EGL_RESOURCE_NOT_ACQUIRED_KHR      -1092
35*c217d954SCole Faust 
36*c217d954SCole Faust /* CLeglImageKHR is an opaque handle to an EGLImage */
37*c217d954SCole Faust typedef void* CLeglImageKHR;
38*c217d954SCole Faust 
39*c217d954SCole Faust /* CLeglDisplayKHR is an opaque handle to an EGLDisplay */
40*c217d954SCole Faust typedef void* CLeglDisplayKHR;
41*c217d954SCole Faust 
42*c217d954SCole Faust /* CLeglSyncKHR is an opaque handle to an EGLSync object */
43*c217d954SCole Faust typedef void* CLeglSyncKHR;
44*c217d954SCole Faust 
45*c217d954SCole Faust /* properties passed to clCreateFromEGLImageKHR */
46*c217d954SCole Faust typedef intptr_t cl_egl_image_properties_khr;
47*c217d954SCole Faust 
48*c217d954SCole Faust 
49*c217d954SCole Faust #define cl_khr_egl_image 1
50*c217d954SCole Faust 
51*c217d954SCole Faust extern CL_API_ENTRY cl_mem CL_API_CALL
52*c217d954SCole Faust clCreateFromEGLImageKHR(cl_context                  context,
53*c217d954SCole Faust                         CLeglDisplayKHR             egldisplay,
54*c217d954SCole Faust                         CLeglImageKHR               eglimage,
55*c217d954SCole Faust                         cl_mem_flags                flags,
56*c217d954SCole Faust                         const cl_egl_image_properties_khr * properties,
57*c217d954SCole Faust                         cl_int *                    errcode_ret) CL_API_SUFFIX__VERSION_1_0;
58*c217d954SCole Faust 
59*c217d954SCole Faust typedef cl_mem (CL_API_CALL *clCreateFromEGLImageKHR_fn)(
60*c217d954SCole Faust     cl_context                  context,
61*c217d954SCole Faust     CLeglDisplayKHR             egldisplay,
62*c217d954SCole Faust     CLeglImageKHR               eglimage,
63*c217d954SCole Faust     cl_mem_flags                flags,
64*c217d954SCole Faust     const cl_egl_image_properties_khr * properties,
65*c217d954SCole Faust     cl_int *                    errcode_ret);
66*c217d954SCole Faust 
67*c217d954SCole Faust 
68*c217d954SCole Faust extern CL_API_ENTRY cl_int CL_API_CALL
69*c217d954SCole Faust clEnqueueAcquireEGLObjectsKHR(cl_command_queue command_queue,
70*c217d954SCole Faust                               cl_uint          num_objects,
71*c217d954SCole Faust                               const cl_mem *   mem_objects,
72*c217d954SCole Faust                               cl_uint          num_events_in_wait_list,
73*c217d954SCole Faust                               const cl_event * event_wait_list,
74*c217d954SCole Faust                               cl_event *       event) CL_API_SUFFIX__VERSION_1_0;
75*c217d954SCole Faust 
76*c217d954SCole Faust typedef cl_int (CL_API_CALL *clEnqueueAcquireEGLObjectsKHR_fn)(
77*c217d954SCole Faust     cl_command_queue command_queue,
78*c217d954SCole Faust     cl_uint          num_objects,
79*c217d954SCole Faust     const cl_mem *   mem_objects,
80*c217d954SCole Faust     cl_uint          num_events_in_wait_list,
81*c217d954SCole Faust     const cl_event * event_wait_list,
82*c217d954SCole Faust     cl_event *       event);
83*c217d954SCole Faust 
84*c217d954SCole Faust 
85*c217d954SCole Faust extern CL_API_ENTRY cl_int CL_API_CALL
86*c217d954SCole Faust clEnqueueReleaseEGLObjectsKHR(cl_command_queue command_queue,
87*c217d954SCole Faust                               cl_uint          num_objects,
88*c217d954SCole Faust                               const cl_mem *   mem_objects,
89*c217d954SCole Faust                               cl_uint          num_events_in_wait_list,
90*c217d954SCole Faust                               const cl_event * event_wait_list,
91*c217d954SCole Faust                               cl_event *       event) CL_API_SUFFIX__VERSION_1_0;
92*c217d954SCole Faust 
93*c217d954SCole Faust typedef cl_int (CL_API_CALL *clEnqueueReleaseEGLObjectsKHR_fn)(
94*c217d954SCole Faust     cl_command_queue command_queue,
95*c217d954SCole Faust     cl_uint          num_objects,
96*c217d954SCole Faust     const cl_mem *   mem_objects,
97*c217d954SCole Faust     cl_uint          num_events_in_wait_list,
98*c217d954SCole Faust     const cl_event * event_wait_list,
99*c217d954SCole Faust     cl_event *       event);
100*c217d954SCole Faust 
101*c217d954SCole Faust 
102*c217d954SCole Faust #define cl_khr_egl_event 1
103*c217d954SCole Faust 
104*c217d954SCole Faust extern CL_API_ENTRY cl_event CL_API_CALL
105*c217d954SCole Faust clCreateEventFromEGLSyncKHR(cl_context      context,
106*c217d954SCole Faust                             CLeglSyncKHR    sync,
107*c217d954SCole Faust                             CLeglDisplayKHR display,
108*c217d954SCole Faust                             cl_int *        errcode_ret) CL_API_SUFFIX__VERSION_1_0;
109*c217d954SCole Faust 
110*c217d954SCole Faust typedef cl_event (CL_API_CALL *clCreateEventFromEGLSyncKHR_fn)(
111*c217d954SCole Faust     cl_context      context,
112*c217d954SCole Faust     CLeglSyncKHR    sync,
113*c217d954SCole Faust     CLeglDisplayKHR display,
114*c217d954SCole Faust     cl_int *        errcode_ret);
115*c217d954SCole Faust 
116*c217d954SCole Faust #ifdef __cplusplus
117*c217d954SCole Faust }
118*c217d954SCole Faust #endif
119*c217d954SCole Faust 
120*c217d954SCole Faust #endif /* __OPENCL_CL_EGL_H */
121