| 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 |
#ifndef __VP_RENDER_AI_KERNEL_H__ |
| 23 |
#define __VP_RENDER_AI_KERNEL_H__ |
| 24 |
|
| 25 |
#include "vp_render_kernel_obj.h" |
| 26 |
|
| 27 |
namespace vp |
| 28 |
{ |
| 29 |
|
| 30 |
class VpRenderAiKernel : public VpRenderKernelObj |
| 31 |
{ |
| 32 |
public: |
| 33 |
VpRenderAiKernel(PVP_MHWINTERFACE hwInterface, std::string kernemName, uint32_t kernelIndex, PVpAllocator allocator); |
| 34 |
virtual ~VpRenderAiKernel(); |
| 35 |
|
| 36 |
virtual MOS_STATUS Init(VpRenderKernel &kernel); |
| 37 |
virtual MOS_STATUS GetCurbeState(void *&curbe, uint32_t &curbeLength); |
| 38 |
virtual uint32_t GetInlineDataSize() override |
| 39 |
{ |
| 40 |
return 0; |
| 41 |
} |
| 42 |
virtual MOS_STATUS SetSamplerStates(KERNEL_SAMPLER_STATE_GROUP &samplerStateGroup); |
| 43 |
virtual MOS_STATUS GetWalkerSetting(KERNEL_WALKER_PARAMS &walkerParam, KERNEL_PACKET_RENDER_DATA &renderData); |
| 44 |
|
| 45 |
virtual MOS_STATUS SetKernelConfigs(KERNEL_CONFIGS &kernelConfigs) override; |
| 46 |
virtual MOS_STATUS SetPerfTag() override; |
| 47 |
virtual uint32_t GetLargeGrfMode() override; |
| 48 |
|
| 49 |
MOS_STATUS FreeCurbe(void *&curbe) |
| 50 |
{ |
| 51 |
return MOS_STATUS_SUCCESS; |
| 52 |
} |
| 53 |
|
| 54 |
virtual void OcaDumpKernelInfo(MOS_COMMAND_BUFFER &cmdBuffer, MOS_CONTEXT &mosContext) override; |
| 55 |
|
| 56 |
protected: |
| 57 |
virtual MOS_STATUS SetupSurfaceState() override; |
| 58 |
virtual MOS_STATUS SetWalkerSetting(KERNEL_THREAD_SPACE &threadSpace, bool bSyncFlag, bool flushL1 = false); |
| 59 |
virtual MOS_STATUS SetKernelArgs(KERNEL_ARGS &kernelArgs, VP_PACKET_SHARED_CONTEXT *sharedContext); |
| 60 |
virtual MOS_STATUS GetKernelSurfaceParam(bool isBTI, SURFACE_PARAMS &surfParam, KERNEL_SURFACE_STATE_PARAM &kernelSurfaceParam); |
| 61 |
virtual MOS_STATUS GetInlineData(uint8_t *inlineData); |
| 62 |
|
| 63 |
PRENDERHAL_INTERFACE m_renderHal = nullptr; |
| 64 |
|
| 65 |
static std::map<std::string, VpKernelID> m_kernelBiniaryIdMap; |
| 66 |
static VpKernelID m_currentBiniaryID; |
| 67 |
|
| 68 |
//kernel Arguments |
| 69 |
KERNEL_INDEX_ARG_MAP m_kernelArgs = {}; |
| 70 |
KERNEL_BTIS m_kernelBtis = {}; |
| 71 |
KRN_EXECUTE_ENV m_kernelEnv = {}; |
| 72 |
KRN_PER_THREAD_ARG_INFO m_kernelPerThreadArgInfo = {}; |
| 73 |
KERNEL_WALKER_PARAMS m_walkerParam = {}; |
| 74 |
void *m_curbe = nullptr; |
| 75 |
uint32_t m_kernelIndex = 0; |
| 76 |
int32_t m_linearSamplerIndex = -1; |
| 77 |
int32_t m_nearestSamplerIndex = -1; |
| 78 |
std ::vector<uint8_t> m_inlineData = {}; |
| 79 |
AI_KERNEL_CONFIG m_kernelConfig = {}; |
| 80 |
|
| 81 |
MEDIA_CLASS_DEFINE_END(vp__VpRenderAiKernel) |
| 82 |
}; |
| 83 |
} // namespace vp |
| 84 |
#endif //__VP_RENDER_AI_KERNEL_H__ |