| 1 |
/* |
| 2 |
* Copyright (c) 2021-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 |
//! |
| 23 |
//! \file vp_render_cmd_packet.cpp |
| 24 |
//! \brief render packet which used in by mediapipline. |
| 25 |
//! \details render packet provide the structures and generate the cmd buffer which mediapipline will used. |
| 26 |
//! |
| 27 |
#include <iomanip> |
| 28 |
|
| 29 |
#include "vp_render_cmd_packet.h" |
| 30 |
#include "vp_platform_interface.h" |
| 31 |
#include "vp_pipeline_common.h" |
| 32 |
#include "vp_render_kernel_obj.h" |
| 33 |
#include "vp_pipeline.h" |
| 34 |
#include "vp_packet_pipe.h" |
| 35 |
#include "vp_user_feature_control.h" |
| 36 |
#include "mhw_mi_itf.h" |
| 37 |
#include "mhw_mi_cmdpar.h" |
| 38 |
#include "vp_platform_interface.h" |
| 39 |
#include "hal_oca_interface_next.h" |
| 40 |
#include "renderhal_platform_interface.h" |
| 41 |
|
| 42 |
namespace vp |
| 43 |
{ |
| 44 |
static inline RENDERHAL_SURFACE_TYPE InitRenderHalSurfType(VPHAL_SURFACE_TYPE vpSurfType) |
| 45 |
{ |
| 46 |
VP_FUNC_CALL(); |
| 47 |
|
| 48 |
switch (vpSurfType) |
| 49 |
{ |
| 50 |
case SURF_IN_BACKGROUND: |
| 51 |
return RENDERHAL_SURF_IN_BACKGROUND; |
| 52 |
|
| 53 |
case SURF_IN_PRIMARY: |
| 54 |
return RENDERHAL_SURF_IN_PRIMARY; |
| 55 |
|
| 56 |
case SURF_IN_SUBSTREAM: |
| 57 |
return RENDERHAL_SURF_IN_SUBSTREAM; |
| 58 |
|
| 59 |
case SURF_IN_REFERENCE: |
| 60 |
return RENDERHAL_SURF_IN_REFERENCE; |
| 61 |
|
| 62 |
case SURF_OUT_RENDERTARGET: |
| 63 |
return RENDERHAL_SURF_OUT_RENDERTARGET; |
| 64 |
|
| 65 |
case SURF_NONE: |
| 66 |
default: |
| 67 |
return RENDERHAL_SURF_NONE; |
| 68 |
} |
| 69 |
} |
| 70 |
|
| 71 |
VpRenderCmdPacket::VpRenderCmdPacket(MediaTask *task, PVP_MHWINTERFACE hwInterface, PVpAllocator &allocator, VPMediaMemComp *mmc, VpKernelSet *kernelSet) : CmdPacket(task), |
| 72 |
RenderCmdPacket(task, hwInterface->m_osInterface, hwInterface->m_renderHal), |
| 73 |
VpCmdPacket(task, hwInterface, allocator, mmc, VP_PIPELINE_PACKET_RENDER), |
| 74 |
m_firstFrame(true), |
| 75 |
m_kernelSet(kernelSet) |
| 76 |
{ |
| 77 |
if (m_hwInterface && m_hwInterface->m_userFeatureControl) |
| 78 |
{ |
| 79 |
bool computeContextEnabled = m_hwInterface->m_userFeatureControl->IsComputeContextEnabled(); |
| 80 |
m_PacketId = computeContextEnabled ? VP_PIPELINE_PACKET_COMPUTE : VP_PIPELINE_PACKET_RENDER; |
| 81 |
m_vpUserFeatureControl = m_hwInterface->m_userFeatureControl; |
| 82 |
} |
| 83 |
else |
| 84 |
{ |
| 85 |
VP_RENDER_ASSERTMESSAGE("m_hwInterface or m_hwInterface->m_userFeatureControl is nullptr!"); |
| 86 |
} |
| 87 |
} |
| 88 |
|
| 89 |
VpRenderCmdPacket::~VpRenderCmdPacket() |
| 90 |
{ |
| 91 |
for (auto &samplerstate : m_kernelSamplerStateGroup) |
| 92 |
{ |
| 93 |
if (samplerstate.second.SamplerType == MHW_SAMPLER_TYPE_AVS) |
| 94 |
{ |
| 95 |
MOS_FreeMemAndSetNull(samplerstate.second.Avs.pMhwSamplerAvsTableParam); |
| 96 |
} |
| 97 |
} |
| 98 |
|
| 99 |
MOS_Delete(m_surfMemCacheCtl); |
| 100 |
} |
| 101 |
|
| 102 |
MOS_STATUS VpRenderCmdPacket::Init() |
| 103 |
{ |
| 104 |
VP_RENDER_CHK_STATUS_RETURN(RenderCmdPacket::Init()); |
| 105 |
|
| 106 |
return MOS_STATUS_SUCCESS; |
| 107 |
} |
| 108 |
|
| 109 |
MOS_STATUS VpRenderCmdPacket::LoadKernel() |
| 110 |
{ |
| 111 |
int32_t iKrnAllocation = 0; |
| 112 |
MHW_KERNEL_PARAM MhwKernelParam = {}; |
| 113 |
RENDERHAL_KERNEL_PARAM KernelParam = m_renderData.KernelParam; |
| 114 |
// Load kernel to GSH |
| 115 |
INIT_MHW_KERNEL_PARAM(MhwKernelParam, &m_renderData.KernelEntry); |
| 116 |
UpdateKernelConfigParam(KernelParam); |
| 117 |
iKrnAllocation = m_renderHal->pfnLoadKernel( |
| 118 |
m_renderHal, |
| 119 |
&KernelParam, |
| 120 |
&MhwKernelParam, |
| 121 |
m_kernel->GetCachedEntryForKernelLoad()); |
| 122 |
|
| 123 |
if (iKrnAllocation < 0) |
| 124 |
{ |
| 125 |
RENDER_PACKET_ASSERTMESSAGE("kernel load failed"); |
| 126 |
return MOS_STATUS_UNKNOWN; |
| 127 |
} |
| 128 |
|
| 129 |
m_renderData.kernelAllocationID = iKrnAllocation; |
| 130 |
|
| 131 |
if (m_renderData.iCurbeOffset < 0) |
| 132 |
{ |
| 133 |
RENDER_PACKET_ASSERTMESSAGE("Curbe Set Fail, return error"); |
| 134 |
return MOS_STATUS_UNKNOWN; |
| 135 |
} |
| 136 |
// Allocate Media ID, link to kernel |
| 137 |
// iCurbeOffset and iCurbeLength is useless in bindless mode |
| 138 |
// pRenderHal->pfnSetupInterfaceDesc is not used in bindless mode, it's set in send compute walker |
| 139 |
m_renderData.mediaID = m_renderHal->pfnAllocateMediaID( |
| 140 |
m_renderHal, |
| 141 |
iKrnAllocation, |
| 142 |
m_renderData.bindingTable, |
| 143 |
m_renderData.iCurbeOffset, |
| 144 |
(m_renderData.iCurbeLength), |
| 145 |
0, |
| 146 |
nullptr); |
| 147 |
|
| 148 |
if (m_renderData.mediaID < 0) |
| 149 |
{ |
| 150 |
RENDER_PACKET_ASSERTMESSAGE("Allocate Media ID failed, return error"); |
| 151 |
return MOS_STATUS_UNKNOWN; |
| 152 |
} |
| 153 |
|
| 154 |
return MOS_STATUS_SUCCESS; |
| 155 |
} |
| 156 |
|
| 157 |
MOS_STATUS VpRenderCmdPacket::SetLargeGrfMode(uint32_t mode) |
| 158 |
{ |
| 159 |
VP_FUNC_CALL(); |
| 160 |
VP_RENDER_CHK_NULL_RETURN(m_renderHal); |
| 161 |
uint32_t curMode = m_renderHal->largeGrfMode; |
| 162 |
if (curMode != mode) |
| 163 |
{ |
| 164 |
if (curMode != 0) |
| 165 |
{ |
| 166 |
RENDER_PACKET_ASSERTMESSAGE("HW Not support different large grf modes in same BB!"); |
| 167 |
} |
| 168 |
else |
| 169 |
{ |
| 170 |
m_renderHal->largeGrfMode = mode; |
| 171 |
} |
| 172 |
} |
| 173 |
return MOS_STATUS_SUCCESS; |
| 174 |
} |
| 175 |
|
| 176 |
MOS_STATUS VpRenderCmdPacket::SetEuThreadSchedulingMode(uint32_t mode) |
| 177 |
{ |
| 178 |
VP_FUNC_CALL(); |
| 179 |
VP_RENDER_CHK_NULL_RETURN(m_renderHal); |
| 180 |
uint32_t curMode = m_renderHal->euThreadSchedulingMode; |
| 181 |
if (curMode != mode) |
| 182 |
{ |
| 183 |
if (curMode != 0) |
| 184 |
{ |
| 185 |
RENDER_PACKET_ASSERTMESSAGE("Not support different modes in same kernelObjs!"); |
| 186 |
} |
| 187 |
else |
| 188 |
{ |
| 189 |
m_renderHal->euThreadSchedulingMode = mode; |
| 190 |
} |
| 191 |
} |
| 192 |
return MOS_STATUS_SUCCESS; |
| 193 |
} |
| 194 |
|
| 195 |
MOS_STATUS VpRenderCmdPacket::Prepare() |
| 196 |
{ |
| 197 |
VP_FUNC_CALL(); |
| 198 |
VP_RENDER_CHK_NULL_RETURN(m_renderHal); |
| 199 |
VP_RENDER_CHK_NULL_RETURN(m_kernelSet); |
| 200 |
VP_RENDER_CHK_NULL_RETURN(m_surfMemCacheCtl); |
| 201 |
VP_RENDER_CHK_NULL_RETURN(m_hwInterface); |
| 202 |
VP_RENDER_CHK_NULL_RETURN(m_hwInterface->m_vpPlatformInterface); |
| 203 |
|
| 204 |
if (m_renderHal->pStateHeap == nullptr) |
| 205 |
{ |
| 206 |
VP_RENDER_CHK_STATUS_RETURN(m_renderHal->pfnAllocateStateHeaps(m_renderHal, &m_renderHal->StateHeapSettings)); |
| 207 |
if (m_renderHal->pStateHeap) |
| 208 |
{ |
| 209 |
MHW_STATE_BASE_ADDR_PARAMS *pStateBaseParams = &m_renderHal->StateBaseAddressParams; |
| 210 |
|
| 211 |
pStateBaseParams->presGeneralState = &m_renderHal->pStateHeap->GshOsResource; |
| 212 |
pStateBaseParams->dwGeneralStateSize = m_renderHal->pStateHeap->dwSizeGSH; |
| 213 |
pStateBaseParams->presDynamicState = &m_renderHal->pStateHeap->GshOsResource; |
| 214 |
pStateBaseParams->dwDynamicStateSize = m_renderHal->pStateHeap->dwSizeGSH; |
| 215 |
pStateBaseParams->bDynamicStateRenderTarget = false; |
| 216 |
pStateBaseParams->presIndirectObjectBuffer = &m_renderHal->pStateHeap->GshOsResource; |
| 217 |
pStateBaseParams->dwIndirectObjectBufferSize = m_renderHal->pStateHeap->dwSizeGSH; |
| 218 |
pStateBaseParams->presInstructionBuffer = &m_renderHal->pStateHeap->IshOsResource; |
| 219 |
pStateBaseParams->dwInstructionBufferSize = m_renderHal->pStateHeap->dwSizeISH; |
| 220 |
} |
| 221 |
} |
| 222 |
|
| 223 |
if (m_packetResourcesPrepared) |
| 224 |
{ |
| 225 |
VP_RENDER_NORMALMESSAGE("Resource Prepared, skip this time"); |
| 226 |
return MOS_STATUS_SUCCESS; |
| 227 |
} |
| 228 |
|
| 229 |
m_renderHal->euThreadSchedulingMode = 0; |
| 230 |
m_renderHal->largeGrfMode = 0; |
| 231 |
m_renderHal->enableVariableRegisterSizeAllocationVrt = m_hwInterface->m_vpPlatformInterface->IsVrtEnabled(); |
| 232 |
|
| 233 |
VP_RENDER_CHK_STATUS_RETURN(m_kernelSet->CreateKernelObjects( |
| 234 |
m_renderKernelParams, |
| 235 |
m_surfSetting.surfGroup, |
| 236 |
m_kernelSamplerStateGroup, |
| 237 |
m_kernelConfigs, |
| 238 |
m_kernelObjs, |
| 239 |
*m_surfMemCacheCtl, |
| 240 |
m_packetSharedContext)); |
| 241 |
|
| 242 |
if (m_submissionMode == SINGLE_KERNEL_ONLY) |
| 243 |
{ |
| 244 |
m_kernelRenderData.clear(); |
| 245 |
|
| 246 |
VP_RENDER_CHK_NULL_RETURN(m_renderHal->pStateHeap); |
| 247 |
|
| 248 |
m_renderHal->pStateHeap->iCurrentBindingTable = 0; |
| 249 |
m_renderHal->pStateHeap->iCurrentSurfaceState = 0; |
| 250 |
|
| 251 |
for (auto it = m_kernelObjs.begin(); it != m_kernelObjs.end(); it++) |
| 252 |
{ |
| 253 |
m_kernel = it->second; |
| 254 |
VP_RENDER_CHK_NULL_RETURN(m_kernel); |
| 255 |
|
| 256 |
m_kernel->SetCacheCntl(m_surfMemCacheCtl); |
| 257 |
m_kernel->SetPerfTag(); |
| 258 |
VP_RENDER_CHK_STATUS_RETURN(SetEuThreadSchedulingMode(m_kernel->GetEuThreadSchedulingMode())); |
| 259 |
VP_RENDER_CHK_STATUS_RETURN(SetLargeGrfMode(m_kernel->GetLargeGrfMode())); |
| 260 |
|
| 261 |
// reset render Data for current kernel |
| 262 |
MOS_ZeroMemory(&m_renderData, sizeof(KERNEL_PACKET_RENDER_DATA)); |
| 263 |
|
| 264 |
|
| 265 |
if (!m_renderHal->isBindlessHeapInUse && |
| 266 |
m_hwInterface->m_vpPlatformInterface->GetKernelConfig() && |
| 267 |
m_hwInterface->m_vpPlatformInterface->GetKernelConfig()->GetRenderEnlargeOverwriteParams().needOverwrite) |
| 268 |
{ |
| 269 |
// State Heap Setting has been overridden on this platform to require more kernels in one BB. |
| 270 |
// This leads to a smaller Binding Table Size and larger Binding Table number because the BB size is not sufficient for both enlargements. |
| 271 |
// For legacy single kernel mode kernels, they may need the default(Bigger) Binding Table Size because incontinuous use of Binding Tables during kernel design. |
| 272 |
// So reallocate SSH. |
| 273 |
bool allocated = false; |
| 274 |
VP_RENDER_CHK_NULL_RETURN(m_renderHal->pfnReAllocateStateHeapsforAdvFeatureWithSshResize); |
| 275 |
VP_RENDER_CHK_STATUS_RETURN(m_renderHal->pfnReAllocateStateHeapsforAdvFeatureWithSshResize(m_renderHal, false, allocated)); |
| 276 |
if (allocated && m_renderHal->pStateHeap) |
| 277 |
{ |
| 278 |
MHW_STATE_BASE_ADDR_PARAMS *pStateBaseParams = &m_renderHal->StateBaseAddressParams; |
| 279 |
pStateBaseParams->presGeneralState = &m_renderHal->pStateHeap->GshOsResource; |
| 280 |
pStateBaseParams->presDynamicState = &m_renderHal->pStateHeap->GshOsResource; |
| 281 |
pStateBaseParams->presIndirectObjectBuffer = &m_renderHal->pStateHeap->GshOsResource; |
| 282 |
pStateBaseParams->presInstructionBuffer = &m_renderHal->pStateHeap->IshOsResource; |
| 283 |
} |
| 284 |
} |
| 285 |
|
| 286 |
m_isMultiBindingTables = false; |
| 287 |
|
| 288 |
VP_RENDER_CHK_STATUS_RETURN(RenderEngineSetup()); |
| 289 |
|
| 290 |
VP_RENDER_CHK_STATUS_RETURN(KernelStateSetup()); |
| 291 |
|
| 292 |
VP_RENDER_CHK_STATUS_RETURN(SetupSurfaceState()); // once Surface setup done, surface index should be created here |
| 293 |
|
| 294 |
if (m_renderHal->isBindlessHeapInUse == false) |
| 295 |
{ |
| 296 |
VP_RENDER_CHK_STATUS_RETURN(SetupCurbeState()); // Set Curbe with updated surface index |
| 297 |
} |
| 298 |
|
| 299 |
VP_RENDER_CHK_STATUS_RETURN(LoadKernel()); |
| 300 |
|
| 301 |
VP_RENDER_CHK_STATUS_RETURN(SetupSamplerStates()); |
| 302 |
|
| 303 |
if (m_renderHal->isBindlessHeapInUse) |
| 304 |
{ |
| 305 |
// In bindless mode, Curbe need to set after surface state setup and sampler state setup |
| 306 |
// Since bindless surface and bindless sampler only can be set into curbe after they are setup |
| 307 |
// In bindful mode, they don't need to be set in curbe |
| 308 |
VP_RENDER_CHK_STATUS_RETURN(SetupCurbeStateInBindlessMode()); |
| 309 |
} |
| 310 |
|
| 311 |
VP_RENDER_CHK_STATUS_RETURN(SetupWalkerParams()); |
| 312 |
|
| 313 |
VP_RENDER_CHK_STATUS_RETURN(m_renderHal->pfnSetVfeStateParams( |
| 314 |
m_renderHal, |
| 315 |
MEDIASTATE_DEBUG_COUNTER_FREE_RUNNING, |
| 316 |
m_renderData.KernelParam.Thread_Count, |
| 317 |
m_renderData.iCurbeLength, |
| 318 |
m_renderData.iInlineLength, |
| 319 |
m_renderData.scoreboardParams)); |
| 320 |
|
| 321 |
m_kernelRenderData.emplace(it->first, m_renderData); |
| 322 |
} |
| 323 |
} |
| 324 |
else if (m_submissionMode == MULTI_KERNELS_SINGLE_MEDIA_STATE) |
| 325 |
{ |
| 326 |
bool bAllocated = false; |
| 327 |
|
| 328 |
VP_RENDER_CHK_STATUS_RETURN(m_renderHal->pfnReAllocateStateHeapsforAdvFeatureWithAllHeapsEnlarged(m_renderHal, bAllocated)); |
| 329 |
if (bAllocated && m_renderHal->pStateHeap) |
| 330 |
{ |
| 331 |
MHW_STATE_BASE_ADDR_PARAMS *pStateBaseParams = &m_renderHal->StateBaseAddressParams; |
| 332 |
pStateBaseParams->presGeneralState = &m_renderHal->pStateHeap->GshOsResource; |
| 333 |
pStateBaseParams->dwGeneralStateSize = m_renderHal->pStateHeap->dwSizeGSH; |
| 334 |
pStateBaseParams->presDynamicState = &m_renderHal->pStateHeap->GshOsResource; |
| 335 |
pStateBaseParams->dwDynamicStateSize = m_renderHal->pStateHeap->dwSizeGSH; |
| 336 |
pStateBaseParams->bDynamicStateRenderTarget = false; |
| 337 |
pStateBaseParams->presIndirectObjectBuffer = &m_renderHal->pStateHeap->GshOsResource; |
| 338 |
pStateBaseParams->dwIndirectObjectBufferSize = m_renderHal->pStateHeap->dwSizeGSH; |
| 339 |
pStateBaseParams->presInstructionBuffer = &m_renderHal->pStateHeap->IshOsResource; |
| 340 |
pStateBaseParams->dwInstructionBufferSize = m_renderHal->pStateHeap->dwSizeISH; |
| 341 |
uint32_t heapMocs = m_renderHal->pOsInterface->pfnCachePolicyGetMemoryObject(MOS_HW_RESOURCE_USAGE_VP_INPUT_PICTURE_RENDER, |
| 342 |
m_renderHal->pOsInterface->pfnGetGmmClientContext(m_renderHal->pOsInterface)).DwordValue; |
| 343 |
pStateBaseParams->mocs4SurfaceState = heapMocs; |
| 344 |
pStateBaseParams->mocs4GeneralState = heapMocs; |
| 345 |
pStateBaseParams->mocs4DynamicState = heapMocs; |
| 346 |
pStateBaseParams->mocs4InstructionCache = heapMocs; |
| 347 |
pStateBaseParams->mocs4IndirectObjectBuffer = heapMocs; |
| 348 |
pStateBaseParams->mocs4StatelessDataport = heapMocs; |
| 349 |
} |
| 350 |
|
| 351 |
MOS_ZeroMemory(&m_renderData, sizeof(KERNEL_PACKET_RENDER_DATA)); |
| 352 |
m_isMultiBindingTables = true; |
| 353 |
m_isMultiKernelOneMediaState = true; |
| 354 |
VP_RENDER_CHK_STATUS_RETURN(RenderEngineSetup()); |
| 355 |
|
| 356 |
m_kernelRenderData.clear(); |
| 357 |
|
| 358 |
// for multi-kernel prepare together |
| 359 |
for (auto it = m_kernelObjs.begin(); it != m_kernelObjs.end(); it++) |
| 360 |
{ |
| 361 |
m_kernel = it->second; |
| 362 |
VP_RENDER_CHK_NULL_RETURN(m_kernel); |
| 363 |
m_kernel->SetPerfTag(); |
| 364 |
VP_RENDER_CHK_STATUS_RETURN(SetEuThreadSchedulingMode(m_kernel->GetEuThreadSchedulingMode())); |
| 365 |
VP_RENDER_CHK_STATUS_RETURN(SetLargeGrfMode(m_kernel->GetLargeGrfMode())); |
| 366 |
|
| 367 |
if (it != m_kernelObjs.begin()) |
| 368 |
{ |
| 369 |
// reset render Data for current kernel |
| 370 |
PRENDERHAL_MEDIA_STATE pMediaState = m_renderData.mediaState; |
| 371 |
MOS_ZeroMemory(&m_renderData, sizeof(KERNEL_PACKET_RENDER_DATA)); |
| 372 |
m_renderData.mediaState = pMediaState; |
| 373 |
// Assign and Reset binding table |
| 374 |
RENDER_PACKET_CHK_STATUS_RETURN(m_renderHal->pfnAssignBindingTable( |
| 375 |
m_renderHal, |
| 376 |
&m_renderData.bindingTable)); |
| 377 |
} |
| 378 |
|
| 379 |
VP_RENDER_CHK_STATUS_RETURN(KernelStateSetup()); |
| 380 |
|
| 381 |
VP_RENDER_CHK_STATUS_RETURN(SetupSurfaceState()); // once Surface setup done, surface index should be created here |
| 382 |
|
| 383 |
if (m_renderHal->isBindlessHeapInUse == false) |
| 384 |
{ |
| 385 |
VP_RENDER_CHK_STATUS_RETURN(SetupCurbeState()); // Set Curbe with updated surface index |
| 386 |
} |
| 387 |
|
| 388 |
VP_RENDER_CHK_STATUS_RETURN(LoadKernel()); |
| 389 |
|
| 390 |
VP_RENDER_CHK_STATUS_RETURN(SetupSamplerStates()); |
| 391 |
|
| 392 |
if (m_renderHal->isBindlessHeapInUse) |
| 393 |
{ |
| 394 |
// In bindless mode, Curbe need to set after surface state setup and sampler state setup |
| 395 |
// Since bindless surface and bindless sampler only can be set into curbe after they are setup |
| 396 |
// In bindful mode, they don't need to be set in curbe |
| 397 |
VP_RENDER_CHK_STATUS_RETURN(SetupCurbeStateInBindlessMode()); |
| 398 |
} |
| 399 |
|
| 400 |
VP_RENDER_CHK_STATUS_RETURN(SetupWalkerParams()); |
| 401 |
|
| 402 |
m_kernelRenderData.emplace(it->first, m_renderData); |
| 403 |
} |
| 404 |
|
| 405 |
VP_RENDER_CHK_STATUS_RETURN(m_renderHal->pfnSetVfeStateParams( |
| 406 |
m_renderHal, |
| 407 |
MEDIASTATE_DEBUG_COUNTER_FREE_RUNNING, |
| 408 |
RENDERHAL_USE_MEDIA_THREADS_MAX, |
| 409 |
m_totalCurbeSize, |
| 410 |
m_totoalInlineSize, |
| 411 |
m_renderData.scoreboardParams)); |
| 412 |
} |
| 413 |
else |
| 414 |
{ |
| 415 |
return MOS_STATUS_INVALID_PARAMETER; |
| 416 |
} |
| 417 |
|
| 418 |
return MOS_STATUS_SUCCESS; |
| 419 |
} |
| 420 |
|
| 421 |
MOS_STATUS VpRenderCmdPacket::SetupSamplerStates() |
| 422 |
{ |
| 423 |
VP_FUNC_CALL(); |
| 424 |
VP_RENDER_CHK_NULL_RETURN(m_renderHal); |
| 425 |
VP_RENDER_CHK_NULL_RETURN(m_kernel); |
| 426 |
|
| 427 |
KERNEL_SAMPLER_STATES samplerStates = {}; |
| 428 |
|
| 429 |
// For AdvKernel, SetSamplerStates is called by VpRenderKernelObj::SetKernelConfigs |
| 430 |
// For some AdvKernels, when UseIndependentSamplerGroup is true, each kernel in one media state submission uses a stand alone sampler state group |
| 431 |
if (!m_kernel->IsAdvKernel() || m_kernel->UseIndependentSamplerGroup()) |
| 432 |
{ |
| 433 |
// Initialize m_kernelSamplerStateGroup. |
| 434 |
VP_RENDER_CHK_STATUS_RETURN(m_kernel->SetSamplerStates(m_kernelSamplerStateGroup)); |
| 435 |
} |
| 436 |
|
| 437 |
for (int samplerIndex = 0, activeSamplerLeft = m_kernelSamplerStateGroup.size(); activeSamplerLeft > 0; ++samplerIndex) |
| 438 |
{ |
| 439 |
auto it = m_kernelSamplerStateGroup.find(samplerIndex); |
| 440 |
if (m_kernelSamplerStateGroup.end() != it) |
| 441 |
{ |
| 442 |
--activeSamplerLeft; |
| 443 |
samplerStates.push_back(it->second); |
| 444 |
} |
| 445 |
else |
| 446 |
{ |
| 447 |
VP_RENDER_NORMALMESSAGE("Sampler State is empty for samplerIndex %d", samplerIndex); |
| 448 |
MHW_SAMPLER_STATE_PARAM param = {}; |
| 449 |
samplerStates.push_back(param); |
| 450 |
} |
| 451 |
} |
| 452 |
|
| 453 |
if (!samplerStates.empty()) |
| 454 |
{ |
| 455 |
if (samplerStates.size() > MHW_RENDER_ENGINE_SAMPLERS_MAX) |
| 456 |
{ |
| 457 |
MOS_STATUS_INVALID_PARAMETER; |
| 458 |
} |
| 459 |
|
| 460 |
VP_RENDER_CHK_STATUS_RETURN(m_renderHal->pfnSetAndGetSamplerStates( |
| 461 |
m_renderHal, |
| 462 |
m_renderData.mediaID, |
| 463 |
&samplerStates[0], |
| 464 |
samplerStates.size(), |
| 465 |
m_kernel->GetBindlessSamplers())); |
| 466 |
|
| 467 |
} |
| 468 |
|
| 469 |
return MOS_STATUS_SUCCESS; |
| 470 |
} |
| 471 |
|
| 472 |
MOS_STATUS VpRenderCmdPacket::Submit(MOS_COMMAND_BUFFER *commandBuffer, uint8_t packetPhase) |
| 473 |
{ |
| 474 |
VP_FUNC_CALL(); |
| 475 |
if (m_kernelObjs.empty()) |
| 476 |
{ |
| 477 |
VP_RENDER_ASSERTMESSAGE("No Kernel Object Creation"); |
| 478 |
return MOS_STATUS_NULL_POINTER; |
| 479 |
} |
| 480 |
|
| 481 |
if (m_submissionMode == SINGLE_KERNEL_ONLY) |
| 482 |
{ |
| 483 |
VP_RENDER_CHK_STATUS_RETURN(SetupMediaWalker()); |
| 484 |
|
| 485 |
VP_RENDER_CHK_STATUS_RETURN(RenderCmdPacket::Submit(commandBuffer, packetPhase)); |
| 486 |
} |
| 487 |
else if (m_submissionMode == MULTI_KERNELS_SINGLE_MEDIA_STATE) |
| 488 |
{ |
| 489 |
VP_RENDER_CHK_STATUS_RETURN(SubmitWithMultiKernel(commandBuffer, packetPhase)); |
| 490 |
} |
| 491 |
else |
| 492 |
{ |
| 493 |
return MOS_STATUS_INVALID_PARAMETER; |
| 494 |
} |
| 495 |
|
| 496 |
if (!m_surfSetting.dumpLaceSurface && |
| 497 |
!m_surfSetting.dumpPostSurface) |
| 498 |
{ |
| 499 |
VP_RENDER_CHK_STATUS_RETURN(m_kernelSet->DestroyKernelObjects(m_kernelObjs)); |
| 500 |
} |
| 501 |
|
| 502 |
return MOS_STATUS_SUCCESS; |
| 503 |
} |
| 504 |
|
| 505 |
MOS_STATUS VpRenderCmdPacket::InitFcMemCacheControlForTarget(PVP_RENDER_CACHE_CNTL settings) |
| 506 |
{ |
| 507 |
MOS_HW_RESOURCE_DEF Usage = MOS_HW_RESOURCE_DEF_MAX; |
| 508 |
MEMORY_OBJECT_CONTROL_STATE MemObjCtrl = {}; |
| 509 |
PMOS_INTERFACE pOsInterface = m_osInterface; |
| 510 |
|
| 511 |
VP_RENDER_CHK_NULL_RETURN(pOsInterface); |
| 512 |
VP_RENDER_CHK_NULL_RETURN(settings); |
| 513 |
|
| 514 |
VPHAL_SET_SURF_MEMOBJCTL(settings->Composite.TargetSurfMemObjCtl, MOS_HW_RESOURCE_USAGE_VP_INTERNAL_READ_WRITE_RENDER); |
| 515 |
|
| 516 |
return MOS_STATUS_SUCCESS; |
| 517 |
} |
| 518 |
|
| 519 |
MOS_STATUS VpRenderCmdPacket::InitFcMemCacheControl(PVP_RENDER_CACHE_CNTL settings) |
| 520 |
{ |
| 521 |
MOS_HW_RESOURCE_DEF Usage = MOS_HW_RESOURCE_DEF_MAX; |
| 522 |
MEMORY_OBJECT_CONTROL_STATE MemObjCtrl = {}; |
| 523 |
PMOS_INTERFACE pOsInterface = m_osInterface; |
| 524 |
|
| 525 |
VP_RENDER_CHK_NULL_RETURN(settings); |
| 526 |
|
| 527 |
if (!settings->bCompositing) |
| 528 |
{ |
| 529 |
return MOS_STATUS_SUCCESS; |
| 530 |
} |
| 531 |
|
| 532 |
settings->Composite.bL3CachingEnabled = true; |
| 533 |
|
| 534 |
VPHAL_SET_SURF_MEMOBJCTL(settings->Composite.PrimaryInputSurfMemObjCtl, MOS_HW_RESOURCE_USAGE_VP_INPUT_PICTURE_RENDER); |
| 535 |
VPHAL_SET_SURF_MEMOBJCTL(settings->Composite.InputSurfMemObjCtl, MOS_HW_RESOURCE_USAGE_VP_INPUT_PICTURE_RENDER); |
| 536 |
|
| 537 |
VP_RENDER_CHK_STATUS_RETURN(InitFcMemCacheControlForTarget(settings)); |
| 538 |
|
| 539 |
return MOS_STATUS_SUCCESS; |
| 540 |
} |
| 541 |
|
| 542 |
MOS_STATUS VpRenderCmdPacket::InitSurfMemCacheControl(VP_EXECUTE_CAPS packetCaps) |
| 543 |
{ |
| 544 |
MOS_HW_RESOURCE_DEF Usage = MOS_HW_RESOURCE_DEF_MAX; |
| 545 |
MEMORY_OBJECT_CONTROL_STATE MemObjCtrl = {}; |
| 546 |
PMOS_INTERFACE pOsInterface = nullptr; |
| 547 |
PVP_RENDER_CACHE_CNTL pSettings = nullptr; |
| 548 |
|
| 549 |
VP_FUNC_CALL(); |
| 550 |
|
| 551 |
if (nullptr == m_surfMemCacheCtl) |
| 552 |
{ |
| 553 |
m_surfMemCacheCtl = MOS_New(VP_RENDER_CACHE_CNTL); |
| 554 |
VP_PUBLIC_CHK_NULL_RETURN(m_surfMemCacheCtl); |
| 555 |
} |
| 556 |
|
| 557 |
VP_PUBLIC_CHK_NULL_RETURN(m_hwInterface); |
| 558 |
VP_PUBLIC_CHK_NULL_RETURN(m_hwInterface->m_osInterface); |
| 559 |
|
| 560 |
MOS_ZeroMemory(m_surfMemCacheCtl, sizeof(*m_surfMemCacheCtl)); |
| 561 |
|
| 562 |
pOsInterface = m_hwInterface->m_osInterface; |
| 563 |
pSettings = m_surfMemCacheCtl; |
| 564 |
|
| 565 |
pSettings->bCompositing = packetCaps.bComposite; |
| 566 |
pSettings->bDnDi = true; |
| 567 |
|
| 568 |
if (m_hwInterface->m_skuTable) |
| 569 |
{ |
| 570 |
pSettings->bLace = MEDIA_IS_SKU(m_hwInterface->m_skuTable, FtrLace); |
| 571 |
pSettings->bHdr = MEDIA_IS_SKU(m_hwInterface->m_skuTable, FtrHDR); |
| 572 |
} |
| 573 |
|
| 574 |
VP_RENDER_CHK_STATUS_RETURN(InitFcMemCacheControl(pSettings)); |
| 575 |
|
| 576 |
if (pSettings->bDnDi) |
| 577 |
{ |
| 578 |
pSettings->DnDi.bL3CachingEnabled = true; |
| 579 |
|
| 580 |
VPHAL_SET_SURF_MEMOBJCTL(pSettings->DnDi.CurrentInputSurfMemObjCtl, MOS_HW_RESOURCE_USAGE_VP_INPUT_PICTURE_RENDER); |
| 581 |
VPHAL_SET_SURF_MEMOBJCTL(pSettings->DnDi.PreviousInputSurfMemObjCtl, MOS_HW_RESOURCE_USAGE_VP_INPUT_PICTURE_RENDER); |
| 582 |
VPHAL_SET_SURF_MEMOBJCTL(pSettings->DnDi.STMMInputSurfMemObjCtl, MOS_HW_RESOURCE_USAGE_VP_INPUT_PICTURE_RENDER); |
| 583 |
VPHAL_SET_SURF_MEMOBJCTL(pSettings->DnDi.STMMOutputSurfMemObjCtl, MOS_HW_RESOURCE_USAGE_VP_OUTPUT_PICTURE_RENDER); |
| 584 |
VPHAL_SET_SURF_MEMOBJCTL(pSettings->DnDi.DnOutSurfMemObjCtl, MOS_HW_RESOURCE_USAGE_VP_OUTPUT_PICTURE_RENDER); |
| 585 |
|
| 586 |
if (packetCaps.bVebox && !packetCaps.bSFC && !packetCaps.bRender) |
| 587 |
{ |
| 588 |
// Disable cache for output surface in vebox only condition |
| 589 |
VPHAL_SET_SURF_MEMOBJCTL(pSettings->DnDi.CurrentOutputSurfMemObjCtl, MOS_HW_RESOURCE_USAGE_VP_OUTPUT_PICTURE_RENDER); |
| 590 |
} |
| 591 |
else |
| 592 |
{ |
| 593 |
VPHAL_SET_SURF_MEMOBJCTL(pSettings->DnDi.CurrentOutputSurfMemObjCtl, MOS_HW_RESOURCE_USAGE_VP_OUTPUT_PICTURE_RENDER); |
| 594 |
} |
| 595 |
|
| 596 |
VPHAL_SET_SURF_MEMOBJCTL(pSettings->DnDi.StatisticsOutputSurfMemObjCtl, MOS_HW_RESOURCE_USAGE_VP_OUTPUT_PICTURE_RENDER); |
| 597 |
VPHAL_SET_SURF_MEMOBJCTL(pSettings->DnDi.AlphaOrVignetteSurfMemObjCtl, MOS_HW_RESOURCE_USAGE_VP_INTERNAL_READ_WRITE_RENDER); |
| 598 |
VPHAL_SET_SURF_MEMOBJCTL(pSettings->DnDi.LaceOrAceOrRgbHistogramSurfCtrl, MOS_HW_RESOURCE_USAGE_VP_INTERNAL_READ_WRITE_RENDER); |
| 599 |
VPHAL_SET_SURF_MEMOBJCTL(pSettings->DnDi.SkinScoreSurfMemObjCtl, MOS_HW_RESOURCE_USAGE_VP_INTERNAL_READ_WRITE_RENDER); |
| 600 |
VPHAL_SET_SURF_MEMOBJCTL(pSettings->DnDi.LaceLookUpTablesSurfMemObjCtl, MOS_HW_RESOURCE_USAGE_VP_INTERNAL_READ_WRITE_RENDER); |
| 601 |
VPHAL_SET_SURF_MEMOBJCTL(pSettings->DnDi.Vebox3DLookUpTablesSurfMemObjCtl, MOS_HW_RESOURCE_USAGE_VP_INTERNAL_READ_WRITE_RENDER); |
| 602 |
} |
| 603 |
else |
| 604 |
{ |
| 605 |
pSettings->DnDi.bL3CachingEnabled = false; |
| 606 |
|
| 607 |
VPHAL_SET_SURF_MEMOBJCTL(pSettings->DnDi.CurrentInputSurfMemObjCtl, MOS_HW_RESOURCE_USAGE_VP_INPUT_PICTURE_RENDER); |
| 608 |
VPHAL_SET_SURF_MEMOBJCTL(pSettings->DnDi.PreviousInputSurfMemObjCtl, MOS_HW_RESOURCE_USAGE_VP_INPUT_PICTURE_RENDER); |
| 609 |
VPHAL_SET_SURF_MEMOBJCTL(pSettings->DnDi.STMMInputSurfMemObjCtl, MOS_HW_RESOURCE_USAGE_VP_INPUT_PICTURE_RENDER); |
| 610 |
VPHAL_SET_SURF_MEMOBJCTL(pSettings->DnDi.STMMOutputSurfMemObjCtl, MOS_HW_RESOURCE_USAGE_VP_OUTPUT_PICTURE_RENDER); |
| 611 |
VPHAL_SET_SURF_MEMOBJCTL(pSettings->DnDi.DnOutSurfMemObjCtl, MOS_HW_RESOURCE_USAGE_VP_OUTPUT_PICTURE_RENDER); |
| 612 |
VPHAL_SET_SURF_MEMOBJCTL(pSettings->DnDi.CurrentOutputSurfMemObjCtl, MOS_HW_RESOURCE_USAGE_VP_OUTPUT_PICTURE_RENDER); |
| 613 |
VPHAL_SET_SURF_MEMOBJCTL(pSettings->DnDi.StatisticsOutputSurfMemObjCtl, MOS_HW_RESOURCE_USAGE_VP_OUTPUT_PICTURE_RENDER); |
| 614 |
VPHAL_SET_SURF_MEMOBJCTL(pSettings->DnDi.AlphaOrVignetteSurfMemObjCtl, MOS_HW_RESOURCE_USAGE_VP_INTERNAL_READ_WRITE_RENDER); |
| 615 |
VPHAL_SET_SURF_MEMOBJCTL(pSettings->DnDi.LaceOrAceOrRgbHistogramSurfCtrl, MOS_HW_RESOURCE_USAGE_VP_INTERNAL_READ_WRITE_RENDER); |
| 616 |
VPHAL_SET_SURF_MEMOBJCTL(pSettings->DnDi.SkinScoreSurfMemObjCtl, MOS_HW_RESOURCE_USAGE_VP_INTERNAL_READ_WRITE_RENDER); |
| 617 |
VPHAL_SET_SURF_MEMOBJCTL(pSettings->DnDi.LaceLookUpTablesSurfMemObjCtl, MOS_HW_RESOURCE_USAGE_VP_INTERNAL_READ_WRITE_RENDER); |
| 618 |
VPHAL_SET_SURF_MEMOBJCTL(pSettings->DnDi.Vebox3DLookUpTablesSurfMemObjCtl, MOS_HW_RESOURCE_USAGE_VP_INTERNAL_READ_WRITE_RENDER); |
| 619 |
} |
| 620 |
|
| 621 |
if (pSettings->bLace) |
| 622 |
{ |
| 623 |
VPHAL_SET_SURF_MEMOBJCTL(pSettings->Lace.FrameHistogramSurfaceMemObjCtl, MOS_HW_RESOURCE_USAGE_VP_INTERNAL_READ_WRITE_RENDER); |
| 624 |
VPHAL_SET_SURF_MEMOBJCTL(pSettings->Lace.AggregatedHistogramSurfaceMemObjCtl, MOS_HW_RESOURCE_USAGE_VP_INTERNAL_READ_WRITE_RENDER); |
| 625 |
VPHAL_SET_SURF_MEMOBJCTL(pSettings->Lace.StdStatisticsSurfaceMemObjCtl, MOS_HW_RESOURCE_USAGE_VP_INTERNAL_READ_WRITE_RENDER); |
| 626 |
VPHAL_SET_SURF_MEMOBJCTL(pSettings->Lace.PwlfInSurfaceMemObjCtl, MOS_HW_RESOURCE_USAGE_VP_INPUT_PICTURE_RENDER); |
| 627 |
VPHAL_SET_SURF_MEMOBJCTL(pSettings->Lace.PwlfOutSurfaceMemObjCtl, MOS_HW_RESOURCE_USAGE_VP_OUTPUT_PICTURE_RENDER); |
| 628 |
VPHAL_SET_SURF_MEMOBJCTL(pSettings->Lace.WeitCoefSurfaceMemObjCtl, MOS_HW_RESOURCE_USAGE_VP_INTERNAL_READ_WRITE_RENDER); |
| 629 |
} |
| 630 |
else |
| 631 |
{ |
| 632 |
VPHAL_SET_SURF_MEMOBJCTL(pSettings->Lace.FrameHistogramSurfaceMemObjCtl, MOS_HW_RESOURCE_USAGE_VP_INTERNAL_READ_WRITE_RENDER); |
| 633 |
VPHAL_SET_SURF_MEMOBJCTL(pSettings->Lace.AggregatedHistogramSurfaceMemObjCtl, MOS_HW_RESOURCE_USAGE_VP_INTERNAL_READ_WRITE_RENDER); |
| 634 |
VPHAL_SET_SURF_MEMOBJCTL(pSettings->Lace.StdStatisticsSurfaceMemObjCtl, MOS_HW_RESOURCE_USAGE_VP_INTERNAL_READ_WRITE_RENDER); |
| 635 |
VPHAL_SET_SURF_MEMOBJCTL(pSettings->Lace.PwlfInSurfaceMemObjCtl, MOS_HW_RESOURCE_USAGE_VP_INPUT_PICTURE_RENDER); |
| 636 |
VPHAL_SET_SURF_MEMOBJCTL(pSettings->Lace.PwlfOutSurfaceMemObjCtl, MOS_HW_RESOURCE_USAGE_VP_OUTPUT_PICTURE_RENDER); |
| 637 |
VPHAL_SET_SURF_MEMOBJCTL(pSettings->Lace.WeitCoefSurfaceMemObjCtl, MOS_HW_RESOURCE_USAGE_VP_INTERNAL_READ_WRITE_RENDER); |
| 638 |
VPHAL_SET_SURF_MEMOBJCTL(pSettings->Lace.GlobalToneMappingCurveLUTSurfaceMemObjCtl, MOS_HW_RESOURCE_USAGE_VP_INTERNAL_READ_WRITE_RENDER); |
| 639 |
} |
| 640 |
|
| 641 |
if (pSettings->bHdr) |
| 642 |
{ |
| 643 |
VPHAL_SET_SURF_MEMOBJCTL(pSettings->Hdr.SourceSurfMemObjCtl, MOS_MP_RESOURCE_USAGE_SurfaceState_FF); |
| 644 |
VPHAL_SET_SURF_MEMOBJCTL(pSettings->Hdr.TargetSurfMemObjCtl, MOS_MP_RESOURCE_USAGE_DEFAULT_FF); |
| 645 |
VPHAL_SET_SURF_MEMOBJCTL(pSettings->Hdr.Lut2DSurfMemObjCtl, MOS_MP_RESOURCE_USAGE_SurfaceState_FF); |
| 646 |
VPHAL_SET_SURF_MEMOBJCTL(pSettings->Hdr.Lut3DSurfMemObjCtl, MOS_MP_RESOURCE_USAGE_SurfaceState_FF); |
| 647 |
VPHAL_SET_SURF_MEMOBJCTL(pSettings->Hdr.CoeffSurfMemObjCtl, MOS_MP_RESOURCE_USAGE_SurfaceState_FF); |
| 648 |
} |
| 649 |
else |
| 650 |
{ |
| 651 |
pSettings->Hdr.bL3CachingEnabled = false; |
| 652 |
VPHAL_SET_SURF_MEMOBJCTL(pSettings->Hdr.SourceSurfMemObjCtl, MOS_MP_RESOURCE_USAGE_DEFAULT); |
| 653 |
VPHAL_SET_SURF_MEMOBJCTL(pSettings->Hdr.TargetSurfMemObjCtl, MOS_MP_RESOURCE_USAGE_DEFAULT); |
| 654 |
VPHAL_SET_SURF_MEMOBJCTL(pSettings->Hdr.Lut2DSurfMemObjCtl, MOS_MP_RESOURCE_USAGE_DEFAULT); |
| 655 |
VPHAL_SET_SURF_MEMOBJCTL(pSettings->Hdr.Lut3DSurfMemObjCtl, MOS_MP_RESOURCE_USAGE_DEFAULT); |
| 656 |
VPHAL_SET_SURF_MEMOBJCTL(pSettings->Hdr.CoeffSurfMemObjCtl, MOS_MP_RESOURCE_USAGE_DEFAULT); |
| 657 |
} |
| 658 |
|
| 659 |
return MOS_STATUS_SUCCESS; |
| 660 |
} |
| 661 |
|
| 662 |
MOS_STATUS VpRenderCmdPacket::PacketInit( |
| 663 |
VP_SURFACE * inputSurface, |
| 664 |
VP_SURFACE * outputSurface, |
| 665 |
VP_SURFACE * previousSurface, |
| 666 |
VP_SURFACE_SETTING &surfSetting, |
| 667 |
VP_EXECUTE_CAPS packetCaps) |
| 668 |
{ |
| 669 |
VP_FUNC_CALL(); |
| 670 |
|
| 671 |
// will remodify when normal render path enabled |
| 672 |
VP_UNUSED(inputSurface); |
| 673 |
VP_UNUSED(outputSurface); |
| 674 |
VP_UNUSED(previousSurface); |
| 675 |
VP_RENDER_CHK_NULL_RETURN(m_renderHal); |
| 676 |
|
| 677 |
m_PacketCaps = packetCaps; |
| 678 |
|
| 679 |
// Init packet surface params. |
| 680 |
m_surfSetting = surfSetting; |
| 681 |
|
| 682 |
m_packetResourcesPrepared = false; |
| 683 |
m_kernelConfigs.clear(); |
| 684 |
m_renderKernelParams.clear(); |
| 685 |
|
| 686 |
m_renderHal->eufusionBypass = false; |
| 687 |
m_totoalInlineSize = 0; |
| 688 |
|
| 689 |
VP_RENDER_CHK_STATUS_RETURN(InitSurfMemCacheControl(packetCaps)); |
| 690 |
|
| 691 |
return MOS_STATUS_SUCCESS; |
| 692 |
} |
| 693 |
|
| 694 |
MOS_STATUS VpRenderCmdPacket::KernelStateSetup() |
| 695 |
{ |
| 696 |
VP_FUNC_CALL(); |
| 697 |
VP_RENDER_CHK_NULL_RETURN(m_kernel); |
| 698 |
|
| 699 |
// Initialize States |
| 700 |
MOS_ZeroMemory(&m_renderData.KernelEntry, sizeof(Kdll_CacheEntry)); |
| 701 |
|
| 702 |
// Store pointer to Kernel Parameter |
| 703 |
VP_RENDER_CHK_STATUS_RETURN(m_kernel->GetKernelSettings(m_renderData.KernelParam)); |
| 704 |
|
| 705 |
// Set Parameters for Kernel Entry |
| 706 |
VP_RENDER_CHK_STATUS_RETURN(m_kernel->GetKernelEntry(m_renderData.KernelEntry)); |
| 707 |
|
| 708 |
// set the Inline Data length |
| 709 |
m_renderData.iInlineLength = (int32_t)m_kernel->GetInlineDataSize(); |
| 710 |
m_totoalInlineSize += m_renderData.iInlineLength; |
| 711 |
|
| 712 |
VP_RENDER_CHK_STATUS_RETURN(m_kernel->GetScoreboardParams(m_renderData.scoreboardParams)); |
| 713 |
|
| 714 |
return MOS_STATUS_SUCCESS; |
| 715 |
} |
| 716 |
|
| 717 |
MOS_STATUS VpRenderCmdPacket::SetupSurfaceState() |
| 718 |
{ |
| 719 |
VP_FUNC_CALL(); |
| 720 |
VP_RENDER_CHK_NULL_RETURN(m_kernel); |
| 721 |
VP_RENDER_CHK_NULL_RETURN(m_renderHal); |
| 722 |
VP_RENDER_CHK_NULL_RETURN(m_renderHal->pOsInterface); |
| 723 |
|
| 724 |
|
| 725 |
if (!m_kernel->GetKernelSurfaceConfig().empty()) |
| 726 |
{ |
| 727 |
for (auto surface = m_kernel->GetKernelSurfaceConfig().begin(); surface != m_kernel->GetKernelSurfaceConfig().end(); surface++) |
| 728 |
{ |
| 729 |
KERNEL_SURFACE_STATE_PARAM *kernelSurfaceParam = &surface->second; |
| 730 |
SurfaceType type = surface->first; |
| 731 |
|
| 732 |
RENDERHAL_SURFACE_NEXT renderHalSurface; |
| 733 |
MOS_ZeroMemory(&renderHalSurface, sizeof(RENDERHAL_SURFACE_NEXT)); |
| 734 |
|
| 735 |
RENDERHAL_SURFACE_STATE_PARAMS renderSurfaceParams; |
| 736 |
MOS_ZeroMemory(&renderSurfaceParams, sizeof(RENDERHAL_SURFACE_STATE_PARAMS)); |
| 737 |
if (kernelSurfaceParam->surfaceOverwriteParams.updatedRenderSurfaces) |
| 738 |
{ |
| 739 |
renderSurfaceParams = kernelSurfaceParam->surfaceOverwriteParams.renderSurfaceParams; |
| 740 |
} |
| 741 |
else |
| 742 |
{ |
| 743 |
renderSurfaceParams.isOutput = (kernelSurfaceParam->isOutput == true) ? 1 : 0; |
| 744 |
renderSurfaceParams.Boundary = RENDERHAL_SS_BOUNDARY_ORIGINAL; // Add conditional in future for Surfaces out of range |
| 745 |
renderSurfaceParams.bWidth16Align = false; |
| 746 |
renderSurfaceParams.bWidthInDword_Y = true; |
| 747 |
renderSurfaceParams.bWidthInDword_UV = true; |
| 748 |
|
| 749 |
//set mem object control for cache |
| 750 |
renderSurfaceParams.MemObjCtl = (m_renderHal->pOsInterface->pfnCachePolicyGetMemoryObject( |
| 751 |
MOS_HW_RESOURCE_USAGE_VP_INTERNAL_READ_WRITE_RENDER, |
| 752 |
m_renderHal->pOsInterface->pfnGetGmmClientContext(m_renderHal->pOsInterface))).DwordValue; |
| 753 |
} |
| 754 |
|
| 755 |
VP_SURFACE *vpSurface = nullptr; |
| 756 |
|
| 757 |
if (m_surfSetting.surfGroup.find(type) != m_surfSetting.surfGroup.end()) |
| 758 |
{ |
| 759 |
vpSurface = m_surfSetting.surfGroup.find(type)->second; |
| 760 |
} |
| 761 |
|
| 762 |
if (vpSurface) |
| 763 |
{ |
| 764 |
MOS_STATUS status = m_kernel->InitRenderHalSurface(type, vpSurface, &renderHalSurface); |
| 765 |
if (MOS_STATUS_UNIMPLEMENTED == status) |
| 766 |
{ |
| 767 |
// Prepare surfaces tracked in Resource manager |
| 768 |
VP_RENDER_CHK_STATUS_RETURN(InitRenderHalSurface(*vpSurface, renderHalSurface)); |
| 769 |
VP_RENDER_CHK_STATUS_RETURN(UpdateRenderSurface(renderHalSurface, *kernelSurfaceParam)); |
| 770 |
} |
| 771 |
else |
| 772 |
{ |
| 773 |
VP_RENDER_CHK_STATUS_RETURN(status); |
| 774 |
} |
| 775 |
if (SurfaceTypeFcCscCoeff == type) |
| 776 |
{ |
| 777 |
m_renderHal->bCmfcCoeffUpdate = true; |
| 778 |
m_renderHal->pCmfcCoeffSurface = &vpSurface->osSurface->OsResource; |
| 779 |
} |
| 780 |
else |
| 781 |
{ |
| 782 |
m_renderHal->bCmfcCoeffUpdate = false; |
| 783 |
m_renderHal->pCmfcCoeffSurface = nullptr; |
| 784 |
} |
| 785 |
} |
| 786 |
else |
| 787 |
{ |
| 788 |
// State Heaps are not tracked in resource manager till now |
| 789 |
VP_RENDER_CHK_STATUS_RETURN(InitStateHeapSurface(type, renderHalSurface)); |
| 790 |
VP_RENDER_CHK_STATUS_RETURN(UpdateRenderSurface(renderHalSurface, *kernelSurfaceParam)); |
| 791 |
} |
| 792 |
|
| 793 |
if (m_hwInterface->m_vpPlatformInterface->IsRenderMMCLimitationCheckNeeded()) |
| 794 |
{ |
| 795 |
RenderMMCLimitationCheck(vpSurface, renderHalSurface, type); |
| 796 |
} |
| 797 |
|
| 798 |
uint32_t index = 0; |
| 799 |
bool bWrite = renderSurfaceParams.isOutput; |
| 800 |
if (renderSurfaceParams.bSurfaceTypeDefined) |
| 801 |
{ |
| 802 |
bWrite = false; |
| 803 |
} |
| 804 |
|
| 805 |
std::vector<RENDERHAL_STATE_LOCATION> stateLocations; |
| 806 |
if (kernelSurfaceParam->surfaceOverwriteParams.bindedKernel && !kernelSurfaceParam->surfaceOverwriteParams.bufferResource) |
| 807 |
{ |
| 808 |
auto bindingMap = m_kernel->GetSurfaceBindingIndex(type); |
| 809 |
if (bindingMap.empty()) |
| 810 |
{ |
| 811 |
VP_RENDER_CHK_STATUS_RETURN(MOS_STATUS_INVALID_PARAMETER); |
| 812 |
} |
| 813 |
VP_RENDER_CHK_STATUS_RETURN(SetSurfaceForHwAccess( |
| 814 |
&renderHalSurface.OsSurface, |
| 815 |
&renderHalSurface, |
| 816 |
&renderSurfaceParams, |
| 817 |
bindingMap, |
| 818 |
bWrite, |
| 819 |
stateLocations, |
| 820 |
kernelSurfaceParam->iCapcityOfSurfaceEntry, |
| 821 |
kernelSurfaceParam->surfaceEntries, |
| 822 |
kernelSurfaceParam->sizeOfSurfaceEntries)); |
| 823 |
for (uint32_t const& bti : bindingMap) |
| 824 |
{ |
| 825 |
VP_RENDER_NORMALMESSAGE("Using Binded Index Surface. KernelID %d, SurfType %d, bti %d", m_kernel->GetKernelId(), type, bti); |
| 826 |
} |
| 827 |
} |
| 828 |
// Bindless heap path - parameter validations performed inside block |
| 829 |
else if (m_renderHal->isBindlessHeapInUse) |
| 830 |
{ |
| 831 |
// Safety check: validate bindedKernel is false for unbinded kernel path |
| 832 |
if (kernelSurfaceParam->surfaceOverwriteParams.bindedKernel) |
| 833 |
{ |
| 834 |
VP_RENDER_ASSERTMESSAGE("bindedKernel is true in bindless heap unbinded kernel path. KernelID %d, SurfType %d", m_kernel->GetKernelId(), type); |
| 835 |
VP_RENDER_CHK_STATUS_RETURN(MOS_STATUS_INVALID_PARAMETER); |
| 836 |
} |
| 837 |
|
| 838 |
// Buffer resources require updatedSurfaceParams |
| 839 |
if (kernelSurfaceParam->surfaceOverwriteParams.bufferResource && kernelSurfaceParam->surfaceOverwriteParams.updatedSurfaceParams) |
| 840 |
{ |
| 841 |
index = SetBufferForHwAccess( |
| 842 |
&renderHalSurface.OsSurface, |
| 843 |
&renderHalSurface, |
| 844 |
&renderSurfaceParams, |
| 845 |
bWrite, |
| 846 |
stateLocations); |
| 847 |
VP_RENDER_CHK_STATUS_RETURN(m_kernel->UpdateCurbeBindingIndex(type, index)); |
| 848 |
VP_RENDER_NORMALMESSAGE("Using Bindless Heap with UnBinded Buffer. KernelID %d, SurfType %d, bti %d", m_kernel->GetKernelId(), type, index); |
| 849 |
} |
| 850 |
// Surface resources do not require updatedSurfaceParams |
| 851 |
else |
| 852 |
{ |
| 853 |
index = SetSurfaceForHwAccess( |
| 854 |
&renderHalSurface.OsSurface, |
| 855 |
&renderHalSurface, |
| 856 |
&renderSurfaceParams, |
| 857 |
bWrite, |
| 858 |
stateLocations); |
| 859 |
VP_RENDER_CHK_STATUS_RETURN(m_kernel->UpdateCurbeBindingIndex(type, index)); |
| 860 |
VP_RENDER_NORMALMESSAGE("Using Bindless Heap with UnBinded Surface. KernelID %d, SurfType %d, bti %d", m_kernel->GetKernelId(), type, index); |
| 861 |
} |
| 862 |
} |
| 863 |
else |
| 864 |
{ |
| 865 |
if ((kernelSurfaceParam->surfaceOverwriteParams.updatedSurfaceParams && |
| 866 |
kernelSurfaceParam->surfaceOverwriteParams.bufferResource && |
| 867 |
kernelSurfaceParam->surfaceOverwriteParams.bindedKernel)) |
| 868 |
{ |
| 869 |
auto bindingMap = m_kernel->GetSurfaceBindingIndex(type); |
| 870 |
if (bindingMap.empty()) |
| 871 |
{ |
| 872 |
VP_RENDER_CHK_STATUS_RETURN(MOS_STATUS_INVALID_PARAMETER); |
| 873 |
} |
| 874 |
VP_RENDER_CHK_STATUS_RETURN(SetBufferForHwAccess( |
| 875 |
&renderHalSurface.OsSurface, |
| 876 |
&renderHalSurface, |
| 877 |
&renderSurfaceParams, |
| 878 |
bindingMap, |
| 879 |
bWrite, |
| 880 |
stateLocations)); |
| 881 |
for (uint32_t const &bti : bindingMap) |
| 882 |
{ |
| 883 |
VP_RENDER_NORMALMESSAGE("Using Binded Index Buffer. KernelID %d, SurfType %d, bti %d", m_kernel->GetKernelId(), type, bti); |
| 884 |
} |
| 885 |
} |
| 886 |
else if ((kernelSurfaceParam->surfaceOverwriteParams.updatedSurfaceParams && |
| 887 |
kernelSurfaceParam->surfaceOverwriteParams.bufferResource && |
| 888 |
!kernelSurfaceParam->surfaceOverwriteParams.bindedKernel) || |
| 889 |
(!kernelSurfaceParam->surfaceOverwriteParams.updatedSurfaceParams && |
| 890 |
(renderHalSurface.OsSurface.Type == MOS_GFXRES_BUFFER || |
| 891 |
renderHalSurface.OsSurface.Type == MOS_GFXRES_INVALID))) |
| 892 |
{ |
| 893 |
index = SetBufferForHwAccess( |
| 894 |
&renderHalSurface.OsSurface, |
| 895 |
&renderHalSurface, |
| 896 |
&renderSurfaceParams, |
| 897 |
bWrite, |
| 898 |
stateLocations); |
| 899 |
VP_RENDER_CHK_STATUS_RETURN(m_kernel->UpdateCurbeBindingIndex(type, index)); |
| 900 |
VP_RENDER_NORMALMESSAGE("Using UnBinded Index Buffer. KernelID %d, SurfType %d, bti %d", m_kernel->GetKernelId(), type, index); |
| 901 |
} |
| 902 |
else |
| 903 |
{ |
| 904 |
index = SetSurfaceForHwAccess( |
| 905 |
&renderHalSurface.OsSurface, |
| 906 |
&renderHalSurface, |
| 907 |
&renderSurfaceParams, |
| 908 |
bWrite, |
| 909 |
stateLocations); |
| 910 |
VP_RENDER_CHK_STATUS_RETURN(m_kernel->UpdateCurbeBindingIndex(type, index)); |
| 911 |
VP_RENDER_NORMALMESSAGE("Using UnBinded Index Surface. KernelID %d, SurfType %d, bti %d. If 1D buffer overwrite to 2D for use, it will go SetSurfaceForHwAccess()", m_kernel->GetKernelId(), type, index); |
| 912 |
} |
| 913 |
} |
| 914 |
|
| 915 |
if (stateLocations.size() > 0) |
| 916 |
{ |
| 917 |
m_kernel->UpdateBindlessSurfaceResource(type, stateLocations); |
| 918 |
} |
| 919 |
} |
| 920 |
VP_RENDER_CHK_STATUS_RETURN(m_kernel->UpdateCompParams()); |
| 921 |
} |
| 922 |
else |
| 923 |
{ |
| 924 |
// Reset status |
| 925 |
m_renderHal->bCmfcCoeffUpdate = false; |
| 926 |
m_renderHal->pCmfcCoeffSurface = nullptr; |
| 927 |
} |
| 928 |
|
| 929 |
return MOS_STATUS_SUCCESS; |
| 930 |
} |
| 931 |
|
| 932 |
void VpRenderCmdPacket::RenderMMCLimitationCheck(VP_SURFACE *vpSurface, RENDERHAL_SURFACE_NEXT &renderHalSurface, SurfaceType type) |
| 933 |
{ |
| 934 |
if (vpSurface && |
| 935 |
vpSurface->osSurface && |
| 936 |
(type == SurfaceTypeFcTarget0 || |
| 937 |
type == SurfaceTypeFcTarget1 || |
| 938 |
type == SurfaceTypeRenderOutput)) |
| 939 |
{ |
| 940 |
if (!vpSurface->osSurface->OsResource.bUncompressedWriteNeeded && |
| 941 |
vpSurface->osSurface->CompressionMode == MOS_MMC_MC && |
| 942 |
IsRenderUncompressedWriteNeeded(vpSurface)) |
| 943 |
{ |
| 944 |
MOS_STATUS eStatus = MOS_STATUS_SUCCESS; |
| 945 |
eStatus = m_renderHal->pOsInterface->pfnDecompResource(m_renderHal->pOsInterface, &vpSurface->osSurface->OsResource); |
| 946 |
|
| 947 |
if (eStatus != MOS_STATUS_SUCCESS) |
| 948 |
{ |
| 949 |
VP_RENDER_NORMALMESSAGE("inplace decompression failed for render target."); |
| 950 |
} |
| 951 |
else |
| 952 |
{ |
| 953 |
VP_RENDER_NORMALMESSAGE("inplace decompression enabled for render target RECT is not compression block align."); |
| 954 |
vpSurface->osSurface->OsResource.bUncompressedWriteNeeded = 1; |
| 955 |
} |
| 956 |
} |
| 957 |
if (vpSurface->osSurface->OsResource.bUncompressedWriteNeeded) |
| 958 |
{ |
| 959 |
renderHalSurface.OsSurface.CompressionMode = MOS_MMC_MC; |
| 960 |
} |
| 961 |
} |
| 962 |
} |
| 963 |
|
| 964 |
bool VpRenderCmdPacket::IsRenderUncompressedWriteNeeded(PVP_SURFACE VpSurface) |
| 965 |
{ |
| 966 |
VP_FUNC_CALL(); |
| 967 |
|
| 968 |
if ((!VpSurface) || |
| 969 |
(!VpSurface->osSurface)) |
| 970 |
{ |
| 971 |
return false; |
| 972 |
} |
| 973 |
|
| 974 |
auto *skuTable = m_renderHal->pOsInterface->pfnGetSkuTable(m_renderHal->pOsInterface); |
| 975 |
if (!MEDIA_IS_SKU(skuTable, FtrE2ECompression)) |
| 976 |
{ |
| 977 |
return false; |
| 978 |
} |
| 979 |
|
| 980 |
if (m_renderHal->pOsInterface && m_renderHal->pOsInterface->bSimIsActive) |
| 981 |
{ |
| 982 |
return false; |
| 983 |
} |
| 984 |
|
| 985 |
uint32_t byteInpixel = 1; |
| 986 |
#if !EMUL |
| 987 |
if (!VpSurface->osSurface->OsResource.pGmmResInfo) |
| 988 |
{ |
| 989 |
VP_RENDER_NORMALMESSAGE("IsSFCUncompressedWriteNeeded cannot support non GMM info cases"); |
| 990 |
return false; |
| 991 |
} |
| 992 |
|
| 993 |
byteInpixel = VpSurface->osSurface->OsResource.pGmmResInfo->GetBitsPerPixel() >> 3; |
| 994 |
|
| 995 |
if (byteInpixel == 0) |
| 996 |
{ |
| 997 |
VP_RENDER_NORMALMESSAGE("surface format is not a valid format for Render"); |
| 998 |
return false; |
| 999 |
} |
| 1000 |
#endif // !EMUL |
| 1001 |
|
| 1002 |
uint32_t writeAlignInWidth = 32 / byteInpixel; |
| 1003 |
uint32_t writeAlignInHeight = 8; |
| 1004 |
|
| 1005 |
|
| 1006 |
if ((VpSurface->rcSrc.top % writeAlignInHeight) || |
| 1007 |
((VpSurface->rcSrc.bottom - VpSurface->rcSrc.top) % writeAlignInHeight) || |
| 1008 |
(VpSurface->rcSrc.left % writeAlignInWidth) || |
| 1009 |
((VpSurface->rcSrc.right - VpSurface->rcSrc.left) % writeAlignInWidth)) |
| 1010 |
{ |
| 1011 |
VP_RENDER_NORMALMESSAGE( |
| 1012 |
"Render Target Uncompressed write needed, \ |
| 1013 |
VpSurface->rcSrc.top % d, \ |
| 1014 |
VpSurface->rcSrc.bottom % d, \ |
| 1015 |
VpSurface->rcSrc.left % d, \ |
| 1016 |
VpSurface->rcSrc.right % d \ |
| 1017 |
VpSurface->Format % d", |
| 1018 |
VpSurface->rcSrc.top, |
| 1019 |
VpSurface->rcSrc.bottom, |
| 1020 |
VpSurface->rcSrc.left, |
| 1021 |
VpSurface->rcSrc.right, |
| 1022 |
VpSurface->osSurface->Format); |
| 1023 |
|
| 1024 |
return true; |
| 1025 |
} |
| 1026 |
|
| 1027 |
return false; |
| 1028 |
} |
| 1029 |
|
| 1030 |
MOS_STATUS VpRenderCmdPacket::SetupCurbeStateInBindlessMode() |
| 1031 |
{ |
| 1032 |
VP_FUNC_CALL(); |
| 1033 |
MT_LOG1(MT_VP_HAL_RENDER_SETUP_CURBE_STATE, MT_NORMAL, MT_FUNC_START, 1); |
| 1034 |
VP_RENDER_CHK_NULL_RETURN(m_kernel); |
| 1035 |
VP_PUBLIC_CHK_NULL_RETURN(m_renderHal->pStateHeap); |
| 1036 |
// set the Curbe Data length |
| 1037 |
void *curbeData = nullptr; |
| 1038 |
uint32_t curbeLength = 0; |
| 1039 |
uint32_t curbeLengthAligned = 0; |
| 1040 |
|
| 1041 |
VP_RENDER_CHK_STATUS_RETURN(m_kernel->GetCurbeState(curbeData, curbeLength, curbeLengthAligned, m_renderData.KernelParam, m_renderHal->dwCurbeBlockAlign)); |
| 1042 |
|
| 1043 |
m_renderData.iCurbeOffset = m_renderHal->pfnLoadCurbeData( |
| 1044 |
m_renderHal, |
| 1045 |
m_renderData.mediaState, |
| 1046 |
curbeData, |
| 1047 |
curbeLength); |
| 1048 |
|
| 1049 |
if (m_renderData.iCurbeOffset < 0 || |
| 1050 |
(m_renderData.iCurbeOffset & 0x1F) != 0 || |
| 1051 |
(m_renderData.iCurbeOffset + static_cast<int32_t>(curbeLengthAligned)) > m_renderData.mediaState->iCurbeOffset) |
| 1052 |
{ |
| 1053 |
RENDER_PACKET_ASSERTMESSAGE("Curbe Set Fail, return error"); |
| 1054 |
return MOS_STATUS_UNKNOWN; |
| 1055 |
} |
| 1056 |
|
| 1057 |
VP_PUBLIC_CHK_STATUS_RETURN(m_kernel->UpdateCurbeStateHeapInfo( |
| 1058 |
&m_renderHal->pStateHeap->GshOsResource, |
| 1059 |
m_renderHal->pStateHeap->pGshBuffer, |
| 1060 |
m_renderHal->pStateHeap->pCurMediaState->dwOffset + m_renderHal->pStateHeap->dwOffsetCurbe + m_renderData.iCurbeOffset)); |
| 1061 |
|
| 1062 |
m_renderData.iCurbeLength = curbeLengthAligned; |
| 1063 |
|
| 1064 |
m_totalCurbeSize += m_renderData.iCurbeLength; |
| 1065 |
|
| 1066 |
m_kernel->FreeCurbe(curbeData); |
| 1067 |
MT_LOG2(MT_VP_HAL_RENDER_SETUP_CURBE_STATE, MT_NORMAL, MT_FUNC_END, 1, MT_MOS_STATUS, MOS_STATUS_SUCCESS); |
| 1068 |
|
| 1069 |
return MOS_STATUS_SUCCESS; |
| 1070 |
} |
| 1071 |
|
| 1072 |
MOS_STATUS VpRenderCmdPacket::SetupCurbeState() |
| 1073 |
{ |
| 1074 |
VP_FUNC_CALL(); |
| 1075 |
MT_LOG1(MT_VP_HAL_RENDER_SETUP_CURBE_STATE, MT_NORMAL, MT_FUNC_START, 1); |
| 1076 |
VP_RENDER_CHK_NULL_RETURN(m_kernel); |
| 1077 |
|
| 1078 |
// set the Curbe Data length |
| 1079 |
void * curbeData = nullptr; |
| 1080 |
uint32_t curbeLength = 0; |
| 1081 |
uint32_t curbeLengthAligned = 0; |
| 1082 |
|
| 1083 |
VP_RENDER_CHK_STATUS_RETURN(m_kernel->GetCurbeState(curbeData, curbeLength, curbeLengthAligned, m_renderData.KernelParam, m_renderHal->dwCurbeBlockAlign)); |
| 1084 |
|
| 1085 |
m_renderData.iCurbeOffset = m_renderHal->pfnLoadCurbeData( |
| 1086 |
m_renderHal, |
| 1087 |
m_renderData.mediaState, |
| 1088 |
curbeData, |
| 1089 |
curbeLength); |
| 1090 |
|
| 1091 |
if (m_renderData.iCurbeOffset < 0) |
| 1092 |
{ |
| 1093 |
RENDER_PACKET_ASSERTMESSAGE("Curbe Set Fail, return error"); |
| 1094 |
return MOS_STATUS_UNKNOWN; |
| 1095 |
} |
| 1096 |
|
| 1097 |
m_renderData.iCurbeLength = curbeLengthAligned; |
| 1098 |
|
| 1099 |
m_totalCurbeSize += m_renderData.iCurbeLength; |
| 1100 |
|
| 1101 |
VP_RENDER_CHK_NULL_RETURN(m_renderHal->pStateHeap); |
| 1102 |
VP_PUBLIC_CHK_STATUS_RETURN(m_kernel->UpdateCurbeStateHeapInfo( |
| 1103 |
&m_renderHal->pStateHeap->GshOsResource, |
| 1104 |
m_renderHal->pStateHeap->pGshBuffer, |
| 1105 |
m_renderHal->pStateHeap->pCurMediaState->dwOffset + m_renderHal->pStateHeap->dwOffsetCurbe + m_renderData.iCurbeOffset)); |
| 1106 |
|
| 1107 |
m_kernel->FreeCurbe(curbeData); |
| 1108 |
MT_LOG2(MT_VP_HAL_RENDER_SETUP_CURBE_STATE, MT_NORMAL, MT_FUNC_END, 1, MT_MOS_STATUS, MOS_STATUS_SUCCESS); |
| 1109 |
|
| 1110 |
return MOS_STATUS_SUCCESS; |
| 1111 |
} |
| 1112 |
|
| 1113 |
VP_SURFACE *VpRenderCmdPacket::GetSurface(SurfaceType type) |
| 1114 |
{ |
| 1115 |
VP_FUNC_CALL(); |
| 1116 |
|
| 1117 |
auto it = m_surfSetting.surfGroup.find(type); |
| 1118 |
VP_SURFACE *surf = (m_surfSetting.surfGroup.end() != it) ? it->second : nullptr; |
| 1119 |
|
| 1120 |
return surf; |
| 1121 |
} |
| 1122 |
|
| 1123 |
MOS_STATUS VpRenderCmdPacket::SetupMediaWalker() |
| 1124 |
{ |
| 1125 |
VP_FUNC_CALL(); |
| 1126 |
|
| 1127 |
switch (m_walkerType) |
| 1128 |
{ |
| 1129 |
case WALKER_TYPE_MEDIA: |
| 1130 |
MOS_ZeroMemory(&m_mediaWalkerParams, sizeof(MHW_WALKER_PARAMS)); |
| 1131 |
// Prepare Media Walker Params |
| 1132 |
VP_RENDER_CHK_STATUS_RETURN(PrepareMediaWalkerParams(m_renderData.walkerParam, m_mediaWalkerParams)); |
| 1133 |
break; |
| 1134 |
case WALKER_TYPE_COMPUTE: |
| 1135 |
// Parepare Compute Walker Param |
| 1136 |
MOS_ZeroMemory(&m_gpgpuWalkerParams, sizeof(MHW_GPGPU_WALKER_PARAMS)); |
| 1137 |
VP_RENDER_CHK_STATUS_RETURN(PrepareComputeWalkerParams(m_renderData.walkerParam, m_gpgpuWalkerParams)); |
| 1138 |
break; |
| 1139 |
case WALKER_TYPE_DISABLED: |
| 1140 |
default: |
| 1141 |
// using BB for walker setting |
| 1142 |
return MOS_STATUS_UNIMPLEMENTED; |
| 1143 |
} |
| 1144 |
|
| 1145 |
return MOS_STATUS_SUCCESS; |
| 1146 |
} |
| 1147 |
|
| 1148 |
MOS_STATUS VpRenderCmdPacket::SetupWalkerParams() |
| 1149 |
{ |
| 1150 |
VP_FUNC_CALL(); |
| 1151 |
MT_LOG1(MT_VP_HAL_RENDER_SETUP_WALKER_PARAM, MT_NORMAL, MT_FUNC_START, 1); |
| 1152 |
VP_RENDER_CHK_NULL_RETURN(m_kernel); |
| 1153 |
|
| 1154 |
VP_RENDER_CHK_STATUS_RETURN(m_kernel->GetWalkerSetting(m_renderData.walkerParam, m_renderData)); |
| 1155 |
MT_LOG2(MT_VP_CREATE, MT_NORMAL, MT_FUNC_END, 1, MT_MOS_STATUS, MOS_STATUS_SUCCESS); |
| 1156 |
|
| 1157 |
return MOS_STATUS_SUCCESS; |
| 1158 |
} |
| 1159 |
|
| 1160 |
void VpRenderCmdPacket::UpdateKernelConfigParam(RENDERHAL_KERNEL_PARAM &kernelParam) |
| 1161 |
{ |
| 1162 |
// In VP, 32 alignment with 5 bits right shift has already been done for CURBE_Length. |
| 1163 |
// No need update here. |
| 1164 |
} |
| 1165 |
|
| 1166 |
void VpRenderCmdPacket::OcaDumpDbgInfo(MOS_COMMAND_BUFFER &cmdBuffer, MOS_CONTEXT &mosContext) |
| 1167 |
{ |
| 1168 |
// Add kernel info to log. |
| 1169 |
for (auto it = m_kernelObjs.begin(); it != m_kernelObjs.end(); it++) |
| 1170 |
{ |
| 1171 |
auto kernel = it->second; |
| 1172 |
if (kernel) |
| 1173 |
{ |
| 1174 |
kernel->OcaDumpKernelInfo(cmdBuffer, mosContext); |
| 1175 |
} |
| 1176 |
else |
| 1177 |
{ |
| 1178 |
VP_RENDER_ASSERTMESSAGE("nullptr in m_kernelObjs!"); |
| 1179 |
} |
| 1180 |
} |
| 1181 |
// Add vphal param to log. |
| 1182 |
HalOcaInterfaceNext::DumpVphalParam(cmdBuffer, (MOS_CONTEXT_HANDLE)&mosContext, m_renderHal->pVphalOcaDumper); |
| 1183 |
|
| 1184 |
if (m_vpUserFeatureControl) |
| 1185 |
{ |
| 1186 |
HalOcaInterfaceNext::DumpVpUserFeautreControlInfo(cmdBuffer, &mosContext, m_vpUserFeatureControl->GetOcaFeautreControlInfo()); |
| 1187 |
} |
| 1188 |
} |
| 1189 |
|
| 1190 |
MOS_STATUS VpRenderCmdPacket::SetMediaFrameTracking(RENDERHAL_GENERIC_PROLOG_PARAMS &genericPrologParams) |
| 1191 |
{ |
| 1192 |
return VpCmdPacket::SetMediaFrameTracking(genericPrologParams); |
| 1193 |
} |
| 1194 |
|
| 1195 |
MOS_STATUS VpRenderCmdPacket::InitRenderHalSurface(VP_SURFACE &surface, RENDERHAL_SURFACE &renderSurface) |
| 1196 |
{ |
| 1197 |
VP_FUNC_CALL(); |
| 1198 |
VP_RENDER_CHK_NULL_RETURN(surface.osSurface); |
| 1199 |
PMOS_INTERFACE pOsInterface = nullptr; |
| 1200 |
RENDER_PACKET_CHK_NULL_RETURN(m_renderHal->pOsInterface); |
| 1201 |
pOsInterface = m_renderHal->pOsInterface; |
| 1202 |
RENDER_PACKET_CHK_NULL_RETURN(pOsInterface->pfnGetMemoryCompressionMode); |
| 1203 |
RENDER_PACKET_CHK_NULL_RETURN(pOsInterface->pfnGetMemoryCompressionFormat); |
| 1204 |
|
| 1205 |
// Update compression status |
| 1206 |
VP_PUBLIC_CHK_STATUS_RETURN(pOsInterface->pfnGetMemoryCompressionMode(pOsInterface, |
| 1207 |
&surface.osSurface->OsResource, |
| 1208 |
&surface.osSurface->MmcState)); |
| 1209 |
|
| 1210 |
VP_PUBLIC_CHK_STATUS_RETURN(pOsInterface->pfnGetMemoryCompressionFormat(pOsInterface, |
| 1211 |
&surface.osSurface->OsResource, |
| 1212 |
&surface.osSurface->CompressionFormat)); |
| 1213 |
|
| 1214 |
if (Mos_ResourceIsNull(&renderSurface.OsSurface.OsResource)) |
| 1215 |
{ |
| 1216 |
renderSurface.OsSurface = *surface.osSurface; |
| 1217 |
} |
| 1218 |
|
| 1219 |
renderSurface.rcSrc = surface.rcSrc; |
| 1220 |
renderSurface.rcDst = surface.rcDst; |
| 1221 |
renderSurface.rcMaxSrc = surface.rcMaxSrc; |
| 1222 |
renderSurface.SurfType = |
| 1223 |
InitRenderHalSurfType(surface.SurfType); |
| 1224 |
|
| 1225 |
return MOS_STATUS_SUCCESS; |
| 1226 |
} |
| 1227 |
MOS_STATUS VpRenderCmdPacket::InitStateHeapSurface(SurfaceType type, RENDERHAL_SURFACE &renderSurface) |
| 1228 |
{ |
| 1229 |
VP_FUNC_CALL(); |
| 1230 |
MOS_STATUS eStatus = MOS_STATUS_SUCCESS; |
| 1231 |
MOS_SURFACE mosSurface; |
| 1232 |
|
| 1233 |
MOS_ZeroMemory(&mosSurface, sizeof(MOS_SURFACE)); |
| 1234 |
|
| 1235 |
// Check for Vebox Heap readiness |
| 1236 |
const MHW_VEBOX_HEAP *pVeboxHeap = nullptr; |
| 1237 |
std::shared_ptr<mhw::vebox::Itf> veboxItf = nullptr; |
| 1238 |
|
| 1239 |
VP_RENDER_CHK_NULL_RETURN(m_hwInterface); |
| 1240 |
|
| 1241 |
VP_PUBLIC_CHK_STATUS_RETURN(m_hwInterface->m_vpPlatformInterface->GetVeboxHeapInfo( |
| 1242 |
m_hwInterface, |
| 1243 |
&pVeboxHeap)); |
| 1244 |
|
| 1245 |
VP_RENDER_CHK_NULL_RETURN(pVeboxHeap); |
| 1246 |
|
| 1247 |
switch (type) |
| 1248 |
{ |
| 1249 |
case SurfaceTypeVeboxStateHeap_Drv: |
| 1250 |
mosSurface.OsResource = pVeboxHeap->DriverResource; |
| 1251 |
break; |
| 1252 |
case SurfaceTypeVeboxStateHeap_Knr: |
| 1253 |
mosSurface.OsResource = pVeboxHeap->KernelResource; |
| 1254 |
break; |
| 1255 |
default: |
| 1256 |
eStatus = MOS_STATUS_UNIMPLEMENTED; |
| 1257 |
VP_RENDER_ASSERTMESSAGE("Not Inplenmented in driver now, return fail, surfacetype %d", type); |
| 1258 |
break; |
| 1259 |
} |
| 1260 |
|
| 1261 |
VP_RENDER_CHK_STATUS_RETURN(RenderCmdPacket::InitRenderHalSurface(mosSurface, &renderSurface)); |
| 1262 |
|
| 1263 |
return eStatus; |
| 1264 |
} |
| 1265 |
MOS_STATUS VpRenderCmdPacket::UpdateRenderSurface(RENDERHAL_SURFACE_NEXT &renderSurface, KERNEL_SURFACE_STATE_PARAM &kernelParams) |
| 1266 |
{ |
| 1267 |
VP_FUNC_CALL(); |
| 1268 |
auto &overwriteParam = kernelParams.surfaceOverwriteParams; |
| 1269 |
if (overwriteParam.updatedSurfaceParams) |
| 1270 |
{ |
| 1271 |
if (overwriteParam.width && overwriteParam.height) |
| 1272 |
{ |
| 1273 |
renderSurface.OsSurface.dwWidth = overwriteParam.width; |
| 1274 |
renderSurface.OsSurface.dwHeight = overwriteParam.height; |
| 1275 |
renderSurface.OsSurface.dwQPitch = overwriteParam.height; |
| 1276 |
} |
| 1277 |
|
| 1278 |
renderSurface.OsSurface.dwPitch = overwriteParam.pitch != 0 ? overwriteParam.pitch : renderSurface.OsSurface.dwPitch; |
| 1279 |
|
| 1280 |
if (renderSurface.OsSurface.dwPitch < renderSurface.OsSurface.dwWidth) |
| 1281 |
{ |
| 1282 |
VP_RENDER_ASSERTMESSAGE("Invalid Surface where Pitch < Width, return invalid Overwrite Params"); |
| 1283 |
return MOS_STATUS_INVALID_PARAMETER; |
| 1284 |
} |
| 1285 |
|
| 1286 |
renderSurface.OsSurface.Format = (overwriteParam.format != 0) ? overwriteParam.format : renderSurface.OsSurface.Format; |
| 1287 |
|
| 1288 |
if (0 == renderSurface.OsSurface.dwQPitch) |
| 1289 |
{ |
| 1290 |
renderSurface.OsSurface.dwQPitch = renderSurface.OsSurface.dwHeight; |
| 1291 |
} |
| 1292 |
} |
| 1293 |
|
| 1294 |
return MOS_STATUS_SUCCESS; |
| 1295 |
} |
| 1296 |
|
| 1297 |
MOS_STATUS VpRenderCmdPacket::SamplerAvsCalcScalingTable( |
| 1298 |
MHW_AVS_PARAMS &avsParameters, |
| 1299 |
MOS_FORMAT SrcFormat, |
| 1300 |
bool bVertical, |
| 1301 |
float fLumaScale, |
| 1302 |
float fChromaScale, |
| 1303 |
uint32_t dwChromaSiting, |
| 1304 |
bool b8TapAdaptiveEnable) |
| 1305 |
{ |
| 1306 |
VP_FUNC_CALL(); |
| 1307 |
MOS_STATUS eStatus = MOS_STATUS_SUCCESS; |
| 1308 |
MHW_PLANE Plane; |
| 1309 |
int32_t iUvPhaseOffset; |
| 1310 |
uint32_t dwHwPhrase; |
| 1311 |
uint32_t YCoefTableSize; |
| 1312 |
uint32_t UVCoefTableSize; |
| 1313 |
float fLumaScaleParam; |
| 1314 |
float fChromaScaleParam; |
| 1315 |
int32_t * piYCoefsParam; |
| 1316 |
int32_t * piUVCoefsParam; |
| 1317 |
float fHPStrength; |
| 1318 |
|
| 1319 |
VP_PUBLIC_CHK_NULL_RETURN(avsParameters.piYCoefsY); |
| 1320 |
VP_PUBLIC_CHK_NULL_RETURN(avsParameters.piYCoefsX); |
| 1321 |
VP_PUBLIC_CHK_NULL_RETURN(avsParameters.piUVCoefsY); |
| 1322 |
VP_PUBLIC_CHK_NULL_RETURN(avsParameters.piUVCoefsX); |
| 1323 |
|
| 1324 |
YCoefTableSize = (NUM_POLYPHASE_Y_ENTRIES * NUM_HW_POLYPHASE_TABLES_G9 * sizeof(float)); |
| 1325 |
UVCoefTableSize = (NUM_POLYPHASE_UV_ENTRIES * NUM_HW_POLYPHASE_TABLES_G9 * sizeof(float)); |
| 1326 |
dwHwPhrase = NUM_HW_POLYPHASE_TABLES_G9; |
| 1327 |
|
| 1328 |
fHPStrength = 0.0F; |
| 1329 |
piYCoefsParam = bVertical ? avsParameters.piYCoefsY : avsParameters.piYCoefsX; |
| 1330 |
piUVCoefsParam = bVertical ? avsParameters.piUVCoefsY : avsParameters.piUVCoefsX; |
| 1331 |
|
| 1332 |
// Recalculate Horizontal or Vertical scaling table |
| 1333 |
if (SrcFormat != avsParameters.Format) //|| fLumaScale != fLumaScaleParam || fChromaScale != fChromaScaleParam |
| 1334 |
{ |
| 1335 |
MOS_ZeroMemory(piYCoefsParam, YCoefTableSize); |
| 1336 |
MOS_ZeroMemory(piUVCoefsParam, UVCoefTableSize); |
| 1337 |
|
| 1338 |
// 4-tap filtering for RGformat G-channel if 8tap adaptive filter is not enabled. |
| 1339 |
Plane = (IS_RGB32_FORMAT(SrcFormat) && !b8TapAdaptiveEnable) ? MHW_U_PLANE : MHW_Y_PLANE; |
| 1340 |
|
| 1341 |
// For 1x scaling in horizontal direction, use special coefficients for filtering |
| 1342 |
// we don't do this when bForcePolyPhaseCoefs flag is set |
| 1343 |
if (fLumaScale == 1.0F && !avsParameters.bForcePolyPhaseCoefs) |
| 1344 |
{ |
| 1345 |
VP_RENDER_CHK_STATUS_RETURN(SetNearestModeTable( |
| 1346 |
piYCoefsParam, |
| 1347 |
Plane, |
| 1348 |
true)); |
| 1349 |
// If the 8-tap adaptive is enabled for all channel, then UV/RB use the same coefficient as Y/G |
| 1350 |
// So, coefficient for UV/RB channels caculation can be passed |
| 1351 |
if (!b8TapAdaptiveEnable) |
| 1352 |
{ |
| 1353 |
if (fChromaScale == 1.0F) |
| 1354 |
{ |
| 1355 |
VP_RENDER_CHK_STATUS_RETURN(SetNearestModeTable( |
| 1356 |
piUVCoefsParam, |
| 1357 |
MHW_U_PLANE, |
| 1358 |
true)); |
| 1359 |
} |
| 1360 |
else |
| 1361 |
{ |
| 1362 |
if (dwChromaSiting & (bVertical ? MHW_CHROMA_SITING_VERT_TOP : MHW_CHROMA_SITING_HORZ_LEFT)) |
| 1363 |
{ |
| 1364 |
// No Chroma Siting |
| 1365 |
VP_RENDER_CHK_STATUS_RETURN(CalcPolyphaseTablesUV( |
| 1366 |
piUVCoefsParam, |
| 1367 |
2.0F, |
| 1368 |
fChromaScale)); |
| 1369 |
} |
| 1370 |
else |
| 1371 |
{ |
| 1372 |
// Chroma siting offset needs to be added |
| 1373 |
if (dwChromaSiting & (bVertical ? MHW_CHROMA_SITING_VERT_CENTER : MHW_CHROMA_SITING_HORZ_CENTER)) |
| 1374 |
{ |
| 1375 |
iUvPhaseOffset = MOS_UF_ROUND(0.5F * 16.0F); // U0.4 |
| 1376 |
} |
| 1377 |
else //if (ChromaSiting & (bVertical ? MHW_CHROMA_SITING_VERT_BOTTOM : MHW_CHROMA_SITING_HORZ_RIGHT)) |
| 1378 |
{ |
| 1379 |
iUvPhaseOffset = MOS_UF_ROUND(1.0F * 16.0F); // U0.4 |
| 1380 |
} |
| 1381 |
|
| 1382 |
VP_RENDER_CHK_STATUS_RETURN(CalcPolyphaseTablesUVOffset( |
| 1383 |
piUVCoefsParam, |
| 1384 |
3.0F, |
| 1385 |
fChromaScale, |
| 1386 |
iUvPhaseOffset)); |
| 1387 |
} |
| 1388 |
} |
| 1389 |
} |
| 1390 |
} |
| 1391 |
else |
| 1392 |
{ |
| 1393 |
// Clamp the Scaling Factor if > 1.0x |
| 1394 |
fLumaScale = MOS_MIN(1.0F, fLumaScale); |
| 1395 |
|
| 1396 |
VP_RENDER_CHK_STATUS_RETURN(CalcPolyphaseTablesY( |
| 1397 |
piYCoefsParam, |
| 1398 |
fLumaScale, |
| 1399 |
Plane, |
| 1400 |
SrcFormat, |
| 1401 |
fHPStrength, |
| 1402 |
true, |
| 1403 |
dwHwPhrase)); |
| 1404 |
|
| 1405 |
// If the 8-tap adaptive is enabled for all channel, then UV/RB use the same coefficient as Y/G |
| 1406 |
// So, coefficient for UV/RB channels caculation can be passed |
| 1407 |
if (!b8TapAdaptiveEnable) |
| 1408 |
{ |
| 1409 |
{ |
| 1410 |
if (fChromaScale == 1.0F) |
| 1411 |
{ |
| 1412 |
VP_RENDER_CHK_STATUS_RETURN(SetNearestModeTable( |
| 1413 |
piUVCoefsParam, |
| 1414 |
MHW_U_PLANE, |
| 1415 |
true)); |
| 1416 |
} |
| 1417 |
else |
| 1418 |
{ |
| 1419 |
// If Chroma Siting info is present |
| 1420 |
if (dwChromaSiting & (bVertical ? MHW_CHROMA_SITING_VERT_TOP : MHW_CHROMA_SITING_HORZ_LEFT)) |
| 1421 |
{ |
| 1422 |
// No Chroma Siting |
| 1423 |
VP_RENDER_CHK_STATUS_RETURN(CalcPolyphaseTablesUV( |
| 1424 |
piUVCoefsParam, |
| 1425 |
2.0F, |
| 1426 |
fChromaScale)); |
| 1427 |
} |
| 1428 |
else |
| 1429 |
{ |
| 1430 |
// Chroma siting offset needs to be added |
| 1431 |
if (dwChromaSiting & (bVertical ? MHW_CHROMA_SITING_VERT_CENTER : MHW_CHROMA_SITING_HORZ_CENTER)) |
| 1432 |
{ |
| 1433 |
iUvPhaseOffset = MOS_UF_ROUND(0.5F * 16.0F); // U0.4 |
| 1434 |
} |
| 1435 |
else //if (ChromaSiting & (bVertical ? MHW_CHROMA_SITING_VERT_BOTTOM : MHW_CHROMA_SITING_HORZ_RIGHT)) |
| 1436 |
{ |
| 1437 |
iUvPhaseOffset = MOS_UF_ROUND(1.0F * 16.0F); // U0.4 |
| 1438 |
} |
| 1439 |
|
| 1440 |
VP_RENDER_CHK_STATUS_RETURN(CalcPolyphaseTablesUVOffset( |
| 1441 |
piUVCoefsParam, |
| 1442 |
3.0F, |
| 1443 |
fChromaScale, |
| 1444 |
iUvPhaseOffset)); |
| 1445 |
} |
| 1446 |
} |
| 1447 |
} |
| 1448 |
} |
| 1449 |
} |
| 1450 |
} |
| 1451 |
return MOS_STATUS_SUCCESS; |
| 1452 |
} |
| 1453 |
|
| 1454 |
MOS_STATUS VpRenderCmdPacket::SetNearestModeTable( |
| 1455 |
int32_t *iCoefs, |
| 1456 |
uint32_t dwPlane, |
| 1457 |
bool bBalancedFilter) |
| 1458 |
{ |
| 1459 |
VP_FUNC_CALL(); |
| 1460 |
uint32_t dwNumEntries; |
| 1461 |
uint32_t dwOffset; |
| 1462 |
uint32_t i; |
| 1463 |
MOS_STATUS eStatus = MOS_STATUS_SUCCESS; |
| 1464 |
|
| 1465 |
MHW_FUNCTION_ENTER; |
| 1466 |
|
| 1467 |
MHW_CHK_NULL(iCoefs); |
| 1468 |
|
| 1469 |
if (dwPlane == MHW_GENERIC_PLANE || dwPlane == MHW_Y_PLANE) |
| 1470 |
{ |
| 1471 |
dwNumEntries = NUM_POLYPHASE_Y_ENTRIES; |
| 1472 |
dwOffset = 3; |
| 1473 |
} |
| 1474 |
else // if (dwPlane == MHW_U_PLANE || dwPlane == MHW_V_PLANE) |
| 1475 |
{ |
| 1476 |
dwNumEntries = NUM_POLYPHASE_UV_ENTRIES; |
| 1477 |
dwOffset = 1; |
| 1478 |
} |
| 1479 |
|
| 1480 |
for (i = 0; i <= NUM_HW_POLYPHASE_TABLES / 2; i++) |
| 1481 |
{ |
| 1482 |
iCoefs[i * dwNumEntries + dwOffset] = 0x40; |
| 1483 |
} |
| 1484 |
|
| 1485 |
if (bBalancedFilter) |
| 1486 |
{ |
| 1487 |
// Fix offset so that filter is balanced |
| 1488 |
for (i = (NUM_HW_POLYPHASE_TABLES / 2 + 1); i < NUM_HW_POLYPHASE_TABLES; i++) |
| 1489 |
{ |
| 1490 |
iCoefs[i * dwNumEntries + dwOffset + 1] = 0x40; |
| 1491 |
} |
| 1492 |
} |
| 1493 |
|
| 1494 |
finish: |
| 1495 |
return eStatus; |
| 1496 |
} |
| 1497 |
|
| 1498 |
MOS_STATUS VpRenderCmdPacket::CalcPolyphaseTablesUV( |
| 1499 |
int32_t *piCoefs, |
| 1500 |
float fLanczosT, |
| 1501 |
float fInverseScaleFactor) |
| 1502 |
{ |
| 1503 |
VP_FUNC_CALL(); |
| 1504 |
int32_t phaseCount, tableCoefUnit, centerPixel, sumQuantCoefs; |
| 1505 |
double phaseCoefs[MHW_SCALER_UV_WIN_SIZE]; |
| 1506 |
double startOffset, sf, base, sumCoefs, pos; |
| 1507 |
int32_t minCoef[MHW_SCALER_UV_WIN_SIZE]; |
| 1508 |
int32_t maxCoef[MHW_SCALER_UV_WIN_SIZE]; |
| 1509 |
int32_t i, j; |
| 1510 |
MOS_STATUS eStatus = MOS_STATUS_SUCCESS; |
| 1511 |
|
| 1512 |
MHW_FUNCTION_ENTER; |
| 1513 |
|
| 1514 |
MHW_CHK_NULL(piCoefs); |
| 1515 |
|
| 1516 |
phaseCount = MHW_TABLE_PHASE_COUNT; |
| 1517 |
centerPixel = (MHW_SCALER_UV_WIN_SIZE / 2) - 1; |
| 1518 |
startOffset = (double)(-centerPixel); |
| 1519 |
tableCoefUnit = 1 << MHW_TBL_COEF_PREC; |
| 1520 |
sf = MOS_MIN(1.0, fInverseScaleFactor); // Sf isn't used for upscaling |
| 1521 |
|
| 1522 |
MOS_ZeroMemory(piCoefs, sizeof(int32_t) * MHW_SCALER_UV_WIN_SIZE * phaseCount); |
| 1523 |
MOS_ZeroMemory(minCoef, sizeof(minCoef)); |
| 1524 |
MOS_ZeroMemory(maxCoef, sizeof(maxCoef)); |
| 1525 |
|
| 1526 |
if (sf < 1.0F) |
| 1527 |
{ |
| 1528 |
fLanczosT = 2.0F; |
| 1529 |
} |
| 1530 |
|
| 1531 |
for (i = 0; i < phaseCount; ++i, piCoefs += MHW_SCALER_UV_WIN_SIZE) |
| 1532 |
{ |
| 1533 |
// Write all |
| 1534 |
// Note - to shift by a half you need to a half to each phase. |
| 1535 |
base = startOffset - (double)(i) / (double)(phaseCount); |
| 1536 |
sumCoefs = 0.0; |
| 1537 |
|
| 1538 |
for (j = 0; j < MHW_SCALER_UV_WIN_SIZE; ++j) |
| 1539 |
{ |
| 1540 |
pos = base + (double)j; |
| 1541 |
phaseCoefs[j] = MosUtilities::MosLanczos((float)(pos * sf), MHW_SCALER_UV_WIN_SIZE, fLanczosT); |
| 1542 |
sumCoefs += phaseCoefs[j]; |
| 1543 |
} |
| 1544 |
// Normalize coefs and save |
| 1545 |
for (j = 0; j < MHW_SCALER_UV_WIN_SIZE; ++j) |
| 1546 |
{ |
| 1547 |
piCoefs[j] = (int32_t)floor((0.5 + (double)(tableCoefUnit) * (phaseCoefs[j] / sumCoefs))); |
| 1548 |
|
| 1549 |
//For debug purposes: |
| 1550 |
minCoef[j] = MOS_MIN(minCoef[j], piCoefs[j]); |
| 1551 |
maxCoef[j] = MOS_MAX(maxCoef[j], piCoefs[j]); |
| 1552 |
} |
| 1553 |
|
| 1554 |
// Recalc center coef |
| 1555 |
sumQuantCoefs = 0; |
| 1556 |
for (j = 0; j < MHW_SCALER_UV_WIN_SIZE; ++j) |
| 1557 |
{ |
| 1558 |
sumQuantCoefs += piCoefs[j]; |
| 1559 |
} |
| 1560 |
|
| 1561 |
// Fix center coef so that filter is balanced |
| 1562 |
if (i <= phaseCount / 2) |
| 1563 |
{ |
| 1564 |
piCoefs[centerPixel] -= sumQuantCoefs - tableCoefUnit; |
| 1565 |
} |
| 1566 |
else |
| 1567 |
{ |
| 1568 |
piCoefs[centerPixel + 1] -= sumQuantCoefs - tableCoefUnit; |
| 1569 |
} |
| 1570 |
} |
| 1571 |
|
| 1572 |
finish: |
| 1573 |
return eStatus; |
| 1574 |
} |
| 1575 |
|
| 1576 |
MOS_STATUS VpRenderCmdPacket::CalcPolyphaseTablesY( |
| 1577 |
int32_t * iCoefs, |
| 1578 |
float fScaleFactor, |
| 1579 |
uint32_t dwPlane, |
| 1580 |
MOS_FORMAT srcFmt, |
| 1581 |
float fHPStrength, |
| 1582 |
bool bUse8x8Filter, |
| 1583 |
uint32_t dwHwPhase) |
| 1584 |
{ |
| 1585 |
VP_FUNC_CALL(); |
| 1586 |
uint32_t dwNumEntries; |
| 1587 |
uint32_t dwTableCoefUnit; |
| 1588 |
uint32_t i, j; |
| 1589 |
int32_t k; |
| 1590 |
MOS_STATUS eStatus = MOS_STATUS_SUCCESS; |
| 1591 |
float fPhaseCoefs[NUM_POLYPHASE_Y_ENTRIES]; |
| 1592 |
float fPhaseCoefsCopy[NUM_POLYPHASE_Y_ENTRIES]; |
| 1593 |
float fStartOffset; |
| 1594 |
float fHPFilter[3], fHPSum, fHPHalfPhase; // Only used for Y_PLANE |
| 1595 |
float fBase, fPos, fSumCoefs; |
| 1596 |
float fLanczosT; |
| 1597 |
int32_t iCenterPixel; |
| 1598 |
int32_t iSumQuantCoefs; |
| 1599 |
|
| 1600 |
MHW_FUNCTION_ENTER; |
| 1601 |
|
| 1602 |
MHW_CHK_NULL(iCoefs); |
| 1603 |
MHW_ASSERT((dwHwPhase == MHW_NUM_HW_POLYPHASE_TABLES) || (dwHwPhase == NUM_HW_POLYPHASE_TABLES)); |
| 1604 |
|
| 1605 |
if (dwPlane == MHW_GENERIC_PLANE || dwPlane == MHW_Y_PLANE) |
| 1606 |
{ |
| 1607 |
dwNumEntries = NUM_POLYPHASE_Y_ENTRIES; |
| 1608 |
} |
| 1609 |
else // if (dwPlane == MHW_U_PLANE || dwPlane == MHW_V_PLANE) |
| 1610 |
{ |
| 1611 |
dwNumEntries = NUM_POLYPHASE_UV_ENTRIES; |
| 1612 |
} |
| 1613 |
|
| 1614 |
MOS_ZeroMemory(fPhaseCoefs, sizeof(fPhaseCoefs)); |
| 1615 |
MOS_ZeroMemory(fPhaseCoefsCopy, sizeof(fPhaseCoefsCopy)); |
| 1616 |
|
| 1617 |
dwTableCoefUnit = 1 << MHW_AVS_TBL_COEF_PREC; |
| 1618 |
iCenterPixel = dwNumEntries / 2 - 1; |
| 1619 |
fStartOffset = (float)(-iCenterPixel); |
| 1620 |
|
| 1621 |
if ((IS_YUV_FORMAT(srcFmt) && |
| 1622 |
dwPlane != MHW_U_PLANE && |
| 1623 |
dwPlane != MHW_V_PLANE) || |
| 1624 |
((IS_RGB32_FORMAT(srcFmt) || |
| 1625 |
srcFmt == Format_Y410 || |
| 1626 |
srcFmt == Format_AYUV) && |
| 1627 |
dwPlane == MHW_Y_PLANE)) |
| 1628 |
{ |
| 1629 |
if (fScaleFactor < 1.0F) |
| 1630 |
{ |
| 1631 |
fLanczosT = 4.0F; |
| 1632 |
} |
| 1633 |
else |
| 1634 |
{ |
| 1635 |
fLanczosT = 8.0F; |
| 1636 |
} |
| 1637 |
} |
| 1638 |
else // if (dwPlane == MHW_U_PLANE || dwPlane == MHW_V_PLANE || (IS_RGB_FORMAT(srcFmt) && dwPlane != MHW_V_PLANE)) |
| 1639 |
{ |
| 1640 |
fLanczosT = 2.0F; |
| 1641 |
} |
| 1642 |
|
| 1643 |
for (i = 0; i < dwHwPhase; i++) |
| 1644 |
{ |
| 1645 |
fBase = fStartOffset - (float)i / (float)NUM_POLYPHASE_TABLES; |
| 1646 |
fSumCoefs = 0.0F; |
| 1647 |
|
| 1648 |
for (j = 0; j < dwNumEntries; j++) |
| 1649 |
{ |
| 1650 |
fPos = fBase + (float)j; |
| 1651 |
|
| 1652 |
if (bUse8x8Filter) |
| 1653 |
{ |
| 1654 |
fPhaseCoefs[j] = fPhaseCoefsCopy[j] = MosUtilities::MosLanczos(fPos * fScaleFactor, dwNumEntries, fLanczosT); |
| 1655 |
} |
| 1656 |
else |
| 1657 |
{ |
| 1658 |
fPhaseCoefs[j] = fPhaseCoefsCopy[j] = MosUtilities::MosLanczosG(fPos * fScaleFactor, NUM_POLYPHASE_5x5_Y_ENTRIES, fLanczosT); |
| 1659 |
} |
| 1660 |
|
| 1661 |
fSumCoefs += fPhaseCoefs[j]; |
| 1662 |
} |
| 1663 |
|
| 1664 |
// Convolve with HP |
| 1665 |
if (dwPlane == MHW_GENERIC_PLANE || dwPlane == MHW_Y_PLANE) |
| 1666 |
{ |
| 1667 |
if (i <= NUM_POLYPHASE_TABLES / 2) |
| 1668 |
{ |
| 1669 |
fHPHalfPhase = (float)i / (float)NUM_POLYPHASE_TABLES; |
| 1670 |
} |
| 1671 |
else |
| 1672 |
{ |
| 1673 |
fHPHalfPhase = (float)(NUM_POLYPHASE_TABLES - i) / (float)NUM_POLYPHASE_TABLES; |
| 1674 |
} |
| 1675 |
fHPFilter[0] = fHPFilter[2] = -fHPStrength * MosUtilities::MosSinc(fHPHalfPhase * MOS_PI); |
| 1676 |
fHPFilter[1] = 1.0F + 2.0F * fHPStrength; |
| 1677 |
|
| 1678 |
for (j = 0; j < dwNumEntries; j++) |
| 1679 |
{ |
| 1680 |
fHPSum = 0.0F; |
| 1681 |
for (k = -1; k <= 1; k++) |
| 1682 |
{ |
| 1683 |
if ((((long)j + k) >= 0) && (j + k < dwNumEntries)) |
| 1684 |
{ |
| 1685 |
fHPSum += fPhaseCoefsCopy[(int32_t)j + k] * fHPFilter[k + 1]; |
| 1686 |
} |
| 1687 |
fPhaseCoefs[j] = fHPSum; |
| 1688 |
} |
| 1689 |
} |
| 1690 |
} |
| 1691 |
|
| 1692 |
// Normalize coefs and save |
| 1693 |
iSumQuantCoefs = 0; |
| 1694 |
for (j = 0; j < dwNumEntries; j++) |
| 1695 |
{ |
| 1696 |
iCoefs[i * dwNumEntries + j] = (int32_t)floor(0.5F + (float)dwTableCoefUnit * fPhaseCoefs[j] / fSumCoefs); |
| 1697 |
iSumQuantCoefs += iCoefs[i * dwNumEntries + j]; |
| 1698 |
} |
| 1699 |
|
| 1700 |
// Fix center coef so that filter is balanced |
| 1701 |
if (i <= NUM_POLYPHASE_TABLES / 2) |
| 1702 |
{ |
| 1703 |
iCoefs[i * dwNumEntries + iCenterPixel] -= iSumQuantCoefs - dwTableCoefUnit; |
| 1704 |
} |
| 1705 |
else |
| 1706 |
{ |
| 1707 |
iCoefs[i * dwNumEntries + iCenterPixel + 1] -= iSumQuantCoefs - dwTableCoefUnit; |
| 1708 |
} |
| 1709 |
} |
| 1710 |
|
| 1711 |
finish: |
| 1712 |
return eStatus; |
| 1713 |
} |
| 1714 |
|
| 1715 |
MOS_STATUS VpRenderCmdPacket::CalcPolyphaseTablesUVOffset( |
| 1716 |
int32_t *piCoefs, |
| 1717 |
float fLanczosT, |
| 1718 |
float fInverseScaleFactor, |
| 1719 |
int32_t iUvPhaseOffset) |
| 1720 |
{ |
| 1721 |
VP_FUNC_CALL(); |
| 1722 |
int32_t phaseCount, tableCoefUnit, centerPixel, sumQuantCoefs; |
| 1723 |
double phaseCoefs[MHW_SCALER_UV_WIN_SIZE]; |
| 1724 |
double startOffset, sf, pos, sumCoefs, base; |
| 1725 |
int32_t minCoef[MHW_SCALER_UV_WIN_SIZE]; |
| 1726 |
int32_t maxCoef[MHW_SCALER_UV_WIN_SIZE]; |
| 1727 |
int32_t i, j; |
| 1728 |
int32_t adjusted_phase; |
| 1729 |
MOS_STATUS eStatus = MOS_STATUS_SUCCESS; |
| 1730 |
|
| 1731 |
MHW_FUNCTION_ENTER; |
| 1732 |
|
| 1733 |
MHW_CHK_NULL(piCoefs); |
| 1734 |
|
| 1735 |
phaseCount = MHW_TABLE_PHASE_COUNT; |
| 1736 |
centerPixel = (MHW_SCALER_UV_WIN_SIZE / 2) - 1; |
| 1737 |
startOffset = (double)(-centerPixel + |
| 1738 |
(double)iUvPhaseOffset / (double)(phaseCount)); |
| 1739 |
tableCoefUnit = 1 << MHW_TBL_COEF_PREC; |
| 1740 |
|
| 1741 |
MOS_ZeroMemory(minCoef, sizeof(minCoef)); |
| 1742 |
MOS_ZeroMemory(maxCoef, sizeof(maxCoef)); |
| 1743 |
MOS_ZeroMemory(piCoefs, sizeof(int32_t) * MHW_SCALER_UV_WIN_SIZE * phaseCount); |
| 1744 |
|
| 1745 |
sf = MOS_MIN(1.0, fInverseScaleFactor); // Sf isn't used for upscaling |
| 1746 |
if (sf < 1.0) |
| 1747 |
{ |
| 1748 |
fLanczosT = 3.0; |
| 1749 |
} |
| 1750 |
|
| 1751 |
for (i = 0; i < phaseCount; ++i, piCoefs += MHW_SCALER_UV_WIN_SIZE) |
| 1752 |
{ |
| 1753 |
// Write all |
| 1754 |
// Note - to shift by a half you need to a half to each phase. |
| 1755 |
base = startOffset - (double)(i) / (double)(phaseCount); |
| 1756 |
sumCoefs = 0.0; |
| 1757 |
|
| 1758 |
for (j = 0; j < MHW_SCALER_UV_WIN_SIZE; ++j) |
| 1759 |
{ |
| 1760 |
pos = base + (double)j; |
| 1761 |
phaseCoefs[j] = MosUtilities::MosLanczos((float)(pos * sf), 6 /*MHW_SCALER_UV_WIN_SIZE*/, fLanczosT); |
| 1762 |
sumCoefs += phaseCoefs[j]; |
| 1763 |
} |
| 1764 |
// Normalize coefs and save |
| 1765 |
for (j = 0; j < MHW_SCALER_UV_WIN_SIZE; ++j) |
| 1766 |
{ |
| 1767 |
piCoefs[j] = (int32_t)floor((0.5 + (double)(tableCoefUnit) * (phaseCoefs[j] / sumCoefs))); |
| 1768 |
|
| 1769 |
// For debug purposes: |
| 1770 |
minCoef[j] = MOS_MIN(minCoef[j], piCoefs[j]); |
| 1771 |
maxCoef[j] = MOS_MAX(maxCoef[j], piCoefs[j]); |
| 1772 |
} |
| 1773 |
|
| 1774 |
// Recalc center coef |
| 1775 |
sumQuantCoefs = 0; |
| 1776 |
for (j = 0; j < MHW_SCALER_UV_WIN_SIZE; ++j) |
| 1777 |
{ |
| 1778 |
sumQuantCoefs += piCoefs[j]; |
| 1779 |
} |
| 1780 |
|
| 1781 |
// Fix center coef so that filter is balanced |
| 1782 |
adjusted_phase = i - iUvPhaseOffset; |
| 1783 |
if (adjusted_phase <= phaseCount / 2) |
| 1784 |
{ |
| 1785 |
piCoefs[centerPixel] -= sumQuantCoefs - tableCoefUnit; |
| 1786 |
} |
| 1787 |
else // if(adjusted_phase < phaseCount) |
| 1788 |
{ |
| 1789 |
piCoefs[centerPixel + 1] -= sumQuantCoefs - tableCoefUnit; |
| 1790 |
} |
| 1791 |
} |
| 1792 |
|
| 1793 |
finish: |
| 1794 |
return eStatus; |
| 1795 |
} |
| 1796 |
|
| 1797 |
MOS_STATUS VpRenderCmdPacket::SubmitWithMultiKernel(MOS_COMMAND_BUFFER *commandBuffer, uint8_t packetPhase) |
| 1798 |
{ |
| 1799 |
VP_FUNC_CALL(); |
| 1800 |
PMOS_INTERFACE pOsInterface = nullptr; |
| 1801 |
MOS_STATUS eStatus = MOS_STATUS_SUCCESS; |
| 1802 |
uint32_t dwSyncTag = 0; |
| 1803 |
int32_t i = 0, iRemaining = 0; |
| 1804 |
MHW_MEDIA_STATE_FLUSH_PARAM FlushParam = {}; |
| 1805 |
bool bEnableSLM = false; |
| 1806 |
RENDERHAL_GENERIC_PROLOG_PARAMS GenericPrologParams = {}; |
| 1807 |
MOS_RESOURCE GpuStatusBuffer = {}; |
| 1808 |
MOS_CONTEXT * pOsContext = nullptr; |
| 1809 |
PMHW_MI_MMIOREGISTERS pMmioRegisters = nullptr; |
| 1810 |
std::shared_ptr<mhw::mi::Itf> m_miItf = nullptr; |
| 1811 |
|
| 1812 |
RENDER_PACKET_CHK_NULL_RETURN(m_renderHal); |
| 1813 |
RENDER_PACKET_CHK_NULL_RETURN(m_renderHal->pRenderHalPltInterface); |
| 1814 |
RENDER_PACKET_CHK_NULL_RETURN(m_renderHal->pRenderHalPltInterface->GetMmioRegisters(m_renderHal)); |
| 1815 |
RENDER_PACKET_CHK_NULL_RETURN(m_renderHal->pOsInterface); |
| 1816 |
RENDER_PACKET_CHK_NULL_RETURN(m_renderHal->pOsInterface->pOsContext); |
| 1817 |
|
| 1818 |
eStatus = MOS_STATUS_UNKNOWN; |
| 1819 |
pOsInterface = m_renderHal->pOsInterface; |
| 1820 |
iRemaining = 0; |
| 1821 |
FlushParam = g_cRenderHal_InitMediaStateFlushParams; |
| 1822 |
pOsContext = pOsInterface->pOsContext; |
| 1823 |
pMmioRegisters = m_renderHal->pRenderHalPltInterface->GetMmioRegisters(m_renderHal); |
| 1824 |
|
| 1825 |
RENDER_PACKET_CHK_STATUS_RETURN(SetPowerMode(kernelCombinedFc)); |
| 1826 |
|
| 1827 |
m_renderHal->pRenderHalPltInterface->On1stLevelBBStart(m_renderHal, commandBuffer, pOsContext, pOsInterface->CurrentGpuContextHandle, pMmioRegisters); |
| 1828 |
|
| 1829 |
OcaDumpDbgInfo(*commandBuffer, *pOsContext); |
| 1830 |
|
| 1831 |
RENDER_PACKET_CHK_STATUS_RETURN(SetMediaFrameTracking(GenericPrologParams)); |
| 1832 |
|
| 1833 |
// Initialize command buffer and insert prolog |
| 1834 |
RENDER_PACKET_CHK_STATUS_RETURN(m_renderHal->pfnInitCommandBuffer(m_renderHal, commandBuffer, &GenericPrologParams)); |
| 1835 |
|
| 1836 |
RENDER_PACKET_CHK_STATUS_RETURN(m_renderHal->pRenderHalPltInterface->AddPerfCollectStartCmd(m_renderHal, pOsInterface, commandBuffer)); |
| 1837 |
|
| 1838 |
RENDER_PACKET_CHK_STATUS_RETURN(m_renderHal->pRenderHalPltInterface->StartPredicate(m_renderHal, commandBuffer)); |
| 1839 |
|
| 1840 |
// Write timing data for 3P budget |
| 1841 |
RENDER_PACKET_CHK_STATUS_RETURN(m_renderHal->pfnSendTimingData(m_renderHal, commandBuffer, true)); |
| 1842 |
|
| 1843 |
bEnableSLM = false; // Media walker first |
| 1844 |
RENDER_PACKET_CHK_STATUS_RETURN(m_renderHal->pfnSetCacheOverrideParams( |
| 1845 |
m_renderHal, |
| 1846 |
&m_renderHal->L3CacheSettings, |
| 1847 |
bEnableSLM)); |
| 1848 |
|
| 1849 |
// Flush media states |
| 1850 |
VP_RENDER_CHK_STATUS_RETURN(SendMediaStates(m_renderHal, commandBuffer)); |
| 1851 |
|
| 1852 |
// Write back GPU Status tag |
| 1853 |
if (!pOsInterface->bEnableKmdMediaFrameTracking) |
| 1854 |
{ |
| 1855 |
RENDER_PACKET_CHK_STATUS_RETURN(m_renderHal->pfnSendRcsStatusTag(m_renderHal, commandBuffer)); |
| 1856 |
} |
| 1857 |
|
| 1858 |
RENDER_PACKET_CHK_STATUS_RETURN(m_renderHal->pRenderHalPltInterface->StopPredicate(m_renderHal, commandBuffer)); |
| 1859 |
|
| 1860 |
RENDER_PACKET_CHK_STATUS_RETURN(m_renderHal->pRenderHalPltInterface->AddPerfCollectEndCmd(m_renderHal, pOsInterface, commandBuffer)); |
| 1861 |
|
| 1862 |
// Write timing data for 3P budget |
| 1863 |
RENDER_PACKET_CHK_STATUS_RETURN(m_renderHal->pfnSendTimingData(m_renderHal, commandBuffer, false)); |
| 1864 |
|
| 1865 |
MHW_PIPE_CONTROL_PARAMS PipeControlParams; |
| 1866 |
|
| 1867 |
MOS_ZeroMemory(&PipeControlParams, sizeof(PipeControlParams)); |
| 1868 |
PipeControlParams.dwFlushMode = MHW_FLUSH_WRITE_CACHE; |
| 1869 |
PipeControlParams.bGenericMediaStateClear = true; // this value is ignored for compute walker. |
| 1870 |
PipeControlParams.bIndirectStatePointersDisable = true; |
| 1871 |
PipeControlParams.bDisableCSStall = false; |
| 1872 |
|
| 1873 |
RENDER_PACKET_CHK_NULL_RETURN(pOsInterface->pfnGetSkuTable); |
| 1874 |
auto *skuTable = pOsInterface->pfnGetSkuTable(pOsInterface); |
| 1875 |
if (skuTable && MEDIA_IS_SKU(skuTable, FtrEnablePPCFlush)) |
| 1876 |
{ |
| 1877 |
// Add PPC fulsh |
| 1878 |
PipeControlParams.bPPCFlush = true; |
| 1879 |
} |
| 1880 |
RENDER_PACKET_CHK_STATUS_RETURN(m_renderHal->pRenderHalPltInterface->AddMiPipeControl(m_renderHal, commandBuffer, &PipeControlParams)); |
| 1881 |
|
| 1882 |
if (MEDIA_IS_WA(m_renderHal->pWaTable, WaSendDummyVFEafterPipelineSelect)) |
| 1883 |
{ |
| 1884 |
MHW_VFE_PARAMS VfeStateParams = {}; |
| 1885 |
VfeStateParams.dwNumberofURBEntries = 1; |
| 1886 |
RENDER_PACKET_CHK_STATUS_RETURN(m_renderHal->pRenderHalPltInterface->AddMediaVfeCmd(m_renderHal, commandBuffer, &VfeStateParams)); |
| 1887 |
} |
| 1888 |
|
| 1889 |
// Add media flush command in case HW not cleaning the media state |
| 1890 |
if (MEDIA_IS_WA(m_renderHal->pWaTable, WaMSFWithNoWatermarkTSGHang)) |
| 1891 |
{ |
| 1892 |
FlushParam.bFlushToGo = true; |
| 1893 |
if (m_walkerType == WALKER_TYPE_MEDIA) |
| 1894 |
{ |
| 1895 |
FlushParam.ui8InterfaceDescriptorOffset = m_mediaWalkerParams.InterfaceDescriptorOffset; |
| 1896 |
} |
| 1897 |
else |
| 1898 |
{ |
| 1899 |
RENDER_PACKET_ASSERTMESSAGE("ERROR, pWalkerParams is nullptr and cannot get InterfaceDescriptorOffset."); |
| 1900 |
} |
| 1901 |
|
| 1902 |
RENDER_PACKET_CHK_STATUS_RETURN(m_renderHal->pRenderHalPltInterface->AddMediaStateFlush(m_renderHal, commandBuffer, &FlushParam)); |
| 1903 |
} |
| 1904 |
else if (MEDIA_IS_WA(m_renderHal->pWaTable, WaAddMediaStateFlushCmd)) |
| 1905 |
{ |
| 1906 |
RENDER_PACKET_CHK_STATUS_RETURN(m_renderHal->pRenderHalPltInterface->AddMediaStateFlush(m_renderHal, commandBuffer, &FlushParam)); |
| 1907 |
} |
| 1908 |
|
| 1909 |
#if (_DEBUG || _RELEASE_INTERNAL) |
| 1910 |
RENDER_PACKET_CHK_STATUS_RETURN(StallBatchBuffer(commandBuffer)); |
| 1911 |
#endif |
| 1912 |
|
| 1913 |
HalOcaInterfaceNext::On1stLevelBBEnd(*commandBuffer, *pOsInterface); |
| 1914 |
|
| 1915 |
if (pBatchBuffer) |
| 1916 |
{ |
| 1917 |
// Send Batch Buffer end command (HW/OS dependent) |
| 1918 |
RENDER_PACKET_CHK_STATUS_RETURN(m_renderHal->pRenderHalPltInterface->AddMiBatchBufferEnd(m_renderHal, commandBuffer, nullptr)); |
| 1919 |
} |
| 1920 |
else if (IsMiBBEndNeeded(pOsInterface)) |
| 1921 |
{ |
| 1922 |
// Send Batch Buffer end command for 1st level Batch Buffer |
| 1923 |
RENDER_PACKET_CHK_STATUS_RETURN(m_renderHal->pRenderHalPltInterface->AddMiBatchBufferEnd(m_renderHal, commandBuffer, nullptr)); |
| 1924 |
} |
| 1925 |
else if (m_renderHal->pOsInterface->bNoParsingAssistanceInKmd) |
| 1926 |
{ |
| 1927 |
RENDER_PACKET_CHK_STATUS_RETURN(m_renderHal->pRenderHalPltInterface->AddMiBatchBufferEnd(m_renderHal, commandBuffer, nullptr)); |
| 1928 |
} |
| 1929 |
|
| 1930 |
MOS_NULL_RENDERING_FLAGS NullRenderingFlags; |
| 1931 |
|
| 1932 |
NullRenderingFlags = |
| 1933 |
pOsInterface->pfnGetNullHWRenderFlags(pOsInterface); |
| 1934 |
|
| 1935 |
if ((NullRenderingFlags.VPLgca || |
| 1936 |
NullRenderingFlags.VPGobal) == false) |
| 1937 |
{ |
| 1938 |
dwSyncTag = m_renderHal->pStateHeap->dwNextTag++; |
| 1939 |
|
| 1940 |
// Set media state and batch buffer as busy |
| 1941 |
m_renderHal->pStateHeap->pCurMediaState->bBusy = true; |
| 1942 |
if (pBatchBuffer) |
| 1943 |
{ |
| 1944 |
pBatchBuffer->bBusy = true; |
| 1945 |
pBatchBuffer->dwSyncTag = dwSyncTag; |
| 1946 |
} |
| 1947 |
} |
| 1948 |
|
| 1949 |
return MOS_STATUS_SUCCESS; |
| 1950 |
} |
| 1951 |
|
| 1952 |
MOS_STATUS VpRenderCmdPacket::DumpOutput() |
| 1953 |
{ |
| 1954 |
VP_FUNC_CALL(); |
| 1955 |
|
| 1956 |
return MOS_STATUS_SUCCESS; |
| 1957 |
} |
| 1958 |
|
| 1959 |
void VpRenderCmdPacket::PrintWalkerParas(MHW_GPGPU_WALKER_PARAMS& WalkerParams) |
| 1960 |
{ |
| 1961 |
#if (_DEBUG || _RELEASE_INTERNAL) |
| 1962 |
std::string inlineData = ""; |
| 1963 |
if (WalkerParams.inlineDataLength > 0 && WalkerParams.inlineData != nullptr) |
| 1964 |
{ |
| 1965 |
for (uint32_t i = 0; i < WalkerParams.inlineDataLength; ++i) |
| 1966 |
{ |
| 1967 |
uint8_t iData = WalkerParams.inlineData[i]; |
| 1968 |
std::stringstream hex; |
| 1969 |
hex << "0x" << std::hex << std::setfill('0') << std::setw(2) << static_cast<int>(iData) << " "; |
| 1970 |
inlineData += hex.str(); |
| 1971 |
} |
| 1972 |
} |
| 1973 |
VP_RENDER_VERBOSEMESSAGE("GpGPU WalkerParams: InterfaceDescriptorOffset = %x, GpGpuEnable = %d, IndirectDataLength = %d, IndirectDataStartAddress = %x, BindingTableID %d, ForcePreferredSLMZero %d", |
| 1974 |
WalkerParams.InterfaceDescriptorOffset, |
| 1975 |
WalkerParams.GpGpuEnable, |
| 1976 |
WalkerParams.IndirectDataLength, |
| 1977 |
WalkerParams.IndirectDataStartAddress, |
| 1978 |
WalkerParams.BindingTableID, |
| 1979 |
WalkerParams.ForcePreferredSLMZero); |
| 1980 |
VP_RENDER_VERBOSEMESSAGE("GpGPU WalkerParams: ThreadWidth = %d, ThreadHeight = %d, ThreadDepth = %d, GroupWidth = %d, GroupHeight = %d, GroupDepth = %d, GroupStartingX = %d, GroupStartingY = %d, GroupStartingZ = %d, SLMSize %d", |
| 1981 |
WalkerParams.ThreadWidth, |
| 1982 |
WalkerParams.ThreadHeight, |
| 1983 |
WalkerParams.ThreadDepth, |
| 1984 |
WalkerParams.GroupWidth, |
| 1985 |
WalkerParams.GroupHeight, |
| 1986 |
WalkerParams.GroupDepth, |
| 1987 |
WalkerParams.GroupStartingX, |
| 1988 |
WalkerParams.GroupStartingY, |
| 1989 |
WalkerParams.GroupStartingZ, |
| 1990 |
WalkerParams.SLMSize); |
| 1991 |
VP_RENDER_VERBOSEMESSAGE("GpGPU WalkerParams: GenerateLocalId %d, EmitLocal %d, EmitInlineParameter %d, HasBarrier %d, SIMD size %d, RegistersPerThread %d", |
| 1992 |
WalkerParams.isGenerateLocalID, |
| 1993 |
WalkerParams.emitLocal, |
| 1994 |
WalkerParams.isEmitInlineParameter, |
| 1995 |
WalkerParams.hasBarrier, |
| 1996 |
WalkerParams.simdSize, |
| 1997 |
WalkerParams.registersPerThread); |
| 1998 |
VP_RENDER_VERBOSEMESSAGE("GpGPU WalkerParams: InlineDataLength = %d, InlineData = %s", |
| 1999 |
WalkerParams.inlineDataLength, |
| 2000 |
inlineData.c_str()); |
| 2001 |
#endif |
| 2002 |
} |
| 2003 |
|
| 2004 |
void VpRenderCmdPacket::PrintWalkerParas(MHW_WALKER_PARAMS &WalkerParams) |
| 2005 |
{ |
| 2006 |
#if (_DEBUG || _RELEASE_INTERNAL) |
| 2007 |
VP_RENDER_VERBOSEMESSAGE("WalkerParams: InterfaceDescriptorOffset = %x, CmWalkerEnable = %x, ColorCountMinusOne = %x, UseScoreboard = %x, ScoreboardMask = %x, MidLoopUnitX = %x, MidLoopUnitY = %x, MiddleLoopExtraSteps = %x", |
| 2008 |
WalkerParams.InterfaceDescriptorOffset, |
| 2009 |
WalkerParams.CmWalkerEnable, |
| 2010 |
WalkerParams.ColorCountMinusOne, |
| 2011 |
WalkerParams.UseScoreboard, |
| 2012 |
WalkerParams.ScoreboardMask, |
| 2013 |
WalkerParams.MidLoopUnitX, |
| 2014 |
WalkerParams.MidLoopUnitY, |
| 2015 |
WalkerParams.MiddleLoopExtraSteps); |
| 2016 |
VP_RENDER_VERBOSEMESSAGE("WalkerParams: GroupIdLoopSelect = %x, InlineDataLength = %x, pInlineData = %x, dwLocalLoopExecCount = %x, dwGlobalLoopExecCount = %x, WalkerMode = %x, BlockResolution = %x, LocalStart = %x", |
| 2017 |
WalkerParams.GroupIdLoopSelect, |
| 2018 |
WalkerParams.InlineDataLength, |
| 2019 |
WalkerParams.pInlineData, |
| 2020 |
WalkerParams.dwLocalLoopExecCount, |
| 2021 |
WalkerParams.dwGlobalLoopExecCount, |
| 2022 |
WalkerParams.WalkerMode, |
| 2023 |
WalkerParams.BlockResolution, |
| 2024 |
WalkerParams.LocalStart); |
| 2025 |
VP_RENDER_VERBOSEMESSAGE("WalkerParams: LocalEnd = %x, LocalOutLoopStride = %x, LocalInnerLoopUnit = %x, GlobalResolution = %x, GlobalStart = %x, GlobalOutlerLoopStride = %x, GlobalInnerLoopUnit = %x, bAddMediaFlush = %x, bRequestSingleSlice = %x, IndirectDataLength = %x, IndirectDataStartAddress = %x", |
| 2026 |
WalkerParams.LocalEnd, |
| 2027 |
WalkerParams.LocalOutLoopStride, |
| 2028 |
WalkerParams.LocalInnerLoopUnit, |
| 2029 |
WalkerParams.GlobalResolution, |
| 2030 |
WalkerParams.GlobalStart, |
| 2031 |
WalkerParams.GlobalOutlerLoopStride, |
| 2032 |
WalkerParams.GlobalInnerLoopUnit, |
| 2033 |
WalkerParams.bAddMediaFlush, |
| 2034 |
WalkerParams.bRequestSingleSlice, |
| 2035 |
WalkerParams.IndirectDataLength, |
| 2036 |
WalkerParams.IndirectDataStartAddress); |
| 2037 |
#endif |
| 2038 |
} |
| 2039 |
|
| 2040 |
MOS_STATUS VpRenderCmdPacket::SendMediaStates( |
| 2041 |
PRENDERHAL_INTERFACE pRenderHal, |
| 2042 |
PMOS_COMMAND_BUFFER pCmdBuffer) |
| 2043 |
{ |
| 2044 |
VP_FUNC_CALL(); |
| 2045 |
PMOS_INTERFACE pOsInterface = nullptr; |
| 2046 |
PRENDERHAL_STATE_HEAP pStateHeap = nullptr; |
| 2047 |
MOS_STATUS eStatus = MOS_STATUS_SUCCESS; |
| 2048 |
MHW_VFE_PARAMS * pVfeStateParams = nullptr; |
| 2049 |
MOS_CONTEXT * pOsContext = nullptr; |
| 2050 |
MHW_MI_LOAD_REGISTER_IMM_PARAMS loadRegisterImmParams = {}; |
| 2051 |
PMHW_MI_MMIOREGISTERS pMmioRegisters = nullptr; |
| 2052 |
MOS_OCA_BUFFER_HANDLE hOcaBuf = 0; |
| 2053 |
bool flushL1 = false; |
| 2054 |
//--------------------------------------- |
| 2055 |
MHW_RENDERHAL_CHK_NULL(pRenderHal); |
| 2056 |
MHW_RENDERHAL_CHK_NULL(pRenderHal->pStateHeap); |
| 2057 |
MHW_RENDERHAL_CHK_NULL(pRenderHal->pRenderHalPltInterface); |
| 2058 |
MHW_RENDERHAL_ASSERT(pRenderHal->pStateHeap->bGshLocked); |
| 2059 |
RENDER_PACKET_CHK_NULL_RETURN(pRenderHal->pRenderHalPltInterface); |
| 2060 |
RENDER_PACKET_CHK_NULL_RETURN(pRenderHal->pRenderHalPltInterface->GetMmioRegisters(pRenderHal)); |
| 2061 |
|
| 2062 |
//--------------------------------------- |
| 2063 |
pOsInterface = pRenderHal->pOsInterface; |
| 2064 |
pStateHeap = pRenderHal->pStateHeap; |
| 2065 |
pOsContext = pOsInterface->pOsContext; |
| 2066 |
pMmioRegisters = pRenderHal->pRenderHalPltInterface->GetMmioRegisters(pRenderHal); |
| 2067 |
|
| 2068 |
// Setup L3$ Config, LRI commands used here & hence must be launched from a secure bb |
| 2069 |
pRenderHal->L3CacheSettings.bEnableSLM = (m_walkerType == WALKER_TYPE_COMPUTE && m_slmSize > 0) ? true : false; |
| 2070 |
MHW_RENDERHAL_CHK_STATUS(pRenderHal->pfnEnableL3Caching(pRenderHal, &pRenderHal->L3CacheSettings)); |
| 2071 |
|
| 2072 |
// Send L3 Cache Configuration |
| 2073 |
MHW_RENDERHAL_CHK_STATUS(pRenderHal->pRenderHalPltInterface->SetL3Cache(pRenderHal, pCmdBuffer)); |
| 2074 |
|
| 2075 |
MHW_RENDERHAL_CHK_STATUS(pRenderHal->pRenderHalPltInterface->EnablePreemption(pRenderHal, pCmdBuffer)); |
| 2076 |
|
| 2077 |
// Send Pipeline Select command |
| 2078 |
MHW_RENDERHAL_CHK_STATUS(pRenderHal->pRenderHalPltInterface->AddPipelineSelectCmd(pRenderHal, pCmdBuffer, (m_walkerType == WALKER_TYPE_COMPUTE) ? true : false)); |
| 2079 |
|
| 2080 |
// The binding table for surface states is at end of command buffer. No need to add it to indirect state heap. |
| 2081 |
HalOcaInterfaceNext::OnIndirectState(*pCmdBuffer, (MOS_CONTEXT_HANDLE)pOsContext, pRenderHal->StateBaseAddressParams.presInstructionBuffer, pStateHeap->CurIDEntryParams.dwKernelOffset, false, pStateHeap->iKernelUsedForDump); |
| 2082 |
|
| 2083 |
// Send State Base Address command |
| 2084 |
MHW_RENDERHAL_CHK_STATUS(pRenderHal->pfnSendStateBaseAddress(pRenderHal, pCmdBuffer)); |
| 2085 |
|
| 2086 |
if (pRenderHal->bComputeContextInUse) |
| 2087 |
{ |
| 2088 |
if (!pRenderHal->isBindlessHeapInUse) |
| 2089 |
{ |
| 2090 |
pRenderHal->pRenderHalPltInterface->SendTo3DStateBindingTablePoolAlloc(pRenderHal, pCmdBuffer); |
| 2091 |
} |
| 2092 |
else |
| 2093 |
{ |
| 2094 |
pRenderHal->pRenderHalPltInterface->SendStateComputeMode(pRenderHal, pCmdBuffer); |
| 2095 |
} |
| 2096 |
} |
| 2097 |
|
| 2098 |
// Send Surface States |
| 2099 |
MHW_RENDERHAL_CHK_STATUS(pRenderHal->pfnSendSurfaces(pRenderHal, pCmdBuffer)); |
| 2100 |
|
| 2101 |
// Send SIP State if ASM debug enabled |
| 2102 |
if (pRenderHal->bIsaAsmDebugEnable) |
| 2103 |
{ |
| 2104 |
MHW_RENDERHAL_CHK_STATUS(pRenderHal->pRenderHalPltInterface->AddSipStateCmd(pRenderHal, pCmdBuffer)); |
| 2105 |
} |
| 2106 |
|
| 2107 |
pVfeStateParams = pRenderHal->pRenderHalPltInterface->GetVfeStateParameters(); |
| 2108 |
if (!pRenderHal->bComputeContextInUse) |
| 2109 |
{ |
| 2110 |
// set VFE State |
| 2111 |
MHW_RENDERHAL_CHK_STATUS(pRenderHal->pRenderHalPltInterface->AddMediaVfeCmd(pRenderHal, pCmdBuffer, pVfeStateParams)); |
| 2112 |
} |
| 2113 |
else |
| 2114 |
{ |
| 2115 |
if (!pRenderHal->isBindlessHeapInUse) |
| 2116 |
{ |
| 2117 |
// set CFE State |
| 2118 |
MHW_RENDERHAL_CHK_STATUS(pRenderHal->pRenderHalPltInterface->AddCfeStateCmd(pRenderHal, pCmdBuffer, pVfeStateParams)); |
| 2119 |
} |
| 2120 |
} |
| 2121 |
|
| 2122 |
// Send CURBE Load |
| 2123 |
if (!pRenderHal->bComputeContextInUse) |
| 2124 |
{ |
| 2125 |
MHW_RENDERHAL_CHK_STATUS(pRenderHal->pfnSendCurbeLoad(pRenderHal, pCmdBuffer)); |
| 2126 |
} |
| 2127 |
|
| 2128 |
// Send Interface Descriptor Load |
| 2129 |
if (!pRenderHal->bComputeContextInUse) |
| 2130 |
{ |
| 2131 |
MHW_RENDERHAL_CHK_STATUS(pRenderHal->pfnSendMediaIdLoad(pRenderHal, pCmdBuffer)); |
| 2132 |
} |
| 2133 |
|
| 2134 |
// Send Chroma Keys |
| 2135 |
MHW_RENDERHAL_CHK_STATUS(pRenderHal->pfnSendChromaKey(pRenderHal, pCmdBuffer)); |
| 2136 |
|
| 2137 |
// Send Palettes in use |
| 2138 |
MHW_RENDERHAL_CHK_STATUS(pRenderHal->pfnSendPalette(pRenderHal, pCmdBuffer)); |
| 2139 |
|
| 2140 |
pRenderHal->pRenderHalPltInterface->OnDispatch(pRenderHal, pCmdBuffer, pOsInterface, pMmioRegisters); |
| 2141 |
|
| 2142 |
for (uint32_t kernelIndex = 0; kernelIndex < m_kernelRenderData.size(); kernelIndex++) |
| 2143 |
{ |
| 2144 |
auto it = m_kernelRenderData.find(kernelIndex); |
| 2145 |
if (it == m_kernelRenderData.end()) |
| 2146 |
{ |
| 2147 |
eStatus = MOS_STATUS_INVALID_PARAMETER; |
| 2148 |
goto finish; |
| 2149 |
} |
| 2150 |
|
| 2151 |
if (kernelIndex > 0 && it->second.walkerParam.bSyncFlag) |
| 2152 |
{ |
| 2153 |
MHW_PIPE_CONTROL_PARAMS pipeCtlParams = g_cRenderHal_InitPipeControlParams; |
| 2154 |
pipeCtlParams.dwPostSyncOp = MHW_FLUSH_NOWRITE; |
| 2155 |
pipeCtlParams.dwFlushMode = MHW_FLUSH_CUSTOM; |
| 2156 |
pipeCtlParams.bInvalidateTextureCache = true; |
| 2157 |
pipeCtlParams.bFlushRenderTargetCache = true; |
| 2158 |
|
| 2159 |
if (it->second.walkerParam.pipeControlParams.bUpdateNeeded) |
| 2160 |
{ |
| 2161 |
pipeCtlParams.bHdcPipelineFlush = it->second.walkerParam.pipeControlParams.bEnableDataPortFlush; |
| 2162 |
pipeCtlParams.bUnTypedDataPortCacheFlush = it->second.walkerParam.pipeControlParams.bUnTypedDataPortCacheFlush; |
| 2163 |
pipeCtlParams.bFlushRenderTargetCache = it->second.walkerParam.pipeControlParams.bFlushRenderTargetCache; |
| 2164 |
pipeCtlParams.bInvalidateTextureCache = it->second.walkerParam.pipeControlParams.bInvalidateTextureCache; |
| 2165 |
} |
| 2166 |
|
| 2167 |
if (flushL1) |
| 2168 |
{ //Flush L1 cache after consumer walker when there is a producer-consumer relationship walker. |
| 2169 |
pipeCtlParams.bUnTypedDataPortCacheFlush = true; |
| 2170 |
pipeCtlParams.bHdcPipelineFlush = true; |
| 2171 |
} |
| 2172 |
MHW_RENDERHAL_CHK_STATUS(pRenderHal->pRenderHalPltInterface->AddMiPipeControl(pRenderHal, |
| 2173 |
pCmdBuffer, |
| 2174 |
&pipeCtlParams)); |
| 2175 |
} |
| 2176 |
|
| 2177 |
if (m_walkerType == WALKER_TYPE_MEDIA) |
| 2178 |
{ |
| 2179 |
MOS_ZeroMemory(&m_mediaWalkerParams, sizeof(m_mediaWalkerParams)); |
| 2180 |
|
| 2181 |
MHW_RENDERHAL_CHK_STATUS(PrepareMediaWalkerParams(it->second.walkerParam, m_mediaWalkerParams)); |
| 2182 |
|
| 2183 |
MHW_RENDERHAL_CHK_STATUS(pRenderHal->pRenderHalPltInterface->AddMediaObjectWalkerCmd(pRenderHal, |
| 2184 |
pCmdBuffer, |
| 2185 |
&m_mediaWalkerParams)); |
| 2186 |
|
| 2187 |
PrintWalkerParas(m_mediaWalkerParams); |
| 2188 |
} |
| 2189 |
else if (m_walkerType == WALKER_TYPE_COMPUTE) |
| 2190 |
{ |
| 2191 |
MOS_ZeroMemory(&m_gpgpuWalkerParams, sizeof(m_gpgpuWalkerParams)); |
| 2192 |
|
| 2193 |
MHW_RENDERHAL_CHK_STATUS(PrepareComputeWalkerParams(it->second.walkerParam, m_gpgpuWalkerParams)); |
| 2194 |
|
| 2195 |
if (m_submissionMode == MULTI_KERNELS_SINGLE_MEDIA_STATE) |
| 2196 |
{ |
| 2197 |
pRenderHal->iKernelAllocationID = it->second.kernelAllocationID; |
| 2198 |
} |
| 2199 |
|
| 2200 |
MHW_RENDERHAL_CHK_STATUS(pRenderHal->pRenderHalPltInterface->SendComputeWalker( |
| 2201 |
pRenderHal, |
| 2202 |
pCmdBuffer, |
| 2203 |
&m_gpgpuWalkerParams)); |
| 2204 |
|
| 2205 |
flushL1 = it->second.walkerParam.bFlushL1; |
| 2206 |
PrintWalkerParas(m_gpgpuWalkerParams); |
| 2207 |
} |
| 2208 |
else |
| 2209 |
{ |
| 2210 |
eStatus = MOS_STATUS_UNIMPLEMENTED; |
| 2211 |
goto finish; |
| 2212 |
} |
| 2213 |
} |
| 2214 |
|
| 2215 |
// This need not be secure, since PPGTT will be used here. But moving this after |
| 2216 |
// L3 cache configuration will delay UMD from fetching another media state. |
| 2217 |
// Send Sync Tag |
| 2218 |
MHW_RENDERHAL_CHK_STATUS(pRenderHal->pfnSendSyncTag(pRenderHal, pCmdBuffer)); |
| 2219 |
|
| 2220 |
m_kernelRenderData.clear(); |
| 2221 |
|
| 2222 |
finish: |
| 2223 |
return eStatus; |
| 2224 |
} |
| 2225 |
|
| 2226 |
MOS_STATUS VpRenderCmdPacket::SetFcParams(PRENDER_FC_PARAMS params) |
| 2227 |
{ |
| 2228 |
VP_FUNC_CALL(); |
| 2229 |
VP_RENDER_CHK_NULL_RETURN(params); |
| 2230 |
|
| 2231 |
m_kernelConfigs.emplace(params->kernelId, (void *)params); |
| 2232 |
|
| 2233 |
KERNEL_PARAMS kernelParams = {}; |
| 2234 |
kernelParams.kernelId = params->kernelId; |
| 2235 |
m_renderKernelParams.push_back(kernelParams); |
| 2236 |
m_isMultiBindingTables = false; |
| 2237 |
m_submissionMode = SINGLE_KERNEL_ONLY; |
| 2238 |
#if(_DEBUG || _RELEASE_INTERNAL) |
| 2239 |
m_report->GetFeatures().isLegacyFCInUse = true; |
| 2240 |
#endif |
| 2241 |
return MOS_STATUS_SUCCESS; |
| 2242 |
} |
| 2243 |
|
| 2244 |
MOS_STATUS VpRenderCmdPacket::SetOclFcParams(PRENDER_OCL_FC_PARAMS params) |
| 2245 |
{ |
| 2246 |
VP_FUNC_CALL(); |
| 2247 |
VP_RENDER_CHK_NULL_RETURN(params); |
| 2248 |
|
| 2249 |
KERNEL_PARAMS kernelParam = {}; |
| 2250 |
for (auto &krnParams : params->fc_kernelParams) |
| 2251 |
{ |
| 2252 |
kernelParam.kernelId = krnParams.kernelId; |
| 2253 |
kernelParam.kernelArgs = krnParams.kernelArgs; |
| 2254 |
kernelParam.kernelThreadSpace.uWidth = krnParams.threadWidth; |
| 2255 |
kernelParam.kernelThreadSpace.uHeight = krnParams.threadHeight; |
| 2256 |
kernelParam.kernelThreadSpace.uLocalWidth = krnParams.localWidth; |
| 2257 |
kernelParam.kernelThreadSpace.uLocalHeight = krnParams.localHeight; |
| 2258 |
kernelParam.syncFlag = true; |
| 2259 |
kernelParam.kernelStatefulSurfaces = krnParams.kernelStatefulSurfaces; |
| 2260 |
|
| 2261 |
m_renderKernelParams.push_back(kernelParam); |
| 2262 |
|
| 2263 |
m_kernelConfigs.emplace(krnParams.kernelId, (void *)(&krnParams.kernelConfig)); |
| 2264 |
} |
| 2265 |
|
| 2266 |
m_submissionMode = MULTI_KERNELS_SINGLE_MEDIA_STATE; |
| 2267 |
m_isMultiBindingTables = true; |
| 2268 |
m_isLargeSurfaceStateNeeded = true; |
| 2269 |
return MOS_STATUS_SUCCESS; |
| 2270 |
} |
| 2271 |
|
| 2272 |
MOS_STATUS VpRenderCmdPacket::SetAiParams(PRENDER_AI_PARAMS params) |
| 2273 |
{ |
| 2274 |
VP_FUNC_CALL(); |
| 2275 |
VP_RENDER_CHK_NULL_RETURN(params); |
| 2276 |
|
| 2277 |
KERNEL_PARAMS kernelParam = {}; |
| 2278 |
for (auto &krnParams : params->ai_kernelParams) |
| 2279 |
{ |
| 2280 |
kernelParam.kernelId = VpKernelID(kernelAiCommon); |
| 2281 |
kernelParam.kernelArgs = krnParams.kernelArgs; |
| 2282 |
kernelParam.kernelThreadSpace.uWidth = krnParams.threadWidth; |
| 2283 |
kernelParam.kernelThreadSpace.uHeight = krnParams.threadHeight; |
| 2284 |
kernelParam.kernelThreadSpace.uDepth = krnParams.threadDepth; |
| 2285 |
kernelParam.kernelThreadSpace.uLocalWidth = krnParams.localWidth; |
| 2286 |
kernelParam.kernelThreadSpace.uLocalHeight = krnParams.localHeight; |
| 2287 |
kernelParam.syncFlag = true; |
| 2288 |
kernelParam.kernelStatefulSurfaces = krnParams.kernelStatefulSurfaces; |
| 2289 |
kernelParam.kernelName = krnParams.kernelName; |
| 2290 |
|
| 2291 |
m_renderKernelParams.push_back(kernelParam); |
| 2292 |
} |
| 2293 |
|
| 2294 |
m_kernelConfigs.insert(std::make_pair(VpKernelID(kernelAiCommon), (void *)(¶ms->ai_kernelConfig))); |
| 2295 |
m_submissionMode = MULTI_KERNELS_SINGLE_MEDIA_STATE; |
| 2296 |
m_isMultiBindingTables = true; |
| 2297 |
m_isLargeSurfaceStateNeeded = true; |
| 2298 |
return MOS_STATUS_SUCCESS; |
| 2299 |
} |
| 2300 |
|
| 2301 |
MOS_STATUS VpRenderCmdPacket::SetHdrLiteParams(PRENDER_HDRLITE_PARAMS params) |
| 2302 |
{ |
| 2303 |
VP_FUNC_CALL(); |
| 2304 |
VP_RENDER_CHK_NULL_RETURN(params); |
| 2305 |
|
| 2306 |
KERNEL_PARAMS kernelParam = {}; |
| 2307 |
for (RENDER_HDRLITE_KERNEL_PARAM &krnParams : params->kernelParams) |
| 2308 |
{ |
| 2309 |
kernelParam.kernelId = krnParams.kernelID; |
| 2310 |
kernelParam.kernelArgs = krnParams.kernelArgs; |
| 2311 |
kernelParam.kernelThreadSpace.uWidth = krnParams.threadWidth; |
| 2312 |
kernelParam.kernelThreadSpace.uHeight = krnParams.threadHeight; |
| 2313 |
kernelParam.kernelThreadSpace.uDepth = krnParams.threadDepth; |
| 2314 |
kernelParam.kernelThreadSpace.uLocalWidth = krnParams.localWidth; |
| 2315 |
kernelParam.kernelThreadSpace.uLocalHeight = krnParams.localHeight; |
| 2316 |
kernelParam.syncFlag = true; |
| 2317 |
kernelParam.kernelStatefulSurfaces = krnParams.kernelStatefulSurfaces; |
| 2318 |
|
| 2319 |
m_renderKernelParams.push_back(kernelParam); |
| 2320 |
} |
| 2321 |
|
| 2322 |
m_submissionMode = MULTI_KERNELS_SINGLE_MEDIA_STATE; |
| 2323 |
m_isMultiBindingTables = true; |
| 2324 |
m_isLargeSurfaceStateNeeded = true; |
| 2325 |
return MOS_STATUS_SUCCESS; |
| 2326 |
} |
| 2327 |
|
| 2328 |
MOS_STATUS VpRenderCmdPacket::SetHdr3DLutParams( |
| 2329 |
PRENDER_HDR_3DLUT_CAL_PARAMS params) |
| 2330 |
{ |
| 2331 |
VP_FUNC_CALL(); |
| 2332 |
VP_RENDER_CHK_NULL_RETURN(params); |
| 2333 |
|
| 2334 |
m_kernelConfigs.emplace(params->kernelId, (void *)params); |
| 2335 |
|
| 2336 |
KERNEL_PARAMS kernelParams = {}; |
| 2337 |
kernelParams.kernelId = params->kernelId; |
| 2338 |
// kernelArgs will be initialized in VpRenderHdr3DLutKernel::Init with |
| 2339 |
// kernel.GetKernelArgs(). |
| 2340 |
kernelParams.kernelThreadSpace.uWidth = params->threadWidth; |
| 2341 |
kernelParams.kernelThreadSpace.uHeight = params->threadHeight; |
| 2342 |
kernelParams.kernelThreadSpace.uLocalWidth = params->localWidth; |
| 2343 |
kernelParams.kernelThreadSpace.uLocalHeight = params->localHeight; |
| 2344 |
kernelParams.kernelArgs = params->kernelArgs; |
| 2345 |
kernelParams.syncFlag = true; |
| 2346 |
m_renderKernelParams.push_back(kernelParams); |
| 2347 |
|
| 2348 |
return MOS_STATUS_SUCCESS; |
| 2349 |
} |
| 2350 |
|
| 2351 |
MHW_SETPAR_DECL_SRC(PIPE_CONTROL, VpRenderCmdPacket) |
| 2352 |
{ |
| 2353 |
MOS_ZeroMemory(¶ms, sizeof(params)); |
| 2354 |
params.dwFlushMode = MHW_FLUSH_WRITE_CACHE; |
| 2355 |
params.bGenericMediaStateClear = true; |
| 2356 |
params.bIndirectStatePointersDisable = true; |
| 2357 |
params.bDisableCSStall = false; |
| 2358 |
|
| 2359 |
RENDER_PACKET_CHK_NULL_RETURN(m_osInterface); |
| 2360 |
RENDER_PACKET_CHK_NULL_RETURN(m_osInterface->pfnGetSkuTable); |
| 2361 |
auto *skuTable = m_osInterface->pfnGetSkuTable(m_osInterface); |
| 2362 |
if (skuTable && MEDIA_IS_SKU(skuTable, FtrEnablePPCFlush)) |
| 2363 |
{ |
| 2364 |
// Add PPC fulsh |
| 2365 |
params.bPPCFlush = true; |
| 2366 |
} |
| 2367 |
|
| 2368 |
return MOS_STATUS_SUCCESS; |
| 2369 |
} |
| 2370 |
|
| 2371 |
MOS_STATUS VpRenderCmdPacket::SetDnHVSParams( |
| 2372 |
PRENDER_DN_HVS_CAL_PARAMS params) |
| 2373 |
{ |
| 2374 |
VP_FUNC_CALL(); |
| 2375 |
VP_RENDER_CHK_NULL_RETURN(params); |
| 2376 |
|
| 2377 |
m_kernelConfigs.emplace(params->kernelId, (void *)params); |
| 2378 |
|
| 2379 |
KERNEL_PARAMS kernelParams = {}; |
| 2380 |
kernelParams.kernelId = params->kernelId; |
| 2381 |
// kernelArgs will be initialized in VpRenderHVSKernel::Init with |
| 2382 |
// kernel.GetKernelArgs(). |
| 2383 |
kernelParams.kernelThreadSpace.uWidth = params->threadWidth; |
| 2384 |
kernelParams.kernelThreadSpace.uHeight = params->threadHeight; |
| 2385 |
kernelParams.kernelArgs = params->kernelArgs; |
| 2386 |
kernelParams.syncFlag = true; |
| 2387 |
m_renderKernelParams.push_back(kernelParams); |
| 2388 |
|
| 2389 |
return MOS_STATUS_SUCCESS; |
| 2390 |
} |
| 2391 |
|
| 2392 |
MOS_STATUS VpRenderCmdPacket::SetHdrParams(PRENDER_HDR_PARAMS params) |
| 2393 |
{ |
| 2394 |
VP_FUNC_CALL(); |
| 2395 |
VP_RENDER_CHK_NULL_RETURN(params); |
| 2396 |
|
| 2397 |
KERNEL_PARAMS kernelParams = {}; |
| 2398 |
VP_SURFACE *surf = GetSurface(SurfaceTypeHdrInputLayer0); |
| 2399 |
PMHW_SAMPLER_STATE_PARAM pSamplerStateParams = nullptr; |
| 2400 |
uint32_t i = 0; |
| 2401 |
|
| 2402 |
params->coeffAllocated = m_surfSetting.coeffAllocated; |
| 2403 |
params->OETF1DLUTAllocated = m_surfSetting.OETF1DLUTAllocated; |
| 2404 |
params->Cri3DLUTAllocated = m_surfSetting.Cri3DLUTAllocated; |
| 2405 |
params->pHDRStageConfigTable = m_surfSetting.pHDRStageConfigTable; |
| 2406 |
|
| 2407 |
//MOS_SURFACE *surface = surf->osSurface; |
| 2408 |
params->dwSurfaceHeight = surf->rcSrc.bottom - surf->rcSrc.top; |
| 2409 |
params->dwSurfaceWidth = surf->rcSrc.right - surf->rcSrc.left; |
| 2410 |
|
| 2411 |
for (i = 0; i < 16; i++) |
| 2412 |
{ |
| 2413 |
MHW_SAMPLER_STATE_PARAM samplerStateParam = {}; |
| 2414 |
MOS_ZeroMemory(&samplerStateParam, sizeof(samplerStateParam)); |
| 2415 |
|
| 2416 |
pSamplerStateParams = &samplerStateParam; |
| 2417 |
|
| 2418 |
switch (i) |
| 2419 |
{ |
| 2420 |
case 13: |
| 2421 |
pSamplerStateParams->bInUse = true; |
| 2422 |
pSamplerStateParams->SamplerType = MHW_SAMPLER_TYPE_3D; |
| 2423 |
pSamplerStateParams->Unorm.SamplerFilterMode = MHW_SAMPLER_FILTER_NEAREST; |
| 2424 |
pSamplerStateParams->Unorm.AddressU = MHW_GFX3DSTATE_TEXCOORDMODE_CLAMP; |
| 2425 |
pSamplerStateParams->Unorm.AddressV = MHW_GFX3DSTATE_TEXCOORDMODE_CLAMP; |
| 2426 |
pSamplerStateParams->Unorm.AddressW = MHW_GFX3DSTATE_TEXCOORDMODE_CLAMP; |
| 2427 |
break; |
| 2428 |
case 14: |
| 2429 |
pSamplerStateParams->bInUse = true; |
| 2430 |
pSamplerStateParams->SamplerType = MHW_SAMPLER_TYPE_3D; |
| 2431 |
pSamplerStateParams->Unorm.SamplerFilterMode = MHW_SAMPLER_FILTER_BILINEAR; |
| 2432 |
pSamplerStateParams->Unorm.AddressU = MHW_GFX3DSTATE_TEXCOORDMODE_CLAMP; |
| 2433 |
pSamplerStateParams->Unorm.AddressV = MHW_GFX3DSTATE_TEXCOORDMODE_CLAMP; |
| 2434 |
pSamplerStateParams->Unorm.AddressW = MHW_GFX3DSTATE_TEXCOORDMODE_CLAMP; |
| 2435 |
break; |
| 2436 |
default: |
| 2437 |
break; |
| 2438 |
} |
| 2439 |
m_kernelSamplerStateGroup.emplace(i, samplerStateParam); |
| 2440 |
} |
| 2441 |
|
| 2442 |
m_kernelConfigs.emplace(params->kernelId, (void *)params); |
| 2443 |
|
| 2444 |
kernelParams.kernelId = params->kernelId; |
| 2445 |
kernelParams.kernelThreadSpace.uWidth = params->threadWidth; |
| 2446 |
kernelParams.kernelThreadSpace.uHeight = params->threadHeight; |
| 2447 |
kernelParams.syncFlag = true; |
| 2448 |
m_renderKernelParams.push_back(kernelParams); |
| 2449 |
|
| 2450 |
if (m_renderHal && !m_renderHal->isBindlessHeapInUse && |
| 2451 |
m_hwInterface && m_hwInterface->m_vpPlatformInterface && |
| 2452 |
m_hwInterface->m_vpPlatformInterface->GetKernelConfig() && |
| 2453 |
m_hwInterface->m_vpPlatformInterface->GetKernelConfig()->GetRenderEnlargeOverwriteParams().needOverwrite) |
| 2454 |
{ |
| 2455 |
m_submissionMode = SINGLE_KERNEL_ONLY; |
| 2456 |
m_isMultiBindingTables = false; |
| 2457 |
m_isLargeSurfaceStateNeeded = false; |
| 2458 |
} |
| 2459 |
|
| 2460 |
return MOS_STATUS_SUCCESS; |
| 2461 |
|
| 2462 |
} |
| 2463 |
|
| 2464 |
|
| 2465 |
} // namespace vp |