| 1 |
/* |
| 2 |
* Copyright (c) 2021-2025, Intel Corporation |
| 3 |
* |
| 4 |
* Permission is hereby granted, free of charge, to any person obtaining a |
| 5 |
* copy of this software and associated documentation files (the "Software"), |
| 6 |
* to deal in the Software without restriction, including without limitation |
| 7 |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 8 |
* and/or sell copies of the Software, and to permit persons to whom the |
| 9 |
* Software is furnished to do so, subject to the following conditions: |
| 10 |
* |
| 11 |
* The above copyright notice and this permission notice shall be included |
| 12 |
* in all copies or substantial portions of the Software. |
| 13 |
* |
| 14 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
| 15 |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 16 |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 17 |
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR |
| 18 |
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
| 19 |
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
| 20 |
* OTHER DEALINGS IN THE SOFTWARE. |
| 21 |
*/ |
| 22 |
//! |
| 23 |
//! \file codec_hw_next.h |
| 24 |
//! \brief This modules implements HW interface layer to be used on all platforms on all operating systems/DDIs, across CODECHAL components. |
| 25 |
//! |
| 26 |
|
| 27 |
#ifndef __CODEC_HW_NEXT_H__ |
| 28 |
#define __CODEC_HW_NEXT_H__ |
| 29 |
|
| 30 |
#include "codechal_common.h" |
| 31 |
#include "media_interfaces_mhw_next.h" |
| 32 |
|
| 33 |
#include "mhw_mi_itf.h" |
| 34 |
#include "media_sfc_interface.h" |
| 35 |
#include "renderhal.h" |
| 36 |
#include "codechal_setting.h" |
| 37 |
#include "mhw_vdbox_vvcp_itf.h" |
| 38 |
|
| 39 |
#define HUC_DMEM_OFFSET_RTOS_GEMS 0x2000 |
| 40 |
//------------------------------------------------------------------------------ |
| 41 |
// Macros specific to MOS_CODEC_SUBCOMP_HW sub-comp |
| 42 |
//------------------------------------------------------------------------------ |
| 43 |
#define CODEC_HW_ASSERT(_expr) \ |
| 44 |
MOS_ASSERT(MOS_COMPONENT_CODEC, MOS_CODEC_SUBCOMP_HW, _expr) |
| 45 |
|
| 46 |
#define CODEC_HW_ASSERTMESSAGE(_message, ...) \ |
| 47 |
MOS_ASSERTMESSAGE(MOS_COMPONENT_CODEC, MOS_CODEC_SUBCOMP_HW, _message, ##__VA_ARGS__) |
| 48 |
|
| 49 |
#define CODEC_HW_WARNINGMESSAGE(_message, ...) \ |
| 50 |
MOS_WARNINGMESSAGE(MOS_COMPONENT_CODEC, MOS_CODEC_SUBCOMP_HW, _message, ##__VA_ARGS__) |
| 51 |
|
| 52 |
#define CODEC_HW_NORMALMESSAGE(_message, ...) \ |
| 53 |
MOS_NORMALMESSAGE(MOS_COMPONENT_CODEC, MOS_CODEC_SUBCOMP_HW, _message, ##__VA_ARGS__) |
| 54 |
|
| 55 |
#define CODEC_HW_VERBOSEMESSAGE(_message, ...) \ |
| 56 |
MOS_VERBOSEMESSAGE(MOS_COMPONENT_CODEC, MOS_CODEC_SUBCOMP_HW, _message, ##__VA_ARGS__) |
| 57 |
|
| 58 |
#define CODEC_HW_FUNCTION_ENTER \ |
| 59 |
MOS_FUNCTION_ENTER(MOS_COMPONENT_CODEC, MOS_CODEC_SUBCOMP_HW) |
| 60 |
|
| 61 |
#define CODEC_HW_CHK_STATUS(_stmt) \ |
| 62 |
MOS_CHK_STATUS(MOS_COMPONENT_CODEC, MOS_CODEC_SUBCOMP_HW, _stmt) |
| 63 |
|
| 64 |
#define CODEC_HW_CHK_STATUS_RETURN(_stmt) \ |
| 65 |
MOS_CHK_STATUS_RETURN(MOS_COMPONENT_CODEC, MOS_CODEC_SUBCOMP_HW, _stmt) |
| 66 |
|
| 67 |
#define CODEC_HW_CHK_STATUS_MESSAGE(_stmt, _message, ...) \ |
| 68 |
MOS_CHK_STATUS_MESSAGE(MOS_COMPONENT_CODEC, MOS_CODEC_SUBCOMP_HW, _stmt, _message, ##__VA_ARGS__) |
| 69 |
|
| 70 |
#define CODEC_HW_CHK_NULL(_ptr) \ |
| 71 |
MOS_CHK_NULL(MOS_COMPONENT_CODEC, MOS_CODEC_SUBCOMP_HW, _ptr) |
| 72 |
|
| 73 |
#define CODEC_HW_CHK_NULL_RETURN(_ptr) \ |
| 74 |
MOS_CHK_NULL_RETURN(MOS_COMPONENT_CODEC, MOS_CODEC_SUBCOMP_HW, _ptr) |
| 75 |
|
| 76 |
#define CODEC_HW_CHK_NULL_NO_STATUS(_ptr) \ |
| 77 |
MOS_CHK_NULL_NO_STATUS(MOS_COMPONENT_CODEC, MOS_CODEC_SUBCOMP_HW, _ptr) |
| 78 |
|
| 79 |
#define CODEC_HW_CHK_COND_RETURN(_expr, _message, ...) \ |
| 80 |
MOS_CHK_COND_RETURN(MOS_COMPONENT_CODEC, MOS_CODEC_SUBCOMP_HW,_expr,_message, ##__VA_ARGS__) |
| 81 |
|
| 82 |
#define CODECHAL_SURFACE_PITCH_ALIGNMENT 128 |
| 83 |
|
| 84 |
class MediaScalability; |
| 85 |
class MediaContext; |
| 86 |
class MediaCopyBaseState; |
| 87 |
|
| 88 |
//! Codec hw next interface |
| 89 |
/*! |
| 90 |
This class defines the interfaces for hardware dependent settings and functions used in Codechal |
| 91 |
*/ |
| 92 |
class CodechalHwInterfaceNext |
| 93 |
{ |
| 94 |
public: |
| 95 |
//! |
| 96 |
//! \brief Constructor |
| 97 |
//! |
| 98 |
CodechalHwInterfaceNext( |
| 99 |
PMOS_INTERFACE osInterface, |
| 100 |
CODECHAL_FUNCTION codecFunction, |
| 101 |
MhwInterfacesNext *mhwInterfacesNext, |
| 102 |
bool disableScalability = false); |
| 103 |
//! |
| 104 |
//! \brief Constructor |
| 105 |
//! |
| 106 |
CodechalHwInterfaceNext( |
| 107 |
PMOS_INTERFACE osInterface, |
| 108 |
bool disableScalability = false); |
| 109 |
|
| 110 |
//! |
| 111 |
//! \brief Destructor |
| 112 |
//! |
| 113 |
virtual ~CodechalHwInterfaceNext(); |
| 114 |
|
| 115 |
static CodechalHwInterfaceNext* Create( |
| 116 |
PMOS_INTERFACE osInterface, |
| 117 |
CODECHAL_FUNCTION codecFunction, |
| 118 |
MhwInterfacesNext* mhwInterfacesNext, |
| 119 |
bool disableScalability); |
| 120 |
|
| 121 |
//! |
| 122 |
//! \brief Initialize the codechal hw interface |
| 123 |
//! \details Initialize the interface before using |
| 124 |
//! |
| 125 |
//! \param [in] settings |
| 126 |
//! Settings for initialization |
| 127 |
//! |
| 128 |
//! \return MOS_STATUS |
| 129 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 130 |
//! |
| 131 |
virtual MOS_STATUS Initialize( |
| 132 |
CodechalSetting *settings); |
| 133 |
|
| 134 |
MOS_STATUS GetVdencPictureSecondLevelCommandsSize( |
| 135 |
uint32_t mode, |
| 136 |
uint32_t *commandsSize); |
| 137 |
|
| 138 |
//! \brief Create media copy |
| 139 |
//! \details Create media copy instance. |
| 140 |
//! \param osInterface |
| 141 |
//! [in] Pointer to MOS_INTERFACE. |
| 142 |
//! \return MediaCopyBaseState* |
| 143 |
//! Pointer to MediaCopyBaseState |
| 144 |
//! |
| 145 |
virtual MediaCopyBaseState *CreateMediaCopy(PMOS_INTERFACE mosInterface) |
| 146 |
{ |
| 147 |
return nullptr; |
| 148 |
} |
| 149 |
|
| 150 |
//! |
| 151 |
//! \brief Get Cacheability Settings |
| 152 |
//! \details Get Cacheability Settings in codechal hw interface |
| 153 |
//! |
| 154 |
//! \return [out] MHW_MEMORY_OBJECT_CONTROL_PARAMS* |
| 155 |
//! Cachebility Settings got. |
| 156 |
//! |
| 157 |
inline MHW_MEMORY_OBJECT_CONTROL_PARAMS *GetCacheabilitySettings() |
| 158 |
{ |
| 159 |
return m_cacheabilitySettings; |
| 160 |
} |
| 161 |
|
| 162 |
//! |
| 163 |
//! \brief Get platform |
| 164 |
//! \details Get platform in codechal hw interface |
| 165 |
//! |
| 166 |
//! \return [out] PLATFORM |
| 167 |
//! Platform got. |
| 168 |
//! |
| 169 |
inline PLATFORM GetPlatform() |
| 170 |
{ |
| 171 |
return m_platform; |
| 172 |
} |
| 173 |
|
| 174 |
//! |
| 175 |
//! \brief Get Wa table |
| 176 |
//! \details Get Wa table in codechal hw interface |
| 177 |
//! |
| 178 |
//! \return [out] MEDIA_WA_TABLE |
| 179 |
//! Wa table got. |
| 180 |
//! |
| 181 |
inline MEDIA_WA_TABLE *GetWaTable() |
| 182 |
{ |
| 183 |
return m_waTable; |
| 184 |
} |
| 185 |
|
| 186 |
//! |
| 187 |
//! \brief Get SFC interface |
| 188 |
//! \details Get SFC interface in codechal hw interface |
| 189 |
//! |
| 190 |
//! \return [out] MhwSfcInterface* |
| 191 |
//! Interface got. |
| 192 |
//! |
| 193 |
inline MhwSfcInterface *GetSfcInterface() |
| 194 |
{ |
| 195 |
return m_sfcInterface; |
| 196 |
} |
| 197 |
|
| 198 |
//! |
| 199 |
//! \brief Get renderHal interface |
| 200 |
//! \details Get renderHal interface in codechal hw interface |
| 201 |
//! |
| 202 |
//! \return [out] RENDERHAL_INTERFACE* |
| 203 |
//! Interface got. |
| 204 |
//! |
| 205 |
inline RENDERHAL_INTERFACE *GetRenderHalInterface() |
| 206 |
{ |
| 207 |
return m_renderHal; |
| 208 |
} |
| 209 |
|
| 210 |
//! |
| 211 |
//! \brief Get mfx interface |
| 212 |
//! \details Get mfx interface in codechal hw interface next |
| 213 |
//! |
| 214 |
//! \return pointer to new MFX interface |
| 215 |
//! |
| 216 |
inline std::shared_ptr<mhw::vdbox::mfx::Itf> GetMfxInterfaceNext() |
| 217 |
{ |
| 218 |
return m_mfxItf; |
| 219 |
} |
| 220 |
|
| 221 |
//! |
| 222 |
//! \brief Get avp interface |
| 223 |
//! \details Get avp interface in codechal hw interface next |
| 224 |
//! |
| 225 |
//! \return pointer to new AVP interface |
| 226 |
//! |
| 227 |
inline std::shared_ptr<mhw::vdbox::avp::Itf> GetAvpInterfaceNext() |
| 228 |
{ |
| 229 |
return m_avpItf; |
| 230 |
} |
| 231 |
|
| 232 |
//! |
| 233 |
//! \brief Get vdenc interface |
| 234 |
//! \details Get vdenc interface in codechal hw interface next |
| 235 |
//! |
| 236 |
//! \return pointer to new VDENC interface |
| 237 |
//! |
| 238 |
inline std::shared_ptr<mhw::vdbox::vdenc::Itf> GetVdencInterfaceNext() |
| 239 |
{ |
| 240 |
return m_vdencItf; |
| 241 |
} |
| 242 |
|
| 243 |
//! \brief Get huc interface |
| 244 |
//! \details Get huc interface in codechal hw interface next |
| 245 |
//! |
| 246 |
//! \return pointer to new HUC interface |
| 247 |
//! |
| 248 |
inline std::shared_ptr<mhw::vdbox::huc::Itf> GetHucInterfaceNext() |
| 249 |
{ |
| 250 |
return m_hucItf; |
| 251 |
} |
| 252 |
|
| 253 |
//! |
| 254 |
//! \brief Get mi interface |
| 255 |
//! \details Get mi interface in codechal hw interface next |
| 256 |
//! |
| 257 |
//! \return pointer to new MI interface |
| 258 |
//! |
| 259 |
inline std::shared_ptr<mhw::mi::Itf> GetMiInterfaceNext() |
| 260 |
{ |
| 261 |
return m_miItf; |
| 262 |
} |
| 263 |
|
| 264 |
//! |
| 265 |
//! \brief Get hcp interface |
| 266 |
//! \details Get hcp interface in codechal hw interface next |
| 267 |
//! |
| 268 |
//! \return pointer to new HCP interface |
| 269 |
//! |
| 270 |
inline std::shared_ptr<mhw::vdbox::hcp::Itf> GetHcpInterfaceNext() |
| 271 |
{ |
| 272 |
return m_hcpItf; |
| 273 |
} |
| 274 |
|
| 275 |
//! |
| 276 |
//! \brief Get render interface |
| 277 |
//! \details Get render interface in codechal hw interface next |
| 278 |
//! |
| 279 |
//! \return pointer to new HCP interface |
| 280 |
//! |
| 281 |
inline std::shared_ptr<mhw::render::Itf> GetRenderInterfaceNext() |
| 282 |
{ |
| 283 |
return m_renderItf; |
| 284 |
} |
| 285 |
|
| 286 |
//! |
| 287 |
//! \brief Get vvcp interface |
| 288 |
//! \details Get vvcp interface in codechal hw interface next |
| 289 |
//! |
| 290 |
//! \return pointer to new VVCP interface |
| 291 |
//! |
| 292 |
inline std::shared_ptr<mhw::vdbox::vvcp::Itf> GetVvcpInterfaceNext() |
| 293 |
{ |
| 294 |
return m_vvcpItf; |
| 295 |
} |
| 296 |
|
| 297 |
//! |
| 298 |
//! \brief Get aqm interface |
| 299 |
//! \details Get aqm interface in codechal hw interface next |
| 300 |
//! |
| 301 |
//! \return pointer to new aqm interface |
| 302 |
//! |
| 303 |
inline std::shared_ptr<mhw::vdbox::aqm::Itf> GetAqmInterfaceNext() |
| 304 |
{ |
| 305 |
return m_aqmItf; |
| 306 |
} |
| 307 |
|
| 308 |
//! |
| 309 |
//! \brief Get Os interface |
| 310 |
//! \details Get Os interface in codechal hw interface |
| 311 |
//! |
| 312 |
//! \return [out] PMOS_INTERFACE |
| 313 |
//! Interface got. |
| 314 |
//! |
| 315 |
inline PMOS_INTERFACE GetOsInterface() |
| 316 |
{ |
| 317 |
return m_osInterface; |
| 318 |
} |
| 319 |
|
| 320 |
//! |
| 321 |
//! \brief Get Sku table |
| 322 |
//! \details Get Sku table in codechal hw interface |
| 323 |
//! |
| 324 |
//! \return [out] MEDIA_FEATURE_TABLE * |
| 325 |
//! Sku table got. |
| 326 |
//! |
| 327 |
inline MEDIA_FEATURE_TABLE *GetSkuTable() |
| 328 |
{ |
| 329 |
return m_skuTable; |
| 330 |
} |
| 331 |
|
| 332 |
//! |
| 333 |
//! \brief Get cp interface |
| 334 |
//! \details Get cp interface in codechal hw interface |
| 335 |
//! |
| 336 |
//! \return [out] MhwCpInterface* |
| 337 |
//! Interface got. |
| 338 |
//! |
| 339 |
inline MhwCpInterface *GetCpInterface() |
| 340 |
{ |
| 341 |
return m_cpInterface; |
| 342 |
} |
| 343 |
|
| 344 |
inline std::shared_ptr<MediaSfcInterface> GetMediaSfcInterface() |
| 345 |
{ |
| 346 |
return m_mediaSfcItf; |
| 347 |
} |
| 348 |
|
| 349 |
inline void SetMediaSfcInterface(std::shared_ptr<MediaSfcInterface> itf) |
| 350 |
{ |
| 351 |
m_mediaSfcItf = itf; |
| 352 |
} |
| 353 |
|
| 354 |
//! |
| 355 |
//! \brief Init Cacheability Control Settings |
| 356 |
//! \details Init Cacheability Control Settings in codechal hw interface |
| 357 |
//! |
| 358 |
//! \param [in] codecFunction |
| 359 |
//! codec function used to judge how to setup cacheability control settings |
| 360 |
//! |
| 361 |
//! \return MOS_STATUS |
| 362 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 363 |
//! |
| 364 |
MOS_STATUS InitCacheabilityControlSettings( |
| 365 |
CODECHAL_FUNCTION codecFunction); |
| 366 |
|
| 367 |
|
| 368 |
//! |
| 369 |
//! \brief Init MemoryObject Cache Settings |
| 370 |
//! \details Init MemoryObject Cache Settings in codechal hw interface |
| 371 |
//! |
| 372 |
//! \return MOS_STATUS |
| 373 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 374 |
//! |
| 375 |
MOS_STATUS InitMemoryObjectCacheSettings(); |
| 376 |
|
| 377 |
//! |
| 378 |
//! \brief Get memory object of GMM Cacheability control settings |
| 379 |
//! \details Internal function to get memory object of GMM Cacheability control settings |
| 380 |
//! |
| 381 |
//! \param [in] mosUsage |
| 382 |
//! Codec usages in mos type |
| 383 |
//! |
| 384 |
//! \return MOS_STATUS |
| 385 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 386 |
//! |
| 387 |
MOS_STATUS CachePolicyGetMemoryObject( |
| 388 |
MOS_HW_RESOURCE_DEF mosUsage); |
| 389 |
|
| 390 |
uint32_t ComposeSurfaceCacheabilityControl( |
| 391 |
uint32_t cacheabiltySettingIdx, |
| 392 |
uint32_t cacheabilityTypeRequested) |
| 393 |
{ |
| 394 |
CODEC_HW_FUNCTION_ENTER; |
| 395 |
|
| 396 |
MHW_MEMORY_OBJECT_CONTROL_PARAMS cacheSetting = m_cacheabilitySettings[cacheabiltySettingIdx]; |
| 397 |
|
| 398 |
return (uint32_t)m_cacheabilitySettings[cacheabiltySettingIdx].Value; |
| 399 |
} |
| 400 |
|
| 401 |
//! |
| 402 |
//! \brief Calculates the maximum size for AVP picture level commands |
| 403 |
//! \details Client facing function to calculate the maximum size for AVP picture level commands |
| 404 |
//! \param [in] mode |
| 405 |
//! Indicate the codec mode |
| 406 |
//! \param [out] commandsSize |
| 407 |
//! The maximum command buffer size |
| 408 |
//! \param [out] patchListSize |
| 409 |
//! The maximum command patch list size |
| 410 |
//! \param [in] params |
| 411 |
//! Indicate the command size parameters |
| 412 |
//! \return MOS_STATUS |
| 413 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 414 |
//! |
| 415 |
virtual MOS_STATUS GetAvpStateCommandSize( |
| 416 |
uint32_t mode, |
| 417 |
uint32_t *commandsSize, |
| 418 |
uint32_t *patchListSize, |
| 419 |
PMHW_VDBOX_STATE_CMDSIZE_PARAMS params); |
| 420 |
|
| 421 |
//! |
| 422 |
//! \brief Calculates maximum size for AVP tile level commands |
| 423 |
//! \details Client facing function to calculate maximum size for AVP tile level commands |
| 424 |
//! \param [in] mode |
| 425 |
//! Indicate the codec mode |
| 426 |
//! \param [out] commandsSize |
| 427 |
//! The maximum command buffer size |
| 428 |
//! \param [out] patchListSize |
| 429 |
//! The maximum command patch list size |
| 430 |
//! \return MOS_STATUS |
| 431 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 432 |
//! |
| 433 |
virtual MOS_STATUS GetAvpPrimitiveCommandSize( |
| 434 |
uint32_t mode, |
| 435 |
uint32_t *commandsSize, |
| 436 |
uint32_t *patchListSize); |
| 437 |
|
| 438 |
//! |
| 439 |
//! \brief Set Cacheability Settings |
| 440 |
//! \details Set Cacheability Settings in sub interfaces in codechal hw interface |
| 441 |
//! |
| 442 |
//! \param [in] cacheabilitySettings |
| 443 |
//! cacheability Settings to set into sub mhw intefaces in hw interface |
| 444 |
//! |
| 445 |
//! \return MOS_STATUS |
| 446 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 447 |
//! |
| 448 |
virtual MOS_STATUS SetCacheabilitySettings( |
| 449 |
MHW_MEMORY_OBJECT_CONTROL_PARAMS cacheabilitySettings[MOS_CODEC_RESOURCE_USAGE_END_CODEC]); |
| 450 |
|
| 451 |
//! |
| 452 |
//! \brief Calculates the maximum size for Huc picture level commands |
| 453 |
//! \details Client facing function to calculate the maximum size for Huc picture level commands |
| 454 |
//! \param [in] mode |
| 455 |
//! Indicate the codec mode |
| 456 |
//! \param [out] commandsSize |
| 457 |
//! The maximum command buffer size |
| 458 |
//! \param [out] patchListSize |
| 459 |
//! The maximum command patch list size |
| 460 |
//! \param [in] params |
| 461 |
//! Indicate the command size parameters |
| 462 |
//! \return MOS_STATUS |
| 463 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 464 |
//! |
| 465 |
virtual MOS_STATUS GetHucStateCommandSize( |
| 466 |
uint32_t mode, |
| 467 |
uint32_t* commandsSize, |
| 468 |
uint32_t* patchListSize, |
| 469 |
PMHW_VDBOX_STATE_CMDSIZE_PARAMS params); |
| 470 |
|
| 471 |
//! |
| 472 |
//! \brief Calculates maximum size for all picture level commands |
| 473 |
//! \details Client facing function to calculate maximum size for all slice/MB level commands in mfx pipeline |
| 474 |
//! |
| 475 |
//! \param [in] mode |
| 476 |
//! Codec mode |
| 477 |
//! \param [out] commandsSize |
| 478 |
//! The maximum command buffer size |
| 479 |
//! \param [out] patchListSize |
| 480 |
//! The maximum command patch list size |
| 481 |
//! \param [in] modeSpecific |
| 482 |
//! Indicate the long or short format for decoder or single take phase for encoder |
| 483 |
//! |
| 484 |
//! \return MOS_STATUS |
| 485 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 486 |
//! |
| 487 |
virtual MOS_STATUS GetMfxStateCommandsDataSize( |
| 488 |
uint32_t mode, |
| 489 |
uint32_t *commandsSize, |
| 490 |
uint32_t *patchListSize, |
| 491 |
bool modeSpecific); |
| 492 |
|
| 493 |
//! |
| 494 |
//! \brief Calculates maximum size for all slice/MB level commands |
| 495 |
//! \details Client facing function to calculate maximum size for all slice/MB level commands in mfx pipeline |
| 496 |
//! |
| 497 |
//! \param [in] mode |
| 498 |
//! Codec mode |
| 499 |
//! \param [out] commandsSize |
| 500 |
//! The maximum command buffer size |
| 501 |
//! \param [out] patchListSize |
| 502 |
//! The maximum command patch list size |
| 503 |
//! \param [in] modeSpecific |
| 504 |
//! Indicate the long or short format for decoder or single take phase for encoder |
| 505 |
//! |
| 506 |
//! \return MOS_STATUS |
| 507 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 508 |
//! |
| 509 |
virtual MOS_STATUS GetMfxPrimitiveCommandsDataSize( |
| 510 |
uint32_t mode, |
| 511 |
uint32_t *commandsSize, |
| 512 |
uint32_t *patchListSize, |
| 513 |
bool modeSpecific); |
| 514 |
|
| 515 |
//! |
| 516 |
//! \brief Calculates maximum size for HCP slice/MB level commands |
| 517 |
//! \details Client facing function to calculate maximum size for HCP slice/MB level commands |
| 518 |
//! \param [in] mode |
| 519 |
//! Indicate the codec mode |
| 520 |
//! \param [out] commandsSize |
| 521 |
//! The maximum command buffer size |
| 522 |
//! \param [out] patchListSize |
| 523 |
//! The maximum command patch list size |
| 524 |
//! \param [in] modeSpecific |
| 525 |
//! Indicate the long or short format |
| 526 |
//! \return MOS_STATUS |
| 527 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 528 |
//! |
| 529 |
virtual MOS_STATUS GetHcpPrimitiveCommandSize( |
| 530 |
uint32_t mode, |
| 531 |
uint32_t *commandsSize, |
| 532 |
uint32_t *patchListSize, |
| 533 |
bool modeSpecific); |
| 534 |
|
| 535 |
//! |
| 536 |
//! \brief Calculates the maximum size for VVCP picture level commands |
| 537 |
//! \details Client facing function to calculate the maximum size for VVCP picture level commands |
| 538 |
//! \param [in] mode |
| 539 |
//! Indicate the codec mode |
| 540 |
//! \param [out] commandsSize |
| 541 |
//! The maximum command buffer size |
| 542 |
//! \param [out] patchListSize |
| 543 |
//! The maximum command patch list size |
| 544 |
//! \param [in] params |
| 545 |
//! Indicate the command size parameters |
| 546 |
//! \return MOS_STATUS |
| 547 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 548 |
//! |
| 549 |
MOS_STATUS GetVvcpStateCommandSize( |
| 550 |
uint32_t mode, |
| 551 |
uint32_t *commandsSize, |
| 552 |
uint32_t *patchListSize, |
| 553 |
PMHW_VDBOX_STATE_CMDSIZE_PARAMS params); |
| 554 |
|
| 555 |
//! |
| 556 |
//! \brief Calculates the size for VVCP slice level commands |
| 557 |
//! \details Client facing function to calculate the maximum size for VVCP picture level commands |
| 558 |
//! \param [in] mode |
| 559 |
//! Indicate the codec mode |
| 560 |
//! \param [out] sliceCommandsSize |
| 561 |
//! The maximum command buffer size for slice |
| 562 |
//! \param [out] slicePatchListSize |
| 563 |
//! The maximum command patch list size for slice |
| 564 |
//! \param [out] tileCommandsSize |
| 565 |
//! The maximum command buffer size for tile |
| 566 |
//! \param [out] tilePatchListSize |
| 567 |
//! The maximum command patch list size for tile |
| 568 |
//! \return MOS_STATUS |
| 569 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 570 |
//! |
| 571 |
MOS_STATUS GetVvcpPrimitiveCommandSize( |
| 572 |
uint32_t mode, |
| 573 |
uint32_t *sliceCommandsSize, |
| 574 |
uint32_t *slicePatchListSize, |
| 575 |
uint32_t *tileCommandsSize, |
| 576 |
uint32_t *tilePatchListSize); |
| 577 |
|
| 578 |
MOS_STATUS GetVvcpSliceLvlCmdSize(uint32_t *sliceLvlCmdSize); |
| 579 |
|
| 580 |
//! |
| 581 |
//! \brief Add Huc stream out copy cmds |
| 582 |
//! \details Prepare and add Huc stream out copy cmds |
| 583 |
//! |
| 584 |
//! \param [in,out] cmdBuffer |
| 585 |
//! Command buffer |
| 586 |
//! |
| 587 |
//! \return MOS_STATUS |
| 588 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 589 |
//! |
| 590 |
MOS_STATUS AddHucDummyStreamOut( |
| 591 |
PMOS_COMMAND_BUFFER cmdBuffer); |
| 592 |
|
| 593 |
//! |
| 594 |
//! \brief Perform Huc stream out copy |
| 595 |
//! \details Implement the copy using huc stream out |
| 596 |
//! |
| 597 |
//! \param [in] hucStreamOutParams |
| 598 |
//! Huc stream out parameters |
| 599 |
//! \param [in,out] cmdBuffer |
| 600 |
//! Command buffer |
| 601 |
//! |
| 602 |
//! \return MOS_STATUS |
| 603 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 604 |
//! |
| 605 |
MOS_STATUS PerformHucStreamOut( |
| 606 |
CodechalHucStreamoutParams *hucStreamOutParams, |
| 607 |
PMOS_COMMAND_BUFFER cmdBuffer); |
| 608 |
|
| 609 |
//! \brief Read HCP status for status report |
| 610 |
//! \param vdboxIndex |
| 611 |
//! [in] the vdbox index |
| 612 |
//! \param params |
| 613 |
//! [in] the parameters for HCP status read |
| 614 |
//! \param cmdBuffer |
| 615 |
//! [in, out] the command buffer |
| 616 |
//! \return MOS_STATUS |
| 617 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 618 |
//! |
| 619 |
MOS_STATUS ReadHcpStatus( |
| 620 |
MHW_VDBOX_NODE_IND vdboxIndex, |
| 621 |
const EncodeStatusReadParams ¶ms, |
| 622 |
PMOS_COMMAND_BUFFER cmdBuffer); |
| 623 |
|
| 624 |
//! |
| 625 |
//! \brief Read HCP specific image status for status report |
| 626 |
//! \param vdboxIndex |
| 627 |
//! [in] the vdbox index |
| 628 |
//! \param params |
| 629 |
//! [in] the parameters for HCP IMG status read |
| 630 |
//! \param cmdBuffer |
| 631 |
//! [in, out] the command buffer |
| 632 |
//! \return MOS_STATUS |
| 633 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 634 |
//! |
| 635 |
MOS_STATUS ReadImageStatusForHcp( |
| 636 |
MHW_VDBOX_NODE_IND vdboxIndex, |
| 637 |
const EncodeStatusReadParams ¶ms, |
| 638 |
PMOS_COMMAND_BUFFER cmdBuffer); |
| 639 |
|
| 640 |
MHW_VDBOX_NODE_IND GetMaxVdboxIndex() |
| 641 |
{ |
| 642 |
return MEDIA_IS_SKU(m_skuTable, FtrVcs2) ? MHW_VDBOX_NODE_2 : MHW_VDBOX_NODE_1; |
| 643 |
}; |
| 644 |
|
| 645 |
//! |
| 646 |
//! \brief Check if disable scalability by default |
| 647 |
//! \return bool |
| 648 |
//! True if it is to disable scalability by default, else it is not. |
| 649 |
//! |
| 650 |
bool IsDisableScalability() |
| 651 |
{ |
| 652 |
return m_disableScalability; |
| 653 |
} |
| 654 |
|
| 655 |
//! |
| 656 |
//! \brief Resizes the cmd buffer and patch list |
| 657 |
//! \details Resizes the buffer to be used for rendering GPU commands |
| 658 |
//! |
| 659 |
//! \param [in] requestedCommandBufferSize |
| 660 |
//! Requested resize command buffer size |
| 661 |
//! \param [in] requestedPatchListSize |
| 662 |
//! Requested resize patchlist size |
| 663 |
//! |
| 664 |
//! \return MOS_STATUS |
| 665 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 666 |
//! |
| 667 |
MOS_STATUS ResizeCommandBufferAndPatchList( |
| 668 |
uint32_t requestedCommandBufferSize, |
| 669 |
uint32_t requestedPatchListSize) |
| 670 |
{ |
| 671 |
CODEC_HW_FUNCTION_ENTER; |
| 672 |
|
| 673 |
if (m_osInterface->bUsesCmdBufHeaderInResize) |
| 674 |
{ |
| 675 |
return ResizeCommandBufferAndPatchListCmd(requestedCommandBufferSize, requestedPatchListSize); |
| 676 |
} |
| 677 |
else |
| 678 |
{ |
| 679 |
return ResizeCommandBufferAndPatchListOs(requestedCommandBufferSize, requestedPatchListSize); |
| 680 |
} |
| 681 |
} |
| 682 |
|
| 683 |
|
| 684 |
MediaScalability *m_singlePipeScalability = nullptr; |
| 685 |
MediaScalability *m_multiPipeScalability = nullptr; |
| 686 |
MOS_STATUS(*pfnCreateDecodeSinglePipe) |
| 687 |
(void *hwInterface, MediaContext *mediaContext, uint8_t componentType) = nullptr; |
| 688 |
MOS_STATUS(*pfnCreateDecodeMultiPipe) |
| 689 |
(void *hwInterface, MediaContext *mediaContext, uint8_t componentType) = nullptr; |
| 690 |
|
| 691 |
//! |
| 692 |
//! \brief Select Vdbox by index and get MMIO register |
| 693 |
//! \details Uses input parameters to Select VDBOX from KMD and get MMIO register |
| 694 |
//! \param index |
| 695 |
//! [in] vdbox index interface |
| 696 |
//! \param pCmdBuffer |
| 697 |
//! [in] get mos vdbox id from cmd buffer |
| 698 |
//! \return MmioRegistersMfx |
| 699 |
//! return the vdbox mmio register |
| 700 |
//! |
| 701 |
MmioRegistersMfx *SelectVdAndGetMmioReg( |
| 702 |
MHW_VDBOX_NODE_IND index, |
| 703 |
PMOS_COMMAND_BUFFER pCmdBuffer); |
| 704 |
|
| 705 |
//! |
| 706 |
//! \brief Init L3 Cache Settings |
| 707 |
//! |
| 708 |
//! \return MOS_STATUS |
| 709 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 710 |
//! |
| 711 |
virtual MOS_STATUS InitL3CacheSettings(); |
| 712 |
|
| 713 |
//! |
| 714 |
//! \brief Set Rowstore Cache offsets |
| 715 |
//! \details Set Rowstore Cache offsets in sub interfaces in codechal hw interface |
| 716 |
//! |
| 717 |
//! \param [in] rowstoreParams |
| 718 |
//! parameters to set rowstore cache offsets |
| 719 |
//! |
| 720 |
//! \return MOS_STATUS |
| 721 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 722 |
//! |
| 723 |
virtual MOS_STATUS SetRowstoreCachingOffsets( |
| 724 |
PMHW_VDBOX_ROWSTORE_PARAMS rowstoreParams); |
| 725 |
|
| 726 |
bool UsesRenderEngine(CODECHAL_FUNCTION codecFunction, uint32_t standard) |
| 727 |
{ |
| 728 |
if (codecFunction == CODECHAL_FUNCTION_ENC || |
| 729 |
(codecFunction == CODECHAL_FUNCTION_ENC_PAK) || |
| 730 |
codecFunction == CODECHAL_FUNCTION_HYBRIDPAK || |
| 731 |
((codecFunction == CODECHAL_FUNCTION_DECODE) && (standard == CODECHAL_VC1)) || |
| 732 |
codecFunction == CODECHAL_FUNCTION_ENC_VDENC_PAK || |
| 733 |
codecFunction == CODECHAL_FUNCTION_FEI_PRE_ENC || |
| 734 |
codecFunction == CODECHAL_FUNCTION_FEI_ENC || |
| 735 |
codecFunction == CODECHAL_FUNCTION_FEI_ENC_PAK) |
| 736 |
{ |
| 737 |
return true; |
| 738 |
} |
| 739 |
|
| 740 |
return false; |
| 741 |
} |
| 742 |
|
| 743 |
//! |
| 744 |
//! \brief Send mi atomic dword cmd with indirect data (non-inline) mode |
| 745 |
//! \details Send mi atomic dword cmd for sync perpose |
| 746 |
//! |
| 747 |
//! \param [in] resource |
| 748 |
//! Reource used in mi atomic dword cmd |
| 749 |
//! \param [in] opCode |
| 750 |
//! Operation code |
| 751 |
//! \param [in,out] cmdBuffer |
| 752 |
//! command buffer |
| 753 |
//! |
| 754 |
//! \return MOS_STATUS |
| 755 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 756 |
//! |
| 757 |
MOS_STATUS SendMiAtomicDwordIndirectDataCmd( |
| 758 |
PMOS_RESOURCE resource, |
| 759 |
MHW_COMMON_MI_ATOMIC_OPCODE opCode, |
| 760 |
PMOS_COMMAND_BUFFER cmdBuffer) |
| 761 |
{ |
| 762 |
MOS_STATUS eStatus = MOS_STATUS_SUCCESS; |
| 763 |
|
| 764 |
CODEC_HW_FUNCTION_ENTER; |
| 765 |
CODEC_HW_CHK_NULL_RETURN(m_miItf); |
| 766 |
|
| 767 |
auto ¶ms = m_miItf->MHW_GETPAR_F(MI_ATOMIC)(); |
| 768 |
params = {}; |
| 769 |
params.pOsResource = resource; |
| 770 |
params.dwDataSize = sizeof(uint32_t); |
| 771 |
params.Operation = (mhw::mi::MHW_COMMON_MI_ATOMIC_OPCODE) opCode; |
| 772 |
params.bInlineData = false; |
| 773 |
eStatus = m_miItf->MHW_ADDCMD_F(MI_ATOMIC)(cmdBuffer); |
| 774 |
|
| 775 |
return eStatus; |
| 776 |
} |
| 777 |
|
| 778 |
//! |
| 779 |
//! \brief Send mi atomic dword cmd |
| 780 |
//! \details Send mi atomic dword cmd for sync perpose |
| 781 |
//! |
| 782 |
//! \param [in] resource |
| 783 |
//! Reource used in mi atomic dword cmd |
| 784 |
//! \param [in] immData |
| 785 |
//! Immediate data |
| 786 |
//! \param [in] opCode |
| 787 |
//! Operation code |
| 788 |
//! \param [in,out] cmdBuffer |
| 789 |
//! command buffer |
| 790 |
//! |
| 791 |
//! \return MOS_STATUS |
| 792 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 793 |
//! |
| 794 |
MOS_STATUS SendMiAtomicDwordCmd( |
| 795 |
PMOS_RESOURCE resource, |
| 796 |
uint32_t immData, |
| 797 |
MHW_COMMON_MI_ATOMIC_OPCODE opCode, |
| 798 |
PMOS_COMMAND_BUFFER cmdBuffer) |
| 799 |
{ |
| 800 |
MOS_STATUS eStatus = MOS_STATUS_SUCCESS; |
| 801 |
|
| 802 |
CODEC_HW_FUNCTION_ENTER; |
| 803 |
CODEC_HW_CHK_NULL_RETURN(m_miItf); |
| 804 |
|
| 805 |
auto ¶ms = m_miItf->MHW_GETPAR_F(MI_ATOMIC)(); |
| 806 |
params = {}; |
| 807 |
params.pOsResource = resource; |
| 808 |
params.dwDataSize = sizeof(uint32_t); |
| 809 |
params.Operation = (mhw::mi::MHW_COMMON_MI_ATOMIC_OPCODE) opCode; |
| 810 |
params.bInlineData = true; |
| 811 |
params.dwOperand1Data[0] = immData; |
| 812 |
eStatus = m_miItf->MHW_ADDCMD_F(MI_ATOMIC)(cmdBuffer); |
| 813 |
|
| 814 |
return eStatus; |
| 815 |
} |
| 816 |
|
| 817 |
//! |
| 818 |
//! \brief Send hw semphore wait cmd |
| 819 |
//! \details Send hw semphore wait cmd for sync perpose |
| 820 |
//! |
| 821 |
//! \param [in] semaMem |
| 822 |
//! Reource of Hw semphore |
| 823 |
//! \param [in] semaData |
| 824 |
//! Data of Hw semphore |
| 825 |
//! \param [in] opCode |
| 826 |
//! Operation code |
| 827 |
//! \param [in,out] cmdBuffer |
| 828 |
//! command buffer |
| 829 |
//! |
| 830 |
//! \return MOS_STATUS |
| 831 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 832 |
//! |
| 833 |
MOS_STATUS SendHwSemaphoreWaitCmd( |
| 834 |
PMOS_RESOURCE semaMem, |
| 835 |
uint32_t semaData, |
| 836 |
MHW_COMMON_MI_SEMAPHORE_COMPARE_OPERATION opCode, |
| 837 |
PMOS_COMMAND_BUFFER cmdBuffer, |
| 838 |
uint32_t semaMemOffset = 0) |
| 839 |
{ |
| 840 |
CODEC_HW_FUNCTION_ENTER; |
| 841 |
MOS_STATUS eStatus = MOS_STATUS_SUCCESS; |
| 842 |
|
| 843 |
CODEC_HW_CHK_NULL_RETURN(m_miItf); |
| 844 |
|
| 845 |
// Check if 64-bit hardware semaphore is supported |
| 846 |
bool isSemaphore64Supported = MEDIA_IS_SKU(m_osInterface->pfnGetSkuTable(m_osInterface), FtrHwSemaphore64); |
| 847 |
|
| 848 |
#ifdef _MEDIA_RESERVED |
| 849 |
if (isSemaphore64Supported) |
| 850 |
{ |
| 851 |
// Use MI_SEMAPHORE_WAIT_64 for 64-bit semaphore support |
| 852 |
auto ¶ms = m_miItf->MHW_GETPAR_F(MI_SEMAPHORE_WAIT_64)(); |
| 853 |
params = {}; |
| 854 |
|
| 855 |
// Initialize parameters using helper macro |
| 856 |
// This macro hardcodes semaphoreToken to 0 and sets other parameters |
| 857 |
INIT_MHW_MI_SEMAPHORE_WAIT_64_PARAMS_SCALABILITY(params, semaMem, semaData, opCode, semaMemOffset); |
| 858 |
|
| 859 |
eStatus = m_miItf->MHW_ADDCMD_F(MI_SEMAPHORE_WAIT_64)(cmdBuffer); |
| 860 |
} |
| 861 |
else |
| 862 |
#endif |
| 863 |
{ |
| 864 |
// Fallback to MI_SEMAPHORE_WAIT for platforms without 64-bit support |
| 865 |
// or when _MEDIA_RESERVED is not defined |
| 866 |
auto ¶ms = m_miItf->MHW_GETPAR_F(MI_SEMAPHORE_WAIT)(); |
| 867 |
params = {}; |
| 868 |
params.presSemaphoreMem = semaMem; |
| 869 |
params.bPollingWaitMode = true; |
| 870 |
params.dwSemaphoreData = semaData; |
| 871 |
params.CompareOperation = (mhw::mi::MHW_COMMON_MI_SEMAPHORE_COMPARE_OPERATION) opCode; |
| 872 |
params.dwResourceOffset = semaMemOffset; |
| 873 |
eStatus = m_miItf->MHW_ADDCMD_F(MI_SEMAPHORE_WAIT)(cmdBuffer); |
| 874 |
} |
| 875 |
|
| 876 |
return eStatus; |
| 877 |
} |
| 878 |
|
| 879 |
//! |
| 880 |
//! \brief Check if simulation/emulation is active |
| 881 |
//! \return bool |
| 882 |
//! True if simulation/emulation is active, else false. |
| 883 |
//! |
| 884 |
bool IsSimActive() |
| 885 |
{ |
| 886 |
return m_osInterface ? m_osInterface->bSimIsActive : false; |
| 887 |
} |
| 888 |
|
| 889 |
//! |
| 890 |
//! \brief Send mi store data imm cmd |
| 891 |
//! \param [in] resource |
| 892 |
//! Reource used in mi store data imm cmd |
| 893 |
//! \param [in] immData |
| 894 |
//! Immediate data |
| 895 |
//! \param [in,out] cmdBuffer |
| 896 |
//! command buffer |
| 897 |
//! |
| 898 |
//! \return MOS_STATUS |
| 899 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 900 |
//! |
| 901 |
MOS_STATUS SendMiStoreDataImm( |
| 902 |
PMOS_RESOURCE resource, |
| 903 |
uint32_t immData, |
| 904 |
PMOS_COMMAND_BUFFER cmdBuffer) |
| 905 |
{ |
| 906 |
MOS_STATUS eStatus = MOS_STATUS_SUCCESS; |
| 907 |
|
| 908 |
CODEC_HW_FUNCTION_ENTER; |
| 909 |
|
| 910 |
CODEC_HW_CHK_NULL_RETURN(resource); |
| 911 |
CODEC_HW_CHK_NULL_RETURN(cmdBuffer); |
| 912 |
|
| 913 |
CODEC_HW_CHK_NULL_RETURN(m_miItf); |
| 914 |
auto ¶ms = m_miItf->MHW_GETPAR_F(MI_STORE_DATA_IMM)(); |
| 915 |
params = {}; |
| 916 |
params.pOsResource = resource; |
| 917 |
params.dwResourceOffset = 0; |
| 918 |
params.dwValue = immData; |
| 919 |
eStatus = m_miItf->MHW_ADDCMD_F(MI_STORE_DATA_IMM)(cmdBuffer); |
| 920 |
|
| 921 |
return eStatus; |
| 922 |
} |
| 923 |
|
| 924 |
// Hardware dependent parameters |
| 925 |
bool m_turboMode = false; //!> Turbo mode info to pass in cmdBuf |
| 926 |
bool m_isVdencSuperSliceEnabled = false; //!> Flag indicating Vdenc super slice is enabled |
| 927 |
uint16_t m_sizeOfCmdBatchBufferEnd = 0; //!> Size of batch buffer end cmd |
| 928 |
uint16_t m_sizeOfCmdMediaReset = 0; //!> Size of media reset cmd |
| 929 |
uint32_t m_vdencBrcImgStateBufferSize = 0; //!> vdenc brc img state buffer size |
| 930 |
uint32_t m_vdencBatchBuffer1stGroupSize = 0; //!> vdenc batch buffer 1st group size |
| 931 |
uint32_t m_vdencBatchBuffer2ndGroupSize = 0; //!> vdenc batch buffer 2nd group size |
| 932 |
uint32_t m_vdencReadBatchBufferSize = 0; //!> vdenc read batch buffer size for group1 and group2 |
| 933 |
uint32_t m_vdenc2ndLevelBatchBufferSize = 0; //!> vdenc 2nd level batch buffer size |
| 934 |
uint32_t m_vdencBatchBufferPerSliceConstSize = 0; //!> vdenc batch buffer per slice const size |
| 935 |
uint32_t m_HucStitchCmdBatchBufferSize = 0; //!> huc stitch cmd 2nd level batch buffer size |
| 936 |
uint32_t m_pakIntTileStatsSize = 0; //!> Size of combined statistics across all tiles |
| 937 |
uint32_t m_pakIntAggregatedFrameStatsSize = 0; //!> Size of HEVC/ VP9 PAK Stats, HEVC Slice Streamout, VDEnc Stats |
| 938 |
uint32_t m_tileRecordSize = 0; //!> Tile record size |
| 939 |
uint32_t m_hucCommandBufferSize = 0; //!> Size of a single HuC command buffer |
| 940 |
|
| 941 |
// Slice/Sub-slice/EU Shutdown Parameters |
| 942 |
uint32_t m_numRequestedEuSlices = 0; //!> Number of requested Slices |
| 943 |
uint32_t m_numRequestedSubSlices = 0; //!> Number of requested Sub-slices |
| 944 |
uint32_t m_numRequestedEus = 0; //!> Number of requested EUs |
| 945 |
bool m_enableCodecMmc = false; //!> Flag to indicate if enable codec MMC by default or not |
| 946 |
|
| 947 |
//! \brief default disable the get vdbox node by UMD, decided by MHW and MOS |
| 948 |
bool m_getVdboxNodeByUMD = false; |
| 949 |
|
| 950 |
void *legacyHwInterface = nullptr; |
| 951 |
|
| 952 |
protected: |
| 953 |
|
| 954 |
#if (_DEBUG || _RELEASE_INTERNAL) |
| 955 |
MOS_STATUS InitL3ControlUserFeatureSettings( |
| 956 |
mhw::render::MHW_RENDER_ENGINE_L3_CACHE_CONFIG *l3CacheConfig, |
| 957 |
mhw::render::MHW_RENDER_ENGINE_L3_CACHE_SETTINGS *l3Overrides); |
| 958 |
#endif |
| 959 |
|
| 960 |
//! |
| 961 |
//! \brief Send conditional batch buffer end cmd |
| 962 |
//! \details Send conditional batch buffer end cmd |
| 963 |
//! |
| 964 |
//! \param [in] resource |
| 965 |
//! Reource used in conditional batch buffer end cmd |
| 966 |
//! \param [in] offset |
| 967 |
//! Reource offset used in mi atomic dword cmd |
| 968 |
//! \param [in] compData |
| 969 |
//! Compare data |
| 970 |
//! \param [in] disableCompMask |
| 971 |
//! Indicate disabling compare mask |
| 972 |
//! \param [in,out] cmdBuffer |
| 973 |
//! command buffer |
| 974 |
//! |
| 975 |
//! \return MOS_STATUS |
| 976 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 977 |
//! |
| 978 |
MOS_STATUS SendCondBbEndCmd( |
| 979 |
PMOS_RESOURCE resource, |
| 980 |
uint32_t offset, |
| 981 |
uint32_t compData, |
| 982 |
bool disableCompMask, |
| 983 |
PMOS_COMMAND_BUFFER cmdBuffer) |
| 984 |
{ |
| 985 |
MOS_STATUS eStatus = MOS_STATUS_SUCCESS; |
| 986 |
|
| 987 |
CODEC_HW_FUNCTION_ENTER; |
| 988 |
|
| 989 |
if (!Mos_ResourceIsNull(&m_conditionalBbEndDummy)) |
| 990 |
{ |
| 991 |
auto &miFlushDwParams = m_miItf->MHW_GETPAR_F(MI_FLUSH_DW)(); |
| 992 |
miFlushDwParams = {}; |
| 993 |
miFlushDwParams.postSyncOperation = 1; |
| 994 |
miFlushDwParams.pOsResource = &m_conditionalBbEndDummy; |
| 995 |
miFlushDwParams.dwDataDW1 = 0; |
| 996 |
CODEC_HW_CHK_STATUS_RETURN(m_miItf->MHW_ADDCMD_F(MI_FLUSH_DW)(cmdBuffer)); |
| 997 |
} |
| 998 |
|
| 999 |
auto &miConditionalBatchBufferEndParams = m_miItf->MHW_GETPAR_F(MI_CONDITIONAL_BATCH_BUFFER_END)(); |
| 1000 |
miConditionalBatchBufferEndParams = {}; |
| 1001 |
miConditionalBatchBufferEndParams.presSemaphoreBuffer = resource; |
| 1002 |
miConditionalBatchBufferEndParams.dwOffset = offset; |
| 1003 |
miConditionalBatchBufferEndParams.dwValue = compData; |
| 1004 |
miConditionalBatchBufferEndParams.bDisableCompareMask = disableCompMask; |
| 1005 |
CODEC_HW_CHK_STATUS_RETURN(m_miItf->MHW_ADDCMD_F(MI_CONDITIONAL_BATCH_BUFFER_END)(cmdBuffer)); |
| 1006 |
|
| 1007 |
return eStatus; |
| 1008 |
} |
| 1009 |
|
| 1010 |
MOS_STATUS ResizeCommandBufferAndPatchListCmd( |
| 1011 |
uint32_t requestedCommandBufferSize, |
| 1012 |
uint32_t requestedPatchListSize) |
| 1013 |
{ |
| 1014 |
MOS_STATUS eStatus = MOS_STATUS_SUCCESS; |
| 1015 |
|
| 1016 |
CODEC_HW_FUNCTION_ENTER; |
| 1017 |
|
| 1018 |
CODEC_HW_CHK_NULL_RETURN(m_miItf); |
| 1019 |
|
| 1020 |
MOS_COMMAND_BUFFER cmdBuffer; |
| 1021 |
|
| 1022 |
CODEC_HW_CHK_STATUS_RETURN(m_osInterface->pfnGetCommandBuffer(m_osInterface, &cmdBuffer, 0)); |
| 1023 |
CODEC_HW_CHK_STATUS_RETURN(m_miItf->MHW_ADDCMD_F(MI_NOOP)(&cmdBuffer, nullptr)); |
| 1024 |
m_osInterface->pfnReturnCommandBuffer(m_osInterface, &cmdBuffer, 0); |
| 1025 |
CODEC_HW_CHK_STATUS_RETURN(m_osInterface->pfnResizeCommandBufferAndPatchList(m_osInterface, requestedCommandBufferSize, requestedPatchListSize, 0)); |
| 1026 |
|
| 1027 |
return eStatus; |
| 1028 |
} |
| 1029 |
|
| 1030 |
MOS_STATUS ResizeCommandBufferAndPatchListOs( |
| 1031 |
uint32_t requestedCommandBufferSize, |
| 1032 |
uint32_t requestedPatchListSize) |
| 1033 |
{ |
| 1034 |
MOS_STATUS eStatus = MOS_STATUS_SUCCESS; |
| 1035 |
|
| 1036 |
CODEC_HW_CHK_STATUS_RETURN(m_osInterface->pfnResizeCommandBufferAndPatchList(m_osInterface, requestedCommandBufferSize, requestedPatchListSize, 0)); |
| 1037 |
|
| 1038 |
return eStatus; |
| 1039 |
} |
| 1040 |
|
| 1041 |
protected: |
| 1042 |
std::shared_ptr<mhw::vdbox::avp::Itf> m_avpItf = nullptr; //!< Pointer to Mhw avp interface |
| 1043 |
std::shared_ptr<mhw::vdbox::vdenc::Itf> m_vdencItf = nullptr; //!< Pointer to Mhw vdenc interface |
| 1044 |
std::shared_ptr<mhw::vdbox::huc::Itf> m_hucItf = nullptr; //!< Pointer to Mhw huc interface |
| 1045 |
std::shared_ptr<mhw::mi::Itf> m_miItf = nullptr; //!< Pointer to Mhw mi interface |
| 1046 |
std::shared_ptr<mhw::vdbox::hcp::Itf> m_hcpItf = nullptr; //!< Pointer to Mhw hcp interface |
| 1047 |
std::shared_ptr<mhw::vdbox::mfx::Itf> m_mfxItf = nullptr; //!< Pointer to Mhw mfx interface |
| 1048 |
std::shared_ptr<mhw::render::Itf> m_renderItf = nullptr; //!< Pointer to render interface |
| 1049 |
std::shared_ptr<MediaSfcInterface> m_mediaSfcItf = nullptr; //!< Pointer to Media sfc interface |
| 1050 |
std::shared_ptr<mhw::vdbox::vvcp::Itf> m_vvcpItf = nullptr; |
| 1051 |
std::shared_ptr<mhw::vdbox::aqm::Itf> m_aqmItf = nullptr; |
| 1052 |
// States |
| 1053 |
PMOS_INTERFACE m_osInterface; //!< Pointer to OS interface |
| 1054 |
|
| 1055 |
MediaUserSettingSharedPtr m_userSettingPtr = nullptr; |
| 1056 |
|
| 1057 |
// Auxiliary |
| 1058 |
PLATFORM m_platform; //!< Platform information |
| 1059 |
|
| 1060 |
MHW_STATE_HEAP_SETTINGS m_stateHeapSettings; //!< State heap Mhw settings |
| 1061 |
MhwCpInterface *m_cpInterface = nullptr; //!< Pointer to Mhw cp interface |
| 1062 |
RENDERHAL_INTERFACE *m_renderHal = nullptr; //!< RenderHal interface |
| 1063 |
MhwCpInterface *m_renderHalCpInterface = nullptr; //!< Pointer to RenderHal cp interface |
| 1064 |
MhwVeboxInterface *m_veboxInterface = nullptr; //!< Pointer to Mhw vebox interface |
| 1065 |
MhwSfcInterface *m_sfcInterface = nullptr; //!< Pointer to Mhw sfc interface |
| 1066 |
MHW_MEMORY_OBJECT_CONTROL_PARAMS m_cacheabilitySettings[MOS_CODEC_RESOURCE_USAGE_END_CODEC]; //!< Cacheability Settings list |
| 1067 |
bool m_disableScalability = false; //!> Flag to indicate if disable scalability by default |
| 1068 |
CODECHAL_SSEU_SETTING const *m_ssEuTable = nullptr; //!< Pointer to the default SSEU settings table |
| 1069 |
uint16_t m_numMediaStates = CODECHAL_NUM_MEDIA_STATES; //!< number of media states |
| 1070 |
uint32_t m_maxKernelLoadCmdSize = 0; //!> Max kernel load cmd size |
| 1071 |
#if (_DEBUG || _RELEASE_INTERNAL) |
| 1072 |
bool m_numRequestedOverride = false; //!> Flag to indicate whether these params are set by Reg |
| 1073 |
uint32_t m_numRequestedEuSlicesOverride = 0; //!> Number of requested Slices set by Reg |
| 1074 |
uint32_t m_numRequestedSubSlicesOverride = 0; //!> Number of requested Sub-slices set by Reg |
| 1075 |
uint32_t m_numRequestedEusOverride = 0; //!> Number of requested EUs set by Reg |
| 1076 |
#endif |
| 1077 |
|
| 1078 |
uint32_t m_sizeOfCmdMediaObject = 0; //!> Size of media object cmd |
| 1079 |
uint32_t m_sizeOfCmdMediaStateFlush = 0; //!> Size of media state flush cmd |
| 1080 |
// COND BBE WA |
| 1081 |
MOS_RESOURCE m_conditionalBbEndDummy; //!> Dummy Resource for conditional batch buffer end WA |
| 1082 |
|
| 1083 |
|
| 1084 |
// Auxiliary |
| 1085 |
MEDIA_FEATURE_TABLE *m_skuTable = nullptr; //!< Pointer to SKU table |
| 1086 |
MEDIA_WA_TABLE *m_waTable = nullptr; //!< Pointer to WA table |
| 1087 |
|
| 1088 |
// HuC WA implementation |
| 1089 |
MOS_RESOURCE m_dummyStreamIn; //!> Resource of dummy stream in |
| 1090 |
MOS_RESOURCE m_dummyStreamOut; //!> Resource of dummy stream out |
| 1091 |
MOS_RESOURCE m_hucDmemDummy; //!> Resource of Huc DMEM for dummy streamout WA |
| 1092 |
uint32_t m_dmemBufSize = 0; //!> |
| 1093 |
|
| 1094 |
bool m_checkBankCount = false; //!> Used to check L3 cache enable |
| 1095 |
|
| 1096 |
MEDIA_CLASS_DEFINE_END(CodechalHwInterfaceNext) |
| 1097 |
}; |
| 1098 |
|
| 1099 |
#endif // __CODEC_HW_NEXT_H__ |