• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #ifndef IMAGE_OPENCL_SETUP_H
16 #define IMAGE_OPENCL_SETUP_H
17 #define CL_USE_DEPRECATED_OPENCL_1_2_APIS
18 #include <stdio.h>
19 #include <stdlib.h>
20 #include <time.h>
21 #include <CL/opencl.h>
22 #include <CL/cl_egl.h>
23 
24 struct ClContext {
25     // Platform and device
26     cl_platform_id *platforms{};
27     cl_uint numPlatforms{};   // Total platforms
28     cl_uint idxPlatforms{};   // Current platform
29     cl_device_id **devices{}; // Devices[idxPlatforms] is link list header of platform[idxPlatforms]
30     cl_uint *numDevices{};    // each numDevices[i] record device number of each platform.
31     cl_uint *idxDevices{};    // Current device under current platform
32 
33     // CL Context and Command queue
34     cl_context context{};
35     cl_command_queue cmdQueueGPU{};
36     cl_command_queue cmdQueueCPU{};
37     cl_command_queue cmdQueueDSP{};
38     cl_command_queue cmdQueueOther{};
39 };
40 #define INFO_BUFFER_LENGTH 128
41 
42 extern "C" {
43 namespace OHOS {
44 namespace Media {
45 namespace VideoProcessingEngine {
46 int SetupOpencl(void **pHandle, const char *vendorName, char *deviceName);
47 void CleanOpencl(ClContext *pCtx);
48 } // namespace VideoProcessingEngine
49 } // namespace Media
50 } // namespace OHOS
51 }
52 
53 #endif // IMAGE_OPENCL_SETUP_H
54