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
30Copyright (c) 2013-2019 Intel Corporation All Rights Reserved.
31
32THESE MATERIALS ARE PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
33"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
34LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
35A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
36CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
37EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
38PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
39PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
40OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
41NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THESE
42MATERIALS, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
43
44File Name: cl_dx9_media_sharing_intel.h
45
46Abstract:
47
48Notes:
49
50\*****************************************************************************/
51
52#ifndef __OPENCL_CL_DX9_MEDIA_SHARING_INTEL_H
53#define __OPENCL_CL_DX9_MEDIA_SHARING_INTEL_H
54
55#include <CL/cl.h>
56#include <CL/cl_platform.h>
57#include <d3d9.h>
58#include <dxvahd.h>
59#include <wtypes.h>
60#include <d3d9types.h>
61
62#ifdef __cplusplus
63extern "C" {
64#endif
65
66/***************************************
67* cl_intel_dx9_media_sharing extension *
68****************************************/
69
70#define cl_intel_dx9_media_sharing 1
71
72typedef cl_uint cl_dx9_device_source_intel;
73typedef cl_uint cl_dx9_device_set_intel;
74
75/* error codes */
76#define CL_INVALID_DX9_DEVICE_INTEL                   -1010
77#define CL_INVALID_DX9_RESOURCE_INTEL                 -1011
78#define CL_DX9_RESOURCE_ALREADY_ACQUIRED_INTEL        -1012
79#define CL_DX9_RESOURCE_NOT_ACQUIRED_INTEL            -1013
80
81/* cl_dx9_device_source_intel */
82#define CL_D3D9_DEVICE_INTEL                          0x4022
83#define CL_D3D9EX_DEVICE_INTEL                        0x4070
84#define CL_DXVA_DEVICE_INTEL                          0x4071
85
86/* cl_dx9_device_set_intel */
87#define CL_PREFERRED_DEVICES_FOR_DX9_INTEL            0x4024
88#define CL_ALL_DEVICES_FOR_DX9_INTEL                  0x4025
89
90/* cl_context_info */
91#define CL_CONTEXT_D3D9_DEVICE_INTEL                  0x4026
92#define CL_CONTEXT_D3D9EX_DEVICE_INTEL                0x4072
93#define CL_CONTEXT_DXVA_DEVICE_INTEL                  0x4073
94
95/* cl_mem_info */
96#define CL_MEM_DX9_RESOURCE_INTEL                     0x4027
97#define CL_MEM_DX9_SHARED_HANDLE_INTEL                0x4074
98
99/* cl_image_info */
100#define CL_IMAGE_DX9_PLANE_INTEL                      0x4075
101
102/* cl_command_type */
103#define CL_COMMAND_ACQUIRE_DX9_OBJECTS_INTEL          0x402A
104#define CL_COMMAND_RELEASE_DX9_OBJECTS_INTEL          0x402B
105/******************************************************************************/
106
107extern CL_API_ENTRY cl_int CL_API_CALL
108clGetDeviceIDsFromDX9INTEL(
109    cl_platform_id              platform,
110    cl_dx9_device_source_intel  dx9_device_source,
111    void*                       dx9_object,
112    cl_dx9_device_set_intel     dx9_device_set,
113    cl_uint                     num_entries,
114    cl_device_id*               devices,
115    cl_uint*                    num_devices) CL_EXT_SUFFIX__VERSION_1_1;
116
117typedef CL_API_ENTRY cl_int (CL_API_CALL* clGetDeviceIDsFromDX9INTEL_fn)(
118    cl_platform_id              platform,
119    cl_dx9_device_source_intel  dx9_device_source,
120    void*                       dx9_object,
121    cl_dx9_device_set_intel     dx9_device_set,
122    cl_uint                     num_entries,
123    cl_device_id*               devices,
124    cl_uint*                    num_devices) CL_EXT_SUFFIX__VERSION_1_1;
125
126extern CL_API_ENTRY cl_mem CL_API_CALL
127clCreateFromDX9MediaSurfaceINTEL(
128    cl_context                  context,
129    cl_mem_flags                flags,
130    IDirect3DSurface9*          resource,
131    HANDLE                      sharedHandle,
132    UINT                        plane,
133    cl_int*                     errcode_ret) CL_EXT_SUFFIX__VERSION_1_1;
134
135typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromDX9MediaSurfaceINTEL_fn)(
136    cl_context                  context,
137    cl_mem_flags                flags,
138    IDirect3DSurface9*          resource,
139    HANDLE                      sharedHandle,
140    UINT                        plane,
141    cl_int*                     errcode_ret) CL_EXT_SUFFIX__VERSION_1_1;
142
143extern CL_API_ENTRY cl_int CL_API_CALL
144clEnqueueAcquireDX9ObjectsINTEL(
145    cl_command_queue            command_queue,
146    cl_uint                     num_objects,
147    const cl_mem*               mem_objects,
148    cl_uint                     num_events_in_wait_list,
149    const cl_event*             event_wait_list,
150    cl_event*                   event) CL_EXT_SUFFIX__VERSION_1_1;
151
152typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueAcquireDX9ObjectsINTEL_fn)(
153    cl_command_queue            command_queue,
154    cl_uint                     num_objects,
155    const cl_mem*               mem_objects,
156    cl_uint                     num_events_in_wait_list,
157    const cl_event*             event_wait_list,
158    cl_event*                   event) CL_EXT_SUFFIX__VERSION_1_1;
159
160extern CL_API_ENTRY cl_int CL_API_CALL
161clEnqueueReleaseDX9ObjectsINTEL(
162    cl_command_queue            command_queue,
163    cl_uint                     num_objects,
164    cl_mem*                     mem_objects,
165    cl_uint                     num_events_in_wait_list,
166    const cl_event*             event_wait_list,
167    cl_event*                   event) CL_EXT_SUFFIX__VERSION_1_1;
168
169typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueReleaseDX9ObjectsINTEL_fn)(
170    cl_command_queue            command_queue,
171    cl_uint                     num_objects,
172    cl_mem*                     mem_objects,
173    cl_uint                     num_events_in_wait_list,
174    const cl_event*             event_wait_list,
175    cl_event*                   event) CL_EXT_SUFFIX__VERSION_1_1;
176
177#ifdef __cplusplus
178}
179#endif
180
181#endif  /* __OPENCL_CL_DX9_MEDIA_SHARING_INTEL_H */
182
183