1 /******************************************************************************* 2 * Copyright (c) 2008-2020 The Khronos Group Inc. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 ******************************************************************************/ 16 17 #ifndef __OPENCL_CL_VA_API_MEDIA_SHARING_INTEL_H 18 #define __OPENCL_CL_VA_API_MEDIA_SHARING_INTEL_H 19 20 #include <CL/cl.h> 21 #include <CL/cl_platform.h> 22 #include <va/va.h> 23 24 #ifdef __cplusplus 25 extern "C" { 26 #endif 27 28 /*************************************************************** 29 * cl_intel_sharing_format_query_va_api 30 ***************************************************************/ 31 #define cl_intel_sharing_format_query_va_api 1 32 33 /* when cl_intel_va_api_media_sharing is supported */ 34 35 extern CL_API_ENTRY cl_int CL_API_CALL 36 clGetSupportedVA_APIMediaSurfaceFormatsINTEL( 37 cl_context context, 38 cl_mem_flags flags, 39 cl_mem_object_type image_type, 40 cl_uint plane, 41 cl_uint num_entries, 42 VAImageFormat* va_api_formats, 43 cl_uint* num_surface_formats) ; 44 45 typedef cl_int (CL_API_CALL * 46 clGetSupportedVA_APIMediaSurfaceFormatsINTEL_fn)( 47 cl_context context, 48 cl_mem_flags flags, 49 cl_mem_object_type image_type, 50 cl_uint plane, 51 cl_uint num_entries, 52 VAImageFormat* va_api_formats, 53 cl_uint* num_surface_formats) ; 54 55 /****************************************** 56 * cl_intel_va_api_media_sharing extension * 57 *******************************************/ 58 59 #define cl_intel_va_api_media_sharing 1 60 61 /* error codes */ 62 #define CL_INVALID_VA_API_MEDIA_ADAPTER_INTEL -1098 63 #define CL_INVALID_VA_API_MEDIA_SURFACE_INTEL -1099 64 #define CL_VA_API_MEDIA_SURFACE_ALREADY_ACQUIRED_INTEL -1100 65 #define CL_VA_API_MEDIA_SURFACE_NOT_ACQUIRED_INTEL -1101 66 67 /* cl_va_api_device_source_intel */ 68 #define CL_VA_API_DISPLAY_INTEL 0x4094 69 70 /* cl_va_api_device_set_intel */ 71 #define CL_PREFERRED_DEVICES_FOR_VA_API_INTEL 0x4095 72 #define CL_ALL_DEVICES_FOR_VA_API_INTEL 0x4096 73 74 /* cl_context_info */ 75 #define CL_CONTEXT_VA_API_DISPLAY_INTEL 0x4097 76 77 /* cl_mem_info */ 78 #define CL_MEM_VA_API_MEDIA_SURFACE_INTEL 0x4098 79 80 /* cl_image_info */ 81 #define CL_IMAGE_VA_API_PLANE_INTEL 0x4099 82 83 /* cl_command_type */ 84 #define CL_COMMAND_ACQUIRE_VA_API_MEDIA_SURFACES_INTEL 0x409A 85 #define CL_COMMAND_RELEASE_VA_API_MEDIA_SURFACES_INTEL 0x409B 86 87 typedef cl_uint cl_va_api_device_source_intel; 88 typedef cl_uint cl_va_api_device_set_intel; 89 90 extern CL_API_ENTRY cl_int CL_API_CALL 91 clGetDeviceIDsFromVA_APIMediaAdapterINTEL( 92 cl_platform_id platform, 93 cl_va_api_device_source_intel media_adapter_type, 94 void* media_adapter, 95 cl_va_api_device_set_intel media_adapter_set, 96 cl_uint num_entries, 97 cl_device_id* devices, 98 cl_uint* num_devices) CL_API_SUFFIX__VERSION_1_2; 99 100 typedef cl_int (CL_API_CALL * clGetDeviceIDsFromVA_APIMediaAdapterINTEL_fn)( 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_API_SUFFIX__VERSION_1_2; 108 109 extern CL_API_ENTRY cl_mem CL_API_CALL 110 clCreateFromVA_APIMediaSurfaceINTEL( 111 cl_context context, 112 cl_mem_flags flags, 113 VASurfaceID* surface, 114 cl_uint plane, 115 cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_2; 116 117 typedef cl_mem (CL_API_CALL * clCreateFromVA_APIMediaSurfaceINTEL_fn)( 118 cl_context context, 119 cl_mem_flags flags, 120 VASurfaceID* surface, 121 cl_uint plane, 122 cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_2; 123 124 extern CL_API_ENTRY cl_int CL_API_CALL 125 clEnqueueAcquireVA_APIMediaSurfacesINTEL( 126 cl_command_queue command_queue, 127 cl_uint num_objects, 128 const cl_mem* mem_objects, 129 cl_uint num_events_in_wait_list, 130 const cl_event* event_wait_list, 131 cl_event* event) CL_API_SUFFIX__VERSION_1_2; 132 133 typedef cl_int (CL_API_CALL *clEnqueueAcquireVA_APIMediaSurfacesINTEL_fn)( 134 cl_command_queue command_queue, 135 cl_uint num_objects, 136 const cl_mem* mem_objects, 137 cl_uint num_events_in_wait_list, 138 const cl_event* event_wait_list, 139 cl_event* event) CL_API_SUFFIX__VERSION_1_2; 140 141 extern CL_API_ENTRY cl_int CL_API_CALL 142 clEnqueueReleaseVA_APIMediaSurfacesINTEL( 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_API_SUFFIX__VERSION_1_2; 149 150 typedef cl_int (CL_API_CALL *clEnqueueReleaseVA_APIMediaSurfacesINTEL_fn)( 151 cl_command_queue command_queue, 152 cl_uint num_objects, 153 const cl_mem* mem_objects, 154 cl_uint num_events_in_wait_list, 155 const cl_event* event_wait_list, 156 cl_event* event) CL_API_SUFFIX__VERSION_1_2; 157 158 #ifdef __cplusplus 159 } 160 #endif 161 162 #endif /* __OPENCL_CL_VA_API_MEDIA_SHARING_INTEL_H */ 163 164