| 1 | /* |
| 2 | * Copyright (c) 2025, Intel Corporation |
| 3 | * |
| 4 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 5 | * copy of this software and associated documentation files (the "Software"), |
| 6 | * to deal in the Software without restriction, including without limitation |
| 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 8 | * and/or sell copies of the Software, and to permit persons to whom the |
| 9 | * Software is furnished to do so, subject to the following conditions: |
| 10 | * |
| 11 | * The above copyright notice and this permission notice shall be included |
| 12 | * in all copies or substantial portions of the Software. |
| 13 | * |
| 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
| 15 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 17 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR |
| 18 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
| 19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
| 20 | * OTHER DEALINGS IN THE SOFTWARE. |
| 21 | */ |
| 22 | //! |
| 23 | //! \file vp_ai_kernel_pipe.cpp |
| 24 | //! \brief Defines the common interface for ai |
| 25 | //! this file is for the base interface which is shared by all ai filter in driver. |
| 26 | //! |
| 27 | |
| 28 | #include "vp_ai_kernel_pipe.h" |
| 29 | #include "vp_utils.h" |
| 30 | |
| 31 | using namespace vp; |
| 32 | |
| 33 | void AI_SINGLE_GPU_LAYER_SETTING::Init() |
| 34 | { |
| 35 | engine = FEATURE_AI_ENGINE::GPU; |
| 36 | kernelName = ""; |
| 37 | groupWidth = 0; |
| 38 | groupHeight = 0; |
| 39 | localWidth = 0; |
| 40 | localHeight = 0; |
| 41 | pfnSetStatefulSurface = nullptr; |
| 42 | pfnSetKernelArg = nullptr; |
| 43 | pfnGetIntermediateSurfaceSetting = nullptr; |
| 44 | } |
| 45 | |
| 46 | void AI_SINGLE_NPU_GRAPH_SETTING::Init() |
| 47 | { |
| 48 | engine = FEATURE_AI_ENGINE::NPU; |
| 49 | id = VP_GRAPH_ID_INVALID; |
| 50 | pfnGetIntermediateSurfaceSetting = nullptr; |
| 51 | } |
| 52 | |
| 53 | MOS_STATUS AiGpuSettingInterface::Init() |
| 54 | { |
| 55 | VP_PUBLIC_CHK_NULL_RETURN(setting); |
| 56 | VP_PUBLIC_CHK_STATUS_RETURN(InitBaseSetting()); |
| 57 | VP_PUBLIC_CHK_STATUS_RETURN(InitFuncGetIntermediateSurfaceSetting()); |
| 58 | VP_PUBLIC_CHK_STATUS_RETURN(InitFuncSetStatefulSurface()); |
| 59 | VP_PUBLIC_CHK_STATUS_RETURN(InitFuncSetStatelessSurface()); |
| 60 | VP_PUBLIC_CHK_STATUS_RETURN(InitFuncSetKernelArg()); |
| 61 | |
| 62 | return MOS_STATUS_SUCCESS; |
| 63 | } |
| 64 | |
| 65 | MOS_STATUS AiGpuSettingInterface::Register(AI_SETTING_PIPE &settingPipe) |
| 66 | { |
| 67 | VP_PUBLIC_CHK_NULL_RETURN(setting); |
| 68 | settingPipe.push_back(setting->Clone()); |
| 69 | return MOS_STATUS_SUCCESS; |
| 70 | } |
| 71 | |
| 72 | MOS_STATUS AiNpuSettingInterface::Init() |
| 73 | { |
| 74 | VP_PUBLIC_CHK_NULL_RETURN(setting); |
| 75 | VP_PUBLIC_CHK_STATUS_RETURN(InitBaseSetting()); |
| 76 | VP_PUBLIC_CHK_STATUS_RETURN(InitFuncGetIntermediateSurfaceSetting()); |
| 77 | VP_PUBLIC_CHK_STATUS_RETURN(InitGraphArguments()); |
| 78 | |
| 79 | return MOS_STATUS_SUCCESS; |
| 80 | } |
| 81 | |
| 82 | MOS_STATUS AiNpuSettingInterface::Register(AI_SETTING_PIPE& settingPipe) |
| 83 | { |
| 84 | VP_PUBLIC_CHK_NULL_RETURN(setting); |
| 85 | settingPipe.push_back(setting->Clone()); |
| 86 | return MOS_STATUS_SUCCESS; |
| 87 | } |