1 /**********************************************************************************
2  * Copyright (c) 2008-2019 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 
30 Copyright (c) 2013-2019 Intel Corporation All Rights Reserved.
31 
32 THESE MATERIALS ARE PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
33 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
34 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
35 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
36 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
37 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
38 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
39 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
40 OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
41 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THESE
42 MATERIALS, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
43 
44 File Name: cl_va_api_media_sharing_intel.h
45 
46 Abstract:
47 
48 Notes:
49 
50 \*****************************************************************************/
51 
52 
53 #ifndef __OPENCL_CL_VA_API_MEDIA_SHARING_INTEL_H
54 #define __OPENCL_CL_VA_API_MEDIA_SHARING_INTEL_H
55 
56 #include <CL/cl.h>
57 #include <CL/cl_platform.h>
58 #include <va/va.h>
59 
60 #ifdef __cplusplus
61 extern "C" {
62 #endif
63 
64 /******************************************
65 * cl_intel_va_api_media_sharing extension *
66 *******************************************/
67 
68 #define cl_intel_va_api_media_sharing 1
69 
70 /* error codes */
71 #define CL_INVALID_VA_API_MEDIA_ADAPTER_INTEL               -1098
72 #define CL_INVALID_VA_API_MEDIA_SURFACE_INTEL               -1099
73 #define CL_VA_API_MEDIA_SURFACE_ALREADY_ACQUIRED_INTEL      -1100
74 #define CL_VA_API_MEDIA_SURFACE_NOT_ACQUIRED_INTEL          -1101
75 
76 /* cl_va_api_device_source_intel */
77 #define CL_VA_API_DISPLAY_INTEL                             0x4094
78 
79 /* cl_va_api_device_set_intel */
80 #define CL_PREFERRED_DEVICES_FOR_VA_API_INTEL               0x4095
81 #define CL_ALL_DEVICES_FOR_VA_API_INTEL                     0x4096
82 
83 /* cl_context_info */
84 #define CL_CONTEXT_VA_API_DISPLAY_INTEL                     0x4097
85 
86 /* cl_mem_info */
87 #define CL_MEM_VA_API_MEDIA_SURFACE_INTEL                   0x4098
88 
89 /* cl_image_info */
90 #define CL_IMAGE_VA_API_PLANE_INTEL                         0x4099
91 
92 /* cl_command_type */
93 #define CL_COMMAND_ACQUIRE_VA_API_MEDIA_SURFACES_INTEL      0x409A
94 #define CL_COMMAND_RELEASE_VA_API_MEDIA_SURFACES_INTEL      0x409B
95 
96 typedef cl_uint cl_va_api_device_source_intel;
97 typedef cl_uint cl_va_api_device_set_intel;
98 
99 extern CL_API_ENTRY cl_int CL_API_CALL
100 clGetDeviceIDsFromVA_APIMediaAdapterINTEL(
101     cl_platform_id                platform,
102     cl_va_api_device_source_intel media_adapter_type,
103     void*                         media_adapter,
104     cl_va_api_device_set_intel    media_adapter_set,
105     cl_uint                       num_entries,
106     cl_device_id*                 devices,
107     cl_uint*                      num_devices) CL_EXT_SUFFIX__VERSION_1_2;
108 
109 typedef CL_API_ENTRY cl_int (CL_API_CALL * clGetDeviceIDsFromVA_APIMediaAdapterINTEL_fn)(
110     cl_platform_id                platform,
111     cl_va_api_device_source_intel media_adapter_type,
112     void*                         media_adapter,
113     cl_va_api_device_set_intel    media_adapter_set,
114     cl_uint                       num_entries,
115     cl_device_id*                 devices,
116     cl_uint*                      num_devices) CL_EXT_SUFFIX__VERSION_1_2;
117 
118 extern CL_API_ENTRY cl_mem CL_API_CALL
119 clCreateFromVA_APIMediaSurfaceINTEL(
120     cl_context                    context,
121     cl_mem_flags                  flags,
122     VASurfaceID*                  surface,
123     cl_uint                       plane,
124     cl_int*                       errcode_ret) CL_EXT_SUFFIX__VERSION_1_2;
125 
126 typedef CL_API_ENTRY cl_mem (CL_API_CALL * clCreateFromVA_APIMediaSurfaceINTEL_fn)(
127     cl_context                    context,
128     cl_mem_flags                  flags,
129     VASurfaceID*                  surface,
130     cl_uint                       plane,
131     cl_int*                       errcode_ret) CL_EXT_SUFFIX__VERSION_1_2;
132 
133 extern CL_API_ENTRY cl_int CL_API_CALL
134 clEnqueueAcquireVA_APIMediaSurfacesINTEL(
135     cl_command_queue              command_queue,
136     cl_uint                       num_objects,
137     const cl_mem*                 mem_objects,
138     cl_uint                       num_events_in_wait_list,
139     const cl_event*               event_wait_list,
140     cl_event*                     event) CL_EXT_SUFFIX__VERSION_1_2;
141 
142 typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueAcquireVA_APIMediaSurfacesINTEL_fn)(
143     cl_command_queue              command_queue,
144     cl_uint                       num_objects,
145     const cl_mem*                 mem_objects,
146     cl_uint                       num_events_in_wait_list,
147     const cl_event*               event_wait_list,
148     cl_event*                     event) CL_EXT_SUFFIX__VERSION_1_2;
149 
150 extern CL_API_ENTRY cl_int CL_API_CALL
151 clEnqueueReleaseVA_APIMediaSurfacesINTEL(
152     cl_command_queue              command_queue,
153     cl_uint                       num_objects,
154     const cl_mem*                 mem_objects,
155     cl_uint                       num_events_in_wait_list,
156     const cl_event*               event_wait_list,
157     cl_event*                     event) CL_EXT_SUFFIX__VERSION_1_2;
158 
159 typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueReleaseVA_APIMediaSurfacesINTEL_fn)(
160     cl_command_queue              command_queue,
161     cl_uint                       num_objects,
162     const cl_mem*                 mem_objects,
163     cl_uint                       num_events_in_wait_list,
164     const cl_event*               event_wait_list,
165     cl_event*                     event) CL_EXT_SUFFIX__VERSION_1_2;
166 
167 #ifdef __cplusplus
168 }
169 #endif
170 
171 #endif  /* __OPENCL_CL_VA_API_MEDIA_SHARING_INTEL_H */
172 
173