1 /* 2 * Copyright (c) 2022, 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_VEBOX_HVS_KERNEL_H__ 23 #define __VP_RENDER_VEBOX_HVS_KERNEL_H__ 24 25 #include "vp_render_cmd_packet.h" 26 namespace vp 27 { 28 // Defined in "VEBOX HVS Kernel" 29 struct VEBOX_HVS_STATIC_DATA 30 { 31 union 32 { 33 struct 34 { 35 uint32_t hvsSurface; 36 }; 37 uint32_t Value; 38 } DW00; 39 40 union 41 { 42 struct 43 { 44 uint16_t hvsMode; 45 uint16_t hvsFormat; 46 }; 47 uint32_t Value; 48 } DW01; 49 50 union 51 { 52 struct 53 { 54 uint16_t hvsWidth; 55 uint16_t hvsHeight; 56 }; 57 uint32_t Value; 58 } DW02; 59 60 union 61 { 62 struct 63 { 64 uint32_t noiseLevel; 65 }; 66 uint32_t Value; 67 } DW03; 68 69 union 70 { 71 struct 72 { 73 uint32_t noiseLevel_u; 74 }; 75 uint32_t Value; 76 } DW04; 77 78 union 79 { 80 struct 81 { 82 uint32_t noiseLevel_v; 83 }; 84 uint32_t Value; 85 } DW05; 86 87 union 88 { 89 struct 90 { 91 uint32_t sgneNoiseLevel; 92 }; 93 uint32_t Value; 94 } DW06; 95 96 union 97 { 98 struct 99 { 100 uint32_t sgneNoiseLevel_u; 101 }; 102 uint32_t Value; 103 } DW07; 104 105 union 106 { 107 struct 108 { 109 uint32_t sgneNoiseLevel_v; 110 }; 111 uint32_t Value; 112 } DW08; 113 114 union 115 { 116 struct 117 { 118 uint32_t sgneCount; 119 }; 120 uint32_t Value; 121 } DW09; 122 123 union 124 { 125 struct 126 { 127 uint32_t sgneCount_u; 128 }; 129 uint32_t Value; 130 } DW10; 131 132 union 133 { 134 struct 135 { 136 uint32_t sgneCount_v; 137 }; 138 uint32_t Value; 139 } DW11; 140 141 union 142 { 143 struct 144 { 145 uint32_t preNslvTemporal; 146 }; 147 uint32_t Value; 148 } DW12; 149 150 union 151 { 152 struct 153 { 154 uint32_t preNslvTemporal_u; 155 }; 156 uint32_t Value; 157 } DW13; 158 159 union 160 { 161 struct 162 { 163 uint32_t preNslvTemporal_v; 164 }; 165 uint32_t Value; 166 } DW14; 167 168 union 169 { 170 struct 171 { 172 uint16_t hvsQP; 173 uint16_t firstFrame; 174 }; 175 uint32_t Value; 176 } 177 DW15; 178 179 union 180 { 181 struct 182 { 183 uint16_t tgneFirstFrame; 184 uint16_t fallBack; 185 }; 186 uint32_t Value; 187 } DW16; 188 189 union 190 { 191 struct 192 { 193 uint16_t enableChroma; 194 uint16_t enableTemporalGNE; 195 }; 196 uint32_t Value; 197 } DW17; 198 199 }; 200 C_ASSERT(SIZE32(VEBOX_HVS_STATIC_DATA) == 18); 201 202 class VpRenderHVSKernel : public VpRenderKernelObj 203 { 204 public: 205 VpRenderHVSKernel(PVP_MHWINTERFACE hwInterface, VpKernelID kernelID, uint32_t kernelIndex, PVpAllocator allocator); 206 virtual ~VpRenderHVSKernel(); 207 208 virtual MOS_STATUS Init(VpRenderKernel &kernel) override; 209 virtual MOS_STATUS GetCurbeState(void *&curbe, uint32_t &curbeLength) override; 210 FreeCurbe(void * & curbe)211 virtual MOS_STATUS FreeCurbe(void*& curbe) override 212 { 213 return MOS_STATUS_SUCCESS; 214 } 215 GetInlineDataSize()216 virtual uint32_t GetInlineDataSize() override 217 { 218 return 0; 219 } 220 IsKernelCached()221 virtual bool IsKernelCached() override 222 { 223 return true; 224 } 225 226 virtual MOS_STATUS GetWalkerSetting(KERNEL_WALKER_PARAMS &walkerParam, KERNEL_PACKET_RENDER_DATA &renderData) override; 227 228 protected: 229 virtual MOS_STATUS SetupSurfaceState() override; 230 virtual MOS_STATUS SetWalkerSetting(KERNEL_THREAD_SPACE &threadSpace, bool bSyncFlag, bool flushL1 = false) override; 231 virtual MOS_STATUS SetKernelArgs(KERNEL_ARGS &kernelArgs, VP_PACKET_SHARED_CONTEXT *sharedContext) override; 232 virtual MOS_STATUS SetKernelConfigs(KERNEL_CONFIGS &kernelConfigs) override; 233 234 //kernel Arguments 235 KERNEL_ARGS m_kernelArgs = {}; 236 KERNEL_WALKER_PARAMS m_walkerParam = {}; 237 238 VEBOX_HVS_STATIC_DATA m_curbe = {}; 239 240 MEDIA_CLASS_DEFINE_END(vp__VpRenderHVSKernel) 241 }; 242 243 } // namespace vp 244 245 #endif //__VP_RENDER_VEBOX_HVS_KERNEL_H__