| 1 |
/* |
| 2 |
* Copyright (c) 2014-2020, 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 mhw_state_heap.h |
| 24 |
//! \brief This modules implements HW interface layer to be used on all platforms on all operating systems/DDIs, across MHW components. |
| 25 |
//! |
| 26 |
#ifndef __MHW_STATE_HEAP_H__ |
| 27 |
#define __MHW_STATE_HEAP_H__ |
| 28 |
|
| 29 |
#include "mos_os.h" |
| 30 |
#include "mhw_utilities.h" |
| 31 |
#include "heap_manager.h" |
| 32 |
|
| 33 |
typedef struct _MHW_STATE_HEAP_MEMORY_BLOCK MHW_STATE_HEAP_MEMORY_BLOCK, *PMHW_STATE_HEAP_MEMORY_BLOCK; |
| 34 |
typedef struct _MHW_STATE_HEAP_INTERFACE MHW_STATE_HEAP_INTERFACE, *PMHW_STATE_HEAP_INTERFACE; |
| 35 |
typedef class XMHW_STATE_HEAP_INTERFACE *PXMHW_STATE_HEAP_INTERFACE; |
| 36 |
typedef struct _MHW_STATE_HEAP MHW_STATE_HEAP, *PMHW_STATE_HEAP; |
| 37 |
typedef struct MHW_BLOCK_MANAGER *PMHW_BLOCK_MANAGER; |
| 38 |
|
| 39 |
#define MHW_INDIRECT_HEAP_SIZE MHW_PAGE_SIZE |
| 40 |
#define MHW_SURFACE_PITCH_ALIGNMENT 128 |
| 41 |
#define MHW_MAX_SURFACE_PLANES 3 |
| 42 |
|
| 43 |
#define MHW_NUM_HW_POLYPHASE_TABLES 17 |
| 44 |
#define MHW_NUM_HW_POLYPHASE_EXTRA_TABLES_G9 15 |
| 45 |
|
| 46 |
//! |
| 47 |
//! \brief GSH Defaults and limits |
| 48 |
//! |
| 49 |
#define MHW_MEDIA_STATE_ALIGN 128 |
| 50 |
#define MHW_SCRATCH_SPACE_ALIGN 1024 |
| 51 |
#define MHW_SAMPLER_STATE_ALIGN 64 |
| 52 |
#define MHW_SAMPLER_STATE_VA_ALIGN 32 |
| 53 |
#define MHW_SAMPLER_STATE_AVS_ALIGN 1024 |
| 54 |
#define MHW_SAMPLER_STATE_AVS_ALIGN_G9 2048 |
| 55 |
|
| 56 |
#define MHW_SAMPLER_STATE_AVS_ALIGN_MEDIA 1024 // per old HWCMD files AVS samplers were aligned to 256. Not sure if this is needed |
| 57 |
#define MHW_SURFACE_STATE_ALIGN 64 // (1 << MHW_BINDING_TABLE_OFFSET_SHIFT) |
| 58 |
|
| 59 |
#define MHW_MEDIA_OBJECT_BYTE_SIZE 24 |
| 60 |
|
| 61 |
// Each increment in sampler index represents this increment in offset |
| 62 |
#define MHW_SAMPLER_STATE_VA_INC 32 |
| 63 |
#define MHW_SAMPLER_STATE_CONV_1D_INC 128 |
| 64 |
#define MHW_AVS_SAMPLER_WIDTH_ALIGN_UNIT 2 |
| 65 |
#define MHW_SAMPLER_STATE_AVS_INC_LEGACY 512 |
| 66 |
#define MHW_AVS_SAMPLER_HEIGHT_ALIGN_UNIT 2 |
| 67 |
#define MHW_SAMPLER_STATE_CONV_INC_LEGACY 512 |
| 68 |
|
| 69 |
#define MHW_SAMPLER_WIDTH_ALIGN_UNIT 2 |
| 70 |
#define MHW_SAMPLER_HEIGHT_ALIGN_UNIT 4 |
| 71 |
|
| 72 |
#define MHW_INVALID_BINDING_TABLE_IDX 0xFFFFFFFF |
| 73 |
|
| 74 |
#define MHW_ASSERT_INVALID_BINDING_TABLE_IDX(index) \ |
| 75 |
{ \ |
| 76 |
if ((index) == MHW_INVALID_BINDING_TABLE_IDX) \ |
| 77 |
{ \ |
| 78 |
MHW_ASSERTMESSAGE("Invalid (nullptr) Pointer."); \ |
| 79 |
eStatus = MOS_STATUS_UNKNOWN; \ |
| 80 |
return eStatus; \ |
| 81 |
} \ |
| 82 |
} |
| 83 |
|
| 84 |
#define MHW_INVALID_SYNC_TAG 0xFFFFFFFF |
| 85 |
|
| 86 |
#define MHW_MIP_TAIL_START_LOD_ENABLED_MASK 0x8000 |
| 87 |
|
| 88 |
enum MW_RENDER_ENGINE_ADDRESS_SHIFT |
| 89 |
{ |
| 90 |
MHW_STATE_HEAP_SURFACE_STATE_SHIFT = 0 |
| 91 |
}; |
| 92 |
|
| 93 |
typedef enum _MHW_STATE_HEAP_PARAM_SHIFTS |
| 94 |
{ |
| 95 |
MHW_SLM_SHIFT = 2, |
| 96 |
MHW_BINDING_TABLE_OFFSET_SHIFT = 6, |
| 97 |
MHW_BINDING_TABLE_ID_SHIFT = 5, |
| 98 |
MHW_SAMPLER_SHIFT = 5, |
| 99 |
MHW_CURBE_SHIFT = 5, |
| 100 |
MHW_THRD_CON_DATA_RD_SHIFT = 5, |
| 101 |
MHW_KERNEL_OFFSET_SHIFT = 6, |
| 102 |
MHW_SAMPLER_INDIRECT_SHIFT = 6, |
| 103 |
MHW_SCRATCH_SPACE_SHIFT = 10, |
| 104 |
MHW_SSH_BASE_SHIFT = 12, |
| 105 |
MHW_COMPUTE_INDIRECT_SHIFT = 6 |
| 106 |
} MHW_STATE_HEAP_PARAM_SHIFTS; |
| 107 |
|
| 108 |
typedef enum _MHW_FRAME_FIELD_TYPE |
| 109 |
{ |
| 110 |
MHW_FRAME = 0, |
| 111 |
MHW_TOP_FIELD, |
| 112 |
MHW_BOTTOM_FIELD, |
| 113 |
MHW_NUM_FRAME_FIELD_TYPES, |
| 114 |
} MHW_FRAME_FIELD_TYPE; |
| 115 |
|
| 116 |
typedef enum _MHW_STATE_HEAP_TYPE |
| 117 |
{ |
| 118 |
MHW_ISH_TYPE = 0, |
| 119 |
MHW_DSH_TYPE, |
| 120 |
MHW_SSH_TYPE //!< Note SSH is currently managed by MOS |
| 121 |
} MHW_STATE_HEAP_TYPE; |
| 122 |
|
| 123 |
typedef enum _MHW_STATE_HEAP_MODE |
| 124 |
{ |
| 125 |
MHW_RENDER_HAL_MODE = 0, //!< 0 - RenderHal handles |
| 126 |
MHW_DSH_MODE, //!< 1 - MDF dynamic heap management |
| 127 |
MHW_DGSH_MODE //!< 2 - Ddynamic generic heap management |
| 128 |
}MHW_STATE_HEAP_MODE; |
| 129 |
|
| 130 |
typedef enum _MHW_PLANE |
| 131 |
{ |
| 132 |
MHW_GENERIC_PLANE = 0, // 1D Surface: MHW_GENERIC_PLANE, 2D Surface: MHW_Y_PLANE |
| 133 |
MHW_Y_PLANE = 0, |
| 134 |
MHW_U_PLANE, |
| 135 |
MHW_V_PLANE, |
| 136 |
} MHW_PLANE; |
| 137 |
|
| 138 |
//! |
| 139 |
//! \brief MHW Rotation Mode enum |
| 140 |
//! |
| 141 |
typedef enum _MHW_ROTATION |
| 142 |
{ |
| 143 |
MHW_ROTATION_IDENTITY = 0, //!< Rotation 0 degrees |
| 144 |
MHW_ROTATION_90, //!< Rotation 90 degrees |
| 145 |
MHW_ROTATION_180, //!< Rotation 180 degrees |
| 146 |
MHW_ROTATION_270, //!< Rotation 270 degrees |
| 147 |
MHW_MIRROR_HORIZONTAL, //!< Horizontal Mirror |
| 148 |
MHW_MIRROR_VERTICAL, //!< Vertical Mirror |
| 149 |
MHW_ROTATE_90_MIRROR_VERTICAL, //!< 90 + V Mirror |
| 150 |
MHW_ROTATE_90_MIRROR_HORIZONTAL //!< 90 + H Mirror |
| 151 |
} MHW_ROTATION; |
| 152 |
|
| 153 |
//! |
| 154 |
//! \brief Render chroma siting vertical value |
| 155 |
//! |
| 156 |
typedef enum _MHW_CHROMA_SITING_VDIRECTION |
| 157 |
{ |
| 158 |
MHW_CHROMA_SITING_VDIRECTION_0 = 0x0, |
| 159 |
MHW_CHROMA_SITING_VDIRECTION_1_4 = 0x1, |
| 160 |
MHW_CHROMA_SITING_VDIRECTION_1_2 = 0x2, |
| 161 |
MHW_CHROMA_SITING_VDIRECTION_3_4 = 0x3, |
| 162 |
MHW_CHROMA_SITING_VDIRECTION_1 = 0x4 |
| 163 |
} MHW_CHROMA_SITING_VDIRECTION; |
| 164 |
|
| 165 |
//! |
| 166 |
//! \brief Chroma Siting enum |
| 167 |
//! |
| 168 |
typedef enum _MHW_CHROMA_SITING |
| 169 |
{ |
| 170 |
MHW_CHROMA_SITING_NONE = 0, |
| 171 |
MHW_CHROMA_SITING_HORZ_LEFT = 1 << 0, |
| 172 |
MHW_CHROMA_SITING_HORZ_CENTER = 1 << 1, |
| 173 |
MHW_CHROMA_SITING_HORZ_RIGHT = 1 << 2, |
| 174 |
MHW_CHROMA_SITING_VERT_TOP = 1 << 4, |
| 175 |
MHW_CHROMA_SITING_VERT_CENTER = 1 << 5, |
| 176 |
MHW_CHROMA_SITING_VERT_BOTTOM = 1 << 6, |
| 177 |
} MHW_CHROMA_SITING; |
| 178 |
|
| 179 |
//! |
| 180 |
//! \brief Scaling mode enum |
| 181 |
//! |
| 182 |
typedef enum _MHW_SCALING_MODE |
| 183 |
{ |
| 184 |
MHW_SCALING_NEAREST = 0, |
| 185 |
MHW_SCALING_BILINEAR, |
| 186 |
MHW_SCALING_AVS |
| 187 |
} MHW_SCALING_MODE; |
| 188 |
|
| 189 |
//! |
| 190 |
//! \brief AVS Params |
| 191 |
//! |
| 192 |
typedef struct _MHW_AVS_PARAMS |
| 193 |
{ |
| 194 |
MOS_FORMAT Format; |
| 195 |
float fScaleX; |
| 196 |
float fScaleY; |
| 197 |
int32_t *piYCoefsX; |
| 198 |
int32_t *piYCoefsY; |
| 199 |
int32_t *piUVCoefsX; |
| 200 |
int32_t *piUVCoefsY; |
| 201 |
bool bForcePolyPhaseCoefs; |
| 202 |
bool bUse8x8Filter; |
| 203 |
} MHW_AVS_PARAMS, *PMHW_AVS_PARAMS; |
| 204 |
|
| 205 |
// Memory block state |
| 206 |
typedef enum _MHW_BLOCK_STATE |
| 207 |
{ |
| 208 |
MHW_BLOCK_STATE_POOL = 0, //!< Block belongs to the pool of memory block objects, it doesn't point to a valid memory block, most fields may be invalid. |
| 209 |
MHW_BLOCK_STATE_FREE, //!< Block points to available memory in State Heap |
| 210 |
MHW_BLOCK_STATE_ALLOCATED, //!< Block points to allocated area in State Heap (allocated but not in use by GPU) |
| 211 |
MHW_BLOCK_STATE_SUBMITTED, //!< Block points to area in State Heap that was submitted for execution by GPU; memory cannot be overwritten or deleted before workload is finished. |
| 212 |
MHW_BLOCK_STATE_DELETED, //!< Block is marked for deletion (State Heap is being deleted). |
| 213 |
|
| 214 |
MHW_BLOCK_STATE_COUNT = 5 |
| 215 |
} MHW_BLOCK_STATE; |
| 216 |
|
| 217 |
struct _MHW_STATE_HEAP_MEMORY_BLOCK |
| 218 |
{ |
| 219 |
//! |
| 220 |
//! \brief The sync tag ID for the memory block may be used to determine |
| 221 |
//! whether or not the memory block is in use--if the ID is |
| 222 |
//! invalid (+1 to the defined maximum number of sync tags), the |
| 223 |
//! memory block is not in use and some or all of it may be used |
| 224 |
//! for a new kernel state region. |
| 225 |
//! |
| 226 |
FrameTrackerTokenFlat trackerToken; |
| 227 |
|
| 228 |
uint32_t dwBlockSize; |
| 229 |
PMHW_STATE_HEAP pStateHeap; |
| 230 |
uint32_t dwOffsetInStateHeap; |
| 231 |
bool bStatic; //!< The kernel state region in this state heap is static and will not be removed during cleanup step. |
| 232 |
|
| 233 |
_MHW_STATE_HEAP_MEMORY_BLOCK *pPrev; |
| 234 |
_MHW_STATE_HEAP_MEMORY_BLOCK *pNext; |
| 235 |
|
| 236 |
//! |
| 237 |
//! \brief The following code is for the MHW dynamic state heap implementation by MDF. |
| 238 |
//! Code is not yet unified across all media driver components |
| 239 |
//! |
| 240 |
MHW_BLOCK_STATE BlockState: 16; //!< Current block state (void, free, allocated, in use, completed, deleted) |
| 241 |
uint32_t bDelete : 1; //!< Block is flagged for deletion upon completion |
| 242 |
uint32_t Reserved : 15; //!< Reserved (uniq block ID used for tracking block utilization by system) |
| 243 |
|
| 244 |
PMHW_STATE_HEAP_MEMORY_BLOCK pHeapNext; //!< Next block in same state heap (adjacent), null if last |
| 245 |
PMHW_STATE_HEAP_MEMORY_BLOCK pHeapPrev; //!< Previous block in same state heap (adjacent), null if first |
| 246 |
|
| 247 |
uint8_t *pDataPtr; //!< Pointer to aligned data |
| 248 |
uint32_t dwDataOffset; //!< Offset of pDataPtr (from State Heap Base - used in state programming) |
| 249 |
uint32_t dwDataSize; //!< Data size (>= requested size due to heap granularity) |
| 250 |
uint32_t dwAlignment; //!< Offset alignment (offset from actual block start) |
| 251 |
}; |
| 252 |
|
| 253 |
typedef struct _MHW_KERNEL_PARAM |
| 254 |
{ |
| 255 |
void *pExtra; //!< Kernel parameter |
| 256 |
uint8_t *pBinary; //!< Pointer to kernel binary |
| 257 |
int32_t iSize; //!< Kernel size |
| 258 |
int32_t iPaddingSize; //!< Padding size |
| 259 |
int32_t iGrfCount; //!< Number of registers |
| 260 |
int32_t iBTCount; //!< Number of BT entries |
| 261 |
int32_t iThreadCount; //!< Number of threads (max) |
| 262 |
int32_t iGrfStartRegister; //!< Start register |
| 263 |
int32_t iSamplerCount; //!< Sampler count |
| 264 |
int32_t iSamplerLength; //!< Sampler length |
| 265 |
int32_t iCurbeLength; //!< Constant URB length |
| 266 |
int32_t iIdCount; //!< Num IDs used by kernel state |
| 267 |
int32_t iInlineDataLength; //!< MEDIA_OBJECT inline data (aka URB length) |
| 268 |
int32_t iBlockWidth; //!< Block width |
| 269 |
int32_t iBlockHeight; //!< Block height |
| 270 |
|
| 271 |
//! |
| 272 |
//! \brief Dynamic kernel parameters may follow below if necessary. |
| 273 |
//! |
| 274 |
int32_t bLoaded; //!< Kernel Loaded flag |
| 275 |
int32_t iKID; //!< Interface descriptor ID for the kernel |
| 276 |
int32_t iKUID; //!< Kernel Unique ID |
| 277 |
int32_t iKCID; //!< Kernel Cache ID |
| 278 |
int32_t iAKBaseID; //!< Authenticated Kernel Base ID |
| 279 |
|
| 280 |
bool bForceReload; //!< The flag to indicate if the kernel need to be reloaded forcibly |
| 281 |
|
| 282 |
} MHW_KERNEL_PARAM, *PMHW_KERNEL_PARAM; |
| 283 |
|
| 284 |
typedef struct MHW_KERNEL_STATE |
| 285 |
{ |
| 286 |
MHW_KERNEL_STATE() |
| 287 |
{ |
| 288 |
m_dshRegion = MemoryBlock(); |
| 289 |
m_ishRegion = MemoryBlock(); |
| 290 |
} |
| 291 |
|
| 292 |
virtual ~MHW_KERNEL_STATE() { MHW_FUNCTION_ENTER; } |
| 293 |
//! |
| 294 |
//! \brief Set when the kernel state is created |
| 295 |
//! |
| 296 |
MHW_KERNEL_PARAM KernelParams = {}; //!< Kernel parameters |
| 297 |
|
| 298 |
//! |
| 299 |
//! \brief Set when the kernel state region for the kernel state |
| 300 |
//! is acquired. |
| 301 |
//! Note: For state heaps other than the SSH it is possible to |
| 302 |
//! make a kernel state region static, such that it belongs |
| 303 |
//! to the kernel state and it is not necessary to acquire a |
| 304 |
//! kernel state region for the DSH/ISH (whichever is |
| 305 |
//! static). |
| 306 |
//! |
| 307 |
uint32_t dwSshOffset = 0; //!< Offset within SSH to the kernel state region |
| 308 |
uint32_t dwBindingTableSize = 0; //!< The size of the binding table for this kernel state |
| 309 |
uint32_t dwSshSize = 0; //!< Size of the kernel state region in the SSH |
| 310 |
uint32_t dwIdOffset = 0; //!< Offset within DSH to ID(s) in kernel state region |
| 311 |
uint32_t dwCurbeOffset = 0; //!< Offset within DSH to CURBE(s) in kernel state region |
| 312 |
uint32_t dwSamplerOffset = 0; //!< Offset within DSH to Sampler(s) in kernel state region |
| 313 |
uint32_t dwKernelBinaryOffset = 0; //!< Offset within ISH to the kernel state region |
| 314 |
|
| 315 |
//! |
| 316 |
//! \brief Descriptors of the DSH/ISH kernel state regions. Since there |
| 317 |
//! may be multiple DSH/ISH buffers, it is necessary to store |
| 318 |
//! which one is used. If one of the regions is static, the memory |
| 319 |
//! block pointer is always expected to be valid. |
| 320 |
//! |
| 321 |
MemoryBlock m_dshRegion; |
| 322 |
MemoryBlock m_ishRegion; |
| 323 |
|
| 324 |
uint32_t m_currTrackerId = MemoryBlock::m_invalidTrackerId; //!< tracker ID for the current execution |
| 325 |
} *PMHW_KERNEL_STATE; |
| 326 |
|
| 327 |
typedef struct _MHW_BINDING_TABLE_PARAMS { |
| 328 |
uint8_t *pBindingTableEntry; // Pointer to BT entry to setup |
| 329 |
uint32_t dwSurfaceStateOffset; // Offset to Surface State (Indirect State) |
| 330 |
bool bSurfaceStateAvs; // true if AVS surface |
| 331 |
int32_t iBindingTableEntry; // Binding Table entry index |
| 332 |
} MHW_BINDING_TABLE_PARAMS, *PMHW_BINDING_TABLE_PARAMS; |
| 333 |
|
| 334 |
typedef struct _MHW_BINDING_TABLE_SEND_PARAMS { |
| 335 |
uint8_t *pBindingTableSource; // Pointer to BT source |
| 336 |
uint8_t *pBindingTableTarget; // Pointer to BT target |
| 337 |
int32_t iSurfaceStateBase; // Offset to first Surface State in SSH |
| 338 |
int32_t iSurfaceStateOffset; // [out] Offset to Surface State in SSH |
| 339 |
int32_t iSurfaceState; // [out] Surface State index (-1 if Copy==0) |
| 340 |
} MHW_BINDING_TABLE_SEND_PARAMS, *PMHW_BINDING_TABLE_SEND_PARAMS; |
| 341 |
|
| 342 |
typedef struct _MHW_SURFACE_STATE_PARAMS { |
| 343 |
uint8_t *pSurfaceState; |
| 344 |
uint32_t dwCacheabilityControl; |
| 345 |
uint32_t dwFormat; |
| 346 |
uint32_t dwWidth; |
| 347 |
uint32_t dwHeight; |
| 348 |
uint32_t dwDepth; |
| 349 |
uint32_t dwPitch; |
| 350 |
uint32_t dwQPitch; |
| 351 |
uint32_t bUseAdvState : 1; |
| 352 |
uint32_t AddressControl : 1; |
| 353 |
uint32_t SurfaceType3D : 3; |
| 354 |
uint32_t bTiledSurface : 1; |
| 355 |
uint32_t bTileWalk : 1; |
| 356 |
uint32_t bVerticalLineStride : 1; |
| 357 |
uint32_t bVerticalLineStrideOffset : 1; |
| 358 |
uint32_t bCompressionEnabled : 1; |
| 359 |
uint32_t bCompressionMode : 1; |
| 360 |
uint32_t MmcState : 3; |
| 361 |
uint32_t bInterleaveChroma : 1; |
| 362 |
uint32_t bHalfPitchChroma : 1; |
| 363 |
uint32_t bSeperateUVPlane : 1; |
| 364 |
uint32_t UVPixelOffsetUDirection : 2; |
| 365 |
uint32_t UVPixelOffsetVDirection : 2; |
| 366 |
uint32_t RotationMode : 3; |
| 367 |
uint32_t bSurfaceArraySpacing : 1; |
| 368 |
uint32_t bBoardColorOGL : 1; |
| 369 |
int32_t iXOffset; |
| 370 |
int32_t iYOffset; |
| 371 |
uint32_t dwXOffsetForU; // U or UV |
| 372 |
uint32_t dwYOffsetForU; // U or UV |
| 373 |
uint32_t dwXOffsetForV; |
| 374 |
uint32_t dwYOffsetForV; |
| 375 |
uint32_t dwCompressionFormat; // Memory Compression Format |
| 376 |
uint32_t L1CacheConfig; |
| 377 |
|
| 378 |
uint32_t *pdwCmd; // [out] Pointer for patching |
| 379 |
uint32_t dwLocationInCmd; // [out] Offset in command for patching |
| 380 |
MOS_TILE_MODE_GMM TileModeGMM; // Tile Type from GMM Definition |
| 381 |
bool bGMMTileEnabled; //!< GMM defined tile mode flag |
| 382 |
|
| 383 |
uint32_t MipTailStartLOD; |
| 384 |
} MHW_SURFACE_STATE_PARAMS, *PMHW_SURFACE_STATE_PARAMS; |
| 385 |
|
| 386 |
struct _MHW_STATE_HEAP |
| 387 |
{ |
| 388 |
MOS_RESOURCE resHeap; //!< Graphics resource for state heap |
| 389 |
void *pvLockedHeap; //!< System (logical) address for state heap |
| 390 |
bool bKeepLocked; |
| 391 |
uint32_t dwSize; //!< Size of the state heap |
| 392 |
|
| 393 |
uint32_t dwUsed; //!< Used memory in state heap |
| 394 |
uint32_t dwFree; //!< Free memory in state heap |
| 395 |
bool bDeleted; //!< State heap is in process of being deleted |
| 396 |
|
| 397 |
// State heap object points to its interface object and block manager |
| 398 |
PMHW_BLOCK_MANAGER pBlockManager; |
| 399 |
PXMHW_STATE_HEAP_INTERFACE pMhwStateHeapInterface; |
| 400 |
|
| 401 |
//! |
| 402 |
//! \brief The memory blocks will be managed in a linked list, each state |
| 403 |
//! heap will have one linked list starting with pMemoryHead. The |
| 404 |
//! memory blocks in this list will describe all available and |
| 405 |
//! used space in the state heap. |
| 406 |
//! |
| 407 |
PMHW_STATE_HEAP_MEMORY_BLOCK pMemoryHead; |
| 408 |
|
| 409 |
PMHW_STATE_HEAP_MEMORY_BLOCK pMemoryTail; //!< Last block in state heap memory (used to traverse pMemNext/pMemPrev) |
| 410 |
PMHW_STATE_HEAP_MEMORY_BLOCK pDebugKernel; //!< Block associated to debug (SIP) kernel in the current ISH |
| 411 |
PMHW_STATE_HEAP_MEMORY_BLOCK pScratchSpace; //!< Block associated with current active scratch space (older scratch spaces are removed) |
| 412 |
uint32_t dwScratchSpace; //!< Active scratch space size |
| 413 |
|
| 414 |
PMHW_STATE_HEAP pPrev; //!< The first state heap is considered primary (pPrev == nullptr) |
| 415 |
PMHW_STATE_HEAP pNext; |
| 416 |
|
| 417 |
uint32_t dwCurrOffset; //!< For simulated SSH to denote the current amount of space used |
| 418 |
}; |
| 419 |
|
| 420 |
typedef struct _MHW_SYNC_TAG |
| 421 |
{ |
| 422 |
uint32_t dwCmdBufId; //!< Command buffer ID for this sync tag, 0 is available |
| 423 |
uint32_t dwSshSizeUsed; |
| 424 |
|
| 425 |
//! |
| 426 |
//! \brief Memory blocks used during the clean up step. |
| 427 |
//! |
| 428 |
PMHW_STATE_HEAP_MEMORY_BLOCK pDshRegion; //!< Memory block for DSH |
| 429 |
PMHW_STATE_HEAP_MEMORY_BLOCK pIshRegion; //!< Memory block for ISH |
| 430 |
} MHW_SYNC_TAG, *PMHW_SYNC_TAG; |
| 431 |
|
| 432 |
typedef struct _MHW_INTERFACE_DESCRIPTOR_PARAMS |
| 433 |
{ |
| 434 |
PMHW_KERNEL_STATE pKernelState; |
| 435 |
uint32_t dwKernelStartOffset; //!< Offset relative to the kernel state region binary start offset in the ISH |
| 436 |
uint32_t dwIdIdx; //!< Index within the ID block of the kernel state region in the DSH of the ID to be added |
| 437 |
uint32_t dwBtOffset; //!< Offset relative to SSH base of the BT start |
| 438 |
uint32_t dwSamplerOffset; //!< Offset within the Sampler block of the kernel state region for the current sampler state |
| 439 |
} MHW_INTERFACE_DESCRIPTOR_PARAMS, *PMHW_INTERFACE_DESCRIPTOR_PARAMS; |
| 440 |
|
| 441 |
// Structure used to program media interface descriptor entry |
| 442 |
typedef struct _MHW_ID_ENTRY_PARAMS |
| 443 |
{ |
| 444 |
uint32_t dwMediaIdOffset; //! Offset of the first Media Interface Descriptor (in DSH) |
| 445 |
uint32_t iMediaId; //! Media Interface Descriptor # |
| 446 |
uint32_t dwKernelOffset; //! Kernel offset (in ISH) |
| 447 |
uint32_t kernelSize; |
| 448 |
uint32_t dwSamplerOffset; //! Sampler offset (in DSH) |
| 449 |
uint32_t dwSamplerCount; //! Sample count |
| 450 |
uint32_t dwBindingTableOffset; //! Binding table offset (in DSH) |
| 451 |
uint32_t iCurbeOffset; //! Curbe offset (in DSH) |
| 452 |
uint32_t iCurbeLength; //! Curbe lenght |
| 453 |
bool bBarrierEnable; //! Enable Barrier |
| 454 |
bool bGlobalBarrierEnable; //! Enable Global Barrier (SKL+) |
| 455 |
uint32_t dwNumberofThreadsInGPGPUGroup; //! Number of threads per group |
| 456 |
uint32_t dwSharedLocalMemorySize; //! Size of SharedLocalMemory (SLM) |
| 457 |
int32_t iCrsThdConDataRdLn; //! |
| 458 |
PMHW_STATE_HEAP pGeneralStateHeap; //! General state heap in use |
| 459 |
MemoryBlock *memoryBlock; //! Memory block associated with the state heap |
| 460 |
uint32_t preferredSlmAllocationSize; //! SLM Allocation Size for per SubSlice |
| 461 |
} MHW_ID_ENTRY_PARAMS, *PMHW_ID_ENTRY_PARAMS; |
| 462 |
|
| 463 |
typedef struct _MHW_PLANE_SETTING |
| 464 |
{ |
| 465 |
uint8_t ui8PlaneID; // Plane identifier |
| 466 |
uint8_t ui8ScaleWidth; // X Scale (divider) |
| 467 |
uint8_t ui8ScaleHeight; // Y Scale (divider) |
| 468 |
uint8_t ui8AlignWidth; // X Alignment |
| 469 |
uint8_t ui8AlignHeight; // Y Alignment |
| 470 |
uint8_t ui8PixelsPerDword; // Pixels per Dword (for dataport read/write) |
| 471 |
bool bAdvanced; // Advanced Surface State |
| 472 |
uint32_t dwFormat; // Hardware Surface Format |
| 473 |
} MHW_PLANE_SETTING, *PMHW_PLANE_SETTING; |
| 474 |
|
| 475 |
typedef struct _MHW_SURFACE_PLANES |
| 476 |
{ |
| 477 |
uint32_t dwNumPlanes; // Number of planes |
| 478 |
MHW_PLANE_SETTING Plane[MHW_MAX_SURFACE_PLANES]; // Description of each plane |
| 479 |
} MHW_SURFACE_PLANES, *PMHW_SURFACE_PLANES; |
| 480 |
|
| 481 |
typedef const _MHW_PLANE_SETTING *PCMHW_PLANE_SETTING; |
| 482 |
typedef const _MHW_SURFACE_PLANES *PCMHW_SURFACE_PLANES; |
| 483 |
|
| 484 |
typedef struct _MHW_RCS_SURFACE_PARAMS |
| 485 |
{ |
| 486 |
PMOS_SURFACE psSurface; |
| 487 |
|
| 488 |
uint32_t bUseAdvState; //!< Indicates that SURFACE_STATE_ADV should be used |
| 489 |
|
| 490 |
uint32_t dwNumPlanes; //!< Indicates the number of valid binding table offsets included |
| 491 |
uint32_t dwPlaneType[MHW_MAX_SURFACE_PLANES]; //!< Indicates the plane type |
| 492 |
uint32_t dwBindingTableOffset[MHW_MAX_SURFACE_PLANES]; //!< Binding table offset for all planes included in surface |
| 493 |
uint32_t dwCacheabilityControl; |
| 494 |
bool bRenderTarget; |
| 495 |
bool bIsWritable; |
| 496 |
|
| 497 |
uint32_t dwWidthToUse[MHW_MAX_SURFACE_PLANES]; //!< If non-zero, overrides value in psSurface |
| 498 |
uint32_t dwHeightToUse[MHW_MAX_SURFACE_PLANES]; //!< If non-zero, overrides value in psSurface |
| 499 |
uint32_t dwPitchToUse[MHW_MAX_SURFACE_PLANES]; //!< If non-zero, overrides value in psSurface |
| 500 |
uint32_t dwBaseAddrOffset[MHW_MAX_SURFACE_PLANES]; |
| 501 |
uint32_t dwYOffset[MHW_MAX_SURFACE_PLANES]; |
| 502 |
uint32_t dwXOffset[MHW_MAX_SURFACE_PLANES]; |
| 503 |
uint32_t ForceSurfaceFormat[MHW_MAX_SURFACE_PLANES]; //!< Of type GFX3DSTATE_SURFACEFORMAT |
| 504 |
uint32_t dwSurfaceType; //!< of type GFX3DSTATE_SURFACETYPE |
| 505 |
|
| 506 |
uint32_t bVertLineStride; |
| 507 |
uint32_t bVertLineStrideOffs; |
| 508 |
uint32_t bInterleaveChroma; |
| 509 |
|
| 510 |
uint32_t dwAddressControl; |
| 511 |
MHW_CHROMA_SITING_VDIRECTION Direction; |
| 512 |
MHW_ROTATION Rotation; //!< 0: 0 degree, 1: 90 degree, 2: 180 degree, 3: 270 degree |
| 513 |
uint32_t MediaBoundaryPixelMode; //!< Of type GFX3DSTATE_MEDIA_BOUNDARY_PIXEL_MODE |
| 514 |
uint32_t dwOffsetInSSH; |
| 515 |
} MHW_RCS_SURFACE_PARAMS, *PMHW_RCS_SURFACE_PARAMS; |
| 516 |
|
| 517 |
typedef struct _MHW_SURFACE_TOKEN_PARAMS |
| 518 |
{ |
| 519 |
PMOS_SURFACE pOsSurface; |
| 520 |
uint32_t dwSurfaceOffset; |
| 521 |
uint32_t YUVPlane : 2; |
| 522 |
uint32_t bRenderTarget : 1; |
| 523 |
uint32_t : 1; |
| 524 |
uint32_t bSurfaceTypeAvs : 1; |
| 525 |
uint32_t : 26; |
| 526 |
} MHW_SURFACE_TOKEN_PARAMS, *PMHW_SURFACE_TOKEN_PARAMS; |
| 527 |
|
| 528 |
//! |
| 529 |
//! \brief Sampler Type |
| 530 |
//! |
| 531 |
typedef enum _MHW_SAMPLER_TYPE |
| 532 |
{ |
| 533 |
MHW_SAMPLER_TYPE_INVALID = 0, |
| 534 |
MHW_SAMPLER_NONE , |
| 535 |
MHW_SAMPLER_TYPE_3D , // UNORM |
| 536 |
MHW_SAMPLER_TYPE_AVS , // AVS (Avanced Video Sampler = 8x8, STE, IEF) |
| 537 |
MHW_SAMPLER_TYPE_VME , // VME |
| 538 |
MHW_SAMPLER_TYPE_MISC , // MISC |
| 539 |
MHW_SAMPLER_TYPE_MINMAX , |
| 540 |
MHW_SAMPLER_TYPE_ERODE , |
| 541 |
MHW_SAMPLER_TYPE_DILATE , |
| 542 |
MHW_SAMPLER_TYPE_CONV // CONVOLUTION (Gen8+) |
| 543 |
} MHW_SAMPLER_TYPE, *PMHW_SAMPLER_TYPE; |
| 544 |
|
| 545 |
typedef enum _MHW_SAMPLER_ELEMENTS_TYPE : unsigned int |
| 546 |
{ |
| 547 |
MHW_Sampler1Element = 0, |
| 548 |
MHW_Sampler2Elements, |
| 549 |
MHW_Sampler4Elements, |
| 550 |
MHW_Sampler8Elements, |
| 551 |
MHW_Sampler64Elements, |
| 552 |
MHW_Sampler128Elements, |
| 553 |
|
| 554 |
MHW_SamplerTotalElements |
| 555 |
}MHW_SAMPLER_ELEMENT_TYPE, *PMHW_SAMPLER_ELEMENT_TYPE; |
| 556 |
|
| 557 |
//! |
| 558 |
//! \brief Sampler Tap Mode |
| 559 |
//! |
| 560 |
typedef enum _MHW_SAMPLER_TAP_MODE |
| 561 |
{ |
| 562 |
MHW_SAMPLER_FILTER_4_TAP = 0, |
| 563 |
MHW_SAMPLER_FILTER_8_4_TAP, |
| 564 |
MHW_SAMPLER_FILTER_8_TAP, |
| 565 |
MHW_SAMPLER_FILTER_8_TAP_ADATIVE |
| 566 |
} MHW_SAMPLER_TAP_MODE, *PMHW_SAMPLER_TAP_MODE; |
| 567 |
|
| 568 |
//! |
| 569 |
//! \brief Sampler Filter Mode |
| 570 |
//! |
| 571 |
typedef enum _MHW_SAMPLER_FILTER_MODE |
| 572 |
{ |
| 573 |
MHW_SAMPLER_FILTER_CUSTOM = 0, |
| 574 |
MHW_SAMPLER_FILTER_NEAREST, |
| 575 |
MHW_SAMPLER_FILTER_BILINEAR |
| 576 |
} MHW_SAMPLER_FILTER_MODE, *PMHW_SAMPLER_FILTER_MODE; |
| 577 |
|
| 578 |
typedef enum _MHW_SAMPLER_TEXTADDR |
| 579 |
{ |
| 580 |
MHW_SAMPLER_TEXTADDR_WRAP, |
| 581 |
MHW_SAMPLER_TEXTADDR_MIRROR, |
| 582 |
MHW_SAMPLER_TEXTADDR_CLAMP, |
| 583 |
MHW_SAMPLER_TEXTADDR_CUBE, |
| 584 |
MHW_SAMPLER_TEXTADDR_CLAMPBORDER, |
| 585 |
MHW_SAMPLER_TEXTADDR_MIRROR_ONCE |
| 586 |
} MHW_SAMPLER_TEXTADDR; |
| 587 |
|
| 588 |
typedef struct _MHW_AVS_COEFFICIENT_PARAM |
| 589 |
{ |
| 590 |
int8_t ZeroXFilterCoefficient[8]; |
| 591 |
int8_t ZeroYFilterCoefficient[8]; |
| 592 |
int8_t OneXFilterCoefficient[4]; //!< [0..3] maps to filter coefficients [2..5], in actual tabel [0..1] are reserved |
| 593 |
int8_t OneYFilterCoefficient[4]; //!< [0..3] maps to filter coefficients [2..5], in actual tabel [0..1] are reserved |
| 594 |
} MHW_AVS_COEFFICIENT_PARAM, *PMHW_AVS_COEFFICIENT_PARAM; |
| 595 |
|
| 596 |
typedef struct _MHW_SAMPLER_AVS_TABLE_PARAM |
| 597 |
{ |
| 598 |
MHW_AVS_COEFFICIENT_PARAM paMhwAvsCoeffParam[MHW_NUM_HW_POLYPHASE_TABLES]; |
| 599 |
|
| 600 |
// sampler table control |
| 601 |
uint8_t byteTransitionArea8Pixels; //!< only least 3-bits used |
| 602 |
uint8_t byteTransitionArea4Pixels; //!< only least 3-bits used |
| 603 |
uint8_t byteMaxDerivative8Pixels; |
| 604 |
uint8_t byteMaxDerivative4Pixels; |
| 605 |
uint8_t byteDefaultSharpnessLevel; |
| 606 |
|
| 607 |
bool bEnableRGBAdaptive; |
| 608 |
bool bAdaptiveFilterAllChannels; |
| 609 |
bool bBypassYAdaptiveFiltering; |
| 610 |
bool bBypassXAdaptiveFiltering; |
| 611 |
|
| 612 |
bool b8TapAdaptiveEnable; |
| 613 |
bool b4TapGY; |
| 614 |
bool b4TapRBUV; |
| 615 |
|
| 616 |
bool bIsCoeffExtraEnabled; |
| 617 |
MHW_AVS_COEFFICIENT_PARAM paMhwAvsCoeffParamExtra[MHW_NUM_HW_POLYPHASE_EXTRA_TABLES_G9]; // only for gen9+ |
| 618 |
|
| 619 |
} MHW_SAMPLER_AVS_TABLE_PARAM, *PMHW_SAMPLER_AVS_TABLE_PARAM; |
| 620 |
|
| 621 |
//! |
| 622 |
//! \brief Sampler States for 8x8 sampler |
| 623 |
//! |
| 624 |
typedef struct _MHW_SAMPLER_STATE_AVS_PARAM |
| 625 |
{ |
| 626 |
int16_t stateID; |
| 627 |
|
| 628 |
// STE params |
| 629 |
bool bEnableSTDE; // a.k.a SkinToneTunedIEF |
| 630 |
bool b8TapAdaptiveEnable; |
| 631 |
bool bSkinDetailFactor; |
| 632 |
bool bHdcDwEnable; // Gen9+ |
| 633 |
bool bWritebackStandard; // set Writeback same as Original Sample_8x8 |
| 634 |
|
| 635 |
// IEF params |
| 636 |
bool bEnableIEF; |
| 637 |
uint16_t wIEFFactor; // 0 will disable IEF |
| 638 |
uint16_t wR3xCoefficient; |
| 639 |
uint16_t wR3cCoefficient; |
| 640 |
uint16_t wR5xCoefficient; |
| 641 |
uint16_t wR5cxCoefficient; |
| 642 |
uint16_t wR5cCoefficient; |
| 643 |
|
| 644 |
// AVS params |
| 645 |
bool bEnableAVS; |
| 646 |
bool AvsType; // 0 - Polyphase; 1 - nearest |
| 647 |
bool EightTapAFEnable; |
| 648 |
bool BypassIEF; // ignored for BWL, moved to sampler8x8 payload. |
| 649 |
uint16_t GainFactor; |
| 650 |
uint8_t GlobalNoiseEstm; |
| 651 |
uint8_t StrongEdgeThr; |
| 652 |
uint8_t WeakEdgeThr; |
| 653 |
uint8_t StrongEdgeWght; |
| 654 |
uint8_t RegularWght; |
| 655 |
uint8_t NonEdgeWght; |
| 656 |
bool b8TapLumaForYUV444; |
| 657 |
|
| 658 |
// Additional overrides |
| 659 |
uint16_t AdditionalOverridesUsed; |
| 660 |
uint16_t YSlope2; |
| 661 |
uint16_t S0L; |
| 662 |
uint16_t YSlope1; |
| 663 |
uint16_t S2U; |
| 664 |
uint16_t S1U; |
| 665 |
|
| 666 |
PMHW_SAMPLER_AVS_TABLE_PARAM pMhwSamplerAvsTableParam; // pointer to AVS scaling 8x8 table params |
| 667 |
|
| 668 |
int32_t iTable8x8_Index; // Table allocation index (not needed on Gen8+) |
| 669 |
void *pTable8x8_Ptr; // Table data ptr in GSH |
| 670 |
uint32_t dwTable8x8_Offset; // Table data offset in GSH |
| 671 |
} MHW_SAMPLER_STATE_AVS_PARAM, *PMHW_SAMPLER_STATE_AVS_PARAM; |
| 672 |
|
| 673 |
//! |
| 674 |
//! \brief Structure to handle UNORM sampler states |
| 675 |
//! |
| 676 |
typedef enum _MHW_SAMPLER_SURFACE_PIXEL_TYPE |
| 677 |
{ |
| 678 |
MHW_SAMPLER_SURFACE_PIXEL_UINT, |
| 679 |
MHW_SAMPLER_SURFACE_PIXEL_SINT, |
| 680 |
MHW_SAMPLER_SURFACE_PIXEL_OTHER |
| 681 |
} MHW_SAMPLER_SURFACE_PIXEL_TYPE; |
| 682 |
|
| 683 |
typedef enum _MHW_GFX3DSTATE_MAPFILTER |
| 684 |
{ |
| 685 |
MHW_GFX3DSTATE_MAPFILTER_NEAREST = 0x0, |
| 686 |
MHW_GFX3DSTATE_MAPFILTER_LINEAR = 0x1, |
| 687 |
MHW_GFX3DSTATE_MAPFILTER_ANISOTROPIC = 0x2, |
| 688 |
MHW_GFX3DSTATE_MAPFILTER_FLEXIBLE = 0x3, |
| 689 |
MHW_GFX3DSTATE_MAPFILTER_MONO = 0x6 |
| 690 |
} MHW_GFX3DSTATE_MAPFILTER; |
| 691 |
|
| 692 |
typedef enum _MHW_GFX3DSTATE_TEXCOORDMODE |
| 693 |
{ |
| 694 |
MHW_GFX3DSTATE_TEXCOORDMODE_WRAP = 0, |
| 695 |
MHW_GFX3DSTATE_TEXCOORDMODE_MIRROR = 1, |
| 696 |
MHW_GFX3DSTATE_TEXCOORDMODE_CLAMP = 2, |
| 697 |
MHW_GFX3DSTATE_TEXCOORDMODE_CUBE = 3, |
| 698 |
MHW_GFX3DSTATE_TEXCOORDMODE_CLAMP_BORDER = 4, |
| 699 |
MHW_GFX3DSTATE_TEXCOORDMODE_MIRROR_ONCE = 5 |
| 700 |
} MHW_GFX3DSTATE_TEXCOORDMODE; |
| 701 |
|
| 702 |
typedef enum _MHW_CHROMAKEY_MODE |
| 703 |
{ |
| 704 |
MHW_CHROMAKEY_MODE_KILL_ON_ANY_MATCH = 0, |
| 705 |
MHW_CHROMAKEY_MODE_REPLACE_BLACK = 1 |
| 706 |
} MHW_CHROMAKEY_MODE; |
| 707 |
|
| 708 |
typedef struct _MHW_SAMPLER_STATE_UNORM_PARAM |
| 709 |
{ |
| 710 |
MHW_SAMPLER_FILTER_MODE SamplerFilterMode; |
| 711 |
MHW_GFX3DSTATE_MAPFILTER MagFilter; |
| 712 |
MHW_GFX3DSTATE_MAPFILTER MinFilter; |
| 713 |
MHW_GFX3DSTATE_TEXCOORDMODE AddressU; |
| 714 |
MHW_GFX3DSTATE_TEXCOORDMODE AddressV; |
| 715 |
MHW_GFX3DSTATE_TEXCOORDMODE AddressW; |
| 716 |
|
| 717 |
MHW_SAMPLER_SURFACE_PIXEL_TYPE SurfaceFormat; |
| 718 |
union { |
| 719 |
uint32_t BorderColorRedU; |
| 720 |
int32_t BorderColorRedS; |
| 721 |
float BorderColorRedF; |
| 722 |
}; |
| 723 |
|
| 724 |
union { |
| 725 |
uint32_t BorderColorGreenU; |
| 726 |
int32_t BorderColorGreenS; |
| 727 |
float BorderColorGreenF; |
| 728 |
}; |
| 729 |
|
| 730 |
union { |
| 731 |
uint32_t BorderColorBlueU; |
| 732 |
int32_t BorderColorBlueS; |
| 733 |
float BorderColorBlueF; |
| 734 |
}; |
| 735 |
|
| 736 |
union { |
| 737 |
uint32_t BorderColorAlphaU; |
| 738 |
int32_t BorderColorAlphaS; |
| 739 |
float BorderColorAlphaF; |
| 740 |
}; |
| 741 |
|
| 742 |
uint32_t IndirectStateOffset; |
| 743 |
void *pIndirectState; |
| 744 |
bool bBorderColorIsValid; |
| 745 |
|
| 746 |
bool bChromaKeyEnable; |
| 747 |
uint32_t ChromaKeyIndex; |
| 748 |
MHW_CHROMAKEY_MODE ChromaKeyMode; |
| 749 |
} MHW_SAMPLER_STATE_UNORM_PARAM, *PMHW_SAMPLER_STATE_UNORM_PARAM; |
| 750 |
|
| 751 |
//! |
| 752 |
//! \brief Structure to capture sizes of HW engine commands and structures |
| 753 |
//! |
| 754 |
typedef struct _MHW_RENDER_STATE_SIZES |
| 755 |
{ |
| 756 |
uint32_t dwSizeMediaObjectHeaderCmd; // Size of Media Object Header Command |
| 757 |
uint32_t dwMaxSizeSurfaceState; // Max size of a surface state |
| 758 |
uint32_t dwSizeSurfaceState; // Size of surface state |
| 759 |
uint32_t dwSizeSurfaceStateAvs; // Size of AVS surface state |
| 760 |
uint32_t dwSizeBindingTableState; // Size of binding table state entry |
| 761 |
uint32_t dwSizeSamplerState; // Size of sampler state (unorm) |
| 762 |
uint32_t dwSizeSamplerIndirectState; // Size of sampler indirect state (unorm) |
| 763 |
uint32_t dwSizeSamplerStateAvs; // Size of sampler state (Avs) |
| 764 |
uint32_t dwSizeSamplerStateVA; // Size of sampler state (va) |
| 765 |
uint32_t dwSizeSamplerStateVAConvolve; // Size of sampler state (va convolve) |
| 766 |
uint32_t dwSizeSamplerStateTable8x8; // Size of sampler state 8x8 table |
| 767 |
uint32_t dwSizeSampler8x8Table; // Size of sampler 8x8 table |
| 768 |
uint32_t dwSizeInterfaceDescriptor; // Size of interface descriptor |
| 769 |
uint32_t dwSizeMediaWalkerBlock; // Size of Media Walker block |
| 770 |
} MHW_RENDER_STATE_SIZES, *PMHW_RENDER_STATE_SIZES; |
| 771 |
|
| 772 |
//! |
| 773 |
//! \brief Structure to handle VME Sampler State |
| 774 |
//! |
| 775 |
typedef struct _MHW_SAMPLER_STATE_VME_PARAM |
| 776 |
{ |
| 777 |
uint32_t *pdwLUTSearchPath; |
| 778 |
uint32_t *pdwLUTMbMode; |
| 779 |
uint32_t *pdwLUTMv; |
| 780 |
} MHW_SAMPLER_STATE_VME_PARAM, *PMHW_SAMPLER_STATE_VME_PARAM; |
| 781 |
|
| 782 |
typedef struct _MHW_SAMPLER_CONVOLVE_COEFF_TABLE |
| 783 |
{ |
| 784 |
uint16_t wFilterCoeff[16]; |
| 785 |
} MHW_SAMPLER_CONVOLVE_COEFF_TABLE; |
| 786 |
|
| 787 |
typedef struct _MHW_SAMPLER_STATE_CONVOLVE_PARAM |
| 788 |
{ |
| 789 |
uint8_t ui8ConvolveType; // 1d, 2d |
| 790 |
uint8_t ui8Height; |
| 791 |
uint8_t ui8Width; |
| 792 |
uint8_t ui8ScaledDownValue; |
| 793 |
uint8_t ui8SizeOfTheCoefficient; |
| 794 |
uint8_t ui8MSBHeight; |
| 795 |
uint8_t ui8MSBWidth; |
| 796 |
bool skl_mode; |
| 797 |
MHW_SAMPLER_CONVOLVE_COEFF_TABLE CoeffTable[62]; |
| 798 |
} MHW_SAMPLER_STATE_CONVOLVE_PARAM, *PMHW_SAMPLER_STATE_CONVOLVE_PARAM; |
| 799 |
|
| 800 |
typedef struct _MHW_SAMPLER_8x8_MISC_STATE { |
| 801 |
uint8_t byteHeight; |
| 802 |
uint8_t byteWidth; |
| 803 |
uint16_t wRow[15]; |
| 804 |
} MHW_SAMPLER_8x8_MISC_STATE, *PMHW_SAMPLER_8x8_MISC_STATE; |
| 805 |
|
| 806 |
//! |
| 807 |
//! \brief Structure to handle Sampler State |
| 808 |
//! |
| 809 |
typedef struct _MHW_SAMPLER_STATE_PARAM |
| 810 |
{ |
| 811 |
bool bInUse; |
| 812 |
PMHW_KERNEL_STATE pKernelState; |
| 813 |
MHW_SAMPLER_TYPE SamplerType; |
| 814 |
MHW_SAMPLER_ELEMENT_TYPE ElementType; |
| 815 |
union |
| 816 |
{ |
| 817 |
MHW_SAMPLER_STATE_UNORM_PARAM Unorm; |
| 818 |
MHW_SAMPLER_STATE_AVS_PARAM Avs; |
| 819 |
MHW_SAMPLER_STATE_VME_PARAM Vme; |
| 820 |
MHW_SAMPLER_STATE_CONVOLVE_PARAM Convolve; |
| 821 |
MHW_SAMPLER_8x8_MISC_STATE Misc; |
| 822 |
}; |
| 823 |
} MHW_SAMPLER_STATE_PARAM, *PMHW_SAMPLER_STATE_PARAM; |
| 824 |
|
| 825 |
typedef struct _MHW_SURFACE_STATE_SEND_PARAMS { |
| 826 |
uint8_t *pIndirectStateBase; |
| 827 |
uint8_t *pSurfaceStateSource; |
| 828 |
uint8_t *pSurfaceToken; |
| 829 |
int32_t iIndirectStateBase; |
| 830 |
int32_t iSurfaceStateOffset; |
| 831 |
bool bNeedNullPatch; |
| 832 |
PMOS_RESOURCE surfaceStateHeapMosResource; |
| 833 |
} MHW_SURFACE_STATE_SEND_PARAMS, *PMHW_SURFACE_STATE_SEND_PARAMS; |
| 834 |
|
| 835 |
struct MHW_STATE_HEAP_SETTINGS |
| 836 |
{ |
| 837 |
MHW_STATE_HEAP_SETTINGS() {} |
| 838 |
|
| 839 |
virtual ~MHW_STATE_HEAP_SETTINGS() {} |
| 840 |
|
| 841 |
uint32_t dwIshSize = 0; //!< Initial size of ISH |
| 842 |
uint32_t dwDshSize = 0; //!< Initial size of DSH |
| 843 |
uint32_t dwIshIncrement = 0; //!< ISH increment step |
| 844 |
uint32_t dwDshIncrement = 0; //!< DSH increment step |
| 845 |
uint32_t dwIshMaxSize = 0; //!< ISH max size |
| 846 |
uint32_t dwDshMaxSize = 0; //!< DSH max size |
| 847 |
|
| 848 |
bool m_keepIshLocked = false; //!< Keep ISH locked always |
| 849 |
bool m_keepDshLocked = false; //!< Keep DSH locked always |
| 850 |
|
| 851 |
HeapManager::Behavior m_ishBehavior = HeapManager::Behavior::wait; //!< ISH behavior |
| 852 |
HeapManager::Behavior m_dshBehavior = HeapManager::Behavior::wait; //!< DSH behavior |
| 853 |
|
| 854 |
uint32_t dwNumSyncTags = 0; //!< to be removed with old interfaces |
| 855 |
MOS_HW_RESOURCE_DEF m_heapUsageType = MOS_CODEC_RESOURCE_USAGE_BEGIN_CODEC; |
| 856 |
}; |
| 857 |
|
| 858 |
typedef struct _MHW_STATE_HEAP_DYNAMIC_ALLOC_PARAMS |
| 859 |
{ |
| 860 |
int32_t *piSizes; //<! [in] array of block sizes to allocate |
| 861 |
int32_t iCount; //<! [in] number of blocks to allocate |
| 862 |
uint32_t dwAlignment; //<! [in] block alignment |
| 863 |
bool bHeapAffinity; //<! [in] true if all blocks must be allocated in the same heap; false otherwize |
| 864 |
PMHW_STATE_HEAP pHeapAffinity; //<! [in] Select a specific heap to allocate (nullptr if don't care) |
| 865 |
uint32_t dwScratchSpace; //<! [in/out] Scratch space requested, scratch space allocated in same heap as the block |
| 866 |
PMHW_STATE_HEAP_MEMORY_BLOCK pScratchSpace; //<! [out] Pointer to scratch space block used - needed for command buffer setup |
| 867 |
bool bZeroAssignedMem; //<! [in] Zero memory blocks after allocation |
| 868 |
bool bStatic; //<! [in] Block allocations are flaged as static |
| 869 |
bool bGrow; //<! [in] Allow state heap to grow in order to satisfy the request |
| 870 |
} MHW_STATE_HEAP_DYNAMIC_ALLOC_PARAMS, *PMHW_STATE_HEAP_DYNAMIC_ALLOC_PARAMS; |
| 871 |
|
| 872 |
typedef MOS_STATUS ( *pfnAddResourceToCmd) (PMOS_INTERFACE , PMOS_COMMAND_BUFFER ,PMHW_RESOURCE_PARAMS); |
| 873 |
|
| 874 |
class XMHW_STATE_HEAP_INTERFACE |
| 875 |
{ |
| 876 |
public: |
| 877 |
static const uint32_t m_mhwBindingTableOffsetShift = 6; |
| 878 |
static const uint32_t m_mhwBindingTableSurfaceShift = 6; |
| 879 |
static const uint32_t m_mhwGenericOffsetShift = 6; |
| 880 |
static const uint32_t m_mhwBindingTableOffsetAlignment = (1 << m_mhwBindingTableOffsetShift); |
| 881 |
static const uint32_t m_mhwNumBindingTableEntryOffset = (m_mhwBindingTableOffsetAlignment/4); |
| 882 |
|
| 883 |
protected: |
| 884 |
HeapManager m_ishManager; |
| 885 |
HeapManager m_dshManager; |
| 886 |
std::vector<MemoryBlock> m_blocks; |
| 887 |
std::vector<uint32_t> m_blockSizes; |
| 888 |
|
| 889 |
private: |
| 890 |
MEDIA_WA_TABLE *m_pWaTable; |
| 891 |
MHW_STATE_HEAP_SETTINGS m_StateHeapSettings; |
| 892 |
|
| 893 |
// old heap management |
| 894 |
MOS_RESOURCE m_resCmdBufIdGlobal; |
| 895 |
uint32_t *m_pdwCmdBufIdGlobal; |
| 896 |
uint32_t m_dwCurrCmdBufId; |
| 897 |
PMHW_SYNC_TAG m_pSyncTags; |
| 898 |
uint32_t m_dwCurrSyncTag; |
| 899 |
uint32_t m_dwInvalidSyncTagId; //!< Passed in at creation by the client |
| 900 |
bool m_bRegisteredBBCompleteNotifyEvent; |
| 901 |
PMHW_STATE_HEAP m_pInstructionStateHeaps; |
| 902 |
uint32_t m_dwNumIsh; |
| 903 |
uint32_t m_dwNumDsh; |
| 904 |
PMHW_STATE_HEAP m_pDynamicStateHeaps; |
| 905 |
int8_t m_bDynamicMode; //!< To be deprecated, 0 - RenderHal handles, 1 - MDF heap management, 2 - generic hep |
| 906 |
PMHW_BLOCK_MANAGER m_pIshBlockManager; //!< ISH block management object |
| 907 |
PMHW_BLOCK_MANAGER m_pDshBlockManager; //!< DSH block management object |
| 908 |
|
| 909 |
public: |
| 910 |
PMOS_INTERFACE m_pOsInterface; |
| 911 |
uint16_t m_wIdAlignment; |
| 912 |
uint16_t m_wBtIdxAlignment; |
| 913 |
uint16_t m_wCurbeAlignment; |
| 914 |
uint16_t m_wSizeOfCmdSamplerState; |
| 915 |
uint32_t m_dwMaxSurfaceStateSize; |
| 916 |
pfnAddResourceToCmd m_pfnAddResourceToCmd; |
| 917 |
MHW_STATE_HEAP m_SurfaceStateHeap; //!< Simulated SSH with MHW_STATE_HEAP. |
| 918 |
uint16_t m_wSizeOfCmdInterfaceDescriptorData; |
| 919 |
MHW_RENDER_STATE_SIZES m_HwSizes; |
| 920 |
|
| 921 |
public: |
| 922 |
//! |
| 923 |
//! \brief Internal to MHW |
| 924 |
//! |
| 925 |
|
| 926 |
//! |
| 927 |
//! \brief Constructor of the MI StateHeap interface |
| 928 |
//! \details Internal MHW function to initialize all function pointers and some parameters |
| 929 |
//! \param [in] pCpInterface |
| 930 |
//! CP interface, must be valid |
| 931 |
//! \param [in] pOsInterface |
| 932 |
//! OS interface, must be valid |
| 933 |
//! |
| 934 |
XMHW_STATE_HEAP_INTERFACE(PMOS_INTERFACE pInputOSInterface, int8_t bDynamicMode=0); |
| 935 |
|
| 936 |
XMHW_STATE_HEAP_INTERFACE(const XMHW_STATE_HEAP_INTERFACE&) = delete; |
| 937 |
|
| 938 |
XMHW_STATE_HEAP_INTERFACE& operator=(const XMHW_STATE_HEAP_INTERFACE&) = delete; |
| 939 |
|
| 940 |
virtual ~XMHW_STATE_HEAP_INTERFACE(); |
| 941 |
|
| 942 |
virtual PMHW_STATE_HEAP GetDSHPointer(){ return m_pDynamicStateHeaps; }; |
| 943 |
|
| 944 |
virtual PMHW_STATE_HEAP GetISHPointer() { return m_pInstructionStateHeaps; }; |
| 945 |
|
| 946 |
uint32_t GetNumDsh(){return m_dwNumDsh;}; |
| 947 |
|
| 948 |
uint32_t GetNumIsh(){return m_dwNumIsh;}; |
| 949 |
|
| 950 |
PMOS_RESOURCE GetResCmdBufIdGlobal(){return &m_resCmdBufIdGlobal;}; |
| 951 |
|
| 952 |
PMHW_SYNC_TAG GetSycnTags(){return m_pSyncTags;}; |
| 953 |
|
| 954 |
uint16_t GetIdAlignment(){return m_wIdAlignment;}; |
| 955 |
|
| 956 |
uint16_t GetSizeofCmdSampleState(){return m_wSizeOfCmdSamplerState;}; |
| 957 |
|
| 958 |
uint16_t GetSizeofCmdInterfaceDescriptorData(){ return m_wSizeOfCmdInterfaceDescriptorData;}; |
| 959 |
|
| 960 |
uint16_t GetCurbeAlignment(){ return m_wCurbeAlignment;}; |
| 961 |
|
| 962 |
uint16_t GetBtIdxAlignment(){ return m_wBtIdxAlignment;}; |
| 963 |
|
| 964 |
uint32_t GetCurrCmdBufId(){ return m_dwCurrCmdBufId;}; |
| 965 |
|
| 966 |
uint32_t GetCmdBufIdGlobal(){ return *m_pdwCmdBufIdGlobal;}; |
| 967 |
|
| 968 |
uint32_t *GetCmdBufIdGlobalPointer(){ return m_pdwCmdBufIdGlobal; }; |
| 969 |
|
| 970 |
PMHW_RENDER_STATE_SIZES GetHwSizesPointer() { return & m_HwSizes;}; |
| 971 |
|
| 972 |
uint32_t GetSizeofSamplerStateAvs() { return m_HwSizes.dwSizeSamplerStateAvs;}; |
| 973 |
|
| 974 |
int8_t GetDynamicMode() { return m_bDynamicMode; } |
| 975 |
|
| 976 |
//! |
| 977 |
//! \brief Initializes the MI StateHeap interface |
| 978 |
//! \details Internal MHW function to initialize all function pointers and some parameters |
| 979 |
//! Assumes that the caller has checked pointer validity and whether or not an |
| 980 |
//! addressing method has been selected in the OS interface (bUsesGfxAddress or |
| 981 |
//! bUsesPatchList). |
| 982 |
//! \param [in] StateHeapSettings |
| 983 |
//! StateHeap setting passed from caller |
| 984 |
//! \return MOS_STATUS |
| 985 |
//! MOS_STATUS_SUCCESS if success else fail reason |
| 986 |
MOS_STATUS InitializeInterface(MHW_STATE_HEAP_SETTINGS StateHeapSettings); |
| 987 |
|
| 988 |
//! |
| 989 |
//! \brief Assigns space in a state heap to a kernel state |
| 990 |
//! \details Client facing function to assign as space in a state heap a kernel state; |
| 991 |
//! if no space is available, a clean up is attempted |
| 992 |
//! \param MHW_STATE_HEAP_TYPE StateHeapType |
| 993 |
//! [in] The state heap type requested (ISH/DSH) |
| 994 |
//! \param PMHW_KERNEL_STATE pKernelState |
| 995 |
//! [in] Kernel state to which a state heap space will be assigned |
| 996 |
//! \param uint32_t dwSpaceRequested |
| 997 |
//! [in] The amount of space requested from the state heap |
| 998 |
//! \param bool bStatic |
| 999 |
//! [in] Whether or not the space requested is static |
| 1000 |
//! \param bool bZeroAssignedMem |
| 1001 |
//! [in] Whether or not acquired memory should be zeroed |
| 1002 |
//! \return MOS_STATUS |
| 1003 |
//! MOS_STATUS_SUCCESS if success, MOS_STATUS_CLIENT_AR_NO_SPACE if no space |
| 1004 |
//! is available but it is possible for the client to wait, else fail reason |
| 1005 |
//! |
| 1006 |
MOS_STATUS AssignSpaceInStateHeap( |
| 1007 |
MHW_STATE_HEAP_TYPE StateHeapType, |
| 1008 |
PMHW_KERNEL_STATE pKernelState, |
| 1009 |
uint32_t dwSpaceRequested, |
| 1010 |
bool bStatic, |
| 1011 |
bool bZeroAssignedMem); |
| 1012 |
|
| 1013 |
//! |
| 1014 |
//! \brief Submits all non-static blocks in kernel state |
| 1015 |
//! \param [in] pKernelState |
| 1016 |
//! Kernel state containing all memory blocks to submit |
| 1017 |
//! \return MOS_STATUS |
| 1018 |
//! MOS_STATUS_SUCCESS if success |
| 1019 |
//! |
| 1020 |
MOS_STATUS SubmitBlocks(PMHW_KERNEL_STATE pKernelState); |
| 1021 |
|
| 1022 |
//! |
| 1023 |
//! \brief Locks requested state heap |
| 1024 |
//! \details Client facing function to lock a state heap |
| 1025 |
//! \param PMHW_STATE_HEAP pStateHeap |
| 1026 |
//! [in] The state heap to be locked |
| 1027 |
//! \return MOS_STATUS |
| 1028 |
//! MOS_STATUS_SUCCESS if success |
| 1029 |
//! |
| 1030 |
MOS_STATUS LockStateHeap( |
| 1031 |
PMHW_STATE_HEAP pStateHeap); |
| 1032 |
|
| 1033 |
//! |
| 1034 |
//! \brief Unlocks requested state heap |
| 1035 |
//! \details Client facing function to unlock a state heap |
| 1036 |
//! \param PMHW_STATE_HEAP pStateHeap |
| 1037 |
//! [in] The state heap to be locked |
| 1038 |
//! \return MOS_STATUS |
| 1039 |
//! MOS_STATUS_SUCCESS if success |
| 1040 |
//! |
| 1041 |
MOS_STATUS UnLockStateHeap( |
| 1042 |
PMHW_STATE_HEAP pStateHeap); |
| 1043 |
|
| 1044 |
//! |
| 1045 |
//! \brief Allocates a state heap of the requested type |
| 1046 |
//! \details Client facing function to extend a state heap of the requested time, which |
| 1047 |
//! involves allocating state heap and added it to the state heap liked list. |
| 1048 |
//! \param MHW_STATE_HEAP_TYPE StateHeapType |
| 1049 |
//! [in] The state heap type requested (ISH/DSH) |
| 1050 |
//! \param uint32_t dwSizeRequested |
| 1051 |
//! [in] The size of the state heap |
| 1052 |
//! \return MOS_STATUS |
| 1053 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 1054 |
//! |
| 1055 |
MOS_STATUS ExtendStateHeap( |
| 1056 |
MHW_STATE_HEAP_TYPE StateHeapType, |
| 1057 |
uint32_t dwSizeRequested); |
| 1058 |
|
| 1059 |
//! |
| 1060 |
//! \brief Update CmdBufIdGlobal |
| 1061 |
//! \details Client facing function to update CmdBufIdGlobal |
| 1062 |
//! reset current offset to zero |
| 1063 |
//! \return MOS_STATUS |
| 1064 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 1065 |
//! |
| 1066 |
MOS_STATUS UpdateGlobalCmdBufId(); |
| 1067 |
|
| 1068 |
//! |
| 1069 |
//! \brief Set command buffer status pointer |
| 1070 |
//! \details Client facing function to set command buffer status pointer |
| 1071 |
//! \param void *pvCmdBufStatus |
| 1072 |
//! [in] command buffer status pointer |
| 1073 |
//! \return MOS_STATUS |
| 1074 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 1075 |
//! |
| 1076 |
MOS_STATUS SetCmdBufStatusPtr(void *pvCmdBufStatus); |
| 1077 |
|
| 1078 |
//! |
| 1079 |
//! \brief Calculate the space needed in the SSH |
| 1080 |
//! \details Client facing function to calculate the space needed in the SSH |
| 1081 |
//! given the number of binding table entries |
| 1082 |
//! \param uint32_t dwBtEntriesRequested |
| 1083 |
//! [in] Binding table entries requested in the SSH |
| 1084 |
//! \param uint32_t *pdwSshSize |
| 1085 |
//! [out] The size needed in the SSH |
| 1086 |
//! \return MOS_STATUS |
| 1087 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 1088 |
//! |
| 1089 |
MOS_STATUS CalculateSshAndBtSizesRequested( |
| 1090 |
uint32_t dwBtEntriesRequested, |
| 1091 |
uint32_t *pdwSshSize, |
| 1092 |
uint32_t *pdwBtSize); |
| 1093 |
|
| 1094 |
//! |
| 1095 |
//! \brief Request SSH space for a command buffer. |
| 1096 |
//! \details Client facing function to request SSH space for a command buffer, if not enough |
| 1097 |
//! space is available, more will be requested. |
| 1098 |
//! \param uint32_t dwBtEntriesRequested |
| 1099 |
//! [in] Binding table entries requested in the SSH |
| 1100 |
//! \return MOS_STATUS |
| 1101 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 1102 |
//! |
| 1103 |
MOS_STATUS RequestSshSpaceForCmdBuf( |
| 1104 |
uint32_t dwBtEntriesRequested); |
| 1105 |
|
| 1106 |
//! |
| 1107 |
//! \brief Calculates the amount of space needed |
| 1108 |
//! \details Tells if there is enough space available in heap to load an array of blocks |
| 1109 |
// Returns how much is missing (needs to be freed, 0 if none) |
| 1110 |
//! \param MHW_STATE_HEAP_TYPE StateHeapType |
| 1111 |
//! [in] State heap type (DSH/ISH) |
| 1112 |
//! \param PMHW_STATE_HEAP_DYNAMIC_ALLOC_PARAMS pParams |
| 1113 |
//! [in] Dynamic state heap parameters |
| 1114 |
//! \return uint32_t |
| 1115 |
//! Amount of space needed in bytes |
| 1116 |
//! |
| 1117 |
uint32_t CalculateSpaceNeededDyn( |
| 1118 |
MHW_STATE_HEAP_TYPE StateHeapType, |
| 1119 |
PMHW_STATE_HEAP_DYNAMIC_ALLOC_PARAMS pParams); |
| 1120 |
|
| 1121 |
//Virtual Interfaces |
| 1122 |
|
| 1123 |
//! |
| 1124 |
//! \brief Adds INTERFACE_DESCRIPTOR command(s) to the DSH |
| 1125 |
//! \details Client facing function to add INTERFACE_DESCRIPTOR(s) to the DSH |
| 1126 |
//! \param uint32_t dwNumIdsToSet |
| 1127 |
//! [in] The number of pParams |
| 1128 |
//! \param PMHW_INTERFACE_DESCRIPTOR_PARAMS pParams |
| 1129 |
//! [in] Parameters used to set the INTERFACE_DESCRIPTOR(s) |
| 1130 |
//! \return MOS_STATUS |
| 1131 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 1132 |
//! |
| 1133 |
virtual MOS_STATUS SetInterfaceDescriptor( |
| 1134 |
uint32_t dwNumIdsToSet, |
| 1135 |
PMHW_INTERFACE_DESCRIPTOR_PARAMS pParams) = 0; |
| 1136 |
|
| 1137 |
//! |
| 1138 |
//! \brief Setup Media Interface Descriptor Entry in DSH |
| 1139 |
//! \details Setup Single Media Interface Descriptor Entry |
| 1140 |
//! \param PMHW_ID_ENTRY_PARAMS pParams |
| 1141 |
//! [in] Interface Descriptor Parameters |
| 1142 |
//! \param PMOS_COMMAND_BUFFER pCmdBuffer |
| 1143 |
//! [in] Pointer to Command Buffer |
| 1144 |
//! \return MOS_STATUS |
| 1145 |
//! |
| 1146 |
virtual MOS_STATUS SetInterfaceDescriptorEntry( |
| 1147 |
PMHW_ID_ENTRY_PARAMS pParams) = 0; |
| 1148 |
|
| 1149 |
//! |
| 1150 |
//! \brief Adds media interface descriptor data to dynamic GSH |
| 1151 |
//! \param PMHW_ID_ENTRY_PARAMS pParams |
| 1152 |
//! [in] Interface descriptor parameters |
| 1153 |
//! \return MOS_STATUS |
| 1154 |
//! |
| 1155 |
virtual MOS_STATUS AddInterfaceDescriptorData( |
| 1156 |
PMHW_ID_ENTRY_PARAMS pParams) = 0; |
| 1157 |
|
| 1158 |
//! |
| 1159 |
//! \brief Adds a binding table to the SSH |
| 1160 |
//! \details Client facing function to add binding table to SSH |
| 1161 |
//! \param PMHW_KERNEL_STATE pKernelState |
| 1162 |
//! [in] Kernel state to construct the binding table for |
| 1163 |
//! \param void *pvHwInterface |
| 1164 |
//! [in] Temporary input parameter until SSH setup occurs in MHW |
| 1165 |
//! \return MOS_STATUS |
| 1166 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 1167 |
//! |
| 1168 |
virtual MOS_STATUS SetBindingTable( |
| 1169 |
PMHW_KERNEL_STATE pKernelState)= 0; |
| 1170 |
|
| 1171 |
//! |
| 1172 |
//! \brief Sets binding table entry in SSH |
| 1173 |
//! \details TO BE REMOVED! Client facing function to add binding table to SSH |
| 1174 |
//! \param PMHW_BINDING_TABLE_PARAMS pParams |
| 1175 |
//! [in] Surface binding parameters |
| 1176 |
//! |
| 1177 |
virtual MOS_STATUS SetBindingTableEntry( |
| 1178 |
PMHW_BINDING_TABLE_PARAMS pParams) = 0; |
| 1179 |
|
| 1180 |
//! |
| 1181 |
//! \brief Sends binding table entry to Command Buffer (indirect state) |
| 1182 |
//! \details TO BE REMOVED! Sends binding table entry to indirect state heap in Cmd buffer, |
| 1183 |
//! retrieving associated surface state offset and index |
| 1184 |
//! \param PMHW_BINDING_TABLE_PARAMS pParams |
| 1185 |
//! [in] Surface binding parameters - returns surface state pointer and index |
| 1186 |
//! |
| 1187 |
virtual MOS_STATUS SendBindingTableEntry( |
| 1188 |
PMHW_BINDING_TABLE_SEND_PARAMS pParams) = 0; |
| 1189 |
|
| 1190 |
//! |
| 1191 |
//! \brief set surface state entry |
| 1192 |
//! \details TO BE REMOVED! set surface state entry |
| 1193 |
//! \param PMHW_BINDING_TABLE_PARAMS pParams |
| 1194 |
//! [in] Surface state parameters |
| 1195 |
//! |
| 1196 |
virtual MOS_STATUS SetSurfaceStateEntry( |
| 1197 |
PMHW_SURFACE_STATE_PARAMS pParams) = 0; |
| 1198 |
|
| 1199 |
//! |
| 1200 |
//! \brief Set surface state in ssh |
| 1201 |
//! \details Set sampler state in ssh |
| 1202 |
//! \param PMOS_COMMAND_BUFFER pCmdBuffer |
| 1203 |
//! [in] command buffer pointer |
| 1204 |
//! \param uint32_t dwNumSurfaceStatesToSet |
| 1205 |
//! [in] number of surface states need to set |
| 1206 |
//! \param PMHW_RCS_SURFACE_PARAMS pParams |
| 1207 |
//! [in] render surface state parameters |
| 1208 |
//! |
| 1209 |
virtual MOS_STATUS SetSurfaceState( |
| 1210 |
PMHW_KERNEL_STATE pKernelState, |
| 1211 |
PMOS_COMMAND_BUFFER pCmdBuffer, |
| 1212 |
uint32_t dwNumSurfaceStatesToSet, |
| 1213 |
PMHW_RCS_SURFACE_PARAMS pParams) = 0; |
| 1214 |
|
| 1215 |
//! |
| 1216 |
//! \brief Set sampler state |
| 1217 |
//! \details Set sampler state |
| 1218 |
//! \param PMHW_SAMPLER_STATE_PARAM pParams |
| 1219 |
//! [in] Sampler state parameters |
| 1220 |
//! |
| 1221 |
virtual MOS_STATUS SetSamplerState( |
| 1222 |
void *pSampler, |
| 1223 |
PMHW_SAMPLER_STATE_PARAM pParam) = 0; |
| 1224 |
|
| 1225 |
//! |
| 1226 |
//! \brief Adds sampler state data to dynamic GSH |
| 1227 |
//! \param uint32_t samplerOffset |
| 1228 |
//! [in] sampler offset |
| 1229 |
//! \param MemoryBlock memoryBlock |
| 1230 |
//! [in,out] Pointer to memory block |
| 1231 |
//! \param PMHW_SAMPLER_STATE_PARAM pParam |
| 1232 |
//! [in] sampler state parameters |
| 1233 |
//! \return MOS_STATUS |
| 1234 |
//! |
| 1235 |
virtual MOS_STATUS AddSamplerStateData( |
| 1236 |
uint32_t samplerOffset, |
| 1237 |
MemoryBlock *memoryBlock, |
| 1238 |
PMHW_SAMPLER_STATE_PARAM pParam) = 0; |
| 1239 |
|
| 1240 |
//! |
| 1241 |
//! \brief Initialize sampler states |
| 1242 |
//! \details Initialize sampler states |
| 1243 |
//! \param void *pSamplerStates |
| 1244 |
//! [in] Pointer to sampler states to reset |
| 1245 |
//! \param int32_t iSamplers |
| 1246 |
//! [in] Number of sampler entries to reset |
| 1247 |
//! \return MOS_STATUS |
| 1248 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 1249 |
//! |
| 1250 |
virtual MOS_STATUS InitSamplerStates( |
| 1251 |
void *pSamplerStates, |
| 1252 |
int32_t iSamplers) = 0; |
| 1253 |
|
| 1254 |
//! |
| 1255 |
//! \brief Init HwSizes |
| 1256 |
//! \details Init HwSizes |
| 1257 |
//! \return MOS_STATUS |
| 1258 |
//! MOS_STATUS_SUCCESS if success else fail reason |
| 1259 |
//! |
| 1260 |
virtual MOS_STATUS InitHwSizes() = 0; |
| 1261 |
|
| 1262 |
//! |
| 1263 |
//! \brief Releases the dynamic state heap |
| 1264 |
//! \details Releases the dynamic state heap. If all blocks |
| 1265 |
//! are completed, free the resource. If there are some blocks still in |
| 1266 |
//! the submitted state, then mark blocks for deletion. This function will be |
| 1267 |
//! called again to free the resource when the last block is released. |
| 1268 |
//! \param PMHW_STATE_HEAP pStateHeap |
| 1269 |
//! [in] Pointer to the state heap to be released |
| 1270 |
//! \return MOS_STATUS |
| 1271 |
//! SUCCESS if state heap was either marked for deletion or actually freed |
| 1272 |
//! |
| 1273 |
MOS_STATUS ReleaseStateHeapDyn(PMHW_STATE_HEAP pStateHeap); |
| 1274 |
|
| 1275 |
//! |
| 1276 |
//! \brief Allocates a dynamic block |
| 1277 |
//! \details Allocates either a single dynamic block or multiple blocks in ISH/DSH |
| 1278 |
//! \param MHW_STATE_HEAP_TYPE StateHeapType |
| 1279 |
//! [in] State heap type (DSH/ISH) |
| 1280 |
//! \param PMHW_STATE_HEAP_DYNAMIC_ALLOC_PARAMS pParams |
| 1281 |
//! [in] Dynamic state heap parameters |
| 1282 |
//! \return PMHW_STATE_HEAP_MEMORY_BLOCK |
| 1283 |
//! Pointer to the allocated memory block(s) |
| 1284 |
//! |
| 1285 |
PMHW_STATE_HEAP_MEMORY_BLOCK AllocateDynamicBlockDyn( |
| 1286 |
MHW_STATE_HEAP_TYPE StateHeapType, |
| 1287 |
PMHW_STATE_HEAP_DYNAMIC_ALLOC_PARAMS pParams); |
| 1288 |
|
| 1289 |
//! |
| 1290 |
//! \brief Submits a dynamic block |
| 1291 |
//! \details Submits a dynamic block. Detaches the block from current list and adds to to |
| 1292 |
//! submitted list. Updates block with provided sync tag. |
| 1293 |
//! \param MHW_STATE_HEAP_TYPE StateHeapType |
| 1294 |
//! [in] State heap type (DSH/ISH) |
| 1295 |
//! \param PMHW_STATE_HEAP_MEMORY_BLOCK pBlock |
| 1296 |
//! [in] Pointer to memory block to be submitted |
| 1297 |
//! \param uint32_t dwSyncTag |
| 1298 |
//! [in] Sync Tag |
| 1299 |
//! \return MOS_STATUS |
| 1300 |
//! SUCCESS if submission was successful |
| 1301 |
//! |
| 1302 |
MOS_STATUS SubmitDynamicBlockDyn( |
| 1303 |
MHW_STATE_HEAP_TYPE StateHeapType, |
| 1304 |
PMHW_STATE_HEAP_MEMORY_BLOCK pBlock, |
| 1305 |
const FrameTrackerTokenFlat *trackerToken); |
| 1306 |
|
| 1307 |
//! |
| 1308 |
//! \brief Frees a dynamic block |
| 1309 |
//! \details Detaches the block from current list if block has completed (based on provided dwSyncTag) |
| 1310 |
//! and adds it to deleted list. Otherwise, marks for deletion upon completion. |
| 1311 |
//! submitted list. Updates block with provided sync tag. |
| 1312 |
//! \param MHW_STATE_HEAP_TYPE StateHeapType |
| 1313 |
//! [in] State heap type (DSH/ISH) |
| 1314 |
//! \param PMHW_STATE_HEAP_MEMORY_BLOCK pBlock |
| 1315 |
//! [in] Pointer to memory block to be freed |
| 1316 |
//! \return MOS_STATUS |
| 1317 |
//! SUCCESS if operation was successful |
| 1318 |
//! |
| 1319 |
MOS_STATUS FreeDynamicBlockDyn( |
| 1320 |
MHW_STATE_HEAP_TYPE StateHeapType, |
| 1321 |
PMHW_STATE_HEAP_MEMORY_BLOCK pBlock); |
| 1322 |
|
| 1323 |
//! |
| 1324 |
//! \brief Refresh the dynamic heap |
| 1325 |
//! \details Updates block states based on last executed tag |
| 1326 |
//! submitted unlocked blocks are released; |
| 1327 |
//! move to allocated |
| 1328 |
//! \param MHW_STATE_HEAP_TYPE StateHeapType |
| 1329 |
//! [in] State heap type (DSH/ISH) |
| 1330 |
//! \param uint32_t dwSyncTag |
| 1331 |
//! [in] Sync Tag |
| 1332 |
//! \return MOS_STATUS |
| 1333 |
//! SUCCESS if operation was successful |
| 1334 |
//! |
| 1335 |
MOS_STATUS RefreshDynamicHeapDyn ( |
| 1336 |
MHW_STATE_HEAP_TYPE StateHeapType); |
| 1337 |
|
| 1338 |
private: |
| 1339 |
|
| 1340 |
//! |
| 1341 |
//! \brief Insert a node into a memory block linked list |
| 1342 |
//! \details MHW private function which maintains the memory block linked list |
| 1343 |
//! \param PMHW_STATE_HEAP_MEMORY_BLOCK pStartNode |
| 1344 |
//! [in] The memory block from which to start the insertion |
| 1345 |
//! \param PMHW_STATE_HEAP_MEMORY_BLOCK pNodeToAdd |
| 1346 |
//! [in] The memory block to insert |
| 1347 |
//! \return MOS_STATUS |
| 1348 |
//! MOS_STATUS_SUCCESS if success else fail reason |
| 1349 |
//! |
| 1350 |
MOS_STATUS InsertLinkedList( |
| 1351 |
PMHW_STATE_HEAP_MEMORY_BLOCK pStartNode, |
| 1352 |
PMHW_STATE_HEAP_MEMORY_BLOCK pNodeToAdd); |
| 1353 |
|
| 1354 |
//! |
| 1355 |
//! \brief Allocate and initialize a memory block based on input parameters |
| 1356 |
//! \details MHW private function which creates memory blocks |
| 1357 |
//! \param PMHW_STATE_HEAP pStateHeap |
| 1358 |
//! [in] The state heap which the memory block belongs to |
| 1359 |
//! \param PMHW_STATE_HEAP_MEMORY_BLOCK ppMemoryBlock |
| 1360 |
//! [in/out] The node to insert. |
| 1361 |
//! \param uint32_t dwRequestedSize |
| 1362 |
//! [in] The size of the memory that the memory block references. |
| 1363 |
//! \param bool bStatic |
| 1364 |
//! [in] If the memory block is static |
| 1365 |
//! \return MOS_STATUS |
| 1366 |
//! MOS_STATUS_SUCCESS if success else fail reason |
| 1367 |
//! |
| 1368 |
MOS_STATUS InitMemoryBlock( |
| 1369 |
PMHW_STATE_HEAP pStateHeap, |
| 1370 |
PMHW_STATE_HEAP_MEMORY_BLOCK *ppMemoryBlock, |
| 1371 |
uint32_t dwRequestedSize, |
| 1372 |
bool bStatic); |
| 1373 |
|
| 1374 |
//! |
| 1375 |
//! \brief Inserts a new memory block into an existing available memory block |
| 1376 |
//! \details MHW private function to insert new memory blocks into available memory blocks |
| 1377 |
//! \param PMHW_STATE_HEAP_MEMORY_BLOCK pMemoryBlockFree |
| 1378 |
//! [in] Available memory block |
| 1379 |
//! \param PMHW_STATE_HEAP_MEMORY_BLOCK pMemoryBlockToAdd |
| 1380 |
//! [in] New memory block to be inserted |
| 1381 |
//! \return MOS_STATUS |
| 1382 |
//! MOS_STATUS_SUCCESS if success else fail reason |
| 1383 |
//! |
| 1384 |
MOS_STATUS InsertMemoryBlock( |
| 1385 |
PMHW_STATE_HEAP_MEMORY_BLOCK pMemoryBlockFree, |
| 1386 |
PMHW_STATE_HEAP_MEMORY_BLOCK pMemoryBlockToAdd); |
| 1387 |
|
| 1388 |
//! |
| 1389 |
//! \brief Returns the space of the memory block to the state heap |
| 1390 |
//! \details MHW private function to return the memory block space to the state heap |
| 1391 |
//! by marking it as available and merging it with adjacent memory blocks |
| 1392 |
|
| 1393 |
//! \param PMHW_STATE_HEAP_MEMORY_BLOCK pMemoryBlock |
| 1394 |
//! [in] Memory block to return to the state heap |
| 1395 |
//! \return MOS_STATUS |
| 1396 |
//! MOS_STATUS_SUCCESS if success else fail reason |
| 1397 |
//! |
| 1398 |
MOS_STATUS ReturnSpaceMemoryBlock( |
| 1399 |
PMHW_STATE_HEAP_MEMORY_BLOCK pMemoryBlock); |
| 1400 |
|
| 1401 |
//Interfaces different cross static and dynmaic mode |
| 1402 |
|
| 1403 |
//! |
| 1404 |
//! \brief Extends the dynamic state heap |
| 1405 |
//! \details Allocates a dynamic state heap (ISH/DSH) with requested size |
| 1406 |
//! \param MHW_STATE_HEAP_TYPE StateHeapType |
| 1407 |
//! [in] State heap type (i.e. ISH/DSH) |
| 1408 |
//! \param uint32_t dwSizeRequested |
| 1409 |
//! [in] Size of requested state heap |
| 1410 |
//! \return MOS_STATUS |
| 1411 |
//! SUCCESS if state heap was successfully allocated |
| 1412 |
//! |
| 1413 |
MOS_STATUS ExtendStateHeapDyn( |
| 1414 |
MHW_STATE_HEAP_TYPE StateHeapType, |
| 1415 |
uint32_t dwSizeRequested); |
| 1416 |
|
| 1417 |
//! |
| 1418 |
//! \brief Extends the dynamic state heap |
| 1419 |
//! \details Allocates a dynamic state heap (ISH/DSH) with requested size |
| 1420 |
//! \param MHW_STATE_HEAP_TYPE StateHeapType |
| 1421 |
//! [in] State heap type (i.e. ISH/DSH) |
| 1422 |
//! \param uint32_t dwSizeRequested |
| 1423 |
//! [in] Size of requested state heap |
| 1424 |
//! \return MOS_STATUS |
| 1425 |
//! SUCCESS if state heap was successfully allocated |
| 1426 |
//! |
| 1427 |
MOS_STATUS ExtendStateHeapSta( |
| 1428 |
MHW_STATE_HEAP_TYPE StateHeapType, |
| 1429 |
uint32_t dwSizeRequested); |
| 1430 |
|
| 1431 |
}; |
| 1432 |
|
| 1433 |
struct _MHW_STATE_HEAP_INTERFACE |
| 1434 |
{ |
| 1435 |
|
| 1436 |
XMHW_STATE_HEAP_INTERFACE *pStateHeapInterface; |
| 1437 |
|
| 1438 |
//! |
| 1439 |
//! \brief Internal to MHW |
| 1440 |
//! |
| 1441 |
|
| 1442 |
MOS_STATUS (*pfnCreate) ( |
| 1443 |
PMHW_STATE_HEAP_INTERFACE *ppStateHeapInterface, |
| 1444 |
MHW_STATE_HEAP_SETTINGS StateHeapSettings); |
| 1445 |
|
| 1446 |
MOS_STATUS (*pfnDestroy) ( |
| 1447 |
PMHW_STATE_HEAP_INTERFACE pCommonStateHeapInterface); |
| 1448 |
|
| 1449 |
//! |
| 1450 |
//! \brief Primarily a state heap interface private function to be |
| 1451 |
//! called as a pair in any state heap interface function which |
| 1452 |
//! accesses the graphics resource like AddDataToStateHeap. |
| 1453 |
//! |
| 1454 |
MOS_STATUS (*pfnLockStateHeap) ( |
| 1455 |
PMHW_STATE_HEAP_INTERFACE pCommonStateHeapInterface, |
| 1456 |
PMHW_STATE_HEAP pStateHeap); |
| 1457 |
|
| 1458 |
MOS_STATUS (*pfnUnlockStateHeap) ( |
| 1459 |
PMHW_STATE_HEAP_INTERFACE pCommonStateHeapInterface, |
| 1460 |
PMHW_STATE_HEAP pStateHeap); |
| 1461 |
|
| 1462 |
//! |
| 1463 |
//! \brief Client facing functions |
| 1464 |
//! |
| 1465 |
MOS_STATUS (*pfnAssignSpaceInStateHeap) ( |
| 1466 |
PMHW_STATE_HEAP_INTERFACE pCommonStateHeapInterface, |
| 1467 |
MHW_STATE_HEAP_TYPE StateHeapType, |
| 1468 |
PMHW_KERNEL_STATE pKernelState, |
| 1469 |
uint32_t dwSpaceRequested, |
| 1470 |
bool bStatic, |
| 1471 |
bool bZeroAssignedMem); |
| 1472 |
|
| 1473 |
MOS_STATUS(*pfnSubmitBlocks) ( |
| 1474 |
PMHW_STATE_HEAP_INTERFACE pCommonStateHeapInterface, |
| 1475 |
PMHW_KERNEL_STATE pKernelState); |
| 1476 |
|
| 1477 |
MOS_STATUS (*pfnExtendStateHeap) ( |
| 1478 |
PMHW_STATE_HEAP_INTERFACE pCommonStateHeapInterface, |
| 1479 |
MHW_STATE_HEAP_TYPE StateHeapType, |
| 1480 |
uint32_t dwSizeRequested); |
| 1481 |
|
| 1482 |
MOS_STATUS (*pfnSetInterfaceDescriptor) ( |
| 1483 |
PMHW_STATE_HEAP_INTERFACE pCommonStateHeapInterface, |
| 1484 |
uint32_t dwNumIdsToSet, |
| 1485 |
PMHW_INTERFACE_DESCRIPTOR_PARAMS pParams); |
| 1486 |
|
| 1487 |
MOS_STATUS (*pfnSetInterfaceDescriptorEntry) ( |
| 1488 |
PMHW_STATE_HEAP_INTERFACE pCommonStateHeapInterface, |
| 1489 |
PMHW_ID_ENTRY_PARAMS pParams); |
| 1490 |
|
| 1491 |
MOS_STATUS(*pfnSetBindingTable) ( |
| 1492 |
PMHW_STATE_HEAP_INTERFACE pCommonStateHeapInterface, |
| 1493 |
PMHW_KERNEL_STATE pKernelState); |
| 1494 |
|
| 1495 |
MOS_STATUS (*pfnSetSurfaceState) ( |
| 1496 |
PMHW_STATE_HEAP_INTERFACE pCommonStateHeapInterface, |
| 1497 |
PMHW_KERNEL_STATE pKernelState, |
| 1498 |
PMOS_COMMAND_BUFFER pCmdBuffer, |
| 1499 |
uint32_t dwNumSurfaceStatesToSet, |
| 1500 |
PMHW_RCS_SURFACE_PARAMS pParams); |
| 1501 |
|
| 1502 |
MOS_STATUS (*pfnSetSurfaceStateBuffer) ( |
| 1503 |
PMHW_STATE_HEAP_INTERFACE pCommonStateHeapInterface, |
| 1504 |
PMHW_RCS_SURFACE_PARAMS pParams, |
| 1505 |
void *pSurfaceState); |
| 1506 |
|
| 1507 |
MOS_STATUS (*pfnSetBindingTableEntry) ( |
| 1508 |
PMHW_STATE_HEAP_INTERFACE pCommonStateHeapInterface, |
| 1509 |
PMHW_BINDING_TABLE_PARAMS pParams); |
| 1510 |
|
| 1511 |
MOS_STATUS (*pfnSendBindingTableEntry) ( |
| 1512 |
PMHW_STATE_HEAP_INTERFACE pCommonStateHeapInterface, |
| 1513 |
PMHW_BINDING_TABLE_SEND_PARAMS pParams); |
| 1514 |
|
| 1515 |
MOS_STATUS (* pfnSetSurfaceStateToken) ( |
| 1516 |
PMHW_STATE_HEAP_INTERFACE pCommonStateHeapInterface, |
| 1517 |
PMHW_SURFACE_TOKEN_PARAMS pParams, |
| 1518 |
void *pSurfaceStateToken); |
| 1519 |
|
| 1520 |
MOS_STATUS (*pfnSetSurfaceStateEntry) ( |
| 1521 |
PMHW_STATE_HEAP_INTERFACE pCommonStateHeapInterface, |
| 1522 |
PMHW_SURFACE_STATE_PARAMS pParams); |
| 1523 |
|
| 1524 |
MOS_STATUS (*pfnSendSurfaceStateEntry) ( |
| 1525 |
PMHW_STATE_HEAP_INTERFACE pCommonStateHeapInterface, |
| 1526 |
PMOS_COMMAND_BUFFER pCmdBuffer, |
| 1527 |
PMHW_SURFACE_STATE_SEND_PARAMS pParams); |
| 1528 |
|
| 1529 |
//! |
| 1530 |
//! \brief May only operate on the primary state heap. |
| 1531 |
//! |
| 1532 |
MOS_STATUS (*pfnCompactStateHeap) ( |
| 1533 |
PMHW_STATE_HEAP_INTERFACE pCommonStateHeapInterface, |
| 1534 |
MHW_STATE_HEAP_TYPE StateHeapType); |
| 1535 |
|
| 1536 |
//! |
| 1537 |
//! \brief Must be called by the client directly to provide |
| 1538 |
//! pointer for command buffer status for tracking purposes. |
| 1539 |
//! |
| 1540 |
MOS_STATUS(*pfnSetCmdBufStatusPtr) ( |
| 1541 |
PMHW_STATE_HEAP_INTERFACE pCommonStateHeapInterface, |
| 1542 |
void *pvCmdBufStatus); |
| 1543 |
|
| 1544 |
//! |
| 1545 |
//! \brief Must be called by the client directly after a command |
| 1546 |
//! buffer containing a kernel workload is submitted. |
| 1547 |
//! |
| 1548 |
MOS_STATUS(*pfnUpdateGlobalCmdBufId) ( |
| 1549 |
PMHW_STATE_HEAP_INTERFACE pCommonStateHeapInterface); |
| 1550 |
|
| 1551 |
//! |
| 1552 |
//! \brief Must be called by the client before the client gets a |
| 1553 |
//! command buffer for a kernel workload from MOS. This function |
| 1554 |
//! will resize the SSH the current size is < dwBtEntriesRequested, |
| 1555 |
//! otherwise it does nothing. In the future when SSHes are |
| 1556 |
//! managed entirely in UMD this function may be deprecated and |
| 1557 |
//! the SSH may be treated like the |
| 1558 |
//! other state heaps. |
| 1559 |
//! |
| 1560 |
MOS_STATUS (*pfnRequestSshSpaceForCmdBuf) ( |
| 1561 |
PMHW_STATE_HEAP_INTERFACE pCommonStateHeapInterface, |
| 1562 |
uint32_t dwBtEntriesRequested); |
| 1563 |
|
| 1564 |
MOS_STATUS (*pfnCalculateSshAndBtSizesRequested) ( |
| 1565 |
PMHW_STATE_HEAP_INTERFACE pCommonStateHeapInterface, |
| 1566 |
uint32_t dwBtEntriesRequested, |
| 1567 |
uint32_t *pdwSshSize, |
| 1568 |
uint32_t *pdwBtSize); |
| 1569 |
|
| 1570 |
MOS_STATUS(* pfnInitSamplerStates) ( |
| 1571 |
PMHW_STATE_HEAP_INTERFACE pCommonStateHeapInterface, |
| 1572 |
void *pSampler, |
| 1573 |
int32_t iSamplers); |
| 1574 |
|
| 1575 |
MOS_STATUS (* pfnSetSamplerState) ( |
| 1576 |
PMHW_STATE_HEAP_INTERFACE pCommonStateHeapInterface, |
| 1577 |
void *pSampler, |
| 1578 |
PMHW_SAMPLER_STATE_PARAM pParams); |
| 1579 |
|
| 1580 |
//Interfaces in dynamic mode |
| 1581 |
uint32_t (*pfnCalculateDynamicSpaceNeeded) ( |
| 1582 |
PMHW_STATE_HEAP_INTERFACE pStateHeapInterface, |
| 1583 |
MHW_STATE_HEAP_TYPE StateHeapType, |
| 1584 |
PMHW_STATE_HEAP_DYNAMIC_ALLOC_PARAMS pParams); |
| 1585 |
|
| 1586 |
PMHW_STATE_HEAP_MEMORY_BLOCK (*pfnAllocateDynamicBlock) ( |
| 1587 |
PMHW_STATE_HEAP_INTERFACE pStateHeapInterface, |
| 1588 |
MHW_STATE_HEAP_TYPE StateHeapType, |
| 1589 |
PMHW_STATE_HEAP_DYNAMIC_ALLOC_PARAMS pParams); |
| 1590 |
|
| 1591 |
MOS_STATUS (*pfnSubmitDynamicBlock) ( |
| 1592 |
PMHW_STATE_HEAP_INTERFACE pStateHeapInterface, |
| 1593 |
MHW_STATE_HEAP_TYPE StateHeapType, |
| 1594 |
PMHW_STATE_HEAP_MEMORY_BLOCK pBlock, |
| 1595 |
FrameTrackerTokenFlat *trackerToken); |
| 1596 |
|
| 1597 |
MOS_STATUS (*pfnFreeDynamicBlock) ( |
| 1598 |
PMHW_STATE_HEAP_INTERFACE pStateHeapInterface, |
| 1599 |
MHW_STATE_HEAP_TYPE StateHeapType, |
| 1600 |
PMHW_STATE_HEAP_MEMORY_BLOCK pBlock); |
| 1601 |
|
| 1602 |
MOS_STATUS (*pfnRefreshDynamicHeap) ( |
| 1603 |
PMHW_STATE_HEAP_INTERFACE pStateHeapInterface, |
| 1604 |
MHW_STATE_HEAP_TYPE StateHeapType); |
| 1605 |
|
| 1606 |
MOS_STATUS (*pfnReleaseStateHeap) ( |
| 1607 |
PMHW_STATE_HEAP_INTERFACE pStateHeapInterface, |
| 1608 |
PMHW_STATE_HEAP pStateHeap); |
| 1609 |
|
| 1610 |
}; |
| 1611 |
|
| 1612 |
MOS_STATUS Mhw_StateHeapInterface_AssignInterfaces( |
| 1613 |
PMHW_STATE_HEAP_INTERFACE pCommonStateHeapInterface); |
| 1614 |
|
| 1615 |
MOS_STATUS Mhw_StateHeapInterface_InitInterface( |
| 1616 |
PMHW_STATE_HEAP_INTERFACE *ppCommonStateHeapInterface, |
| 1617 |
PMOS_INTERFACE pOsInterface, |
| 1618 |
uint8_t bDynamicMode); |
| 1619 |
|
| 1620 |
extern const uint8_t g_cMhw_VDirection[MHW_NUM_FRAME_FIELD_TYPES]; |
| 1621 |
|
| 1622 |
#endif // __MHW_STATE_HEAP_H__ |