| 1 | /* |
| 2 | * Copyright (c) 2017, 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 cm_hal_generic.h |
| 24 | //! \brief Main Entry point for CM HAL Generic component |
| 25 | //! |
| 26 | |
| 27 | #ifndef MEDIADRIVER_AGNOSTIC_COMMON_CM_CMHALGENERIC_H_ |
| 28 | #define MEDIADRIVER_AGNOSTIC_COMMON_CM_CMHALGENERIC_H_ |
| 29 | |
| 30 | #include "cm_def.h" |
| 31 | |
| 32 | typedef struct CM_HAL_GENERIC * PCM_HAL_GENERIC; |
| 33 | typedef struct _CM_HAL_SAMPLER_8X8_PARAM *PCM_HAL_SAMPLER_8X8_PARAM; |
| 34 | typedef struct CmHalL3Settings * PCmHalL3Settings; |
| 35 | |
| 36 | //------------------------------- |
| 37 | //| CM HW platform info |
| 38 | //------------------------------- |
| 39 | struct CM_PLATFORM_INFO |
| 40 | { |
| 41 | uint32_t numSlices; |
| 42 | uint32_t numSubSlices; |
| 43 | uint32_t numEUsPerSubSlice; |
| 44 | uint32_t numHWThreadsPerEU; |
| 45 | uint32_t numMaxEUsPerPool; |
| 46 | }; |
| 47 | typedef CM_PLATFORM_INFO *PCM_PLATFORM_INFO; |
| 48 | |
| 49 | struct CM_HAL_WALKER_XY |
| 50 | { |
| 51 | union |
| 52 | { |
| 53 | struct |
| 54 | { |
| 55 | uint32_t x : 16; |
| 56 | uint32_t y : 16; |
| 57 | }; |
| 58 | uint32_t value; |
| 59 | }; |
| 60 | }; |
| 61 | typedef CM_HAL_WALKER_XY *PCM_HAL_WALKER_XY; |
| 62 | |
| 63 | // The following enum type must match |
| 64 | // MHW_WALKER_MODE defined in mhw_render.h |
| 65 | enum CM_HAL_WALKER_MODE |
| 66 | { |
| 67 | CM_HAL_WALKER_MODE_NOT_SET = -1, |
| 68 | CM_HAL_WALKER_MODE_DISABLED = 0, |
| 69 | CM_HAL_WALKER_MODE_SINGLE = 1, // dual = 0, repel = 1 |
| 70 | CM_HAL_WALKER_MODE_DUAL = 2, // dual = 1, repel = 0) |
| 71 | CM_HAL_WALKER_MODE_TRI = 3, // applies in BDW GT2 which has 1 slice and 3 sampler/VME per slice |
| 72 | CM_HAL_WALKER_MODE_QUAD = 4, // applies in HSW GT3 which has 2 slices and 2 sampler/VME per slice |
| 73 | CM_HAL_WALKER_MODE_HEX = 6, // applies in BDW GT2 which has 2 slices and 3 sampler/VME per slice |
| 74 | CM_HAL_WALKER_MODE_OCT = 8 // may apply in future Gen media architectures |
| 75 | }; |
| 76 | |
| 77 | // The following structure must match the structure |
| 78 | // MHW_WALKER_PARAMS defined in mhw_render.h |
| 79 | struct CM_HAL_WALKER_PARAMS |
| 80 | { |
| 81 | uint32_t interfaceDescriptorOffset : 5; |
| 82 | uint32_t cmWalkerEnable : 1; |
| 83 | uint32_t colorCountMinusOne : 8; |
| 84 | uint32_t useScoreboard : 1; |
| 85 | uint32_t scoreboardMask : 8; |
| 86 | uint32_t midLoopUnitX : 2; |
| 87 | uint32_t midLoopUnitY : 2; |
| 88 | uint32_t middleLoopExtraSteps : 5; |
| 89 | uint32_t groupIdLoopSelect : 24; |
| 90 | uint32_t : 8; |
| 91 | |
| 92 | uint32_t inlineDataLength; |
| 93 | uint8_t *inlineData; |
| 94 | uint32_t localLoopExecCount; |
| 95 | uint32_t globalLoopExecCount; |
| 96 | |
| 97 | CM_HAL_WALKER_MODE walkerMode; |
| 98 | CM_HAL_WALKER_XY blockResolution; |
| 99 | CM_HAL_WALKER_XY localStart; |
| 100 | CM_HAL_WALKER_XY localEnd; |
| 101 | CM_HAL_WALKER_XY localOutLoopStride; |
| 102 | CM_HAL_WALKER_XY localInnerLoopUnit; |
| 103 | CM_HAL_WALKER_XY globalResolution; |
| 104 | CM_HAL_WALKER_XY globalStart; |
| 105 | CM_HAL_WALKER_XY globalOutlerLoopStride; |
| 106 | CM_HAL_WALKER_XY globalInnerLoopUnit; |
| 107 | |
| 108 | bool addMediaFlush; |
| 109 | bool requestSingleSlice; |
| 110 | }; |
| 111 | typedef CM_HAL_WALKER_PARAMS *PCM_HAL_WALKER_PARAMS; |
| 112 | |
| 113 | struct SamplerParam |
| 114 | { |
| 115 | unsigned int samplerTableIndex; |
| 116 | unsigned int heapOffset; |
| 117 | unsigned int bti; |
| 118 | unsigned int btiStepping; |
| 119 | unsigned int btiMultiplier; |
| 120 | bool userDefinedBti; |
| 121 | bool regularBti; |
| 122 | unsigned int elementType; |
| 123 | unsigned int size; |
| 124 | }; |
| 125 | |
| 126 | struct CM_SURFACE_BTI_INFO |
| 127 | { |
| 128 | uint32_t normalSurfaceStart; // start index of normal surface |
| 129 | uint32_t normalSurfaceEnd; // end index of normal surface |
| 130 | uint32_t reservedSurfaceStart; // start index of reserved surface |
| 131 | uint32_t reservedSurfaceEnd; // end index of reserved surface |
| 132 | }; |
| 133 | typedef CM_SURFACE_BTI_INFO *PCM_SURFACE_BTI_INFO; |
| 134 | |
| 135 | //------------------------------------------------------------------------------ |
| 136 | //| CM HW Expected GT system info |
| 137 | //------------------------------------------------------------------------------ |
| 138 | struct CM_EXPECTED_GT_SYSTEM_INFO |
| 139 | { |
| 140 | uint32_t numSlices; |
| 141 | uint32_t numSubSlices; |
| 142 | }; |
| 143 | typedef CM_EXPECTED_GT_SYSTEM_INFO *PCM_EXPECTED_GT_SYSTEM_INFO; |
| 144 | |
| 145 | struct CM_HAL_GENERIC |
| 146 | { |
| 147 | #define ASSIGN_IF_VALID(ptr, value) \ |
| 148 | if (ptr) \ |
| 149 | { \ |
| 150 | *ptr = value; \ |
| 151 | } |
| 152 | |
| 153 | public: |
| 154 | PCM_HAL_STATE m_cmState; |
| 155 | const L3ConfigRegisterValues *m_l3Plane = nullptr; |
| 156 | size_t m_l3ConfigCount = 0; |
| 157 | |
| 158 | CM_HAL_GENERIC(PCM_HAL_STATE cmState) : m_cmState(cmState), |
| 159 | m_platformID(PLATFORM_INTEL_UNKNOWN), |
| 160 | m_genGT(PLATFORM_INTEL_GT_UNKNOWN), |
| 161 | m_platformStr(nullptr), |
| 162 | m_requestShutdownSubslicesForVmeUsage(false), |
| 163 | m_overridePowerOptionPerGpuContext(false), |
| 164 | m_redirectRcsToCcs(false), |
| 165 | m_decompress(false), |
| 166 | m_fastpathDefault(false), |
| 167 | m_defaultMocs(MOS_CM_RESOURCE_USAGE_SurfaceState){}; |
| 168 | |
| 169 | virtual ~CM_HAL_GENERIC(){}; |
| 170 | |
| 171 | //! |
| 172 | //! \brief Get GPUCopy Kernel's ISA and Size |
| 173 | //! \details Get GPUCopy Kernel's ISA and Size |
| 174 | //! \param [out] isa |
| 175 | //! pointer to memory of gpucopy isa |
| 176 | //! \param [out] isaSize |
| 177 | //! size of gpucopy isa |
| 178 | //! \return MOS_STATUS |
| 179 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 180 | //! |
| 181 | virtual MOS_STATUS GetCopyKernelIsa(void *&isa, uint32_t &isaSize) = 0; |
| 182 | |
| 183 | //! |
| 184 | //! \brief Get GPU Surface Initialization Kernel's ISA and Size |
| 185 | //! \details Get GPU Surface Initialization Kernel's ISA and Size |
| 186 | //! \param [out] isa |
| 187 | //! pointer to memory of gpu initialization isa |
| 188 | //! \param [out] isaSize |
| 189 | //! size of gpu initialization isa |
| 190 | //! \return MOS_STATUS |
| 191 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 192 | //! |
| 193 | virtual MOS_STATUS GetInitKernelIsa(void *&isa, uint32_t &isaSize) = 0; |
| 194 | |
| 195 | //! |
| 196 | //! \brief Set media walker parameters |
| 197 | //! \details Set media walker parameters |
| 198 | //! \param [in] engineeringParams |
| 199 | //! engineering params passed by caller |
| 200 | //! \param [in] walkerParams |
| 201 | //! pointer to walker paramaeters to set |
| 202 | //! \return MOS_STATUS |
| 203 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 204 | //! |
| 205 | virtual MOS_STATUS SetMediaWalkerParams( |
| 206 | CM_WALKING_PARAMETERS engineeringParams, |
| 207 | PCM_HAL_WALKER_PARAMS walkerParams) = 0; |
| 208 | |
| 209 | //! |
| 210 | //! \brief Set Surface Memory Object Control |
| 211 | //! \details Convert Memory Object Control bits to RenderHal Surface State |
| 212 | //! \param [in] memObjCtl |
| 213 | //! memObjCtl passed by caller |
| 214 | //! \param [in] surfStateParams |
| 215 | //! pointer to surface state param |
| 216 | //! \return MOS_STATUS |
| 217 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 218 | //! |
| 219 | virtual MOS_STATUS HwSetSurfaceMemoryObjectControl( |
| 220 | uint16_t memObjCtl, |
| 221 | PRENDERHAL_SURFACE_STATE_PARAMS surfStateParams) = 0; |
| 222 | |
| 223 | //! |
| 224 | //! \brief Register Sampler8x8 |
| 225 | //! \details Register Sampler8x8 |
| 226 | //! \param [in] param |
| 227 | //! pointer to cmhal sampler8x8 param |
| 228 | //! \return MOS_STATUS |
| 229 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 230 | //! |
| 231 | virtual MOS_STATUS RegisterSampler8x8( |
| 232 | PCM_HAL_SAMPLER_8X8_PARAM param) = 0; |
| 233 | |
| 234 | //! |
| 235 | //! \brief Submit commmand to kernel mode driver |
| 236 | //! \details Submit commmand to kernel mode driver |
| 237 | //! \param [in] batchBuffer |
| 238 | //! pointer to mhw batch buffer to submit |
| 239 | //! \param [in] taskId |
| 240 | //! id of task |
| 241 | //! \param [in] kernelParam |
| 242 | //! pointer to array of kernel param |
| 243 | //! \param [out] cmdBuffer |
| 244 | //! pointer cmd buffer returned to cm event |
| 245 | //! \return MOS_STATUS |
| 246 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 247 | //! |
| 248 | virtual MOS_STATUS SubmitCommands( |
| 249 | PMHW_BATCH_BUFFER batchBuffer, |
| 250 | int32_t taskId, |
| 251 | PCM_HAL_KERNEL_PARAM *kernelParam, |
| 252 | void ** cmdBuffer) = 0; |
| 253 | #if (_RELEASE_INTERNAL || _DEBUG) |
| 254 | #if defined(CM_DIRECT_GUC_SUPPORT) |
| 255 | //! |
| 256 | //! \brief Submit dummy commmand to kernel mode driver to set up page table for Direct submission |
| 257 | //! \details Submit commmand to kernel mode driver |
| 258 | //! \param [in] pBatchBuffer |
| 259 | //! pointer to mhw batch buffer to submit |
| 260 | //! \param [in] iTaskId |
| 261 | //! id of task |
| 262 | //! \param [out] ppCmdBuffer |
| 263 | //! pointer cmd buffer returned to cm event |
| 264 | //! \return MOS_STATUS |
| 265 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 266 | //! |
| 267 | virtual MOS_STATUS SubmitDummyCommands( |
| 268 | PMHW_BATCH_BUFFER batchBuffer, |
| 269 | int32_t taskId, |
| 270 | PCM_HAL_KERNEL_PARAM *kernelParam, |
| 271 | void ** cmdBuffer) = 0; |
| 272 | #endif |
| 273 | #endif |
| 274 | |
| 275 | //! |
| 276 | //! \brief Submit a commmand to get the time stamp base |
| 277 | //! \return MOS_STATUS |
| 278 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 279 | //! |
| 280 | virtual MOS_STATUS SubmitTimeStampBaseCommands() |
| 281 | { |
| 282 | return MOS_STATUS_SUCCESS; |
| 283 | } |
| 284 | |
| 285 | //! |
| 286 | //! \brief Update platform information from power option |
| 287 | //! \details Power option can be used to do slice shutdown. This function is |
| 288 | //! to adjust platform info (EU numbers/Slice number) accordingly. |
| 289 | //! \param [in] platformInfo |
| 290 | //! pointer to platform info |
| 291 | //! \param [in] euSaturated |
| 292 | //! if EU Saturation required. |
| 293 | //! \return MOS_STATUS |
| 294 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 295 | //! |
| 296 | virtual MOS_STATUS UpdatePlatformInfoFromPower( |
| 297 | PCM_PLATFORM_INFO platformInfo, |
| 298 | bool euSaturated) = 0; |
| 299 | |
| 300 | //! |
| 301 | //! \brief Get media walker's max width |
| 302 | //! \details Get media walker's max width |
| 303 | //! \return media walker's max width |
| 304 | //! |
| 305 | virtual uint32_t GetMediaWalkerMaxThreadWidth() = 0; |
| 306 | |
| 307 | //! |
| 308 | //! \brief Get media walker's max height |
| 309 | //! \details Get media walker's max height |
| 310 | //! \return media walker's max height |
| 311 | //! |
| 312 | virtual uint32_t GetMediaWalkerMaxThreadHeight() = 0; |
| 313 | |
| 314 | //! |
| 315 | //! \brief Get Surface binding table index info |
| 316 | //! \details Get Surface binding table index info, including the start/end index of |
| 317 | //! reserved surfaces and normal surfaces |
| 318 | //! \param [in] btiInfo |
| 319 | //! pointer to binding table information |
| 320 | //! \return MOS_STATUS |
| 321 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 322 | virtual MOS_STATUS GetHwSurfaceBTIInfo( |
| 323 | PCM_SURFACE_BTI_INFO btiInfo) = 0; |
| 324 | |
| 325 | //! |
| 326 | //! \brief Set Suggested L3 Configuration to RenderHal |
| 327 | //! \details Set Suggested L3 Configuration to RenderHal |
| 328 | //! \param [in] l3Config |
| 329 | //! index of selected configuration |
| 330 | //! \return MOS_STATUS |
| 331 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 332 | virtual MOS_STATUS SetSuggestedL3Conf( |
| 333 | L3_SUGGEST_CONFIG l3Config) = 0; |
| 334 | |
| 335 | //! |
| 336 | //! \brief Allocate SIP/CSR Resource for Preemption and Debug |
| 337 | //! \details Allocate SIP/CSR Resource for Preemption and Debug |
| 338 | //! \return MOS_STATUS |
| 339 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 340 | virtual MOS_STATUS AllocateSIPCSRResource() = 0; |
| 341 | |
| 342 | //! |
| 343 | //! \brief Get the stepping string of Gen platform |
| 344 | //! \details Get the stepping string of Gen platform |
| 345 | //! \param [in,out] stepInfoStr |
| 346 | //! reference to stepping information string |
| 347 | //! \return MOS_STATUS |
| 348 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 349 | virtual MOS_STATUS GetGenStepInfo(char *&stepInfoStr) = 0; |
| 350 | |
| 351 | //! |
| 352 | //! \brief Get the platform code and GT type of Gen platform |
| 353 | //! \param [out] platformID |
| 354 | //! pointer to the platform code defined in GPU_PLATFORM |
| 355 | //! \param [out] gengt |
| 356 | //! pointer to the GT type defined in GPU_GT_PLATFORM |
| 357 | //! \param [out] platformStr |
| 358 | //! pointer to platform string |
| 359 | //! \return MOS_STATUS |
| 360 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 361 | virtual MOS_STATUS GetGenPlatformInfo(uint32_t *platformID, |
| 362 | uint32_t * genGT, |
| 363 | const char ** platformStr) |
| 364 | { |
| 365 | ASSIGN_IF_VALID(platformID, m_platformID); |
| 366 | ASSIGN_IF_VALID(genGT, m_genGT); |
| 367 | ASSIGN_IF_VALID(platformStr, m_platformStr); |
| 368 | return MOS_STATUS_SUCCESS; |
| 369 | } |
| 370 | |
| 371 | //! |
| 372 | //! \brief set the platform code and GT type of Gen platform |
| 373 | //! \param [in] platformID |
| 374 | //! the platform code defined in GPU_PLATFORM |
| 375 | //! \param [in] gengt |
| 376 | //! the GT type defined in GPU_GT_PLATFORM |
| 377 | //! \param [in] platformStr |
| 378 | //! platform string |
| 379 | //! \return MOS_STATUS |
| 380 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 381 | virtual MOS_STATUS SetGenPlatformInfo(uint32_t platformID, |
| 382 | uint32_t genGT, |
| 383 | const char * platformStr) |
| 384 | { |
| 385 | m_platformID = platformID; |
| 386 | m_genGT = genGT; |
| 387 | m_platformStr = platformStr; |
| 388 | return MOS_STATUS_SUCCESS; |
| 389 | } |
| 390 | |
| 391 | //! |
| 392 | //! \brief enable or disable the slice downdown feature |
| 393 | //! \param [in] enabled |
| 394 | //! true: enable slice shutdown; false: disable slice shutdown |
| 395 | virtual void SetRequestShutdownSubslicesForVmeUsage(bool enabled) |
| 396 | { |
| 397 | m_requestShutdownSubslicesForVmeUsage = enabled; |
| 398 | } |
| 399 | |
| 400 | //! |
| 401 | //! \brief return whether the slice downdown feature is enabled |
| 402 | //! \return bool |
| 403 | //! true: slice shutdown enabled; false: slice shutdown disabled |
| 404 | virtual bool IsRequestShutdownSubslicesForVmeUsage() |
| 405 | { |
| 406 | return m_requestShutdownSubslicesForVmeUsage; |
| 407 | } |
| 408 | |
| 409 | //! |
| 410 | //! \brief check if the CISA Gen ID is supported on the platform |
| 411 | //! \param [in] cisaGenID |
| 412 | //! the CISA ID that will be checked |
| 413 | //! \return bool |
| 414 | //! true if it is supported; false if not |
| 415 | virtual bool IsCisaIDSupported(uint32_t cisaGenID) |
| 416 | { |
| 417 | for (uint32_t id : m_cisaGenIDs) |
| 418 | { |
| 419 | if (id == cisaGenID) |
| 420 | { |
| 421 | return true; |
| 422 | } |
| 423 | } |
| 424 | return false; |
| 425 | } |
| 426 | |
| 427 | //! |
| 428 | //! \brief add the supported CISA Gen IDs of this product |
| 429 | //! \param [in] cisaGenIDs |
| 430 | //! pointer to the vector of supported cisaGenIDs |
| 431 | //! \param [in] len |
| 432 | //! length of the vector of supported cisaGenIDs |
| 433 | //! \return MOS_STATUS |
| 434 | //! always return MOS_STATUS_SUCCESS |
| 435 | virtual MOS_STATUS AddSupportedCisaIDs(uint32_t *cisaGenIDs, int len = 1) |
| 436 | { |
| 437 | for (int i = 0; i < len; i++) |
| 438 | { |
| 439 | m_cisaGenIDs.push_back(cisaGenIDs[i]); |
| 440 | } |
| 441 | return MOS_STATUS_SUCCESS; |
| 442 | } |
| 443 | |
| 444 | //! |
| 445 | //! \brief Check if Qpitch is supported by hw in surface 3d lock |
| 446 | //! \details Check if Qpitch is supported by hw in surface 3d lock |
| 447 | //! Qpitch is supported from SKL |
| 448 | //! \return True for SKL+ |
| 449 | virtual bool IsSurf3DQpitchSupportedbyHw() { return true; }; |
| 450 | |
| 451 | //! |
| 452 | //! \brief Check if compare mask supported by hw in conditional buffer |
| 453 | //! \details Check if compare mask supported by hw in conditional buffer |
| 454 | //! compare mask is supported from SKL |
| 455 | //! \return True for SKL+ |
| 456 | virtual bool IsCompareMaskSupportedbyHw() { return true; }; |
| 457 | |
| 458 | //! |
| 459 | //! \brief Check if two adjacent sampler index requried by hardware |
| 460 | //! \details Check if two adjacent sampler index requried by hardware |
| 461 | //! compare mask is supported from SKL |
| 462 | //! \return True for BDW, and False for SKL+ |
| 463 | virtual bool IsAdjacentSamplerIndexRequiredbyHw() { return false; }; |
| 464 | |
| 465 | //! |
| 466 | //! \brief Check if the WA to disable surface compression required |
| 467 | //! \details Check if the WA to disable surface compression required |
| 468 | //! \return False for BDW, and True for SKL+ |
| 469 | virtual bool IsSurfaceCompressionWARequired() { return true; }; |
| 470 | |
| 471 | //! |
| 472 | //! \brief Check if scoreboading parameters are supported. |
| 473 | //! \details Check if scoreboading parameters are supported. |
| 474 | //! \return False for Not needed, and True for Needed |
| 475 | virtual bool IsScoreboardParamNeeded() { return true; }; |
| 476 | |
| 477 | //! |
| 478 | //! \brief Check if surface color format is supported by VME |
| 479 | //! \return true if format is supported by VME surface |
| 480 | virtual bool IsSupportedVMESurfaceFormat(MOS_FORMAT format) |
| 481 | { |
| 482 | if (format != Format_NV12) |
| 483 | return false; |
| 484 | else |
| 485 | return true; |
| 486 | } |
| 487 | |
| 488 | //! |
| 489 | //! \brief Sanity check for ColorCount. |
| 490 | //! \details Sanity check for ColorCount. |
| 491 | //! ColorCountMinusOne varies from 4 bit to 8 bit on different platforms |
| 492 | //! \return Result of the operation. |
| 493 | virtual int32_t ColorCountSanityCheck(uint32_t colorCount) = 0; |
| 494 | |
| 495 | //! |
| 496 | //! \brief Sanity check for memory object control policy. |
| 497 | //! \details Sanity check for memory object control policy. |
| 498 | //! Each platform supports different control policy. |
| 499 | //! \param [in] memCtrl |
| 500 | //! input of memory object control to check |
| 501 | //! \return Result of the operation. |
| 502 | virtual bool MemoryObjectCtrlPolicyCheck(uint32_t memCtrl) = 0; |
| 503 | |
| 504 | //! |
| 505 | //! \brief Check if the WA to use No cache setting for GPUCopy surface required |
| 506 | //! \details Check if the WA to use No cache setting for GPUCopy surface required |
| 507 | //! Configure memory object control for the two BufferUP to solve the same |
| 508 | //! cache-line coherency issue. |
| 509 | //! \return False for BDW, and True for SKL+ |
| 510 | virtual bool IsGPUCopySurfaceNoCacheWARequired() { return true; }; |
| 511 | |
| 512 | //! |
| 513 | //! \brief Check if one plane P010 surface is supported. |
| 514 | //! \details Check if one plane P010 surface is supported. |
| 515 | //! one plane P010 surface is supported since CNL. |
| 516 | //! \return False for pre-CNL, and True for CNL+ |
| 517 | virtual bool IsP010SinglePassSupported() { return true; }; |
| 518 | |
| 519 | //! |
| 520 | //! \brief Get Convolution Sampler Index. |
| 521 | //! \details Get Convolution Sampler Index. |
| 522 | //! \param [in] samplerParam |
| 523 | //! pointer to sampler param |
| 524 | //! \param [in] samplerIndexTable |
| 525 | //! pointer to sampler index table |
| 526 | //! \param [in] nSamp8X8Num |
| 527 | //! number of sampler8x8 |
| 528 | //! \param [in] nSampConvNum |
| 529 | //! number of conv sampler |
| 530 | //! \return Sampler index. |
| 531 | virtual int32_t GetConvSamplerIndex( |
| 532 | PMHW_SAMPLER_STATE_PARAM samplerParam, |
| 533 | char * samplerIndexTable, |
| 534 | int32_t nSamp8X8Num, |
| 535 | int32_t nSampConvNum) = 0; |
| 536 | |
| 537 | //! |
| 538 | //! \brief Set L3 values in CM hal layer. |
| 539 | //! \details Use the L3 struct to set L3 to different platforms. |
| 540 | //! \param [in] values |
| 541 | //! pointer to input L3 config values |
| 542 | //! \param [in] cmHalL3Setting |
| 543 | //! pointer to hal layer L3 config values |
| 544 | //! \return MOS_STATUS |
| 545 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 546 | virtual MOS_STATUS SetL3CacheConfig( |
| 547 | const L3ConfigRegisterValues *values, |
| 548 | PCmHalL3Settings cmHalL3Setting) = 0; |
| 549 | |
| 550 | //! |
| 551 | //! \brief Get sampler element count for a given sampler type. |
| 552 | //! \details Convert the sampler type to how many element for this sampler |
| 553 | //! type for current platform. |
| 554 | //! \param [in] mhwSamplerParam |
| 555 | //! pointer to the sampler param defined by MHW |
| 556 | //! \param [in,out] samplerParam |
| 557 | //! Will get sampler size, sampler element type, sampler bti |
| 558 | //! stepping and sampler multiplier for this type of sampler |
| 559 | //! \return MOS_STATUS |
| 560 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 561 | virtual MOS_STATUS GetSamplerParamInfoForSamplerType( |
| 562 | PMHW_SAMPLER_STATE_PARAM mhwSamplerParam, |
| 563 | SamplerParam & samplerParam) = 0; |
| 564 | |
| 565 | //! |
| 566 | //! \brief Get the expected configuration for specific GT |
| 567 | //! \details Get the expected configuration for specific GT |
| 568 | //! \param [in] expectedConfig |
| 569 | //! pointer to expected config |
| 570 | //! \return MOS_STATUS |
| 571 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 572 | //! |
| 573 | virtual MOS_STATUS GetExpectedGtSystemConfig( |
| 574 | PCM_EXPECTED_GT_SYSTEM_INFO expectedConfig) = 0; |
| 575 | |
| 576 | //! |
| 577 | //! \brief Get the size of the timestamp resource for each task |
| 578 | //! \details Get the size of the timestamp resource for each task |
| 579 | //! \return int32_t |
| 580 | //! Size of the timestamp resource for each task |
| 581 | //! |
| 582 | virtual int32_t GetTimeStampResourceSize() |
| 583 | { |
| 584 | // Default: 2 QWORDs for each kernel in the task + 1 QWORD for frame tracking |
| 585 | return (sizeof(uint64_t) * CM_SYNC_QWORD_PER_TASK) + (sizeof(uint64_t) * CM_TRACKER_ID_QWORD_PER_TASK); |
| 586 | } |
| 587 | |
| 588 | //! |
| 589 | //! \brief Covnert the ticks to nano seconds with default config if KMD querying failed |
| 590 | //! \param [in] ticks |
| 591 | //! input ticks |
| 592 | //! \return uint64_t |
| 593 | //! Nano seconds converted from the input ticks |
| 594 | //! |
| 595 | virtual uint64_t ConverTicksToNanoSecondsDefault(uint64_t ticks) = 0; |
| 596 | |
| 597 | //! |
| 598 | //! \brief Check if the platform has media mode or not |
| 599 | //! \details Check if the platform has media mode or not |
| 600 | //! \return bool |
| 601 | //! true: the platform has media mode; false the platform |
| 602 | //! does not have media mode. |
| 603 | //! |
| 604 | virtual bool CheckMediaModeAvailability() { return true; } |
| 605 | |
| 606 | //! |
| 607 | //! \brief enable or disable the power option per GPU context |
| 608 | //! \param [in] enabled |
| 609 | //! true: enable per GPU context; false: disable per Batch command |
| 610 | virtual void SetOverridePowerOptionPerGpuContext(bool enabled) |
| 611 | { |
| 612 | m_overridePowerOptionPerGpuContext = enabled; |
| 613 | } |
| 614 | |
| 615 | //! |
| 616 | //! \brief return whether the power option per GPU context is enabled |
| 617 | //! \return bool |
| 618 | //! true: enable per GPU context; false: disable per Batch command |
| 619 | virtual bool IsOverridePowerOptionPerGpuContext() |
| 620 | { |
| 621 | return m_overridePowerOptionPerGpuContext; |
| 622 | } |
| 623 | |
| 624 | //! |
| 625 | //! \brief enable or disable redirect of RCS to CCS |
| 626 | //! \param [in] enabled |
| 627 | //! true: enable redirect of RCS to CCS; false: disable redirect of RCS to CCS |
| 628 | virtual void SetRedirectRcsToCcs(bool enabled) |
| 629 | { |
| 630 | m_redirectRcsToCcs = enabled; |
| 631 | } |
| 632 | |
| 633 | //! |
| 634 | //! \brief return whether need redirect RCS to CCS |
| 635 | //! \return bool |
| 636 | //! true: redirect is need; false: don't need redirect |
| 637 | virtual bool IsRedirectRcsToCcs() |
| 638 | { |
| 639 | return m_redirectRcsToCcs; |
| 640 | } |
| 641 | |
| 642 | //! |
| 643 | //! \brief enable or disable decompression flag |
| 644 | //! \param [in] enabled |
| 645 | //! true: enable decompression for surface; |
| 646 | //! false: disable decompression |
| 647 | virtual void SetDecompressFlag(bool enabled) |
| 648 | { |
| 649 | m_decompress = enabled; |
| 650 | } |
| 651 | |
| 652 | //! |
| 653 | //! \brief return whether the decompreesion option |
| 654 | //! \return bool |
| 655 | //! true: need to decompress a compressed surface; |
| 656 | //! false: no need to decompress the compressed surface |
| 657 | virtual bool GetDecompressFlag() |
| 658 | { |
| 659 | return m_decompress; |
| 660 | } |
| 661 | |
| 662 | virtual MOS_STATUS RegisterResourceBeforeLock(PMOS_INTERFACE pOsInterface, PMOS_RESOURCE pResource) |
| 663 | { |
| 664 | return MOS_STATUS_SUCCESS; |
| 665 | } |
| 666 | |
| 667 | //! |
| 668 | //! \brief Init the default value of task related property |
| 669 | //! \param [in,out] taskConfig |
| 670 | //! Task related property |
| 671 | //! \return MOS_STATUS_SUCCESS |
| 672 | //! |
| 673 | virtual MOS_STATUS InitTaskProperty(CM_TASK_CONFIG &taskConfig) |
| 674 | { |
| 675 | return MOS_STATUS_SUCCESS; |
| 676 | } |
| 677 | |
| 678 | //! |
| 679 | //! \brief Whether switch to fast path by default |
| 680 | //! \return true or false |
| 681 | //! |
| 682 | virtual void SetFastPathByDefault(bool flag) |
| 683 | { |
| 684 | m_fastpathDefault = flag; |
| 685 | } |
| 686 | |
| 687 | //! |
| 688 | //! \brief Whether switch to fast path by default |
| 689 | //! \return true or false |
| 690 | //! |
| 691 | virtual bool IsFastPathByDefault() |
| 692 | { |
| 693 | return m_fastpathDefault; |
| 694 | } |
| 695 | |
| 696 | //! \brief Get the smallest max thread number that can be set in VFE |
| 697 | //! \return the smallest max thread number |
| 698 | //! |
| 699 | virtual uint32_t GetSmallestMaxThreadNum() |
| 700 | { |
| 701 | return 1; |
| 702 | } |
| 703 | |
| 704 | //! |
| 705 | //! \brief Set the default MOCS for this platform |
| 706 | //! \return void |
| 707 | //! |
| 708 | inline void SetDefaultMOCS(MOS_HW_RESOURCE_DEF mocs) |
| 709 | { |
| 710 | m_defaultMocs = mocs; |
| 711 | } |
| 712 | |
| 713 | //! |
| 714 | //! \brief Get the default MOCS for this platform |
| 715 | //! \return the default MOCS |
| 716 | //! |
| 717 | inline MOS_HW_RESOURCE_DEF GetDefaultMOCS() |
| 718 | { |
| 719 | return m_defaultMocs; |
| 720 | } |
| 721 | |
| 722 | //! \brief Check whether compressed output is needed |
| 723 | //! \return true if compression format is needed |
| 724 | //! |
| 725 | virtual bool SupportCompressedOutput() |
| 726 | { |
| 727 | return false; |
| 728 | } |
| 729 | |
| 730 | //! \brief Check whether separate scratch space is needed |
| 731 | //! \return true if separate scratch is needed |
| 732 | //! |
| 733 | virtual bool IsSeparateScratch() |
| 734 | { |
| 735 | return false; |
| 736 | } |
| 737 | |
| 738 | protected: |
| 739 | uint32_t m_platformID; |
| 740 | uint32_t m_genGT; |
| 741 | const char * m_platformStr; |
| 742 | std::vector<uint32_t> m_cisaGenIDs; |
| 743 | bool m_requestShutdownSubslicesForVmeUsage; |
| 744 | bool m_overridePowerOptionPerGpuContext; |
| 745 | bool m_redirectRcsToCcs; |
| 746 | bool m_decompress; |
| 747 | bool m_fastpathDefault; |
| 748 | MOS_HW_RESOURCE_DEF m_defaultMocs; |
| 749 | }; |
| 750 | |
| 751 | #endif // #ifndef MEDIADRIVER_AGNOSTIC_COMMON_CM_CMHALGENERIC_H_ |