| 1 |
/* |
| 2 |
* Copyright (c) 2011-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 codechal_hw.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 __CODECHAL_HW_H__ |
| 28 |
#define __CODECHAL_HW_H__ |
| 29 |
|
| 30 |
#include "codechal.h" |
| 31 |
#include "renderhal_legacy.h" |
| 32 |
#include "mhw_mi.h" |
| 33 |
#include "mhw_render_legacy.h" |
| 34 |
#include "mhw_state_heap.h" |
| 35 |
#include "mhw_vdbox.h" |
| 36 |
#include "mhw_vebox.h" |
| 37 |
#include "mhw_sfc.h" |
| 38 |
#include "mhw_cp_interface.h" |
| 39 |
#include "media_copy.h" |
| 40 |
#include "media_blt_copy.h" |
| 41 |
|
| 42 |
#include "mhw_vdbox_mfx_interface.h" |
| 43 |
#include "mhw_vdbox_hcp_interface.h" |
| 44 |
#include "mhw_vdbox_avp_interface.h" |
| 45 |
#include "mhw_vdbox_huc_interface.h" |
| 46 |
#include "mhw_vdbox_vdenc_interface.h" |
| 47 |
#include "mhw_vdbox_hcp_itf.h" |
| 48 |
|
| 49 |
#include "media_interfaces_mhw.h" |
| 50 |
#include "media_sfc_interface.h" |
| 51 |
|
| 52 |
#include "gfxmacro.h" |
| 53 |
|
| 54 |
#include "codec_hw_next.h" |
| 55 |
|
| 56 |
//------------------------------------------------------------------------------ |
| 57 |
// Macros specific to MOS_CODEC_SUBCOMP_HW sub-comp |
| 58 |
//------------------------------------------------------------------------------ |
| 59 |
#define CODECHAL_HW_ASSERT(_expr) \ |
| 60 |
MOS_ASSERT(MOS_COMPONENT_CODEC, MOS_CODEC_SUBCOMP_HW, _expr) |
| 61 |
|
| 62 |
#define CODECHAL_HW_ASSERTMESSAGE(_message, ...) \ |
| 63 |
MOS_ASSERTMESSAGE(MOS_COMPONENT_CODEC, MOS_CODEC_SUBCOMP_HW, _message, ##__VA_ARGS__) |
| 64 |
|
| 65 |
#define CODECHAL_HW_WARNINGMESSAGE(_message, ...) \ |
| 66 |
MOS_WARNINGMESSAGE(MOS_COMPONENT_CODEC, MOS_CODEC_SUBCOMP_HW, _message, ##__VA_ARGS__) |
| 67 |
|
| 68 |
#define CODECHAL_HW_NORMALMESSAGE(_message, ...) \ |
| 69 |
MOS_NORMALMESSAGE(MOS_COMPONENT_CODEC, MOS_CODEC_SUBCOMP_HW, _message, ##__VA_ARGS__) |
| 70 |
|
| 71 |
#define CODECHAL_HW_VERBOSEMESSAGE(_message, ...) \ |
| 72 |
MOS_VERBOSEMESSAGE(MOS_COMPONENT_CODEC, MOS_CODEC_SUBCOMP_HW, _message, ##__VA_ARGS__) |
| 73 |
|
| 74 |
#define CODECHAL_HW_FUNCTION_ENTER \ |
| 75 |
MOS_FUNCTION_ENTER(MOS_COMPONENT_CODEC, MOS_CODEC_SUBCOMP_HW) |
| 76 |
|
| 77 |
#define CODECHAL_HW_CHK_STATUS(_stmt) \ |
| 78 |
MOS_CHK_STATUS(MOS_COMPONENT_CODEC, MOS_CODEC_SUBCOMP_HW, _stmt) |
| 79 |
|
| 80 |
#define CODECHAL_HW_CHK_STATUS_RETURN(_stmt) \ |
| 81 |
MOS_CHK_STATUS_RETURN(MOS_COMPONENT_CODEC, MOS_CODEC_SUBCOMP_HW, _stmt) |
| 82 |
|
| 83 |
#define CODECHAL_HW_CHK_STATUS_MESSAGE(_stmt, _message, ...) \ |
| 84 |
MOS_CHK_STATUS_MESSAGE(MOS_COMPONENT_CODEC, MOS_CODEC_SUBCOMP_HW, _stmt, _message, ##__VA_ARGS__) |
| 85 |
|
| 86 |
#define CODECHAL_HW_CHK_NULL(_ptr) \ |
| 87 |
MOS_CHK_NULL(MOS_COMPONENT_CODEC, MOS_CODEC_SUBCOMP_HW, _ptr) |
| 88 |
|
| 89 |
#define CODECHAL_HW_CHK_NULL_RETURN(_ptr) \ |
| 90 |
MOS_CHK_NULL_RETURN(MOS_COMPONENT_CODEC, MOS_CODEC_SUBCOMP_HW, _ptr) |
| 91 |
|
| 92 |
#define CODECHAL_HW_CHK_NULL_NO_STATUS(_ptr) \ |
| 93 |
MOS_CHK_NULL_NO_STATUS(MOS_COMPONENT_CODEC, MOS_CODEC_SUBCOMP_HW, _ptr) |
| 94 |
|
| 95 |
#define CODECHAL_HW_CHK_COND_RETURN(_expr, _message, ...) \ |
| 96 |
MOS_CHK_COND_RETURN(MOS_COMPONENT_CODEC, MOS_CODEC_SUBCOMP_HW,_expr,_message, ##__VA_ARGS__) |
| 97 |
|
| 98 |
#define CODECHAL_SURFACE_PITCH_ALIGNMENT 128 |
| 99 |
|
| 100 |
#define CODECHAL_MEDIA_WALKER_MAX_COLORS 16 // 4 Bits for color field gives max 16 colors |
| 101 |
|
| 102 |
#define CODECHAL_VDIRECTION_FRAME 2 |
| 103 |
#define CODECHAL_VDIRECTION_TOP_FIELD 1 |
| 104 |
#define CODECHAL_VDIRECTION_BOT_FIELD 3 |
| 105 |
#define CODECHAL_VLINESTRIDE_FRAME 0 |
| 106 |
#define CODECHAL_VLINESTRIDE_FIELD 1 |
| 107 |
#define CODECHAL_VLINESTRIDEOFFSET_TOP_FIELD 0 |
| 108 |
#define CODECHAL_VLINESTRIDEOFFSET_BOT_FIELD 1 |
| 109 |
|
| 110 |
#define CODECHAL_MAX_DEPENDENCY_COUNT 8 |
| 111 |
|
| 112 |
#define CODECHAL_INVALID_BINDING_TABLE_IDX 0xFFFFFFFF |
| 113 |
|
| 114 |
//! |
| 115 |
//! \enum MoTargetCache |
| 116 |
//! \brief Mo target cache |
| 117 |
//! |
| 118 |
enum MoTargetCache |
| 119 |
{ |
| 120 |
CODECHAL_MO_TARGET_CACHE_ELLC = 0x0, |
| 121 |
CODECHAL_MO_TARGET_CACHE_LLC = 0x1, |
| 122 |
CODECHAL_MO_TARGET_CACHE_LLC_ELLC = 0x2, |
| 123 |
CODECHAL_MO_TARGET_CACHE_L3_LLC_ELLC = 0x3 |
| 124 |
}; |
| 125 |
|
| 126 |
//! |
| 127 |
//! \enum CodechalCacheabilityType |
| 128 |
//! \brief Codechal cacheability type |
| 129 |
//! |
| 130 |
enum CodechalCacheabilityType |
| 131 |
{ |
| 132 |
codechalUncacheable = 0, |
| 133 |
codechalLLC = 1, |
| 134 |
codechalL3 = 2, |
| 135 |
codechalUncacheableWa = 8 |
| 136 |
}; |
| 137 |
|
| 138 |
//! |
| 139 |
//! \enum CodechalWalkingPattern |
| 140 |
//! \brief Codechal walking pattern |
| 141 |
//! |
| 142 |
enum CodechalWalkingPattern |
| 143 |
{ |
| 144 |
codechalHorizontal26DegreeScan = 0, |
| 145 |
codechalHorizontal45DegreeScan = 1, |
| 146 |
codechalHorizontal26DegreeScanMbaff = 2, |
| 147 |
codechalHorizontalRasterScan = 3, |
| 148 |
codechalVerticalRasterScan = 4 |
| 149 |
}; |
| 150 |
|
| 151 |
typedef enum _CODECHAL_SLICE_STATE |
| 152 |
{ |
| 153 |
CODECHAL_SLICE_SHUTDOWN_DEFAULT = 0, |
| 154 |
CODECHAL_SLICE_SHUTDOWN_ONE_SLICE = 1, |
| 155 |
CODECHAL_SLICE_SHUTDOWN_TWO_SLICES = 2 |
| 156 |
} CODECHAL_SLICE_STATE; |
| 157 |
|
| 158 |
//! |
| 159 |
//! \struct CodechalQpStatusCount |
| 160 |
//! \brief Codechal qp status count |
| 161 |
//! |
| 162 |
struct CodechalQpStatusCount |
| 163 |
{ |
| 164 |
union{ |
| 165 |
struct{ |
| 166 |
uint32_t cumulativeQP : 24; |
| 167 |
uint32_t cumulativeQPAdjust : 8; |
| 168 |
}; |
| 169 |
|
| 170 |
struct |
| 171 |
{ |
| 172 |
// DW0 |
| 173 |
uint32_t hcpCumulativeQP : 24; |
| 174 |
uint32_t : 8; |
| 175 |
|
| 176 |
// DW1 |
| 177 |
uint32_t hcpFrameMinCUQp : 6; |
| 178 |
uint32_t hcpFrameMaxCUQp : 6; |
| 179 |
uint32_t : 20; |
| 180 |
}; |
| 181 |
|
| 182 |
struct |
| 183 |
{ |
| 184 |
uint32_t value[2]; |
| 185 |
}; |
| 186 |
}; |
| 187 |
}; |
| 188 |
|
| 189 |
//! |
| 190 |
//! \struct CodechalDataCopyParams |
| 191 |
//! \brief Codechal data copy parameters |
| 192 |
//! |
| 193 |
struct CodechalDataCopyParams |
| 194 |
{ |
| 195 |
// Src params |
| 196 |
PMOS_RESOURCE srcResource; |
| 197 |
uint32_t srcSize; |
| 198 |
uint32_t srcOffset; |
| 199 |
|
| 200 |
// Dst params |
| 201 |
PMOS_RESOURCE dstResource; |
| 202 |
uint32_t dstSize; |
| 203 |
uint32_t dstOffset; |
| 204 |
}; |
| 205 |
|
| 206 |
//! |
| 207 |
//! \struct BrcPakStatsReadParams |
| 208 |
//! \brief Read brc pak states parameters |
| 209 |
//! |
| 210 |
struct BrcPakStatsReadParams |
| 211 |
{ |
| 212 |
PMOS_RESOURCE presBrcPakStatisticBuffer; |
| 213 |
uint32_t bitstreamBytecountFrameOffset; |
| 214 |
uint32_t bitstreamBytecountFrameNoHeaderOffset; |
| 215 |
uint32_t imageStatusCtrlOffset; |
| 216 |
|
| 217 |
PMOS_RESOURCE presStatusBuffer; |
| 218 |
uint32_t dwStatusBufNumPassesOffset; |
| 219 |
uint8_t ucPass; |
| 220 |
MOS_GPU_CONTEXT VideoContext; |
| 221 |
}; |
| 222 |
|
| 223 |
//! Codechal hw interface |
| 224 |
/*! |
| 225 |
This class defines the interfaces for hardware dependent settings and functions used in Codechal |
| 226 |
*/ |
| 227 |
class CodechalHwInterface |
| 228 |
{ |
| 229 |
protected: |
| 230 |
// Slice Shutdown Threshold |
| 231 |
static const uint32_t m_sliceShutdownAvcTargetUsageThreshold = 2; //!< slice shutdown AVC target usage threshold |
| 232 |
static const uint32_t m_sliceShutdownAvcResolutionThreshold = 2073600; //!< slice shutdown AVC resolution threshold: 1080p - 1920x1080 |
| 233 |
static const uint32_t m_sliceShutdownMpeg2ResolutionThreshold = 8294400; //!< slice shutdown MPEG2 resolution threshold: 4K - 3840x2160 |
| 234 |
|
| 235 |
// States |
| 236 |
PMOS_INTERFACE m_osInterface; //!< Pointer to OS interface |
| 237 |
|
| 238 |
// Auxiliary |
| 239 |
PLATFORM m_platform; //!< Platform information |
| 240 |
MEDIA_FEATURE_TABLE *m_skuTable = nullptr; //!< Pointer to SKU table |
| 241 |
MEDIA_WA_TABLE *m_waTable = nullptr; //!< Pointer to WA table |
| 242 |
|
| 243 |
MHW_STATE_HEAP_SETTINGS m_stateHeapSettings; //!< State heap Mhw settings |
| 244 |
MhwMiInterface *m_miInterface = nullptr; //!< Pointer to Mhw mi interface |
| 245 |
MhwCpInterface *m_cpInterface = nullptr; //!< Pointer to Mhw cp interface |
| 246 |
MhwRenderInterface *m_renderInterface = nullptr; //!< Pointer to Mhw render interface |
| 247 |
RENDERHAL_INTERFACE *m_renderHal = nullptr; //!< RenderHal interface |
| 248 |
MhwCpInterface *m_renderHalCpInterface = nullptr;//!< Pointer to RenderHal cp interface |
| 249 |
MhwVeboxInterface *m_veboxInterface = nullptr; //!< Pointer to Mhw vebox interface |
| 250 |
MhwSfcInterface *m_sfcInterface = nullptr; //!< Pointer to Mhw sfc interface |
| 251 |
MhwVdboxMfxInterface *m_mfxInterface = nullptr; //!< Pointer to Mhw mfx interface |
| 252 |
MhwVdboxHcpInterface *m_hcpInterface = nullptr; //!< Pointer to Mhw hcp interface |
| 253 |
MhwVdboxAvpInterface *m_avpInterface = nullptr; //!< Pointer to Mhw avp interface |
| 254 |
MhwVdboxHucInterface *m_hucInterface = nullptr; //!< Pointer to Mhw huc interface |
| 255 |
MhwVdboxVdencInterface *m_vdencInterface = nullptr; //!< Pointer to Mhw vdenc interface |
| 256 |
std::shared_ptr<mhw::vdbox::hcp::Itf> m_hcpItf = nullptr; |
| 257 |
std::shared_ptr<mhw::vdbox::vdenc::Itf> m_vdencItf = nullptr; |
| 258 |
std::shared_ptr<MediaSfcInterface> m_mediaSfcItf = nullptr; |
| 259 |
std::shared_ptr<mhw::render::Itf> m_renderItf = nullptr; |
| 260 |
|
| 261 |
CODECHAL_SSEU_SETTING const *m_ssEuTable = nullptr; //!< Pointer to the default SSEU settings table |
| 262 |
uint16_t m_numMediaStates = CODECHAL_NUM_MEDIA_STATES; //!< number of media states |
| 263 |
|
| 264 |
MHW_MEMORY_OBJECT_CONTROL_PARAMS m_cacheabilitySettings[MOS_CODEC_RESOURCE_USAGE_END_CODEC]; //!< Cacheability Settings list |
| 265 |
|
| 266 |
// HuC WA implementation |
| 267 |
MOS_RESOURCE m_dummyStreamIn; //!> Resource of dummy stream in |
| 268 |
MOS_RESOURCE m_dummyStreamOut; //!> Resource of dummy stream out |
| 269 |
MOS_RESOURCE m_hucDmemDummy; //!> Resource of Huc DMEM for dummy streamout WA |
| 270 |
uint32_t m_dmemBufSize = 0; //!> |
| 271 |
|
| 272 |
// COND BBE WA |
| 273 |
MOS_RESOURCE m_conditionalBbEndDummy; //!> Dummy Resource for conditional batch buffer end WA |
| 274 |
|
| 275 |
uint32_t m_maxKernelLoadCmdSize = 0; //!> Max kernel load cmd size |
| 276 |
bool m_checkTargetCache = false; //!> Used to check L3 cache enable |
| 277 |
bool m_checkBankCount = false; //!> Used to check L3 cache enable |
| 278 |
|
| 279 |
uint32_t m_sizeOfCmdMediaObject = 0; //!> Size of media object cmd |
| 280 |
uint32_t m_sizeOfCmdMediaStateFlush = 0; //!> Size of media state flush cmd |
| 281 |
|
| 282 |
bool m_noSeparateL3LlcCacheabilitySettings = false; // No separate L3 LLC cacheability settings |
| 283 |
|
| 284 |
bool m_disableScalability = false; //!> Flag to indicate if disable scalability by default |
| 285 |
|
| 286 |
public: |
| 287 |
// Hardware dependent parameters |
| 288 |
bool m_turboMode = false; //!> Turbo mode info to pass in cmdBuf |
| 289 |
bool m_isVdencSuperSliceEnabled = false; //!> Flag indicating Vdenc super slice is enabled |
| 290 |
bool m_noHuC = false; //!> This flag to indicate HuC present on Linux |
| 291 |
uint16_t m_sizeOfCmdBatchBufferEnd = 0; //!> Size of batch buffer end cmd |
| 292 |
uint16_t m_sizeOfCmdMediaReset = 0; //!> Size of media reset cmd |
| 293 |
uint32_t m_vdencBrcImgStateBufferSize = 0; //!> vdenc brc img state buffer size |
| 294 |
uint32_t m_vdencBatchBuffer1stGroupSize = 0; //!> vdenc batch buffer 1st group size |
| 295 |
uint32_t m_vdencBatchBuffer2ndGroupSize = 0; //!> vdenc batch buffer 2nd group size |
| 296 |
uint32_t m_vdencReadBatchBufferSize = 0; //!> vdenc read batch buffer size for group1 and group2 |
| 297 |
uint32_t m_vdencGroup3BatchBufferSize = 0; //!> vdenc read batch buffer size for group3 |
| 298 |
uint32_t m_vdencCopyBatchBufferSize = 0; //!> vdenc copy batch buffer size |
| 299 |
uint32_t m_vdenc2ndLevelBatchBufferSize = 0; //!> vdenc 2nd level batch buffer size |
| 300 |
uint32_t m_vdencBatchBufferPerSliceConstSize = 0; //!> vdenc batch buffer per slice const size |
| 301 |
uint32_t m_HucStitchCmdBatchBufferSize = 0; //!> huc stitch cmd 2nd level batch buffer size |
| 302 |
uint32_t m_mpeg2BrcConstantSurfaceWidth = 64; //!> mpeg2 brc constant surface width |
| 303 |
uint32_t m_mpeg2BrcConstantSurfaceHeight = 43; //!> mpeg2 brc constant surface height |
| 304 |
uint32_t m_avcMbStatBufferSize = 0; //!> AVC Mb status buffer size |
| 305 |
uint32_t m_pakIntTileStatsSize = 0; //!> Size of combined statistics across all tiles |
| 306 |
uint32_t m_pakIntAggregatedFrameStatsSize = 0; //!> Size of HEVC/ VP9 PAK Stats, HEVC Slice Streamout, VDEnc Stats |
| 307 |
uint32_t m_tileRecordSize = 0; //!> Tile record size |
| 308 |
uint32_t m_hucCommandBufferSize = 0; //!> Size of a single HuC command buffer |
| 309 |
|
| 310 |
// Slice/Sub-slice/EU Shutdown Parameters |
| 311 |
uint32_t m_numRequestedEuSlices = 0; //!> Number of requested Slices |
| 312 |
uint32_t m_numRequestedSubSlices = 0; //!> Number of requested Sub-slices |
| 313 |
uint32_t m_numRequestedEus = 0; //!> Number of requested EUs |
| 314 |
#if (_DEBUG || _RELEASE_INTERNAL) |
| 315 |
bool m_numRequestedOverride = false; //!> Flag to indicate whether these params are set by Reg |
| 316 |
uint32_t m_numRequestedEuSlicesOverride = 0; //!> Number of requested Slices set by Reg |
| 317 |
uint32_t m_numRequestedSubSlicesOverride = 0; //!> Number of requested Sub-slices set by Reg |
| 318 |
uint32_t m_numRequestedEusOverride = 0; //!> Number of requested EUs set by Reg |
| 319 |
#endif |
| 320 |
|
| 321 |
uint32_t m_ssdResolutionThreshold = 0; //!> Slice shutdown resolution threshold |
| 322 |
uint32_t m_ssdTargetUsageThreshold = 0; //!> Slice shutdown target usage threshold |
| 323 |
uint32_t m_mpeg2SSDResolutionThreshold = 0; //!> Slice shutdown resolution threshold for MPEG2 |
| 324 |
|
| 325 |
bool m_slicePowerGate = false; //!> Slice power gate |
| 326 |
|
| 327 |
bool m_enableCodecMmc = false; //!> Flag to indicate if enable codec MMC by default or not |
| 328 |
|
| 329 |
//! |
| 330 |
//! \brief Constructor |
| 331 |
//! |
| 332 |
CodechalHwInterface( |
| 333 |
PMOS_INTERFACE osInterface, |
| 334 |
CODECHAL_FUNCTION codecFunction, |
| 335 |
MhwInterfaces *mhwInterfaces, |
| 336 |
bool disableScalability = false); |
| 337 |
|
| 338 |
static CodechalHwInterface *Create( |
| 339 |
PMOS_INTERFACE osInterface, |
| 340 |
CODECHAL_FUNCTION codecFunction, |
| 341 |
MhwInterfaces *mhwInterfaces, |
| 342 |
bool disableScalability); |
| 343 |
|
| 344 |
//! |
| 345 |
//! \brief Get avp interface |
| 346 |
//! \details Get avp interface in codechal hw interface next |
| 347 |
//! |
| 348 |
//! \return pointer to new AVP interface |
| 349 |
//! |
| 350 |
inline std::shared_ptr<mhw::vdbox::avp::Itf> GetAvpInterfaceNext() |
| 351 |
{ |
| 352 |
if (m_hwInterfaceNext) |
| 353 |
{ |
| 354 |
return m_hwInterfaceNext->GetAvpInterfaceNext(); |
| 355 |
} |
| 356 |
else |
| 357 |
{ |
| 358 |
return nullptr; |
| 359 |
} |
| 360 |
} |
| 361 |
|
| 362 |
//! |
| 363 |
//! \brief Get vdenc interface |
| 364 |
//! \details Get vdenc interface in codechal hw interface next |
| 365 |
//! |
| 366 |
//! \return pointer to new Vdenc interface |
| 367 |
//! |
| 368 |
inline std::shared_ptr<mhw::vdbox::vdenc::Itf> GetVdencInterfaceNext() |
| 369 |
{ |
| 370 |
if (m_hwInterfaceNext) |
| 371 |
{ |
| 372 |
return m_hwInterfaceNext->GetVdencInterfaceNext(); |
| 373 |
} |
| 374 |
else |
| 375 |
{ |
| 376 |
return nullptr; |
| 377 |
} |
| 378 |
} |
| 379 |
|
| 380 |
//! \brief Get huc interface |
| 381 |
//! \details Get huc interface in codechal hw interface next |
| 382 |
//! |
| 383 |
//! \return pointer to new HUC interface |
| 384 |
//! |
| 385 |
inline std::shared_ptr<mhw::vdbox::huc::Itf> GetHucInterfaceNext() |
| 386 |
{ |
| 387 |
if (m_hwInterfaceNext) |
| 388 |
{ |
| 389 |
return m_hwInterfaceNext->GetHucInterfaceNext(); |
| 390 |
} |
| 391 |
else |
| 392 |
{ |
| 393 |
return nullptr; |
| 394 |
} |
| 395 |
} |
| 396 |
|
| 397 |
//! |
| 398 |
//! \brief Get mi interface |
| 399 |
//! \details Get mi interface in codechal hw interface next |
| 400 |
//! |
| 401 |
//! \return pointer to new MI interface |
| 402 |
//! |
| 403 |
inline std::shared_ptr<mhw::mi::Itf> GetMiInterfaceNext() |
| 404 |
{ |
| 405 |
if (m_hwInterfaceNext) |
| 406 |
{ |
| 407 |
return m_hwInterfaceNext->GetMiInterfaceNext(); |
| 408 |
} |
| 409 |
else |
| 410 |
{ |
| 411 |
return nullptr; |
| 412 |
} |
| 413 |
} |
| 414 |
|
| 415 |
//! |
| 416 |
//! \brief Get hcp interface |
| 417 |
//! \details Get hcp interface in codechal hw interface next |
| 418 |
//! |
| 419 |
//! \return pointer to new HCP interface |
| 420 |
//! |
| 421 |
inline std::shared_ptr<mhw::vdbox::hcp::Itf> GetHcpInterfaceNext() |
| 422 |
{ |
| 423 |
if (m_hwInterfaceNext) |
| 424 |
{ |
| 425 |
return m_hwInterfaceNext->GetHcpInterfaceNext(); |
| 426 |
} |
| 427 |
else |
| 428 |
{ |
| 429 |
return nullptr; |
| 430 |
} |
| 431 |
} |
| 432 |
|
| 433 |
//! |
| 434 |
//! \brief Get mfx interface |
| 435 |
//! \details Get mfx interface in codechal hw interface next |
| 436 |
//! |
| 437 |
//! \return pointer to new MFX interface |
| 438 |
//! |
| 439 |
inline std::shared_ptr<mhw::vdbox::mfx::Itf> GetMfxInterfaceNext() |
| 440 |
{ |
| 441 |
if (m_hwInterfaceNext) |
| 442 |
{ |
| 443 |
return m_hwInterfaceNext->GetMfxInterfaceNext(); |
| 444 |
} |
| 445 |
else |
| 446 |
{ |
| 447 |
return nullptr; |
| 448 |
} |
| 449 |
} |
| 450 |
//! |
| 451 |
//! \brief Get render interface |
| 452 |
//! \details Get render interface in codechal hw interface next |
| 453 |
//! |
| 454 |
//! \return pointer to new HCP interface |
| 455 |
//! |
| 456 |
inline std::shared_ptr<mhw::render::Itf> GetRenderInterfaceNext() |
| 457 |
{ |
| 458 |
if (m_hwInterfaceNext) |
| 459 |
{ |
| 460 |
return m_hwInterfaceNext->GetRenderInterfaceNext(); |
| 461 |
} |
| 462 |
else |
| 463 |
{ |
| 464 |
return nullptr; |
| 465 |
} |
| 466 |
} |
| 467 |
//! |
| 468 |
//! \brief Copy constructor |
| 469 |
//! |
| 470 |
CodechalHwInterface(const CodechalHwInterface&) = delete; |
| 471 |
|
| 472 |
//! |
| 473 |
//! \brief Copy assignment operator |
| 474 |
//! |
| 475 |
CodechalHwInterface& operator=(const CodechalHwInterface&) = delete; |
| 476 |
|
| 477 |
//! |
| 478 |
//! \brief Destructor |
| 479 |
//! |
| 480 |
virtual ~CodechalHwInterface() |
| 481 |
{ |
| 482 |
CODECHAL_HW_FUNCTION_ENTER; |
| 483 |
|
| 484 |
if (MEDIA_IS_WA(m_waTable, WaHucStreamoutEnable) && m_osInterface) |
| 485 |
{ |
| 486 |
m_osInterface->pfnFreeResource( |
| 487 |
m_osInterface, |
| 488 |
&m_hucDmemDummy); |
| 489 |
m_osInterface->pfnFreeResource( |
| 490 |
m_osInterface, |
| 491 |
&m_dummyStreamIn); |
| 492 |
m_osInterface->pfnFreeResource( |
| 493 |
m_osInterface, |
| 494 |
&m_dummyStreamOut); |
| 495 |
} |
| 496 |
|
| 497 |
if (m_osInterface) |
| 498 |
{ |
| 499 |
m_osInterface->pfnFreeResource(m_osInterface, &m_conditionalBbEndDummy); |
| 500 |
|
| 501 |
m_osInterface->pfnDeleteMhwCpInterface(m_cpInterface); |
| 502 |
m_cpInterface = nullptr; |
| 503 |
} |
| 504 |
|
| 505 |
if (m_miInterface) |
| 506 |
{ |
| 507 |
MOS_Delete(m_miInterface); |
| 508 |
m_miInterface = nullptr; |
| 509 |
} |
| 510 |
|
| 511 |
if (m_renderInterface) |
| 512 |
{ |
| 513 |
MOS_Delete(m_renderInterface); |
| 514 |
m_renderInterface = nullptr; |
| 515 |
} |
| 516 |
|
| 517 |
if (m_veboxInterface) |
| 518 |
{ |
| 519 |
m_veboxInterface->DestroyHeap(); |
| 520 |
MOS_Delete(m_veboxInterface); |
| 521 |
m_veboxInterface = nullptr; |
| 522 |
} |
| 523 |
|
| 524 |
if (m_mfxInterface) |
| 525 |
{ |
| 526 |
MOS_Delete(m_mfxInterface); |
| 527 |
m_mfxInterface = nullptr; |
| 528 |
} |
| 529 |
if (m_hcpInterface) |
| 530 |
{ |
| 531 |
MOS_Delete(m_hcpInterface); |
| 532 |
m_hcpInterface = nullptr; |
| 533 |
} |
| 534 |
if (m_hucInterface) |
| 535 |
{ |
| 536 |
MOS_Delete(m_hucInterface); |
| 537 |
m_hucInterface = nullptr; |
| 538 |
} |
| 539 |
if (m_vdencInterface) |
| 540 |
{ |
| 541 |
MOS_Delete(m_vdencInterface); |
| 542 |
m_vdencInterface = nullptr; |
| 543 |
} |
| 544 |
|
| 545 |
if (m_sfcInterface) |
| 546 |
{ |
| 547 |
MOS_Delete(m_sfcInterface); |
| 548 |
m_sfcInterface = nullptr; |
| 549 |
} |
| 550 |
|
| 551 |
if (m_hwInterfaceNext) |
| 552 |
{ |
| 553 |
MOS_Delete(m_hwInterfaceNext); |
| 554 |
m_hwInterfaceNext = nullptr; |
| 555 |
} |
| 556 |
|
| 557 |
#if MHW_HWCMDPARSER_ENABLED |
| 558 |
mhw::HwcmdParser::DestroyInstance(); |
| 559 |
#endif |
| 560 |
} |
| 561 |
|
| 562 |
//! |
| 563 |
//! \brief Get Os interface |
| 564 |
//! \details Get Os interface in codechal hw interface |
| 565 |
//! |
| 566 |
//! \return [out] PMOS_INTERFACE |
| 567 |
//! Interface got. |
| 568 |
//! |
| 569 |
inline PMOS_INTERFACE GetOsInterface() |
| 570 |
{ |
| 571 |
return m_osInterface; |
| 572 |
} |
| 573 |
|
| 574 |
inline std::shared_ptr<MediaSfcInterface> GetMediaSfcInterface() |
| 575 |
{ |
| 576 |
return m_mediaSfcItf; |
| 577 |
} |
| 578 |
|
| 579 |
//! |
| 580 |
//! \brief Get State Heap Settings |
| 581 |
//! \details Get State Heap Settings in codechal hw interface |
| 582 |
//! |
| 583 |
//! \return [out] MHW_STATE_HEAP_SETTINGS* |
| 584 |
//! Settings got. |
| 585 |
//! |
| 586 |
inline MHW_STATE_HEAP_SETTINGS *GetStateHeapSettings() |
| 587 |
{ |
| 588 |
return &m_stateHeapSettings; |
| 589 |
} |
| 590 |
|
| 591 |
//! |
| 592 |
//! \brief Get mi interface |
| 593 |
//! \details Get mi interface in codechal hw interface |
| 594 |
//! |
| 595 |
//! \return [out] MhwMiInterface* |
| 596 |
//! Interface got. |
| 597 |
//! |
| 598 |
inline MhwMiInterface *GetMiInterface() |
| 599 |
{ |
| 600 |
return m_miInterface; |
| 601 |
} |
| 602 |
|
| 603 |
//! |
| 604 |
//! \brief Get cp interface |
| 605 |
//! \details Get cp interface in codechal hw interface |
| 606 |
//! |
| 607 |
//! \return [out] MhwCpInterface* |
| 608 |
//! Interface got. |
| 609 |
//! |
| 610 |
inline MhwCpInterface *GetCpInterface() |
| 611 |
{ |
| 612 |
return m_cpInterface; |
| 613 |
} |
| 614 |
|
| 615 |
//! |
| 616 |
//! \brief Get render interface |
| 617 |
//! \details Get render interface in codechal hw interface |
| 618 |
//! |
| 619 |
//! \return [out] MhwRenderInterface* |
| 620 |
//! Interface got. |
| 621 |
//! |
| 622 |
inline MhwRenderInterface *GetRenderInterface() |
| 623 |
{ |
| 624 |
return m_renderInterface; |
| 625 |
} |
| 626 |
|
| 627 |
//! |
| 628 |
//! \brief Get renderHal interface |
| 629 |
//! \details Get renderHal interface in codechal hw interface |
| 630 |
//! |
| 631 |
//! \return [out] RENDERHAL_INTERFACE* |
| 632 |
//! Interface got. |
| 633 |
//! |
| 634 |
inline RENDERHAL_INTERFACE *GetRenderHalInterface() |
| 635 |
{ |
| 636 |
return m_renderHal; |
| 637 |
} |
| 638 |
|
| 639 |
//! |
| 640 |
//! \brief Get vebox interface |
| 641 |
//! \details Get vebox interface in codechal hw interface |
| 642 |
//! |
| 643 |
//! \return [out] MhwVeboxInterface* |
| 644 |
//! Interface got. |
| 645 |
//! |
| 646 |
inline MhwVeboxInterface *GetVeboxInterface() |
| 647 |
{ |
| 648 |
return m_veboxInterface; |
| 649 |
} |
| 650 |
|
| 651 |
//! |
| 652 |
//! \brief Get SFC interface |
| 653 |
//! \details Get SFC interface in codechal hw interface |
| 654 |
//! |
| 655 |
//! \return [out] MhwSfcInterface* |
| 656 |
//! Interface got. |
| 657 |
//! |
| 658 |
inline MhwSfcInterface *GetSfcInterface() |
| 659 |
{ |
| 660 |
return m_sfcInterface; |
| 661 |
} |
| 662 |
|
| 663 |
//! |
| 664 |
//! \brief Get mfx interface |
| 665 |
//! \details Get mfx interface in codechal hw interface |
| 666 |
//! |
| 667 |
//! \return [out] MhwVdboxMfxInterface* |
| 668 |
//! Interface got. |
| 669 |
//! |
| 670 |
inline MhwVdboxMfxInterface *GetMfxInterface() |
| 671 |
{ |
| 672 |
return m_mfxInterface; |
| 673 |
} |
| 674 |
|
| 675 |
//! |
| 676 |
//! \brief Get hcp interface |
| 677 |
//! \details Get hcp interface in codechal hw interface |
| 678 |
//! |
| 679 |
//! \return [out] MhwVdboxHcpInterface* |
| 680 |
//! Interface got. |
| 681 |
//! |
| 682 |
inline MhwVdboxHcpInterface *GetHcpInterface() |
| 683 |
{ |
| 684 |
return m_hcpInterface; |
| 685 |
} |
| 686 |
|
| 687 |
//! |
| 688 |
//! \brief Get avp interface |
| 689 |
//! \details Get avp interface in codechal hw interface |
| 690 |
//! |
| 691 |
//! \return [out] MhwVdboxAvpInterface* |
| 692 |
//! Interface got. |
| 693 |
//! |
| 694 |
MhwVdboxAvpInterface *GetAvpInterface() |
| 695 |
{ |
| 696 |
return m_avpInterface; |
| 697 |
} |
| 698 |
|
| 699 |
//! |
| 700 |
//! \brief Get huc interface |
| 701 |
//! \details Get huc interface in codechal hw interface |
| 702 |
//! |
| 703 |
//! \return [out] MhwVdboxHucInterface* |
| 704 |
//! Interface got. |
| 705 |
//! |
| 706 |
inline MhwVdboxHucInterface *GetHucInterface() |
| 707 |
{ |
| 708 |
return m_hucInterface; |
| 709 |
} |
| 710 |
|
| 711 |
//! |
| 712 |
//! \brief Get vdenc interface |
| 713 |
//! \details Get vdenc interface in codechal hw interface |
| 714 |
//! |
| 715 |
//! \return [out] MhwVdboxVdencInterface* |
| 716 |
//! Interface got. |
| 717 |
//! |
| 718 |
inline MhwVdboxVdencInterface *GetVdencInterface() |
| 719 |
{ |
| 720 |
return m_vdencInterface; |
| 721 |
} |
| 722 |
|
| 723 |
//! |
| 724 |
//! \brief Get platform |
| 725 |
//! \details Get platform in codechal hw interface |
| 726 |
//! |
| 727 |
//! \return [out] PLATFORM |
| 728 |
//! Platform got. |
| 729 |
//! |
| 730 |
inline PLATFORM GetPlatform() |
| 731 |
{ |
| 732 |
return m_platform; |
| 733 |
} |
| 734 |
|
| 735 |
//! |
| 736 |
//! \brief Get Sku table |
| 737 |
//! \details Get Sku table in codechal hw interface |
| 738 |
//! |
| 739 |
//! \return [out] MEDIA_FEATURE_TABLE * |
| 740 |
//! Sku table got. |
| 741 |
//! |
| 742 |
inline MEDIA_FEATURE_TABLE *GetSkuTable() |
| 743 |
{ |
| 744 |
return m_skuTable; |
| 745 |
} |
| 746 |
|
| 747 |
//! |
| 748 |
//! \brief Get Wa table |
| 749 |
//! \details Get Wa table in codechal hw interface |
| 750 |
//! |
| 751 |
//! \return [out] MEDIA_WA_TABLE |
| 752 |
//! Wa table got. |
| 753 |
//! |
| 754 |
inline MEDIA_WA_TABLE *GetWaTable() |
| 755 |
{ |
| 756 |
return m_waTable; |
| 757 |
} |
| 758 |
|
| 759 |
//! |
| 760 |
//! \brief Get Cacheability Settings |
| 761 |
//! \details Get Cacheability Settings in codechal hw interface |
| 762 |
//! |
| 763 |
//! \return [out] MHW_MEMORY_OBJECT_CONTROL_PARAMS* |
| 764 |
//! Cachebility Settings got. |
| 765 |
//! |
| 766 |
inline MHW_MEMORY_OBJECT_CONTROL_PARAMS *GetCacheabilitySettings() |
| 767 |
{ |
| 768 |
return m_cacheabilitySettings; |
| 769 |
} |
| 770 |
|
| 771 |
//! \brief Create media copy |
| 772 |
//! \details Create media copy instance. |
| 773 |
//! \param osInterface |
| 774 |
//! [in] Pointer to MOS_INTERFACE. |
| 775 |
//! \return MediaCopyBaseState* |
| 776 |
//! Pointer to MediaCopyBaseState |
| 777 |
//! |
| 778 |
virtual MediaCopyBaseState* CreateMediaCopy(PMOS_INTERFACE mosInterface) |
| 779 |
{ |
| 780 |
return nullptr; |
| 781 |
} |
| 782 |
|
| 783 |
//! \brief Get blt state |
| 784 |
//! \details Get blt interface in codechal hw interface |
| 785 |
//! |
| 786 |
//! \return [out] BltState* |
| 787 |
//! Interface got. |
| 788 |
//! |
| 789 |
virtual BltState *GetBltState() |
| 790 |
{ |
| 791 |
return nullptr; |
| 792 |
} |
| 793 |
|
| 794 |
//! |
| 795 |
//! \brief Set Cacheability Settings |
| 796 |
//! \details Set Cacheability Settings in sub interfaces in codechal hw interface |
| 797 |
//! |
| 798 |
//! \param [in] cacheabilitySettings |
| 799 |
//! cacheability Settings to set into sub mhw intefaces in hw interface |
| 800 |
//! |
| 801 |
//! \return MOS_STATUS |
| 802 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 803 |
//! |
| 804 |
virtual MOS_STATUS SetCacheabilitySettings( |
| 805 |
MHW_MEMORY_OBJECT_CONTROL_PARAMS cacheabilitySettings[MOS_CODEC_RESOURCE_USAGE_END_CODEC]); |
| 806 |
|
| 807 |
//! |
| 808 |
//! \brief Set Rowstore Cache offsets |
| 809 |
//! \details Set Rowstore Cache offsets in sub interfaces in codechal hw interface |
| 810 |
//! |
| 811 |
//! \param [in] rowstoreParams |
| 812 |
//! parameters to set rowstore cache offsets |
| 813 |
//! |
| 814 |
//! \return MOS_STATUS |
| 815 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 816 |
//! |
| 817 |
virtual MOS_STATUS SetRowstoreCachingOffsets( |
| 818 |
PMHW_VDBOX_ROWSTORE_PARAMS rowstoreParams); |
| 819 |
|
| 820 |
//! |
| 821 |
//! \brief Init Cacheability Control Settings |
| 822 |
//! \details Init Cacheability Control Settings in codechal hw interface |
| 823 |
//! |
| 824 |
//! \param [in] codecFunction |
| 825 |
//! codec function used to judge how to setup cacheability control settings |
| 826 |
//! |
| 827 |
//! \return MOS_STATUS |
| 828 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 829 |
//! |
| 830 |
MOS_STATUS InitCacheabilityControlSettings( |
| 831 |
CODECHAL_FUNCTION codecFunction); |
| 832 |
|
| 833 |
//! |
| 834 |
//! \brief Init MemoryObject Cache Settings |
| 835 |
//! \details Init MemoryObject Cache Settings in codechal hw interface |
| 836 |
//! |
| 837 |
//! \return MOS_STATUS |
| 838 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 839 |
//! |
| 840 |
MOS_STATUS InitMemoryObjectCacheSettings(); |
| 841 |
|
| 842 |
//! |
| 843 |
//! \brief Init L3 Cache Settings |
| 844 |
//! |
| 845 |
//! \return MOS_STATUS |
| 846 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 847 |
//! |
| 848 |
virtual MOS_STATUS InitL3CacheSettings(); |
| 849 |
|
| 850 |
//! |
| 851 |
//! \brief Get memory object of GMM Cacheability control settings |
| 852 |
//! \details Internal function to get memory object of GMM Cacheability control settings |
| 853 |
//! |
| 854 |
//! \param [in] mosUsage |
| 855 |
//! Codec usages in mos type |
| 856 |
//! |
| 857 |
//! \return MOS_STATUS |
| 858 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 859 |
//! |
| 860 |
MOS_STATUS CachePolicyGetMemoryObject( |
| 861 |
MOS_HW_RESOURCE_DEF mosUsage); |
| 862 |
|
| 863 |
//! |
| 864 |
//! \brief Calculates the maximum size for all picture level commands |
| 865 |
//! \details Client facing function to calculate the maximum size for all picture level commands in mfx pipline |
| 866 |
//! |
| 867 |
//! \param [in] mode |
| 868 |
//! codec mode |
| 869 |
//! \param [out] commandsSize |
| 870 |
//! The maximum command buffer size |
| 871 |
//! \param [out] patchListSize |
| 872 |
//! The maximum command patch list size |
| 873 |
//! \param [in] shortFormat |
| 874 |
//! True if short format, false long format |
| 875 |
//! |
| 876 |
//! \return MOS_STATUS |
| 877 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 878 |
//! |
| 879 |
MOS_STATUS GetMfxStateCommandsDataSize( |
| 880 |
uint32_t mode, |
| 881 |
uint32_t *commandsSize, |
| 882 |
uint32_t *patchListSize, |
| 883 |
bool shortFormat); |
| 884 |
|
| 885 |
//! |
| 886 |
//! \brief Calculates maximum size for all slice/MB level commands |
| 887 |
//! \details Client facing function to calculate maximum size for all slice/MB level commands in mfx pipeline |
| 888 |
//! |
| 889 |
//! \param [in] mode |
| 890 |
//! Codec mode |
| 891 |
//! \param [out] commandsSize |
| 892 |
//! The maximum command buffer size |
| 893 |
//! \param [out] patchListSize |
| 894 |
//! The maximum command patch list size |
| 895 |
//! \param [in] modeSpecific |
| 896 |
//! Indicate the long or short format for decoder or single take phase for encoder |
| 897 |
//! |
| 898 |
//! \return MOS_STATUS |
| 899 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 900 |
//! |
| 901 |
MOS_STATUS GetMfxPrimitiveCommandsDataSize( |
| 902 |
uint32_t mode, |
| 903 |
uint32_t *commandsSize, |
| 904 |
uint32_t *patchListSize, |
| 905 |
bool modeSpecific); |
| 906 |
|
| 907 |
//! |
| 908 |
//! \brief Calculates the maximum size for HCP/HUC picture level commands |
| 909 |
//! \details Client facing function to calculate the maximum size for HCP/HUC picture level commands |
| 910 |
//! \param [in] mode |
| 911 |
//! Indicate the codec mode |
| 912 |
//! \param [out] commandsSize |
| 913 |
//! The maximum command buffer size |
| 914 |
//! \param [out] patchListSize |
| 915 |
//! The maximum command patch list size |
| 916 |
//! \param [in] params |
| 917 |
//! Indicate the command size parameters |
| 918 |
//! \return MOS_STATUS |
| 919 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 920 |
//! |
| 921 |
MOS_STATUS GetHxxStateCommandSize( |
| 922 |
uint32_t mode, |
| 923 |
uint32_t *commandsSize, |
| 924 |
uint32_t *patchListSize, |
| 925 |
PMHW_VDBOX_STATE_CMDSIZE_PARAMS params); |
| 926 |
|
| 927 |
//! |
| 928 |
//! \brief Calculates maximum size for HCP/HUC slice/MB level commands |
| 929 |
//! \details Client facing function to calculate maximum size for HCP/HUC slice/MB level commands |
| 930 |
//! \param [in] mode |
| 931 |
//! Indicate the codec mode |
| 932 |
//! \param [out] commandsSize |
| 933 |
//! The maximum command buffer size |
| 934 |
//! \param [out] patchListSize |
| 935 |
//! The maximum command patch list size |
| 936 |
//! \param [in] modeSpecific |
| 937 |
//! Indicate the long or short format |
| 938 |
//! \return MOS_STATUS |
| 939 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 940 |
//! |
| 941 |
MOS_STATUS GetHxxPrimitiveCommandSize( |
| 942 |
uint32_t mode, |
| 943 |
uint32_t *commandsSize, |
| 944 |
uint32_t *patchListSize, |
| 945 |
bool modeSpecific); |
| 946 |
|
| 947 |
//! |
| 948 |
//! \brief Calculates the maximum size for HCP picture level commands |
| 949 |
//! \details Client facing function to calculate the maximum size for HCP picture level commands |
| 950 |
//! \param [in] mode |
| 951 |
//! Indicate the codec mode |
| 952 |
//! \param [out] commandsSize |
| 953 |
//! The maximum command buffer size |
| 954 |
//! \param [out] patchListSize |
| 955 |
//! The maximum command patch list size |
| 956 |
//! \param [in] params |
| 957 |
//! Indicate the command size parameters |
| 958 |
//! \return MOS_STATUS |
| 959 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 960 |
//! |
| 961 |
MOS_STATUS GetHcpStateCommandSize( |
| 962 |
uint32_t mode, |
| 963 |
uint32_t * commandsSize, |
| 964 |
uint32_t * patchListSize, |
| 965 |
PMHW_VDBOX_STATE_CMDSIZE_PARAMS params); |
| 966 |
|
| 967 |
//! |
| 968 |
//! \brief Calculates maximum size for HCP slice/MB level commands |
| 969 |
//! \details Client facing function to calculate maximum size for HCP slice/MB level commands |
| 970 |
//! \param [in] mode |
| 971 |
//! Indicate the codec mode |
| 972 |
//! \param [out] commandsSize |
| 973 |
//! The maximum command buffer size |
| 974 |
//! \param [out] patchListSize |
| 975 |
//! The maximum command patch list size |
| 976 |
//! \param [in] modeSpecific |
| 977 |
//! Indicate the long or short format |
| 978 |
//! \return MOS_STATUS |
| 979 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 980 |
//! |
| 981 |
MOS_STATUS GetHcpPrimitiveCommandSize( |
| 982 |
uint32_t mode, |
| 983 |
uint32_t *commandsSize, |
| 984 |
uint32_t *patchListSize, |
| 985 |
bool modeSpecific); |
| 986 |
|
| 987 |
//! |
| 988 |
//! \brief Calculates the maximum size for Huc picture level commands |
| 989 |
//! \details Client facing function to calculate the maximum size for HUC picture level commands |
| 990 |
//! \param [in] mode |
| 991 |
//! Indicate the codec mode |
| 992 |
//! \param [out] commandsSize |
| 993 |
//! The maximum command buffer size |
| 994 |
//! \param [out] patchListSize |
| 995 |
//! The maximum command patch list size |
| 996 |
//! \param [in] params |
| 997 |
//! Indicate the command size parameters |
| 998 |
//! \return MOS_STATUS |
| 999 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 1000 |
//! |
| 1001 |
MOS_STATUS GetHucStateCommandSize( |
| 1002 |
uint32_t mode, |
| 1003 |
uint32_t *commandsSize, |
| 1004 |
uint32_t *patchListSize, |
| 1005 |
PMHW_VDBOX_STATE_CMDSIZE_PARAMS params); |
| 1006 |
|
| 1007 |
//! |
| 1008 |
//! \brief Calculates maximum size for Huc slice/MB level commands |
| 1009 |
//! \details Client facing function to calculate maximum size for Huc slice/MB level commands |
| 1010 |
//! \param [in] mode |
| 1011 |
//! Indicate the codec mode |
| 1012 |
//! \param [out] commandsSize |
| 1013 |
//! The maximum command buffer size |
| 1014 |
//! \param [out] patchListSize |
| 1015 |
//! The maximum command patch list size |
| 1016 |
//! \return MOS_STATUS |
| 1017 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 1018 |
//! |
| 1019 |
MOS_STATUS GetHucPrimitiveCommandSize( |
| 1020 |
uint32_t mode, |
| 1021 |
uint32_t *commandsSize, |
| 1022 |
uint32_t *patchListSize); |
| 1023 |
|
| 1024 |
//! |
| 1025 |
//! \brief Calculates the maximum size for Vdenc state level commands |
| 1026 |
//! \details Client facing function to calculate the maximum size for Vdenc state level commands |
| 1027 |
//! \param [in] mode |
| 1028 |
//! Indicate the codec mode |
| 1029 |
//! \param [out] commandsSize |
| 1030 |
//! The maximum command buffer size |
| 1031 |
//! \param [out] patchListSize |
| 1032 |
//! The maximum command patch list size |
| 1033 |
//! \return MOS_STATUS |
| 1034 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 1035 |
//! |
| 1036 |
MOS_STATUS GetVdencStateCommandsDataSize( |
| 1037 |
uint32_t mode, |
| 1038 |
uint32_t *commandsSize, |
| 1039 |
uint32_t *patchListSize); |
| 1040 |
|
| 1041 |
//! |
| 1042 |
//! \brief Calculates maximum size for all slice level VDEnc commands |
| 1043 |
//! \details Client facing function to calculate the maximum size for Vdenc slice level commands |
| 1044 |
//! \param [in] mode |
| 1045 |
//! Indicate the codec mode |
| 1046 |
//! \param [out] commandsSize |
| 1047 |
//! The maximum command buffer size |
| 1048 |
//! \param [out] patchListSize |
| 1049 |
//! The maximum command patch list size |
| 1050 |
//! \return MOS_STATUS |
| 1051 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 1052 |
//! |
| 1053 |
MOS_STATUS GetVdencPrimitiveCommandsDataSize( |
| 1054 |
uint32_t mode, |
| 1055 |
uint32_t *commandsSize, |
| 1056 |
uint32_t *patchListSize); |
| 1057 |
|
| 1058 |
//! |
| 1059 |
//! \brief Calculates the maximum size for Vdenc picture 2nd level commands |
| 1060 |
//! \details Client facing function to calculate the maximum size for Vdenc picture 2nd level commands |
| 1061 |
//! \param [in] mode |
| 1062 |
//! Indicate the codec mode |
| 1063 |
//! \param [out] commandsSize |
| 1064 |
//! The maximum command buffer size |
| 1065 |
//! \return MOS_STATUS |
| 1066 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 1067 |
//! |
| 1068 |
virtual MOS_STATUS GetVdencPictureSecondLevelCommandsSize( |
| 1069 |
uint32_t mode, |
| 1070 |
uint32_t *commandsSize); |
| 1071 |
|
| 1072 |
//! |
| 1073 |
//! \brief Calculates the maximum size for Huc Streamout commands |
| 1074 |
//! \details Client facing function to calculate the maximum size for Huc Streamout commands |
| 1075 |
//! \param [out] commandsSize |
| 1076 |
//! The maximum command buffer size |
| 1077 |
//! \param [out] patchListSize |
| 1078 |
//! The maximum command patch list size |
| 1079 |
//! \return MOS_STATUS |
| 1080 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 1081 |
//! |
| 1082 |
virtual MOS_STATUS GetStreamoutCommandSize( |
| 1083 |
uint32_t *commandsSize, |
| 1084 |
uint32_t *patchListSize); |
| 1085 |
|
| 1086 |
//! |
| 1087 |
//! \brief Get max vdbox index |
| 1088 |
//! |
| 1089 |
//! \return MHW_VDBOX_NODE_IND |
| 1090 |
//! max vdbox index got |
| 1091 |
//! |
| 1092 |
inline MHW_VDBOX_NODE_IND GetMaxVdboxIndex() |
| 1093 |
{ |
| 1094 |
return MEDIA_IS_SKU(m_skuTable, FtrVcs2) ? MHW_VDBOX_NODE_2 : MHW_VDBOX_NODE_1; |
| 1095 |
} |
| 1096 |
|
| 1097 |
//! |
| 1098 |
//! \brief Initialize the codechal hw interface |
| 1099 |
//! \details Initialize the interface before using |
| 1100 |
//! |
| 1101 |
//! \param [in] settings |
| 1102 |
//! Settings for initialization |
| 1103 |
//! |
| 1104 |
//! \return MOS_STATUS |
| 1105 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 1106 |
//! |
| 1107 |
virtual MOS_STATUS Initialize( |
| 1108 |
CodechalSetting *settings); |
| 1109 |
|
| 1110 |
//! |
| 1111 |
//! \brief Get meida object buffer size |
| 1112 |
//! \details Calculate the 2nd level BB size for media object BBs used with kernels |
| 1113 |
//! |
| 1114 |
//! \param [in] numMbs |
| 1115 |
//! Number of MBs for calculation |
| 1116 |
//! \param [in] inlineDataSize |
| 1117 |
//! Inline data size used |
| 1118 |
//! |
| 1119 |
//! \return uint32_t |
| 1120 |
//! Buffer size got. |
| 1121 |
//! |
| 1122 |
uint32_t GetMediaObjectBufferSize( |
| 1123 |
uint32_t numMbs, |
| 1124 |
uint32_t inlineDataSize); |
| 1125 |
|
| 1126 |
//! |
| 1127 |
//! \brief Add vdenc brc img buffer |
| 1128 |
//! \details Add vdenc bitrate control image buffer into cmdbuffer |
| 1129 |
//! |
| 1130 |
//! \param [in] vdencBrcImgBuffer |
| 1131 |
//! Resource of vdenc brc img buffer |
| 1132 |
//! \param [in] params |
| 1133 |
//! parameter used for AVC img parameters |
| 1134 |
//! |
| 1135 |
//! \return MOS_STATUS |
| 1136 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 1137 |
//! |
| 1138 |
MOS_STATUS AddVdencBrcImgBuffer( |
| 1139 |
PMOS_RESOURCE vdencBrcImgBuffer, |
| 1140 |
PMHW_VDBOX_AVC_IMG_PARAMS params); |
| 1141 |
|
| 1142 |
//! |
| 1143 |
//! \brief Add vdenc sfd img buffer |
| 1144 |
//! \details Add vdenc static frame detection image buffer into cmdbuffer |
| 1145 |
//! |
| 1146 |
//! \param [in] vdencSfdImgBuffer |
| 1147 |
//! Resource of vdenc brc img buffer |
| 1148 |
//! \param [in] params |
| 1149 |
//! parameter used for AVC img parameters |
| 1150 |
//! |
| 1151 |
//! \return MOS_STATUS |
| 1152 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 1153 |
//! |
| 1154 |
MOS_STATUS AddVdencSfdImgBuffer( |
| 1155 |
PMOS_RESOURCE vdencSfdImgBuffer, |
| 1156 |
PMHW_VDBOX_AVC_IMG_PARAMS params); |
| 1157 |
|
| 1158 |
//! |
| 1159 |
//! \brief Calculates the maximum size for all kernel loading commands |
| 1160 |
//! \details Client facing function to calculate the maximum size for all kernel loading commands |
| 1161 |
//! \param [in] maxNumSurfaces |
| 1162 |
//! maximum surface number |
| 1163 |
//! \return uint32_t |
| 1164 |
//! Returns the maximum size for all kernel loading commands |
| 1165 |
//! |
| 1166 |
uint32_t GetKernelLoadCommandSize( |
| 1167 |
uint32_t maxNumSurfaces); |
| 1168 |
|
| 1169 |
//! |
| 1170 |
//! \brief Resizes the cmd buffer and patch list |
| 1171 |
//! \details Resizes the buffer to be used for rendering GPU commands |
| 1172 |
//! |
| 1173 |
//! \param [in] requestedCommandBufferSize |
| 1174 |
//! Requested resize command buffer size |
| 1175 |
//! \param [in] requestedPatchListSize |
| 1176 |
//! Requested resize patchlist size |
| 1177 |
//! |
| 1178 |
//! \return MOS_STATUS |
| 1179 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 1180 |
//! |
| 1181 |
MOS_STATUS ResizeCommandBufferAndPatchList( |
| 1182 |
uint32_t requestedCommandBufferSize, |
| 1183 |
uint32_t requestedPatchListSize); |
| 1184 |
|
| 1185 |
//! |
| 1186 |
//! \brief Resizes the cmd buffer and patch list with cmd buffer header |
| 1187 |
//! \details Resizes the buffer to be used for rendering GPU commands with cmd buffer header |
| 1188 |
//! |
| 1189 |
//! \param [in] requestedCommandBufferSize |
| 1190 |
//! Requested resize command buffer size |
| 1191 |
//! \param [in] requestedPatchListSize |
| 1192 |
//! Requested resize patchlist size |
| 1193 |
//! |
| 1194 |
//! \return MOS_STATUS |
| 1195 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 1196 |
//! |
| 1197 |
MOS_STATUS ResizeCommandBufferAndPatchListCmd( |
| 1198 |
uint32_t requestedCommandBufferSize, |
| 1199 |
uint32_t requestedPatchListSize); |
| 1200 |
|
| 1201 |
//! |
| 1202 |
//! \brief Resizes the cmd buffer and patch list without cmd buffer header |
| 1203 |
//! \details Resizes the buffer to be used for rendering GPU commands without cmd buffer header |
| 1204 |
//! |
| 1205 |
//! \param [in] requestedCommandBufferSize |
| 1206 |
//! Requested resize command buffer size |
| 1207 |
//! \param [in] requestedPatchListSize |
| 1208 |
//! Requested resize patchlist size |
| 1209 |
//! |
| 1210 |
//! \return MOS_STATUS |
| 1211 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 1212 |
//! |
| 1213 |
MOS_STATUS ResizeCommandBufferAndPatchListOs( |
| 1214 |
uint32_t requestedCommandBufferSize, |
| 1215 |
uint32_t requestedPatchListSize); |
| 1216 |
|
| 1217 |
// Synchronization Functions |
| 1218 |
|
| 1219 |
//! |
| 1220 |
//! \brief Write sync tag to resource |
| 1221 |
//! |
| 1222 |
//! \param [in,out] cmdBuffer |
| 1223 |
//! command buffer used |
| 1224 |
//! \param [in] syncParams |
| 1225 |
//! sync parameters used to add tag |
| 1226 |
//! |
| 1227 |
//! \return MOS_STATUS |
| 1228 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 1229 |
//! |
| 1230 |
MOS_STATUS WriteSyncTagToResource( |
| 1231 |
PMOS_COMMAND_BUFFER cmdBuffer, |
| 1232 |
PMOS_SYNC_PARAMS syncParams); |
| 1233 |
|
| 1234 |
//! |
| 1235 |
//! \brief Helper function composes SURFACE_STATE cacheability settings |
| 1236 |
//! \details Helper function composes SURFACE_STATE cacheability settings with LLC and L3 values |
| 1237 |
//! |
| 1238 |
//! \param [in] cacheabiltySettingIdx |
| 1239 |
//! which module needs to be set caching control |
| 1240 |
//! \param [in] cacheabilityTypeRequested |
| 1241 |
//! cacheability type |
| 1242 |
//! |
| 1243 |
//! \return uint32_t |
| 1244 |
//! cacheability settings result |
| 1245 |
//! |
| 1246 |
uint32_t ComposeSurfaceCacheabilityControl( |
| 1247 |
uint32_t cacheabiltySettingIdx, |
| 1248 |
uint32_t cacheabilityTypeRequested); |
| 1249 |
|
| 1250 |
//! |
| 1251 |
//! \brief Add Huc stream out copy cmds |
| 1252 |
//! \details Prepare and add Huc stream out copy cmds |
| 1253 |
//! |
| 1254 |
//! \param [in,out] cmdBuffer |
| 1255 |
//! Command buffer |
| 1256 |
//! |
| 1257 |
//! \return MOS_STATUS |
| 1258 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 1259 |
//! |
| 1260 |
virtual MOS_STATUS AddHucDummyStreamOut( |
| 1261 |
PMOS_COMMAND_BUFFER cmdBuffer); |
| 1262 |
|
| 1263 |
//! |
| 1264 |
//! \brief Perform Huc stream out copy |
| 1265 |
//! \details Implement the copy using huc stream out |
| 1266 |
//! |
| 1267 |
//! \param [in] hucStreamOutParams |
| 1268 |
//! Huc stream out parameters |
| 1269 |
//! \param [in,out] cmdBuffer |
| 1270 |
//! Command buffer |
| 1271 |
//! |
| 1272 |
//! \return MOS_STATUS |
| 1273 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 1274 |
//! |
| 1275 |
MOS_STATUS PerformHucStreamOut( |
| 1276 |
CodechalHucStreamoutParams *hucStreamOutParams, |
| 1277 |
PMOS_COMMAND_BUFFER cmdBuffer); |
| 1278 |
|
| 1279 |
//! |
| 1280 |
//! \brief Update the number of Slices, Sub-slices and EUs in the command buffer |
| 1281 |
//! \details Update the number of Slices, Sub-slices and EUs in the command buffer |
| 1282 |
//! with the final value from the HwInterface structure |
| 1283 |
//! |
| 1284 |
//! \param [in,out] cmdBuffer |
| 1285 |
//! Command buffer |
| 1286 |
//! \param [in] singleTaskPhaseSupported |
| 1287 |
//! Indicate if single task phase supported |
| 1288 |
//! \param [in] lastTaskInPhase |
| 1289 |
//! Indicate if it is last task phase |
| 1290 |
//! |
| 1291 |
//! \return MOS_STATUS |
| 1292 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 1293 |
//! |
| 1294 |
MOS_STATUS UpdateSSEuForCmdBuffer( |
| 1295 |
PMOS_COMMAND_BUFFER cmdBuffer, |
| 1296 |
bool singleTaskPhaseSupported, |
| 1297 |
bool lastTaskInPhase); |
| 1298 |
|
| 1299 |
//! |
| 1300 |
//! \brief Set the default number of Slice, Sub-slice, EUs |
| 1301 |
//! \details Set the default number of Slice, Sub-slice, EUs recommended for |
| 1302 |
//! the given kernel type in the HwInterface structure |
| 1303 |
//! |
| 1304 |
//! \param [in] mediaStateType |
| 1305 |
//! Media state type |
| 1306 |
//! \param [in] setRequestedSlices |
| 1307 |
//! Slices requested to set |
| 1308 |
//! \param [in] setRequestedSubSlices |
| 1309 |
//! SubSlices requested to set |
| 1310 |
//! \param [in] setRequestedEus |
| 1311 |
//! Eu numbers requested to set |
| 1312 |
//! |
| 1313 |
//! \return MOS_STATUS |
| 1314 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 1315 |
//! |
| 1316 |
MOS_STATUS GetDefaultSSEuSetting( |
| 1317 |
CODECHAL_MEDIA_STATE_TYPE mediaStateType, |
| 1318 |
bool setRequestedSlices, |
| 1319 |
bool setRequestedSubSlices, |
| 1320 |
bool setRequestedEus); |
| 1321 |
|
| 1322 |
//! |
| 1323 |
//! \brief Copy data source with drv |
| 1324 |
//! |
| 1325 |
//! \param [in] dataCopyParams |
| 1326 |
//! Parameters for data copy |
| 1327 |
//! |
| 1328 |
//! \return MOS_STATUS |
| 1329 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 1330 |
//! |
| 1331 |
MOS_STATUS CopyDataSourceWithDrv( |
| 1332 |
CodechalDataCopyParams *dataCopyParams); |
| 1333 |
|
| 1334 |
#if (_DEBUG || _RELEASE_INTERNAL) |
| 1335 |
//! |
| 1336 |
//! \brief Initialize L3 control user feature settings |
| 1337 |
//! |
| 1338 |
//! \param [in] l3CacheConfig |
| 1339 |
//! L3 cache configuration |
| 1340 |
//! \param [in] l3Overrides |
| 1341 |
//! L3 overrides |
| 1342 |
//! |
| 1343 |
//! \return MOS_STATUS |
| 1344 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 1345 |
//! |
| 1346 |
MOS_STATUS InitL3ControlUserFeatureSettings( |
| 1347 |
MHW_RENDER_ENGINE_L3_CACHE_CONFIG *l3CacheConfig, |
| 1348 |
MHW_RENDER_ENGINE_L3_CACHE_SETTINGS *l3Overrides); |
| 1349 |
#endif // _DEBUG || _RELEASE_INTERNAL |
| 1350 |
|
| 1351 |
//! |
| 1352 |
//! \brief Send hw semphore wait cmd |
| 1353 |
//! \details Send hw semphore wait cmd for sync perpose |
| 1354 |
//! |
| 1355 |
//! \param [in] semaMem |
| 1356 |
//! Reource of Hw semphore |
| 1357 |
//! \param [in] semaData |
| 1358 |
//! Data of Hw semphore |
| 1359 |
//! \param [in] opCode |
| 1360 |
//! Operation code |
| 1361 |
//! \param [in,out] cmdBuffer |
| 1362 |
//! command buffer |
| 1363 |
//! |
| 1364 |
//! \return MOS_STATUS |
| 1365 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 1366 |
//! |
| 1367 |
MOS_STATUS SendHwSemaphoreWaitCmd( |
| 1368 |
PMOS_RESOURCE semaMem, |
| 1369 |
uint32_t semaData, |
| 1370 |
MHW_COMMON_MI_SEMAPHORE_COMPARE_OPERATION opCode, |
| 1371 |
PMOS_COMMAND_BUFFER cmdBuffer, |
| 1372 |
uint32_t semaMemOffset = 0); |
| 1373 |
|
| 1374 |
//! |
| 1375 |
//! \brief Send mi atomic dword cmd |
| 1376 |
//! \details Send mi atomic dword cmd for sync perpose |
| 1377 |
//! |
| 1378 |
//! \param [in] resource |
| 1379 |
//! Reource used in mi atomic dword cmd |
| 1380 |
//! \param [in] immData |
| 1381 |
//! Immediate data |
| 1382 |
//! \param [in] opCode |
| 1383 |
//! Operation code |
| 1384 |
//! \param [in,out] cmdBuffer |
| 1385 |
//! command buffer |
| 1386 |
//! |
| 1387 |
//! \return MOS_STATUS |
| 1388 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 1389 |
//! |
| 1390 |
MOS_STATUS SendMiAtomicDwordCmd( |
| 1391 |
PMOS_RESOURCE resource, |
| 1392 |
uint32_t immData, |
| 1393 |
MHW_COMMON_MI_ATOMIC_OPCODE opCode, |
| 1394 |
PMOS_COMMAND_BUFFER cmdBuffer); |
| 1395 |
|
| 1396 |
//! |
| 1397 |
//! \brief Send conditional batch buffer end cmd |
| 1398 |
//! \details Send conditional batch buffer end cmd |
| 1399 |
//! |
| 1400 |
//! \param [in] resource |
| 1401 |
//! Reource used in conditional batch buffer end cmd |
| 1402 |
//! \param [in] offset |
| 1403 |
//! Reource offset used in mi atomic dword cmd |
| 1404 |
//! \param [in] compData |
| 1405 |
//! Compare data |
| 1406 |
//! \param [in] disableCompMask |
| 1407 |
//! Indicate disabling compare mask |
| 1408 |
//! \param [in,out] cmdBuffer |
| 1409 |
//! command buffer |
| 1410 |
//! |
| 1411 |
//! \return MOS_STATUS |
| 1412 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 1413 |
//! |
| 1414 |
MOS_STATUS SendCondBbEndCmd( |
| 1415 |
PMOS_RESOURCE resource, |
| 1416 |
uint32_t offset, |
| 1417 |
uint32_t compData, |
| 1418 |
bool disableCompMask, |
| 1419 |
PMOS_COMMAND_BUFFER cmdBuffer); |
| 1420 |
|
| 1421 |
//! |
| 1422 |
//! \brief Loads kernel data into the ISH |
| 1423 |
//! \details Uses the data described in the kernel state to assign an ISH block and load the kernel data into it |
| 1424 |
//! \param stateHeapInterface |
| 1425 |
//! [in] State heap interface |
| 1426 |
//! \param kernelState |
| 1427 |
//! [in] Kernel state describing the kernel data to be loaded |
| 1428 |
//! \return MOS_STATUS |
| 1429 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 1430 |
//! |
| 1431 |
static MOS_STATUS MhwInitISH( |
| 1432 |
PMHW_STATE_HEAP_INTERFACE stateHeapInterface, |
| 1433 |
PMHW_KERNEL_STATE kernelState); |
| 1434 |
|
| 1435 |
//! |
| 1436 |
//! \brief Assigns space in both DSH and SSH to the kernel state |
| 1437 |
//! \details Uses input parameters to assign DSH/SSH regions to the kernel state |
| 1438 |
//! \param stateHeapInterface |
| 1439 |
//! [in] State heap interface |
| 1440 |
//! \param kernelState |
| 1441 |
//! [in] The kernel state to assign the new DSH/ISH regions |
| 1442 |
//! \param noDshSpaceRequested |
| 1443 |
//! [in] No DSH space should be assigned in this call |
| 1444 |
//! \param forcedDshSize |
| 1445 |
//! [in] The size of the DSH space required for this kernel state. |
| 1446 |
//! If this value is 0, the size is calculated from the kernel state. |
| 1447 |
//! \param noSshSpaceRequested |
| 1448 |
//! [in] No SSH space should be assigned in this call |
| 1449 |
//! \param currCmdBufId |
| 1450 |
//! [in] Command buffer Id to keep track of the state heap resource |
| 1451 |
//! \return MOS_STATUS |
| 1452 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 1453 |
//! |
| 1454 |
static MOS_STATUS AssignDshAndSshSpace( |
| 1455 |
PMHW_STATE_HEAP_INTERFACE stateHeapInterface, |
| 1456 |
PMHW_KERNEL_STATE kernelState, |
| 1457 |
bool noDshSpaceRequested, |
| 1458 |
uint32_t forcedDshSize, |
| 1459 |
bool noSshSpaceRequested, |
| 1460 |
uint32_t currCmdBufId); |
| 1461 |
//! |
| 1462 |
//! \brief Select Vdbox by index and get MMIO register |
| 1463 |
//! \details Uses input parameters to Select VDBOX from KMD and get MMIO register |
| 1464 |
//! \param index |
| 1465 |
//! [in] vdbox index interface |
| 1466 |
//! \param pCmdBuffer |
| 1467 |
//! [in] get mos vdbox id from cmd buffer |
| 1468 |
//! \return MmioRegistersMfx |
| 1469 |
//! return the vdbox mmio register |
| 1470 |
//! |
| 1471 |
MmioRegistersMfx * SelectVdboxAndGetMmioRegister( |
| 1472 |
MHW_VDBOX_NODE_IND index, |
| 1473 |
PMOS_COMMAND_BUFFER pCmdBuffer); |
| 1474 |
|
| 1475 |
//! |
| 1476 |
//! \brief Send mi store data imm cmd |
| 1477 |
//! \param [in] resource |
| 1478 |
//! Reource used in mi store data imm cmd |
| 1479 |
//! \param [in] immData |
| 1480 |
//! Immediate data |
| 1481 |
//! \param [in,out] cmdBuffer |
| 1482 |
//! command buffer |
| 1483 |
//! |
| 1484 |
//! \return MOS_STATUS |
| 1485 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 1486 |
//! |
| 1487 |
MOS_STATUS SendMiStoreDataImm( |
| 1488 |
PMOS_RESOURCE resource, |
| 1489 |
uint32_t immData, |
| 1490 |
PMOS_COMMAND_BUFFER cmdBuffer); |
| 1491 |
|
| 1492 |
//! |
| 1493 |
//! \brief Read MFC status for status report |
| 1494 |
//! \param vdboxIndex |
| 1495 |
//! [in] the vdbox index |
| 1496 |
//! \param params |
| 1497 |
//! [in] the parameters for Mfc status read |
| 1498 |
//! \param cmdBuffer |
| 1499 |
//! [in, out] the command buffer |
| 1500 |
//! \return MOS_STATUS |
| 1501 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 1502 |
//! |
| 1503 |
MOS_STATUS ReadMfcStatus( |
| 1504 |
MHW_VDBOX_NODE_IND vdboxIndex, |
| 1505 |
const EncodeStatusReadParams ¶ms, |
| 1506 |
PMOS_COMMAND_BUFFER cmdBuffer); |
| 1507 |
|
| 1508 |
//! |
| 1509 |
//! \brief Read Image status for status report |
| 1510 |
//! \param vdboxIndex |
| 1511 |
//! [in] the vdbox index |
| 1512 |
//! \param params |
| 1513 |
//! [in] the parameters for Image status read |
| 1514 |
//! \param cmdBuffer |
| 1515 |
//! [in, out] the command buffer |
| 1516 |
//! \return MOS_STATUS |
| 1517 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 1518 |
//! |
| 1519 |
MOS_STATUS ReadImageStatus( |
| 1520 |
MHW_VDBOX_NODE_IND vdboxIndex, |
| 1521 |
const EncodeStatusReadParams ¶ms, |
| 1522 |
PMOS_COMMAND_BUFFER cmdBuffer); |
| 1523 |
|
| 1524 |
//! |
| 1525 |
//! \brief Read BRC PAK statistics for status report |
| 1526 |
//! \param vdboxIndex |
| 1527 |
//! [in] the vdbox index |
| 1528 |
//! \param params |
| 1529 |
//! [in] the parameters for BRC PAK statistics specific |
| 1530 |
//! \param cmdBuffer |
| 1531 |
//! [in, out] the command buffer |
| 1532 |
//! \return MOS_STATUS |
| 1533 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 1534 |
//! |
| 1535 |
MOS_STATUS ReadBrcPakStatistics( |
| 1536 |
MHW_VDBOX_NODE_IND vdboxIndex, |
| 1537 |
const BrcPakStatsReadParams ¶ms, |
| 1538 |
PMOS_COMMAND_BUFFER cmdBuffer); |
| 1539 |
|
| 1540 |
//! |
| 1541 |
//! \brief Read HCP status for status report |
| 1542 |
//! \param vdboxIndex |
| 1543 |
//! [in] the vdbox index |
| 1544 |
//! \param params |
| 1545 |
//! [in] the parameters for HCP status read |
| 1546 |
//! \param cmdBuffer |
| 1547 |
//! [in, out] the command buffer |
| 1548 |
//! \return MOS_STATUS |
| 1549 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 1550 |
//! |
| 1551 |
MOS_STATUS ReadHcpStatus( |
| 1552 |
MHW_VDBOX_NODE_IND vdboxIndex, |
| 1553 |
const EncodeStatusReadParams ¶ms, |
| 1554 |
PMOS_COMMAND_BUFFER cmdBuffer); |
| 1555 |
|
| 1556 |
//! |
| 1557 |
//! \brief Read HCP specific image status for status report |
| 1558 |
//! \param vdboxIndex |
| 1559 |
//! [in] the vdbox index |
| 1560 |
//! \param params |
| 1561 |
//! [in] the parameters for HCP IMG status read |
| 1562 |
//! \param cmdBuffer |
| 1563 |
//! [in, out] the command buffer |
| 1564 |
//! \return MOS_STATUS |
| 1565 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 1566 |
//! |
| 1567 |
MOS_STATUS ReadImageStatusForHcp( |
| 1568 |
MHW_VDBOX_NODE_IND vdboxIndex, |
| 1569 |
const EncodeStatusReadParams ¶ms, |
| 1570 |
PMOS_COMMAND_BUFFER cmdBuffer); |
| 1571 |
|
| 1572 |
//! |
| 1573 |
//! \brief Read HCP specific BRC PAK statistics for status report |
| 1574 |
//! \param vdboxIndex |
| 1575 |
//! [in] the vdbox index |
| 1576 |
//! \param params |
| 1577 |
//! [in] the parameters for BRC PAK statistics specific |
| 1578 |
//! \param cmdBuffer |
| 1579 |
//! [in, out] the command buffer |
| 1580 |
//! \return MOS_STATUS |
| 1581 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 1582 |
//! |
| 1583 |
MOS_STATUS ReadBrcPakStatisticsForHcp( |
| 1584 |
MHW_VDBOX_NODE_IND vdboxIndex, |
| 1585 |
const BrcPakStatsReadParams ¶ms, |
| 1586 |
PMOS_COMMAND_BUFFER cmdBuffer); |
| 1587 |
|
| 1588 |
//! |
| 1589 |
//! \brief Set the status tag(start/end) for status report by PIPE contol command, |
| 1590 |
//! this function is for render engine. |
| 1591 |
//! \param osResource |
| 1592 |
//! [in] Reource used in the cmd |
| 1593 |
//! \param offset |
| 1594 |
//! [in] Reource offset used the cmd |
| 1595 |
//! \param tag |
| 1596 |
//! [in] queryStart/queryEnd defined in the media_status_report.h |
| 1597 |
//! \param needFlushCache |
| 1598 |
//! [in] whether need to flush the cache or not. For queryStart, need to flush cache, otherwise |
| 1599 |
//! don't need. |
| 1600 |
//! \param cmdBuffer |
| 1601 |
//! [in, out] the command buffer |
| 1602 |
//! \return MOS_STATUS |
| 1603 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 1604 |
//! |
| 1605 |
MOS_STATUS SetStatusTagByPipeCtrl( |
| 1606 |
PMOS_RESOURCE osResource, |
| 1607 |
uint32_t offset, |
| 1608 |
uint32_t tag, |
| 1609 |
bool needFlushCache, |
| 1610 |
PMOS_COMMAND_BUFFER cmdBuffer); |
| 1611 |
|
| 1612 |
//! |
| 1613 |
//! \brief Set the status tag(start/end) for status report by MI command |
| 1614 |
//! this function is for vdbox. |
| 1615 |
//! \param osResource |
| 1616 |
//! [in] Reource used in the cmd |
| 1617 |
//! \param offset |
| 1618 |
//! [in] Reource offset used the cmd |
| 1619 |
//! \param tag |
| 1620 |
//! [in] queryStart/queryEnd defined in the media_status_report.h |
| 1621 |
//! \param cmdBuffer |
| 1622 |
//! [in, out] the command buffer |
| 1623 |
//! \return MOS_STATUS |
| 1624 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 1625 |
//! |
| 1626 |
MOS_STATUS SetStatusTagByMiCommand( |
| 1627 |
MOS_RESOURCE *osResource, |
| 1628 |
uint32_t offset, |
| 1629 |
uint32_t tag, |
| 1630 |
PMOS_COMMAND_BUFFER cmdBuffer); |
| 1631 |
|
| 1632 |
//! |
| 1633 |
//! \brief Check if simulation/emulation is active |
| 1634 |
//! \return bool |
| 1635 |
//! True if simulation/emulation is active, else false. |
| 1636 |
//! |
| 1637 |
bool IsSimActive() |
| 1638 |
{ |
| 1639 |
return m_osInterface ? m_osInterface->bSimIsActive : false; |
| 1640 |
} |
| 1641 |
|
| 1642 |
//! |
| 1643 |
//! \brief Check if disable scalability by default |
| 1644 |
//! \return bool |
| 1645 |
//! True if it is to disable scalability by default, else it is not. |
| 1646 |
//! |
| 1647 |
bool IsDisableScalability() |
| 1648 |
{ |
| 1649 |
return m_disableScalability; |
| 1650 |
} |
| 1651 |
|
| 1652 |
virtual bool UsesRenderEngine(CODECHAL_FUNCTION codecFunction, uint32_t standard); |
| 1653 |
|
| 1654 |
virtual bool Uses2PlanesInputSurfaceFilmGrain() |
| 1655 |
{ |
| 1656 |
return false; |
| 1657 |
} |
| 1658 |
|
| 1659 |
//! |
| 1660 |
//! \brief Get film grain kernel info |
| 1661 |
//! \details Get kernel base and size |
| 1662 |
//! |
| 1663 |
//! \param [out] kernelBase |
| 1664 |
//! base addr of film grain kernels |
| 1665 |
//! |
| 1666 |
//! \param [out] kernelSize |
| 1667 |
//! size of film grain kernels |
| 1668 |
//! |
| 1669 |
//! \return MOS_STATUS |
| 1670 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 1671 |
//! |
| 1672 |
virtual MOS_STATUS GetFilmGrainKernelInfo( |
| 1673 |
uint8_t* &kernelBase, |
| 1674 |
uint32_t &kernelSize); |
| 1675 |
|
| 1676 |
//! |
| 1677 |
//! \brief Calculates the maximum size for AVP picture level commands |
| 1678 |
//! \details Client facing function to calculate the maximum size for AVP picture level commands |
| 1679 |
//! \param [in] mode |
| 1680 |
//! Indicate the codec mode |
| 1681 |
//! \param [out] commandsSize |
| 1682 |
//! The maximum command buffer size |
| 1683 |
//! \param [out] patchListSize |
| 1684 |
//! The maximum command patch list size |
| 1685 |
//! \param [in] params |
| 1686 |
//! Indicate the command size parameters |
| 1687 |
//! \return MOS_STATUS |
| 1688 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 1689 |
//! |
| 1690 |
virtual MOS_STATUS GetAvpStateCommandSize( |
| 1691 |
uint32_t mode, |
| 1692 |
uint32_t *commandsSize, |
| 1693 |
uint32_t *patchListSize, |
| 1694 |
PMHW_VDBOX_STATE_CMDSIZE_PARAMS params) |
| 1695 |
{ |
| 1696 |
return MOS_STATUS_SUCCESS; |
| 1697 |
}; |
| 1698 |
|
| 1699 |
//! |
| 1700 |
//! \brief Calculates maximum size for AVP tile level commands |
| 1701 |
//! \details Client facing function to calculate maximum size for AVP tile level commands |
| 1702 |
//! \param [in] mode |
| 1703 |
//! Indicate the codec mode |
| 1704 |
//! \param [out] commandsSize |
| 1705 |
//! The maximum command buffer size |
| 1706 |
//! \param [out] patchListSize |
| 1707 |
//! The maximum command patch list size |
| 1708 |
//! \return MOS_STATUS |
| 1709 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 1710 |
//! |
| 1711 |
virtual MOS_STATUS GetAvpPrimitiveCommandSize( |
| 1712 |
uint32_t mode, |
| 1713 |
uint32_t *commandsSize, |
| 1714 |
uint32_t *patchListSize) |
| 1715 |
{ |
| 1716 |
return MOS_STATUS_SUCCESS; |
| 1717 |
}; |
| 1718 |
|
| 1719 |
|
| 1720 |
//! \brief default disable vdbox balancing by UMD |
| 1721 |
bool bEnableVdboxBalancingbyUMD = false; |
| 1722 |
|
| 1723 |
//! \brief default disable the get vdbox node by UMD, decided by MHW and MOS |
| 1724 |
bool m_getVdboxNodeByUMD = false; |
| 1725 |
|
| 1726 |
operator CodechalHwInterfaceNext &() |
| 1727 |
{ |
| 1728 |
if (m_hwInterfaceNext == nullptr) |
| 1729 |
{ |
| 1730 |
CODECHAL_HW_ASSERTMESSAGE("Conversion cannot succeed due to null pointer of m_hwInterfaceNext."); |
| 1731 |
} |
| 1732 |
return *m_hwInterfaceNext; |
| 1733 |
} |
| 1734 |
|
| 1735 |
operator CodechalHwInterfaceNext *() |
| 1736 |
{ |
| 1737 |
return m_hwInterfaceNext; |
| 1738 |
} |
| 1739 |
|
| 1740 |
CodechalHwInterfaceNext *m_hwInterfaceNext = nullptr; |
| 1741 |
|
| 1742 |
}; |
| 1743 |
|
| 1744 |
extern const MOS_SYNC_PARAMS g_cInitSyncParams; |
| 1745 |
|
| 1746 |
#endif // __CODECHAL_HW_H__ |