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_DX9_MEDIA_SHARING_H 1880d59932Sopenharmony_ci#define __OPENCL_CL_DX9_MEDIA_SHARING_H 1980d59932Sopenharmony_ci 2080d59932Sopenharmony_ci#include <CL/cl.h> 2180d59932Sopenharmony_ci#include <CL/cl_platform.h> 2280d59932Sopenharmony_ci 2380d59932Sopenharmony_ci#ifdef __cplusplus 2480d59932Sopenharmony_ciextern "C" { 2580d59932Sopenharmony_ci#endif 2680d59932Sopenharmony_ci 2780d59932Sopenharmony_ci/******************************************************************************/ 2880d59932Sopenharmony_ci/* cl_khr_dx9_media_sharing */ 2980d59932Sopenharmony_ci#define cl_khr_dx9_media_sharing 1 3080d59932Sopenharmony_ci 3180d59932Sopenharmony_citypedef cl_uint cl_dx9_media_adapter_type_khr; 3280d59932Sopenharmony_citypedef cl_uint cl_dx9_media_adapter_set_khr; 3380d59932Sopenharmony_ci 3480d59932Sopenharmony_ci#if defined(_WIN32) 3580d59932Sopenharmony_ci#if defined(_MSC_VER) 3680d59932Sopenharmony_ci#if _MSC_VER >=1500 3780d59932Sopenharmony_ci#pragma warning( push ) 3880d59932Sopenharmony_ci#pragma warning( disable : 4201 ) 3980d59932Sopenharmony_ci#pragma warning( disable : 5105 ) 4080d59932Sopenharmony_ci#endif 4180d59932Sopenharmony_ci#endif 4280d59932Sopenharmony_ci#include <d3d9.h> 4380d59932Sopenharmony_ci#if defined(_MSC_VER) 4480d59932Sopenharmony_ci#if _MSC_VER >=1500 4580d59932Sopenharmony_ci#pragma warning( pop ) 4680d59932Sopenharmony_ci#endif 4780d59932Sopenharmony_ci#endif 4880d59932Sopenharmony_citypedef struct _cl_dx9_surface_info_khr 4980d59932Sopenharmony_ci{ 5080d59932Sopenharmony_ci IDirect3DSurface9 *resource; 5180d59932Sopenharmony_ci HANDLE shared_handle; 5280d59932Sopenharmony_ci} cl_dx9_surface_info_khr; 5380d59932Sopenharmony_ci#endif 5480d59932Sopenharmony_ci 5580d59932Sopenharmony_ci 5680d59932Sopenharmony_ci/******************************************************************************/ 5780d59932Sopenharmony_ci 5880d59932Sopenharmony_ci/* Error Codes */ 5980d59932Sopenharmony_ci#define CL_INVALID_DX9_MEDIA_ADAPTER_KHR -1010 6080d59932Sopenharmony_ci#define CL_INVALID_DX9_MEDIA_SURFACE_KHR -1011 6180d59932Sopenharmony_ci#define CL_DX9_MEDIA_SURFACE_ALREADY_ACQUIRED_KHR -1012 6280d59932Sopenharmony_ci#define CL_DX9_MEDIA_SURFACE_NOT_ACQUIRED_KHR -1013 6380d59932Sopenharmony_ci 6480d59932Sopenharmony_ci/* cl_media_adapter_type_khr */ 6580d59932Sopenharmony_ci#define CL_ADAPTER_D3D9_KHR 0x2020 6680d59932Sopenharmony_ci#define CL_ADAPTER_D3D9EX_KHR 0x2021 6780d59932Sopenharmony_ci#define CL_ADAPTER_DXVA_KHR 0x2022 6880d59932Sopenharmony_ci 6980d59932Sopenharmony_ci/* cl_media_adapter_set_khr */ 7080d59932Sopenharmony_ci#define CL_PREFERRED_DEVICES_FOR_DX9_MEDIA_ADAPTER_KHR 0x2023 7180d59932Sopenharmony_ci#define CL_ALL_DEVICES_FOR_DX9_MEDIA_ADAPTER_KHR 0x2024 7280d59932Sopenharmony_ci 7380d59932Sopenharmony_ci/* cl_context_info */ 7480d59932Sopenharmony_ci#define CL_CONTEXT_ADAPTER_D3D9_KHR 0x2025 7580d59932Sopenharmony_ci#define CL_CONTEXT_ADAPTER_D3D9EX_KHR 0x2026 7680d59932Sopenharmony_ci#define CL_CONTEXT_ADAPTER_DXVA_KHR 0x2027 7780d59932Sopenharmony_ci 7880d59932Sopenharmony_ci/* cl_mem_info */ 7980d59932Sopenharmony_ci#define CL_MEM_DX9_MEDIA_ADAPTER_TYPE_KHR 0x2028 8080d59932Sopenharmony_ci#define CL_MEM_DX9_MEDIA_SURFACE_INFO_KHR 0x2029 8180d59932Sopenharmony_ci 8280d59932Sopenharmony_ci/* cl_image_info */ 8380d59932Sopenharmony_ci#define CL_IMAGE_DX9_MEDIA_PLANE_KHR 0x202A 8480d59932Sopenharmony_ci 8580d59932Sopenharmony_ci/* cl_command_type */ 8680d59932Sopenharmony_ci#define CL_COMMAND_ACQUIRE_DX9_MEDIA_SURFACES_KHR 0x202B 8780d59932Sopenharmony_ci#define CL_COMMAND_RELEASE_DX9_MEDIA_SURFACES_KHR 0x202C 8880d59932Sopenharmony_ci 8980d59932Sopenharmony_ci/******************************************************************************/ 9080d59932Sopenharmony_ci 9180d59932Sopenharmony_citypedef cl_int (CL_API_CALL *clGetDeviceIDsFromDX9MediaAdapterKHR_fn)( 9280d59932Sopenharmony_ci cl_platform_id platform, 9380d59932Sopenharmony_ci cl_uint num_media_adapters, 9480d59932Sopenharmony_ci cl_dx9_media_adapter_type_khr * media_adapter_type, 9580d59932Sopenharmony_ci void * media_adapters, 9680d59932Sopenharmony_ci cl_dx9_media_adapter_set_khr media_adapter_set, 9780d59932Sopenharmony_ci cl_uint num_entries, 9880d59932Sopenharmony_ci cl_device_id * devices, 9980d59932Sopenharmony_ci cl_uint * num_devices) CL_API_SUFFIX__VERSION_1_2; 10080d59932Sopenharmony_ci 10180d59932Sopenharmony_citypedef cl_mem (CL_API_CALL *clCreateFromDX9MediaSurfaceKHR_fn)( 10280d59932Sopenharmony_ci cl_context context, 10380d59932Sopenharmony_ci cl_mem_flags flags, 10480d59932Sopenharmony_ci cl_dx9_media_adapter_type_khr adapter_type, 10580d59932Sopenharmony_ci void * surface_info, 10680d59932Sopenharmony_ci cl_uint plane, 10780d59932Sopenharmony_ci cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_2; 10880d59932Sopenharmony_ci 10980d59932Sopenharmony_citypedef cl_int (CL_API_CALL *clEnqueueAcquireDX9MediaSurfacesKHR_fn)( 11080d59932Sopenharmony_ci cl_command_queue command_queue, 11180d59932Sopenharmony_ci cl_uint num_objects, 11280d59932Sopenharmony_ci const cl_mem * mem_objects, 11380d59932Sopenharmony_ci cl_uint num_events_in_wait_list, 11480d59932Sopenharmony_ci const cl_event * event_wait_list, 11580d59932Sopenharmony_ci cl_event * event) CL_API_SUFFIX__VERSION_1_2; 11680d59932Sopenharmony_ci 11780d59932Sopenharmony_citypedef cl_int (CL_API_CALL *clEnqueueReleaseDX9MediaSurfacesKHR_fn)( 11880d59932Sopenharmony_ci cl_command_queue command_queue, 11980d59932Sopenharmony_ci cl_uint num_objects, 12080d59932Sopenharmony_ci const cl_mem * mem_objects, 12180d59932Sopenharmony_ci cl_uint num_events_in_wait_list, 12280d59932Sopenharmony_ci const cl_event * event_wait_list, 12380d59932Sopenharmony_ci cl_event * event) CL_API_SUFFIX__VERSION_1_2; 12480d59932Sopenharmony_ci 12580d59932Sopenharmony_ci/*************************************** 12680d59932Sopenharmony_ci* cl_intel_dx9_media_sharing extension * 12780d59932Sopenharmony_ci****************************************/ 12880d59932Sopenharmony_ci 12980d59932Sopenharmony_ci#define cl_intel_dx9_media_sharing 1 13080d59932Sopenharmony_ci 13180d59932Sopenharmony_citypedef cl_uint cl_dx9_device_source_intel; 13280d59932Sopenharmony_citypedef cl_uint cl_dx9_device_set_intel; 13380d59932Sopenharmony_ci 13480d59932Sopenharmony_ci/* error codes */ 13580d59932Sopenharmony_ci#define CL_INVALID_DX9_DEVICE_INTEL -1010 13680d59932Sopenharmony_ci#define CL_INVALID_DX9_RESOURCE_INTEL -1011 13780d59932Sopenharmony_ci#define CL_DX9_RESOURCE_ALREADY_ACQUIRED_INTEL -1012 13880d59932Sopenharmony_ci#define CL_DX9_RESOURCE_NOT_ACQUIRED_INTEL -1013 13980d59932Sopenharmony_ci 14080d59932Sopenharmony_ci/* cl_dx9_device_source_intel */ 14180d59932Sopenharmony_ci#define CL_D3D9_DEVICE_INTEL 0x4022 14280d59932Sopenharmony_ci#define CL_D3D9EX_DEVICE_INTEL 0x4070 14380d59932Sopenharmony_ci#define CL_DXVA_DEVICE_INTEL 0x4071 14480d59932Sopenharmony_ci 14580d59932Sopenharmony_ci/* cl_dx9_device_set_intel */ 14680d59932Sopenharmony_ci#define CL_PREFERRED_DEVICES_FOR_DX9_INTEL 0x4024 14780d59932Sopenharmony_ci#define CL_ALL_DEVICES_FOR_DX9_INTEL 0x4025 14880d59932Sopenharmony_ci 14980d59932Sopenharmony_ci/* cl_context_info */ 15080d59932Sopenharmony_ci#define CL_CONTEXT_D3D9_DEVICE_INTEL 0x4026 15180d59932Sopenharmony_ci#define CL_CONTEXT_D3D9EX_DEVICE_INTEL 0x4072 15280d59932Sopenharmony_ci#define CL_CONTEXT_DXVA_DEVICE_INTEL 0x4073 15380d59932Sopenharmony_ci 15480d59932Sopenharmony_ci/* cl_mem_info */ 15580d59932Sopenharmony_ci#define CL_MEM_DX9_RESOURCE_INTEL 0x4027 15680d59932Sopenharmony_ci#define CL_MEM_DX9_SHARED_HANDLE_INTEL 0x4074 15780d59932Sopenharmony_ci 15880d59932Sopenharmony_ci/* cl_image_info */ 15980d59932Sopenharmony_ci#define CL_IMAGE_DX9_PLANE_INTEL 0x4075 16080d59932Sopenharmony_ci 16180d59932Sopenharmony_ci/* cl_command_type */ 16280d59932Sopenharmony_ci#define CL_COMMAND_ACQUIRE_DX9_OBJECTS_INTEL 0x402A 16380d59932Sopenharmony_ci#define CL_COMMAND_RELEASE_DX9_OBJECTS_INTEL 0x402B 16480d59932Sopenharmony_ci/******************************************************************************/ 16580d59932Sopenharmony_ci 16680d59932Sopenharmony_ciextern CL_API_ENTRY cl_int CL_API_CALL 16780d59932Sopenharmony_ciclGetDeviceIDsFromDX9INTEL( 16880d59932Sopenharmony_ci cl_platform_id platform, 16980d59932Sopenharmony_ci cl_dx9_device_source_intel dx9_device_source, 17080d59932Sopenharmony_ci void* dx9_object, 17180d59932Sopenharmony_ci cl_dx9_device_set_intel dx9_device_set, 17280d59932Sopenharmony_ci cl_uint num_entries, 17380d59932Sopenharmony_ci cl_device_id* devices, 17480d59932Sopenharmony_ci cl_uint* num_devices) CL_API_SUFFIX__VERSION_1_1; 17580d59932Sopenharmony_ci 17680d59932Sopenharmony_citypedef cl_int (CL_API_CALL* clGetDeviceIDsFromDX9INTEL_fn)( 17780d59932Sopenharmony_ci cl_platform_id platform, 17880d59932Sopenharmony_ci cl_dx9_device_source_intel dx9_device_source, 17980d59932Sopenharmony_ci void* dx9_object, 18080d59932Sopenharmony_ci cl_dx9_device_set_intel dx9_device_set, 18180d59932Sopenharmony_ci cl_uint num_entries, 18280d59932Sopenharmony_ci cl_device_id* devices, 18380d59932Sopenharmony_ci cl_uint* num_devices) CL_API_SUFFIX__VERSION_1_1; 18480d59932Sopenharmony_ci 18580d59932Sopenharmony_ciextern CL_API_ENTRY cl_mem CL_API_CALL 18680d59932Sopenharmony_ciclCreateFromDX9MediaSurfaceINTEL( 18780d59932Sopenharmony_ci cl_context context, 18880d59932Sopenharmony_ci cl_mem_flags flags, 18980d59932Sopenharmony_ci IDirect3DSurface9* resource, 19080d59932Sopenharmony_ci HANDLE sharedHandle, 19180d59932Sopenharmony_ci UINT plane, 19280d59932Sopenharmony_ci cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_1; 19380d59932Sopenharmony_ci 19480d59932Sopenharmony_citypedef cl_mem (CL_API_CALL *clCreateFromDX9MediaSurfaceINTEL_fn)( 19580d59932Sopenharmony_ci cl_context context, 19680d59932Sopenharmony_ci cl_mem_flags flags, 19780d59932Sopenharmony_ci IDirect3DSurface9* resource, 19880d59932Sopenharmony_ci HANDLE sharedHandle, 19980d59932Sopenharmony_ci UINT plane, 20080d59932Sopenharmony_ci cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_1; 20180d59932Sopenharmony_ci 20280d59932Sopenharmony_ciextern CL_API_ENTRY cl_int CL_API_CALL 20380d59932Sopenharmony_ciclEnqueueAcquireDX9ObjectsINTEL( 20480d59932Sopenharmony_ci cl_command_queue command_queue, 20580d59932Sopenharmony_ci cl_uint num_objects, 20680d59932Sopenharmony_ci const cl_mem* mem_objects, 20780d59932Sopenharmony_ci cl_uint num_events_in_wait_list, 20880d59932Sopenharmony_ci const cl_event* event_wait_list, 20980d59932Sopenharmony_ci cl_event* event) CL_API_SUFFIX__VERSION_1_1; 21080d59932Sopenharmony_ci 21180d59932Sopenharmony_citypedef cl_int (CL_API_CALL *clEnqueueAcquireDX9ObjectsINTEL_fn)( 21280d59932Sopenharmony_ci cl_command_queue command_queue, 21380d59932Sopenharmony_ci cl_uint num_objects, 21480d59932Sopenharmony_ci const cl_mem* mem_objects, 21580d59932Sopenharmony_ci cl_uint num_events_in_wait_list, 21680d59932Sopenharmony_ci const cl_event* event_wait_list, 21780d59932Sopenharmony_ci cl_event* event) CL_API_SUFFIX__VERSION_1_1; 21880d59932Sopenharmony_ci 21980d59932Sopenharmony_ciextern CL_API_ENTRY cl_int CL_API_CALL 22080d59932Sopenharmony_ciclEnqueueReleaseDX9ObjectsINTEL( 22180d59932Sopenharmony_ci cl_command_queue command_queue, 22280d59932Sopenharmony_ci cl_uint num_objects, 22380d59932Sopenharmony_ci cl_mem* mem_objects, 22480d59932Sopenharmony_ci cl_uint num_events_in_wait_list, 22580d59932Sopenharmony_ci const cl_event* event_wait_list, 22680d59932Sopenharmony_ci cl_event* event) CL_API_SUFFIX__VERSION_1_1; 22780d59932Sopenharmony_ci 22880d59932Sopenharmony_citypedef cl_int (CL_API_CALL *clEnqueueReleaseDX9ObjectsINTEL_fn)( 22980d59932Sopenharmony_ci cl_command_queue command_queue, 23080d59932Sopenharmony_ci cl_uint num_objects, 23180d59932Sopenharmony_ci cl_mem* mem_objects, 23280d59932Sopenharmony_ci cl_uint num_events_in_wait_list, 23380d59932Sopenharmony_ci const cl_event* event_wait_list, 23480d59932Sopenharmony_ci cl_event* event) CL_API_SUFFIX__VERSION_1_1; 23580d59932Sopenharmony_ci 23680d59932Sopenharmony_ci/*************************************************************** 23780d59932Sopenharmony_ci* cl_intel_sharing_format_query_dx9 23880d59932Sopenharmony_ci***************************************************************/ 23980d59932Sopenharmony_ci#define cl_intel_sharing_format_query_dx9 1 24080d59932Sopenharmony_ci 24180d59932Sopenharmony_ci/* when cl_khr_dx9_media_sharing or cl_intel_dx9_media_sharing is supported */ 24280d59932Sopenharmony_ci 24380d59932Sopenharmony_ciextern CL_API_ENTRY cl_int CL_API_CALL 24480d59932Sopenharmony_ciclGetSupportedDX9MediaSurfaceFormatsINTEL( 24580d59932Sopenharmony_ci cl_context context, 24680d59932Sopenharmony_ci cl_mem_flags flags, 24780d59932Sopenharmony_ci cl_mem_object_type image_type, 24880d59932Sopenharmony_ci cl_uint plane, 24980d59932Sopenharmony_ci cl_uint num_entries, 25080d59932Sopenharmony_ci D3DFORMAT* dx9_formats, 25180d59932Sopenharmony_ci cl_uint* num_surface_formats) ; 25280d59932Sopenharmony_ci 25380d59932Sopenharmony_citypedef cl_int (CL_API_CALL * 25480d59932Sopenharmony_ciclGetSupportedDX9MediaSurfaceFormatsINTEL_fn)( 25580d59932Sopenharmony_ci cl_context context, 25680d59932Sopenharmony_ci cl_mem_flags flags, 25780d59932Sopenharmony_ci cl_mem_object_type image_type, 25880d59932Sopenharmony_ci cl_uint plane, 25980d59932Sopenharmony_ci cl_uint num_entries, 26080d59932Sopenharmony_ci D3DFORMAT* dx9_formats, 26180d59932Sopenharmony_ci cl_uint* num_surface_formats) ; 26280d59932Sopenharmony_ci 26380d59932Sopenharmony_ci#ifdef __cplusplus 26480d59932Sopenharmony_ci} 26580d59932Sopenharmony_ci#endif 26680d59932Sopenharmony_ci 26780d59932Sopenharmony_ci#endif /* __OPENCL_CL_DX9_MEDIA_SHARING_H */ 26880d59932Sopenharmony_ci 269