| 1 |
/* |
| 2 |
* Copyright (c) 2020-2022, Intel Corporation |
| 3 |
* |
| 4 |
* Permission is hereby granted, free of charge, to any person obtaining a |
| 5 |
* copy of this software and associated documentation files (the "Software"), |
| 6 |
* to deal in the Software without restriction, including without limitation |
| 7 |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 8 |
* and/or sell copies of the Software, and to permit persons to whom the |
| 9 |
* Software is furnished to do so, subject to the following conditions: |
| 10 |
* |
| 11 |
* The above copyright notice and this permission notice shall be included |
| 12 |
* in all copies or substantial portions of the Software. |
| 13 |
* |
| 14 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
| 15 |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 16 |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 17 |
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR |
| 18 |
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
| 19 |
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
| 20 |
* OTHER DEALINGS IN THE SOFTWARE. |
| 21 |
*/ |
| 22 |
#ifndef __VP_RENDER_KERNEL_OBJ_H__ |
| 23 |
#define __VP_RENDER_KERNEL_OBJ_H__ |
| 24 |
|
| 25 |
#include "vp_pipeline_common.h" |
| 26 |
#include "sw_filter.h" |
| 27 |
#include "media_render_cmd_packet.h" |
| 28 |
#include "vp_platform_interface.h" |
| 29 |
#include "vpkrnheader.h" |
| 30 |
#include <vector> |
| 31 |
#include <map> |
| 32 |
#include <set> |
| 33 |
|
| 34 |
class RenderCmdPacket; |
| 35 |
|
| 36 |
namespace vp { |
| 37 |
|
| 38 |
//! |
| 39 |
//! \brief Secure Block Copy kernel inline data size |
| 40 |
//! |
| 41 |
#define SECURE_BLOCK_COPY_KERNEL_INLINE_SIZE (1 * sizeof(uint32_t)) |
| 42 |
//! |
| 43 |
//! \brief Secure Block Copy kernel width |
| 44 |
//! |
| 45 |
#define SECURE_BLOCK_COPY_KERNEL_SURF_WIDTH 64 |
| 46 |
|
| 47 |
//! |
| 48 |
//! \brief Secure Block Copy kernel block height |
| 49 |
//! |
| 50 |
#define SECURE_BLOCK_COPY_KERNEL_BLOCK_HEIGHT 24 |
| 51 |
|
| 52 |
#define KERNEL_BINARY_PADDING_SIZE CM_KERNEL_BINARY_PADDING_SIZE |
| 53 |
|
| 54 |
typedef struct _KERNEL_SURFACE_STATE_PARAM |
| 55 |
{ |
| 56 |
struct { |
| 57 |
bool updatedSurfaceParams; // true if update format/width/height/pitch to renderSurface.OsSurface. |
| 58 |
MOS_FORMAT format; // MOS_FORMAT for processing surfaces |
| 59 |
uint32_t width; |
| 60 |
uint32_t height; |
| 61 |
uint32_t pitch; |
| 62 |
|
| 63 |
uint32_t surface_offset; // Offset to the origin of the surface, in bytes. |
| 64 |
MOS_TILE_TYPE tileType; |
| 65 |
bool bufferResource; |
| 66 |
bool bindedKernel; // true if bind index is hardcoded by bindIndex. |
| 67 |
bool updatedRenderSurfaces; // true if renderSurfaceParams be used. |
| 68 |
RENDERHAL_SURFACE_STATE_PARAMS renderSurfaceParams; // default can be skip. for future usages, if surface configed by kernel, use it directlly |
| 69 |
} surfaceOverwriteParams; |
| 70 |
|
| 71 |
bool isOutput; // true for render target |
| 72 |
PRENDERHAL_SURFACE_STATE_ENTRY *surfaceEntries; |
| 73 |
uint32_t *sizeOfSurfaceEntries; |
| 74 |
uint32_t iCapcityOfSurfaceEntry = 0; |
| 75 |
bool isBindlessSurface = false; |
| 76 |
} KERNEL_SURFACE_STATE_PARAM; |
| 77 |
|
| 78 |
typedef struct _KERNEL_TUNING_PARAMS |
| 79 |
{ |
| 80 |
uint32_t euThreadSchedulingMode; |
| 81 |
} KERNEL_TUNING_PARAMS, *PKERNEL_TUNING_PARAMS; |
| 82 |
|
| 83 |
using KERNEL_CONFIGS = std::map<VpKernelID, void *>; // Only for legacy/non-cm kernels |
| 84 |
using KERNEL_ARGS = std::vector<KRN_ARG>; |
| 85 |
using KERNEL_SAMPLER_STATE_GROUP = std::map<SamplerIndex, MHW_SAMPLER_STATE_PARAM>; |
| 86 |
using KERNEL_SAMPLER_STATES = std::vector<MHW_SAMPLER_STATE_PARAM>; |
| 87 |
using KERNEL_SAMPLER_INDEX = std::vector<SamplerIndex>; |
| 88 |
using KERNEL_SURFACE_CONFIG = std::map<SurfaceType, KERNEL_SURFACE_STATE_PARAM>; |
| 89 |
using KERNEL_SURFACE_BINDING_INDEX = std::map<SurfaceType, std::set<uint32_t>>; |
| 90 |
using KERNEL_BINDELESS_SURFACE = std::map<SurfaceType, std::vector<RENDERHAL_STATE_LOCATION>>; |
| 91 |
using KERNEL_BINDELESS_SAMPLER = std::map<uint32_t, RENDERHAL_STATE_LOCATION>; |
| 92 |
|
| 93 |
typedef struct _KERNEL_PARAMS |
| 94 |
{ |
| 95 |
VpKernelID kernelId; |
| 96 |
KERNEL_ARGS kernelArgs; |
| 97 |
KERNEL_THREAD_SPACE kernelThreadSpace; |
| 98 |
bool syncFlag; |
| 99 |
bool flushL1; |
| 100 |
KERNEL_TUNING_PARAMS kernelTuningParams; |
| 101 |
KERNEL_ARG_INDEX_SURFACE_MAP kernelStatefulSurfaces; |
| 102 |
std::string kernelName; |
| 103 |
} KERNEL_PARAMS; |
| 104 |
|
| 105 |
struct MEDIA_OBJECT_KA2_INLINE_DATA |
| 106 |
{ |
| 107 |
// DWORD 0 - GRF R7.0 |
| 108 |
union |
| 109 |
{ |
| 110 |
// All |
| 111 |
struct |
| 112 |
{ |
| 113 |
uint32_t DestinationBlockHorizontalOrigin : 16; |
| 114 |
uint32_t DestinationBlockVerticalOrigin : 16; |
| 115 |
}; |
| 116 |
|
| 117 |
// Secure Block Copy |
| 118 |
struct |
| 119 |
{ |
| 120 |
uint32_t BlockHeight : 16; |
| 121 |
uint32_t BufferOffset : 16; |
| 122 |
}; |
| 123 |
|
| 124 |
// FMD Summation |
| 125 |
struct |
| 126 |
{ |
| 127 |
uint32_t StartRowOffset; |
| 128 |
}; |
| 129 |
|
| 130 |
uint32_t Value; |
| 131 |
} DW00; |
| 132 |
|
| 133 |
// DWORD 1 - GRF R7.1 |
| 134 |
union |
| 135 |
{ |
| 136 |
// Composite |
| 137 |
struct |
| 138 |
{ |
| 139 |
uint32_t HorizontalBlockCompositeMaskLayer0 : 16; |
| 140 |
uint32_t VerticalBlockCompositeMaskLayer0 : 16; |
| 141 |
}; |
| 142 |
|
| 143 |
// FMD Summation |
| 144 |
struct |
| 145 |
{ |
| 146 |
uint32_t TotalRows; |
| 147 |
}; |
| 148 |
|
| 149 |
uint32_t Value; |
| 150 |
} DW01; |
| 151 |
|
| 152 |
// DWORD 2 - GRF R7.2 |
| 153 |
union |
| 154 |
{ |
| 155 |
// Composite |
| 156 |
struct |
| 157 |
{ |
| 158 |
uint32_t HorizontalBlockCompositeMaskLayer1 : 16; |
| 159 |
uint32_t VerticalBlockCompositeMaskLayer1 : 16; |
| 160 |
}; |
| 161 |
|
| 162 |
// FMD Summation |
| 163 |
struct |
| 164 |
{ |
| 165 |
uint32_t StartColumnOffset; |
| 166 |
}; |
| 167 |
|
| 168 |
uint32_t Value; |
| 169 |
} DW02; |
| 170 |
|
| 171 |
// DWORD 3 - GRF R7.3 |
| 172 |
union |
| 173 |
{ |
| 174 |
// Composite |
| 175 |
struct |
| 176 |
{ |
| 177 |
uint32_t HorizontalBlockCompositeMaskLayer2 : 16; |
| 178 |
uint32_t VerticalBlockCompositeMaskLayer2 : 16; |
| 179 |
}; |
| 180 |
|
| 181 |
// FMD Summation |
| 182 |
struct |
| 183 |
{ |
| 184 |
uint32_t TotalColumns; |
| 185 |
}; |
| 186 |
|
| 187 |
uint32_t Value; |
| 188 |
} DW03; |
| 189 |
|
| 190 |
// DWORD 4 - GRF R7.4 |
| 191 |
union |
| 192 |
{ |
| 193 |
// Sampler Load |
| 194 |
struct |
| 195 |
{ |
| 196 |
float VideoXScalingStep; |
| 197 |
}; |
| 198 |
|
| 199 |
uint32_t Value; |
| 200 |
} DW04; |
| 201 |
|
| 202 |
// DWORD 5 - GRF R7.5 |
| 203 |
union |
| 204 |
{ |
| 205 |
// NLAS |
| 206 |
struct |
| 207 |
{ |
| 208 |
float VideoStepDelta; |
| 209 |
}; |
| 210 |
|
| 211 |
uint32_t Value; |
| 212 |
} DW05; |
| 213 |
|
| 214 |
// DWORD 6 - GRF R7.6 |
| 215 |
union |
| 216 |
{ |
| 217 |
// AVScaling |
| 218 |
struct |
| 219 |
{ |
| 220 |
uint32_t VerticalBlockNumber : 17; |
| 221 |
uint32_t AreaOfInterest : 1; |
| 222 |
uint32_t : 14; |
| 223 |
}; |
| 224 |
|
| 225 |
uint32_t Value; |
| 226 |
} DW06; |
| 227 |
|
| 228 |
// DWORD 7 - GRF R7.7 |
| 229 |
union |
| 230 |
{ |
| 231 |
// AVScaling |
| 232 |
struct |
| 233 |
{ |
| 234 |
uint32_t GroupIDNumber; |
| 235 |
}; |
| 236 |
|
| 237 |
uint32_t Value; |
| 238 |
} DW07; |
| 239 |
|
| 240 |
// DWORD 8 - GRF R8.0 |
| 241 |
union |
| 242 |
{ |
| 243 |
// Composite |
| 244 |
struct |
| 245 |
{ |
| 246 |
uint32_t HorizontalBlockCompositeMaskLayer3 : 16; |
| 247 |
uint32_t VerticalBlockCompositeMaskLayer3 : 16; |
| 248 |
}; |
| 249 |
|
| 250 |
uint32_t Value; |
| 251 |
} DW08; |
| 252 |
|
| 253 |
// DWORD 9 - GRF R8.1 |
| 254 |
union |
| 255 |
{ |
| 256 |
// Composite |
| 257 |
struct |
| 258 |
{ |
| 259 |
uint32_t HorizontalBlockCompositeMaskLayer4 : 16; |
| 260 |
uint32_t VerticalBlockCompositeMaskLayer4 : 16; |
| 261 |
}; |
| 262 |
|
| 263 |
uint32_t Value; |
| 264 |
} DW09; |
| 265 |
|
| 266 |
// DWORD 10 - GRF R8.2 |
| 267 |
union |
| 268 |
{ |
| 269 |
// Composite |
| 270 |
struct |
| 271 |
{ |
| 272 |
uint32_t HorizontalBlockCompositeMaskLayer5 : 16; |
| 273 |
uint32_t VerticalBlockCompositeMaskLayer5 : 16; |
| 274 |
}; |
| 275 |
|
| 276 |
uint32_t Value; |
| 277 |
} DW10; |
| 278 |
|
| 279 |
// DWORD 11 - GRF R8.3 |
| 280 |
union |
| 281 |
{ |
| 282 |
// Composite |
| 283 |
struct |
| 284 |
{ |
| 285 |
uint32_t HorizontalBlockCompositeMaskLayer6 : 16; |
| 286 |
uint32_t VerticalBlockCompositeMaskLayer6 : 16; |
| 287 |
}; |
| 288 |
|
| 289 |
uint32_t Value; |
| 290 |
} DW11; |
| 291 |
|
| 292 |
// DWORD 12 - GRF R8.4 |
| 293 |
union |
| 294 |
{ |
| 295 |
// Composite |
| 296 |
struct |
| 297 |
{ |
| 298 |
uint32_t HorizontalBlockCompositeMaskLayer7 : 16; |
| 299 |
uint32_t VerticalBlockCompositeMaskLayer7 : 16; |
| 300 |
}; |
| 301 |
|
| 302 |
uint32_t Value; |
| 303 |
} DW12; |
| 304 |
|
| 305 |
// DWORD 13 - GRF R8.5 |
| 306 |
union |
| 307 |
{ |
| 308 |
struct |
| 309 |
{ |
| 310 |
uint32_t Reserved; |
| 311 |
}; |
| 312 |
|
| 313 |
uint32_t Value; |
| 314 |
} DW13; |
| 315 |
|
| 316 |
// DWORD 14 - GRF R8.6 |
| 317 |
union |
| 318 |
{ |
| 319 |
struct |
| 320 |
{ |
| 321 |
uint32_t Reserved; |
| 322 |
}; |
| 323 |
|
| 324 |
uint32_t Value; |
| 325 |
} DW14; |
| 326 |
|
| 327 |
// DWORD 15 - GRF R8.7 |
| 328 |
union |
| 329 |
{ |
| 330 |
struct |
| 331 |
{ |
| 332 |
uint32_t Reserved; |
| 333 |
}; |
| 334 |
|
| 335 |
uint32_t Value; |
| 336 |
} DW15; |
| 337 |
}; |
| 338 |
|
| 339 |
class VpRenderKernelObj |
| 340 |
{ |
| 341 |
public: |
| 342 |
VpRenderKernelObj(PVP_MHWINTERFACE hwInterface, PVpAllocator allocator); |
| 343 |
VpRenderKernelObj(PVP_MHWINTERFACE hwInterface, VpKernelID kernelID, uint32_t kernelIndex, std::string kernelName = "", PVpAllocator allocator = nullptr); |
| 344 |
virtual ~VpRenderKernelObj(); |
| 345 |
|
| 346 |
// For Adv kernel |
| 347 |
// Kernel Specific, which will inplenment be each kernel |
| 348 |
// GetCurbeState should be called after UpdateCurbeBindingIndex for all processed surfaces being called |
| 349 |
virtual MOS_STATUS Init(VpRenderKernel& kernel); |
| 350 |
|
| 351 |
MOS_STATUS GetCurbeState(void *&curbe, uint32_t &curbeLength, uint32_t &curbeLengthAligned, RENDERHAL_KERNEL_PARAM kernelParam, uint32_t dwBlockAlign) |
| 352 |
{ |
| 353 |
VP_PUBLIC_CHK_STATUS_RETURN(GetCurbeState(curbe, curbeLength)); |
| 354 |
VP_PUBLIC_CHK_STATUS_RETURN(GetAlignedLength(curbeLength, curbeLengthAligned, kernelParam, dwBlockAlign)); |
| 355 |
return MOS_STATUS_SUCCESS; |
| 356 |
} |
| 357 |
|
| 358 |
virtual uint32_t GetInlineDataSize() = 0; |
| 359 |
|
| 360 |
virtual uint32_t GetKernelIndex(); |
| 361 |
|
| 362 |
VpKernelID GetKernelId() |
| 363 |
{ |
| 364 |
return m_kernelId; |
| 365 |
} |
| 366 |
|
| 367 |
DelayLoadedKernelType GetKernelType() |
| 368 |
{ |
| 369 |
return m_kernelType; |
| 370 |
} |
| 371 |
|
| 372 |
virtual bool IsKernelCached() |
| 373 |
{ |
| 374 |
return false; |
| 375 |
} |
| 376 |
|
| 377 |
virtual Kdll_CacheEntry *GetCachedEntryForKernelLoad() |
| 378 |
{ |
| 379 |
return nullptr; |
| 380 |
} |
| 381 |
|
| 382 |
virtual MOS_STATUS GetWalkerSetting(KERNEL_WALKER_PARAMS& walkerParam, KERNEL_PACKET_RENDER_DATA &renderData); |
| 383 |
|
| 384 |
virtual MOS_STATUS SetKernelConfigs( |
| 385 |
KERNEL_PARAMS& kernelParams, |
| 386 |
VP_SURFACE_GROUP& surfaces, |
| 387 |
KERNEL_SAMPLER_STATE_GROUP& samplerStateGroup, |
| 388 |
KERNEL_CONFIGS& kernelConfigs, |
| 389 |
VP_PACKET_SHARED_CONTEXT* sharedContext); |
| 390 |
|
| 391 |
virtual MOS_STATUS GetScoreboardParams(PMHW_VFE_SCOREBOARD &scoreboardParams) |
| 392 |
{ |
| 393 |
scoreboardParams = nullptr; |
| 394 |
return MOS_STATUS_SUCCESS; |
| 395 |
} |
| 396 |
|
| 397 |
virtual void DumpSurfaces() |
| 398 |
{ |
| 399 |
return; |
| 400 |
} |
| 401 |
|
| 402 |
virtual void DumpSurface(VP_SURFACE *pSurface,PCCHAR fileName); |
| 403 |
|
| 404 |
// Kernel Common configs |
| 405 |
virtual MOS_STATUS GetKernelSettings(RENDERHAL_KERNEL_PARAM &settsings) |
| 406 |
{ |
| 407 |
if (IsAdvKernel()) |
| 408 |
{ |
| 409 |
// For adv kernel, no need for kernel param. |
| 410 |
return MOS_STATUS_SUCCESS; |
| 411 |
} |
| 412 |
if (m_hwInterface && m_hwInterface->m_vpPlatformInterface) |
| 413 |
{ |
| 414 |
VP_PUBLIC_CHK_STATUS_RETURN(m_hwInterface->m_vpPlatformInterface->GetKernelParam(m_kernelId, settsings)); |
| 415 |
return MOS_STATUS_SUCCESS; |
| 416 |
} |
| 417 |
else |
| 418 |
{ |
| 419 |
return MOS_STATUS_INVALID_HANDLE; |
| 420 |
} |
| 421 |
return MOS_STATUS_SUCCESS; |
| 422 |
} |
| 423 |
|
| 424 |
virtual MOS_STATUS GetKernelEntry(Kdll_CacheEntry &entry); |
| 425 |
|
| 426 |
virtual MOS_STATUS FreeCurbe(void*& curbe) |
| 427 |
{ |
| 428 |
VP_FUNC_CALL(); |
| 429 |
|
| 430 |
MOS_SafeFreeMemory(curbe); |
| 431 |
return MOS_STATUS_SUCCESS; |
| 432 |
} |
| 433 |
|
| 434 |
virtual uint32_t GetKernelBinaryID(); |
| 435 |
|
| 436 |
void* GetKernelBinary() |
| 437 |
{ |
| 438 |
return m_kernelBinary; |
| 439 |
} |
| 440 |
|
| 441 |
KERNEL_SURFACE_CONFIG& GetKernelSurfaceConfig() |
| 442 |
{ |
| 443 |
return m_surfaceState; |
| 444 |
} |
| 445 |
|
| 446 |
std::string& GetKernelName() |
| 447 |
{ |
| 448 |
return m_kernelName; |
| 449 |
} |
| 450 |
|
| 451 |
MOS_STATUS UpdateCurbeBindingIndex(SurfaceType surface, uint32_t index) |
| 452 |
{ |
| 453 |
// Surface Type is specified during one submission |
| 454 |
auto it = m_surfaceBindingIndex.find(surface); |
| 455 |
if (it != m_surfaceBindingIndex.end()) |
| 456 |
{ |
| 457 |
it->second.insert(index); |
| 458 |
} |
| 459 |
else |
| 460 |
{ |
| 461 |
std::set<uint32_t> bindingMap; |
| 462 |
bindingMap.insert(index); |
| 463 |
m_surfaceBindingIndex.emplace(surface, bindingMap); |
| 464 |
} |
| 465 |
|
| 466 |
return MOS_STATUS_SUCCESS; |
| 467 |
} |
| 468 |
|
| 469 |
std::set<uint32_t>& GetSurfaceBindingIndex(SurfaceType surface) |
| 470 |
{ |
| 471 |
auto it = m_surfaceBindingIndex.find(surface); |
| 472 |
|
| 473 |
if (it == m_surfaceBindingIndex.end()) |
| 474 |
{ |
| 475 |
VP_RENDER_ASSERTMESSAGE("No surface index created for current surface"); |
| 476 |
std::set<uint32_t> bindingMap; |
| 477 |
it = m_surfaceBindingIndex.emplace(surface, bindingMap).first; |
| 478 |
} |
| 479 |
return it->second; |
| 480 |
} |
| 481 |
|
| 482 |
MOS_STATUS InitKernel(void* binary, uint32_t size, KERNEL_CONFIGS& kernelConfigs, |
| 483 |
VP_SURFACE_GROUP& surfacesGroup, VP_RENDER_CACHE_CNTL& surfMemCacheCtl); |
| 484 |
|
| 485 |
bool IsAdvKernel() |
| 486 |
{ |
| 487 |
return m_isAdvKernel; |
| 488 |
} |
| 489 |
|
| 490 |
bool UseIndependentSamplerGroup() |
| 491 |
{ |
| 492 |
return m_useIndependentSamplerGroup; |
| 493 |
} |
| 494 |
|
| 495 |
virtual MOS_STATUS SetSamplerStates(KERNEL_SAMPLER_STATE_GROUP& samplerStateGroup); |
| 496 |
|
| 497 |
virtual MOS_STATUS UpdateCompParams() |
| 498 |
{ |
| 499 |
return MOS_STATUS_SUCCESS; |
| 500 |
} |
| 501 |
|
| 502 |
virtual MOS_STATUS SetCacheCntl(PVP_RENDER_CACHE_CNTL) |
| 503 |
{ |
| 504 |
return MOS_STATUS_SUCCESS; |
| 505 |
} |
| 506 |
|
| 507 |
virtual MOS_STATUS SetPerfTag() |
| 508 |
{ |
| 509 |
return MOS_STATUS_SUCCESS; |
| 510 |
} |
| 511 |
|
| 512 |
virtual MOS_STATUS InitRenderHalSurface( |
| 513 |
SurfaceType type, |
| 514 |
VP_SURFACE *surf, |
| 515 |
PRENDERHAL_SURFACE renderHalSurface) |
| 516 |
{ |
| 517 |
return MOS_STATUS_UNIMPLEMENTED; |
| 518 |
} |
| 519 |
|
| 520 |
virtual void OcaDumpKernelInfo(MOS_COMMAND_BUFFER &cmdBuffer, MOS_CONTEXT &mosContext); |
| 521 |
|
| 522 |
virtual uint32_t GetEuThreadSchedulingMode() |
| 523 |
{ |
| 524 |
// hw default mode |
| 525 |
return 0; |
| 526 |
} |
| 527 |
|
| 528 |
virtual uint32_t GetLargeGrfMode() |
| 529 |
{ |
| 530 |
//by default not enable |
| 531 |
//control all the kernels in BB, cannot only enable for one kernel in BB |
| 532 |
return 0; |
| 533 |
} |
| 534 |
|
| 535 |
virtual MOS_STATUS InitRenderHalSurfaceCMF(MOS_SURFACE* src, PRENDERHAL_SURFACE renderHalSurface); |
| 536 |
|
| 537 |
virtual MOS_STATUS UpdateBindlessSurfaceResource(SurfaceType surf, std::vector<RENDERHAL_STATE_LOCATION> stateLocations) |
| 538 |
{ |
| 539 |
if (surf != SurfaceTypeInvalid && surf != SurfaceTypeSubPlane) |
| 540 |
{ |
| 541 |
auto handle = m_bindlessSurfaceArray.find(surf); |
| 542 |
if (handle == m_bindlessSurfaceArray.end()) |
| 543 |
{ |
| 544 |
m_bindlessSurfaceArray.insert(std::make_pair(surf, stateLocations)); |
| 545 |
} |
| 546 |
else |
| 547 |
{ |
| 548 |
handle->second = stateLocations; |
| 549 |
} |
| 550 |
} |
| 551 |
|
| 552 |
return MOS_STATUS_SUCCESS; |
| 553 |
} |
| 554 |
|
| 555 |
virtual KERNEL_BINDELESS_SAMPLER &GetBindlessSamplers() |
| 556 |
{ |
| 557 |
return m_bindlessSamperArray; |
| 558 |
} |
| 559 |
|
| 560 |
virtual MOS_STATUS InitBindlessResources() |
| 561 |
{ |
| 562 |
m_bindlessSurfaceArray.clear(); |
| 563 |
m_bindlessSamperArray.clear(); |
| 564 |
return MOS_STATUS_SUCCESS; |
| 565 |
} |
| 566 |
|
| 567 |
MOS_STATUS UpdateCurbeStateHeapInfo(PMOS_RESOURCE stateHeap, uint8_t *statePtr, uint32_t offset); |
| 568 |
|
| 569 |
protected: |
| 570 |
|
| 571 |
virtual MOS_STATUS SetWalkerSetting(KERNEL_THREAD_SPACE &threadSpace, bool bSyncFlag, bool flushL1 = false); |
| 572 |
|
| 573 |
virtual MOS_STATUS SetKernelArgs(KERNEL_ARGS &kernelArgs, VP_PACKET_SHARED_CONTEXT *sharedContext); |
| 574 |
|
| 575 |
virtual MOS_STATUS SetKernelStatefulSurfaces(KERNEL_ARG_INDEX_SURFACE_MAP &statefulSurfaces); |
| 576 |
|
| 577 |
virtual MOS_STATUS SetupSurfaceState() = 0; |
| 578 |
|
| 579 |
virtual MOS_STATUS SetKernelConfigs(KERNEL_CONFIGS& kernelConfigs); |
| 580 |
|
| 581 |
virtual MOS_STATUS SetProcessSurfaceGroup(VP_SURFACE_GROUP &surfaces); |
| 582 |
|
| 583 |
virtual MOS_STATUS CpPrepareResources(); |
| 584 |
|
| 585 |
virtual MOS_STATUS GetCurbeState(void *&curbe, uint32_t &curbeLength) = 0; |
| 586 |
|
| 587 |
virtual MOS_STATUS GetAlignedLength(uint32_t &curbeLength, uint32_t &curbeLengthAligned, RENDERHAL_KERNEL_PARAM kernelParam, uint32_t dwBlockAlign) |
| 588 |
{ |
| 589 |
curbeLengthAligned = MOS_ALIGN_CEIL(curbeLength, dwBlockAlign); |
| 590 |
return MOS_STATUS_SUCCESS; |
| 591 |
} |
| 592 |
|
| 593 |
virtual MOS_STATUS SetTuningFlag(PKERNEL_TUNING_PARAMS tuningParams); |
| 594 |
|
| 595 |
virtual MOS_STATUS SetInlineDataParameter(KRN_ARG arg, uint8_t *inlineData); |
| 596 |
|
| 597 |
virtual MOS_STATUS SetBindlessSamplerToResourceList(KRN_ARG &arg, uint32_t samplerIndex); |
| 598 |
virtual MOS_STATUS SetBindlessSurfaceStateToResourceList(KRN_ARG &arg); |
| 599 |
|
| 600 |
bool IsLocalIdGeneratedByRuntime(KRN_EXECUTE_ENV &krnEnv, KRN_PER_THREAD_ARG_INFO &perThreadInfo, uint32_t localWidth, uint32_t localHeight, uint32_t localDepth); |
| 601 |
|
| 602 |
MOS_STATUS PaddingPerThreadCurbe(uint32_t &curbeSize, uint32_t localWidth, uint32_t localHeight, uint32_t localDepth); |
| 603 |
|
| 604 |
MOS_STATUS SetPerThreadCurbe(uint8_t *curbe, uint32_t offset, uint32_t curbeSize, KRN_PER_THREAD_ARG_INFO &perThreadInfo, uint32_t localWidth, uint32_t localHeight, uint32_t localDepth); |
| 605 |
|
| 606 |
protected: |
| 607 |
|
| 608 |
VP_SURFACE_GROUP *m_surfaceGroup = nullptr; // input surface process surface groups |
| 609 |
PVP_MHWINTERFACE m_hwInterface = nullptr; |
| 610 |
KERNEL_SURFACE_CONFIG m_surfaceState; // surfaces processed pool where the surface state will generated here, if KERNEL_SURFACE_STATE_PARAM |
| 611 |
KERNEL_SURFACE_BINDING_INDEX m_surfaceBindingIndex; // store the binding index for processed surface |
| 612 |
PVpAllocator m_allocator = nullptr; |
| 613 |
MediaUserSettingSharedPtr m_userSettingPtr = nullptr; // usersettingInstance |
| 614 |
KERNEL_BINDELESS_SURFACE m_bindlessSurfaceArray; |
| 615 |
KERNEL_BINDELESS_SAMPLER m_bindlessSamperArray; |
| 616 |
std::vector<MHW_INDIRECT_STATE_RESOURCE_PARAMS> m_curbeResourceList = {}; |
| 617 |
std::vector<MHW_INDIRECT_STATE_RESOURCE_PARAMS> m_inlineResourceList = {}; |
| 618 |
// kernel attribute |
| 619 |
std::string m_kernelName = ""; |
| 620 |
void * m_kernelBinary = nullptr; |
| 621 |
uint32_t m_kernelBinaryID = 0; |
| 622 |
uint32_t m_kernelSize = 0; |
| 623 |
uint32_t m_kernelPaddingSize = 0; |
| 624 |
VpKernelID m_kernelId = kernelCombinedFc; |
| 625 |
DelayLoadedKernelType m_kernelType = KernelNone; |
| 626 |
KernelIndex m_kernelIndex = 0; // index of current kernel in KERNEL_PARAMS_LIST |
| 627 |
|
| 628 |
RENDERHAL_STATE_LOCATION m_curbeLocation = {}; |
| 629 |
|
| 630 |
PKERNEL_TUNING_PARAMS m_kernelTuningParams = nullptr; |
| 631 |
|
| 632 |
bool m_isAdvKernel = false; // true mean multi kernel can be submitted in one workload. |
| 633 |
bool m_useIndependentSamplerGroup = false; //true means multi kernels has their own stand alone sampler states group. only can be true when m_isAdvKernel is true. |
| 634 |
|
| 635 |
std::shared_ptr<mhw::vebox::Itf> m_veboxItf = nullptr; |
| 636 |
|
| 637 |
KERNEL_ARG_INDEX_SURFACE_MAP m_argIndexSurfMap = {}; |
| 638 |
|
| 639 |
MEDIA_CLASS_DEFINE_END(vp__VpRenderKernelObj) |
| 640 |
}; |
| 641 |
} |
| 642 |
#endif // __VP_RENDER_KERNEL_OBJ_H__ |