180d59932Sopenharmony_ci/*******************************************************************************
280d59932Sopenharmony_ci * Copyright (c) 2008-2020 The Khronos Group Inc.
380d59932Sopenharmony_ci *
480d59932Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
580d59932Sopenharmony_ci * you may not use this file except in compliance with the License.
680d59932Sopenharmony_ci * You may obtain a copy of the License at
780d59932Sopenharmony_ci *
880d59932Sopenharmony_ci *    http://www.apache.org/licenses/LICENSE-2.0
980d59932Sopenharmony_ci *
1080d59932Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
1180d59932Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
1280d59932Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1380d59932Sopenharmony_ci * See the License for the specific language governing permissions and
1480d59932Sopenharmony_ci * limitations under the License.
1580d59932Sopenharmony_ci ******************************************************************************/
1680d59932Sopenharmony_ci
1780d59932Sopenharmony_ci#ifndef __OPENCL_CL_EGL_H
1880d59932Sopenharmony_ci#define __OPENCL_CL_EGL_H
1980d59932Sopenharmony_ci
2080d59932Sopenharmony_ci#include <CL/cl.h>
2180d59932Sopenharmony_ci
2280d59932Sopenharmony_ci#ifdef __cplusplus
2380d59932Sopenharmony_ciextern "C" {
2480d59932Sopenharmony_ci#endif
2580d59932Sopenharmony_ci
2680d59932Sopenharmony_ci
2780d59932Sopenharmony_ci/* Command type for events created with clEnqueueAcquireEGLObjectsKHR */
2880d59932Sopenharmony_ci#define CL_COMMAND_EGL_FENCE_SYNC_OBJECT_KHR  0x202F
2980d59932Sopenharmony_ci#define CL_COMMAND_ACQUIRE_EGL_OBJECTS_KHR    0x202D
3080d59932Sopenharmony_ci#define CL_COMMAND_RELEASE_EGL_OBJECTS_KHR    0x202E
3180d59932Sopenharmony_ci
3280d59932Sopenharmony_ci/* Error type for clCreateFromEGLImageKHR */
3380d59932Sopenharmony_ci#define CL_INVALID_EGL_OBJECT_KHR             -1093
3480d59932Sopenharmony_ci#define CL_EGL_RESOURCE_NOT_ACQUIRED_KHR      -1092
3580d59932Sopenharmony_ci
3680d59932Sopenharmony_ci/* CLeglImageKHR is an opaque handle to an EGLImage */
3780d59932Sopenharmony_citypedef void* CLeglImageKHR;
3880d59932Sopenharmony_ci
3980d59932Sopenharmony_ci/* CLeglDisplayKHR is an opaque handle to an EGLDisplay */
4080d59932Sopenharmony_citypedef void* CLeglDisplayKHR;
4180d59932Sopenharmony_ci
4280d59932Sopenharmony_ci/* CLeglSyncKHR is an opaque handle to an EGLSync object */
4380d59932Sopenharmony_citypedef void* CLeglSyncKHR;
4480d59932Sopenharmony_ci
4580d59932Sopenharmony_ci/* properties passed to clCreateFromEGLImageKHR */
4680d59932Sopenharmony_citypedef intptr_t cl_egl_image_properties_khr;
4780d59932Sopenharmony_ci
4880d59932Sopenharmony_ci
4980d59932Sopenharmony_ci#define cl_khr_egl_image 1
5080d59932Sopenharmony_ci
5180d59932Sopenharmony_ciextern CL_API_ENTRY cl_mem CL_API_CALL
5280d59932Sopenharmony_ciclCreateFromEGLImageKHR(cl_context                  context,
5380d59932Sopenharmony_ci                        CLeglDisplayKHR             egldisplay,
5480d59932Sopenharmony_ci                        CLeglImageKHR               eglimage,
5580d59932Sopenharmony_ci                        cl_mem_flags                flags,
5680d59932Sopenharmony_ci                        const cl_egl_image_properties_khr * properties,
5780d59932Sopenharmony_ci                        cl_int *                    errcode_ret) CL_API_SUFFIX__VERSION_1_0;
5880d59932Sopenharmony_ci
5980d59932Sopenharmony_citypedef cl_mem (CL_API_CALL *clCreateFromEGLImageKHR_fn)(
6080d59932Sopenharmony_ci    cl_context                  context,
6180d59932Sopenharmony_ci    CLeglDisplayKHR             egldisplay,
6280d59932Sopenharmony_ci    CLeglImageKHR               eglimage,
6380d59932Sopenharmony_ci    cl_mem_flags                flags,
6480d59932Sopenharmony_ci    const cl_egl_image_properties_khr * properties,
6580d59932Sopenharmony_ci    cl_int *                    errcode_ret);
6680d59932Sopenharmony_ci
6780d59932Sopenharmony_ci
6880d59932Sopenharmony_ciextern CL_API_ENTRY cl_int CL_API_CALL
6980d59932Sopenharmony_ciclEnqueueAcquireEGLObjectsKHR(cl_command_queue command_queue,
7080d59932Sopenharmony_ci                              cl_uint          num_objects,
7180d59932Sopenharmony_ci                              const cl_mem *   mem_objects,
7280d59932Sopenharmony_ci                              cl_uint          num_events_in_wait_list,
7380d59932Sopenharmony_ci                              const cl_event * event_wait_list,
7480d59932Sopenharmony_ci                              cl_event *       event) CL_API_SUFFIX__VERSION_1_0;
7580d59932Sopenharmony_ci
7680d59932Sopenharmony_citypedef cl_int (CL_API_CALL *clEnqueueAcquireEGLObjectsKHR_fn)(
7780d59932Sopenharmony_ci    cl_command_queue command_queue,
7880d59932Sopenharmony_ci    cl_uint          num_objects,
7980d59932Sopenharmony_ci    const cl_mem *   mem_objects,
8080d59932Sopenharmony_ci    cl_uint          num_events_in_wait_list,
8180d59932Sopenharmony_ci    const cl_event * event_wait_list,
8280d59932Sopenharmony_ci    cl_event *       event);
8380d59932Sopenharmony_ci
8480d59932Sopenharmony_ci
8580d59932Sopenharmony_ciextern CL_API_ENTRY cl_int CL_API_CALL
8680d59932Sopenharmony_ciclEnqueueReleaseEGLObjectsKHR(cl_command_queue command_queue,
8780d59932Sopenharmony_ci                              cl_uint          num_objects,
8880d59932Sopenharmony_ci                              const cl_mem *   mem_objects,
8980d59932Sopenharmony_ci                              cl_uint          num_events_in_wait_list,
9080d59932Sopenharmony_ci                              const cl_event * event_wait_list,
9180d59932Sopenharmony_ci                              cl_event *       event) CL_API_SUFFIX__VERSION_1_0;
9280d59932Sopenharmony_ci
9380d59932Sopenharmony_citypedef cl_int (CL_API_CALL *clEnqueueReleaseEGLObjectsKHR_fn)(
9480d59932Sopenharmony_ci    cl_command_queue command_queue,
9580d59932Sopenharmony_ci    cl_uint          num_objects,
9680d59932Sopenharmony_ci    const cl_mem *   mem_objects,
9780d59932Sopenharmony_ci    cl_uint          num_events_in_wait_list,
9880d59932Sopenharmony_ci    const cl_event * event_wait_list,
9980d59932Sopenharmony_ci    cl_event *       event);
10080d59932Sopenharmony_ci
10180d59932Sopenharmony_ci
10280d59932Sopenharmony_ci#define cl_khr_egl_event 1
10380d59932Sopenharmony_ci
10480d59932Sopenharmony_ciextern CL_API_ENTRY cl_event CL_API_CALL
10580d59932Sopenharmony_ciclCreateEventFromEGLSyncKHR(cl_context      context,
10680d59932Sopenharmony_ci                            CLeglSyncKHR    sync,
10780d59932Sopenharmony_ci                            CLeglDisplayKHR display,
10880d59932Sopenharmony_ci                            cl_int *        errcode_ret) CL_API_SUFFIX__VERSION_1_0;
10980d59932Sopenharmony_ci
11080d59932Sopenharmony_citypedef cl_event (CL_API_CALL *clCreateEventFromEGLSyncKHR_fn)(
11180d59932Sopenharmony_ci    cl_context      context,
11280d59932Sopenharmony_ci    CLeglSyncKHR    sync,
11380d59932Sopenharmony_ci    CLeglDisplayKHR display,
11480d59932Sopenharmony_ci    cl_int *        errcode_ret);
11580d59932Sopenharmony_ci
11680d59932Sopenharmony_ci#ifdef __cplusplus
11780d59932Sopenharmony_ci}
11880d59932Sopenharmony_ci#endif
11980d59932Sopenharmony_ci
12080d59932Sopenharmony_ci#endif /* __OPENCL_CL_EGL_H */
121