1 /* 2 * Copyright (c) 2009-2021, 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 renderhal.h 24 //! \brief 25 //! 26 //! 27 //! \file renderhal.h 28 //! \brief Render Engine Interfaces shared across platforms 29 //! \details Platform Independent Hardware Interfaces 30 //! 31 #ifndef __RENDERHAL_H__ 32 #define __RENDERHAL_H__ 33 34 #include "mos_os.h" // Interface to OS functions 35 #include "mhw_state_heap.h" 36 #include "mhw_render.h" 37 38 #include "renderhal_dsh.h" 39 #include "mhw_memory_pool.h" 40 #include "cm_hal_hashtable.h" 41 #include "media_perf_profiler.h" 42 43 #include "frame_tracker.h" 44 #include "media_common_defs.h" 45 46 class XRenderHal_Platform_Interface; 47 48 //------------------------------------------------------------------------------ 49 // Macros specific to RenderHal sub-comp 50 //------------------------------------------------------------------------------ 51 #define MHW_RENDERHAL_ASSERT(_expr) \ 52 MOS_ASSERT(MOS_COMPONENT_CM, MOS_CM_SUBCOMP_RENDERHAL, _expr) 53 54 #define MHW_RENDERHAL_ASSERTMESSAGE(_message, ...) \ 55 MOS_ASSERTMESSAGE(MOS_COMPONENT_CM, MOS_CM_SUBCOMP_RENDERHAL, _message, ##__VA_ARGS__) 56 57 #define MHW_RENDERHAL_NORMALMESSAGE(_message, ...) \ 58 MOS_NORMALMESSAGE(MOS_COMPONENT_CM, MOS_CM_SUBCOMP_RENDERHAL, _message, ##__VA_ARGS__) 59 60 #define MHW_RENDERHAL_VERBOSEMESSAGE(_message, ...) \ 61 MOS_VERBOSEMESSAGE(MOS_COMPONENT_CM, MOS_CM_SUBCOMP_RENDERHAL, _message, ##__VA_ARGS__) 62 63 #define MHW_RENDERHAL_FUNCTION_ENTER \ 64 MOS_FUNCTION_ENTER(MOS_COMPONENT_CM, MOS_CM_SUBCOMP_RENDERHAL) 65 66 #define MHW_RENDERHAL_FUNCTION_EXIT \ 67 MOS_FUNCTION_EXIT(MOS_COMPONENT_CM, MOS_CM_SUBCOMP_RENDERHAL, eStatus) 68 69 #define MHW_RENDERHAL_CHK_STATUS(_stmt) \ 70 MOS_CHK_STATUS(MOS_COMPONENT_CM, MOS_CM_SUBCOMP_RENDERHAL, _stmt) 71 72 #define MHW_RENDERHAL_CHK_STATUS_RETURN(_stmt) \ 73 MOS_CHK_STATUS_RETURN(MOS_COMPONENT_VP, MOS_VP_SUBCOMP_PUBLIC, _stmt) 74 75 #define MHW_RENDERHAL_CHK_STATUS_MESSAGE(_stmt, _message, ...) \ 76 MOS_CHK_STATUS_MESSAGE(MOS_COMPONENT_CM, MOS_CM_SUBCOMP_RENDERHAL, _stmt, _message, ##__VA_ARGS__) 77 78 #define MHW_RENDERHAL_CHK_NULL(_ptr) \ 79 MOS_CHK_NULL(MOS_COMPONENT_CM, MOS_CM_SUBCOMP_RENDERHAL, _ptr) 80 81 #define MHW_RENDERHAL_CHK_NULL_NO_STATUS(_ptr) \ 82 MOS_CHK_NULL_NO_STATUS(MOS_COMPONENT_CM, MOS_CM_SUBCOMP_RENDERHAL, _ptr) 83 84 #define MHW_RENDERHAL_CHK_NULL_NO_STATUS_RETURN(_ptr) \ 85 MOS_CHK_NULL_NO_STATUS_RETURN(MOS_COMPONENT_CM, MOS_CM_SUBCOMP_RENDERHAL, _ptr) 86 87 #define MHW_RENDERHAL_CHK_NULL_RETURN(_ptr) \ 88 MOS_CHK_NULL_RETURN(MOS_COMPONENT_CM, MOS_CM_SUBCOMP_RENDERHAL, _ptr) 89 90 91 #define MHW_RENDERHAL_UNUSED(x) \ 92 MOS_UNUSED(x) 93 94 //! 95 //! \brief Kernel allocation control 96 //! 97 #define RENDERHAL_KERNEL_LOAD_FAIL -1 98 #define RENDERHAL_KERNEL_ALLOCATION_FREE 0 // Kernel entry free 99 #define RENDERHAL_KERNEL_ALLOCATION_USED 1 // Kernel entry in use 100 #define RENDERHAL_KERNEL_ALLOCATION_LOCKED 2 // Kernel entry locked (no garbage collection) 101 #define RENDERHAL_KERNEL_ALLOCATION_REMOVED 3 // Kernel entry in use, but no longer loaded in ISH to make room for others 102 #define RENDERHAL_KERNEL_ALLOCATION_LOADING 4 // Kernel selected to be loaded (was stale or used) 103 #define RENDERHAL_KERNEL_ALLOCATION_STALE 5 // Kernel memory block became invalid, needs to be reloaded 104 105 //! 106 //! \brief SSH defaults and limits 107 //! 108 #define RENDERHAL_SSH_INSTANCES 16 109 #define RENDERHAL_SSH_INSTANCES_MAX 64 110 111 #define RENDERHAL_SSH_BINDING_TABLES 1 112 #define RENDERHAL_SSH_BINDING_TABLES_MIN 1 113 #define RENDERHAL_SSH_BINDING_TABLES_MAX 16 114 #define RENDERHAL_SSH_BINDING_TABLE_ALIGN 64 115 116 #define RENDERHAL_SSH_SURFACE_STATES 40 117 #define RENDERHAL_SSH_SURFACE_STATES_MIN 16 118 #define RENDERHAL_SSH_SURFACE_STATES_MAX 256 119 120 #define RENDERHAL_SSH_SURFACES_PER_BT 64 121 #define RENDERHAL_SSH_SURFACES_PER_BT_MIN 4 122 #define RENDERHAL_SSH_SURFACES_PER_BT_MAX 256 123 124 //! 125 //! \brief Default size of area for sync, debugging, performance collecting 126 //! 127 #define RENDERHAL_SYNC_SIZE_MIN 128 128 #define RENDERHAL_SYNC_SIZE_MAX 4096 129 #define RENDERHAL_SYNC_SIZE 128 130 131 //! 132 //! \brief Default number of media states (Dynamic GSH mode) 133 //! 134 #define RENDERHAL_MEDIA_STATES 16 135 136 //! 137 //! \brief Default number of media IDs 138 //! 139 #define RENDERHAL_MEDIA_IDS 16 140 141 //! 142 //! \brief Max URB Size 143 //! 144 #define RENDERHAL_URB_SIZE_MAX 2048 145 146 //! 147 //! \brief Interface Descriptor Entries 148 //! 149 #define RENDERHAL_INTERFACE_DESCRIPTOR_ENTRIES_MAX 64 150 151 //! 152 //! \brief Max URB Entry Size 153 //! 154 #define RENDERHAL_URB_ENTRY_SIZE_MAX (RENDERHAL_URB_SIZE_MAX - RENDERHAL_INTERFACE_DESCRIPTOR_ENTRIES_MAX) 155 156 //! 157 //! \brief Max CURBE Allocation Size 158 //! 159 #define RENDERHAL_CURBE_SIZE_MAX (RENDERHAL_URB_SIZE_MAX - RENDERHAL_INTERFACE_DESCRIPTOR_ENTRIES_MAX) 160 161 //! 162 //! \brief Max Samplers 163 //! 164 #define RENDERHAL_SAMPLERS_AVS_MAX 8 165 166 //! 167 //! \brief Default Samplers 168 //! 169 #define RENDERHAL_SAMPLERS 16 170 #define RENDERHAL_SAMPLERS_VA 8 171 172 //! 173 //! \brief Default CURBE size in GSH 174 //! Use the size of composition kernel static param since it's the largest of all 175 //! 176 #define RENDERHAL_CURBE_SIZE 832 // MOS ALIGN CEIL(sizeof(GPGPU_WALKER_ISTAB_GMC_STATIC_DATA_G8), RENDERHAL_URB_BLOCK_ALIGN) 177 178 //! 179 //! \brief Default number of kernels that may be cached in GSH 180 //! 181 #define RENDERHAL_KERNEL_COUNT 32 182 183 //! 184 //! \brief Max number of kernels cached in GSH 185 //! 186 #define RENDERHAL_KERNEL_COUNT_MIN 2 187 188 //! 189 //! \brief Default kernel heap size 190 //! 191 #define RENDERHAL_KERNEL_HEAP 2097152 192 193 //! 194 //! \brief Min kernel heap size 195 //! 196 #define RENDERHAL_KERNEL_HEAP_MIN 65536 197 #define RENDERHAL_KERNEL_HEAP_MAX 2097152 198 199 //! 200 //! \brief Default kernel block size (granularity for kernel allocation) 201 //! 202 #define RENDERHAL_KERNEL_BLOCK_SIZE 65536 203 204 //! 205 //! \brief Default ISA ASM Debug Surface BTI 206 //! 207 #define RENDERHAL_ISA_ASM_SURFACE_BTI_DEFAULT 39 208 209 //! 210 //! \brief Min kernel block size 211 //! 212 #define RENDERHAL_KERNEL_BLOCK_MIN 1024 213 #define RENDERHAL_KERNEL_BLOCK_MAX 65536 214 215 //! 216 //! \brief Max number of Media Threads 217 //! 218 #define RENDERHAL_USE_MEDIA_THREADS_MAX 0 219 220 //! 221 //! \brief Number and size of palettes 222 //! 223 #define RENDERHAL_PALETTE_COUNT 2 224 #define RENDERHAL_PALETTE_MAX 2 225 226 #define RENDERHAL_PALETTE_ENTRIES 256 227 #define RENDERHAL_PALETTE_ENTRIES_MAX 256 228 229 //! 230 //! \brief SIP Size 231 //! 232 #define RENDERHAL_MAX_SIP_SIZE 0x4000 233 234 //! 235 //! \brief Number of chroma keys 236 //! 237 #define RENDERHAL_CHROMA_KEY_COUNT 4 238 #define RENDERHAL_CHROMA_KEY_MAX 4 239 240 //! 241 //! \brief Alignment 242 //! 243 #define RENDERHAL_KERNEL_BLOCK_ALIGN 64 244 #define RENDERHAL_URB_BLOCK_ALIGN 64 245 #define RENDERHAL_SYNC_BLOCK_ALIGN 128 246 #define RENDERHAL_CURBE_BLOCK_ALIGN 64 247 248 //! 249 //! \brief Max number of Y_Uoffset size 250 //! 251 #define RENDERHAL_MAX_YV12_PLANE_Y_U_OFFSET_G9 16383 252 253 //! 254 //! \brief Palette allocation id 255 //! 256 #define RENDERHAL_PALETTE_ID_ALLOCATE_ONLY -2 // Allocate but don't load palette 257 #define RENDERHAL_PALETTE_ID_ALLOCATE_LOAD -1 // Allocate and load palette 258 259 //! 260 //! \brief Hw Interface defaults 261 //! 262 #define RENDERHAL_TIMEOUT_MS_DEFAULT 100 263 #define RENDERHAL_EVENT_TIMEOUT_MS 5 264 265 //! 266 //! \brief Sampler State Indices 267 //! 268 #define RENDERHAL_SAMPLER_Y 1 269 #define RENDERHAL_SAMPLER_U 2 270 #define RENDERHAL_SAMPLER_V 3 271 #define RENDERHAL_SAMPLER_8x8_AVS_Y 4 272 #define RENDERHAL_SAMPLER_8x8_AVS_U 8 273 #define RENDERHAL_SAMPLER_8x8_AVS_V 12 274 275 //*----------------------------------------------------------------------------- 276 //| MMIO register offsets used for the EU debug support 277 //*----------------------------------------------------------------------------- 278 279 280 281 #define MEDIASTATE_AVS_MAX_DERIVATIVE_4_PIXELS 7 282 #define MEDIASTATE_AVS_MAX_DERIVATIVE_8_PIXELS 20 283 #define MEDIASTATE_AVS_TRANSITION_AREA_4_PIXELS 4 284 #define MEDIASTATE_AVS_TRANSITION_AREA_8_PIXELS 5 285 286 enum GFX_COMMON_TOKEN_SUBOPCODE 287 { 288 GFXSUBOP_BINDING_TABLE_STATE_TOKEN = 0xFE, 289 GFXSUBOP_SURFACE_STATE_TOKEN = 0xFF 290 }; 291 292 enum MEDIASTATE_AVS_SHARPNESS_LEVEL 293 { 294 MEDIASTATE_AVS_SHARPNESS_LEVEL_SMOOTH = 0, 295 MEDIASTATE_AVS_SHARPNESS_LEVEL_SHARP = 255 296 }; 297 298 // Render chroma siting vertical value 299 enum CHROMA_SITING_VDIRECTION 300 { 301 CHROMA_SITING_VDIRECTION_0 = 0x0, 302 CHROMA_SITING_VDIRECTION_1_4 = 0x1, 303 CHROMA_SITING_VDIRECTION_1_2 = 0x2, 304 CHROMA_SITING_VDIRECTION_3_4 = 0x3, 305 CHROMA_SITING_VDIRECTION_1 = 0x4 306 }; 307 308 // Render chroma siting horizontal value 309 enum CHROMA_SITING_UDIRECTION 310 { 311 CHROMA_SITING_UDIRECTION_LEFT = 0x0, 312 CHROMA_SITING_UDIRECTION_CENTER = 0x1 313 }; 314 315 enum GFX3DSTATE_TILEWALK 316 { 317 GFX3DSTATE_TILEWALK_XMAJOR = 0, 318 GFX3DSTATE_TILEWALK_YMAJOR = 1 319 }; 320 321 enum MEDIA_STATE_DEBUG_COUNTER_CONTROL 322 { 323 MEDIASTATE_DEBUG_COUNTER_FREE_RUNNING = 0, 324 MEDIASTATE_DEBUG_COUNTER_FROZEN = 1, 325 MEDIASTATE_DEBUG_COUNTER_INITIALIZED_ONCE = 2, 326 MEDIASTATE_DEBUG_COUNTER_INITIALIZED_ALWAYS = 3 327 }; 328 329 enum MEDIASTATE_BINDING_TABLE_STATE_TYPE 330 { 331 MEDIASTATE_BTS_DEFAULT_TYPE = 0, 332 MEDIASTATE_BTS_DI_SAMPLE8x8_VME_TYPE = 1 333 }; 334 335 struct SURFACE_STATE_TOKEN_COMMON 336 { 337 // DWORD 0 338 union 339 { 340 struct 341 { 342 uint32_t Length : 8; // OP_LENGTH 343 uint32_t : 8; 344 uint32_t InstructionSubOpcode : 8; // GFX3DSTATE_PIPELINED_SUBOPCODE 345 uint32_t InstructionOpcode : 3; // GFX_OPCODE 346 uint32_t InstructionPipeLine : 2; // INSTRUCTION_PIPELINE 347 uint32_t InstructionType : 2; // INSTRUCTION_TYPE 348 uint32_t Token : 1; // bool 349 }; 350 351 // DriverID for IMOLA patching 352 struct 353 { 354 uint32_t DriverID; 355 }; 356 357 struct 358 { 359 uint32_t Value; 360 }; 361 } DW0; 362 363 // DWORD 1 364 union 365 { 366 struct 367 { 368 uint32_t SurfaceStateHeapOffset : 16; // U16 32-byte aligned 369 uint32_t SurfaceAllocationIndex : 16; // U16 370 }; 371 struct 372 { 373 uint32_t Value; 374 }; 375 } DW1; 376 377 // DWORD 2 378 union 379 { 380 struct 381 { 382 uint32_t SurfaceOffset : 32; 383 }; 384 struct 385 { 386 uint32_t Value; 387 }; 388 } DW2; 389 390 // DWORD 3 391 union 392 { 393 struct 394 { 395 uint32_t RenderTargetEnable : 1; // bool 396 uint32_t YUVPlane : 2; // U2 397 uint32_t SurfaceStateType : 1; // U1 398 uint32_t: 28; 399 }; 400 struct 401 { 402 uint32_t Value; 403 }; 404 } DW3; 405 406 // DWORD 4 407 union 408 { 409 struct 410 { 411 uint32_t SurfaceBaseAddress; // SurfaceBaseAddress[31:12] 412 }; 413 struct 414 { 415 uint32_t Value; 416 }; 417 } DW4; 418 419 // DWORD 5 420 union 421 { 422 struct 423 { 424 uint32_t SurfaceBaseAddress64 : BITFIELD_RANGE(0, 15); // SurfaceBaseAddress[47:32] 425 uint32_t : BITFIELD_RANGE(16, 31); 426 }; 427 struct 428 { 429 uint32_t Value; 430 }; 431 } DW5; 432 433 void* pResourceInfo; 434 435 }; 436 437 extern const SURFACE_STATE_TOKEN_COMMON g_cInit_SURFACE_STATE_TOKEN_COMMON; 438 439 // Forward declarations 440 typedef struct _RENDERHAL_SURFACE RENDERHAL_SURFACE, *PRENDERHAL_SURFACE; 441 typedef struct _RENDERHAL_INTERFACE RENDERHAL_INTERFACE, *PRENDERHAL_INTERFACE; 442 typedef struct _RENDERHAL_SURFACE_STATE_ENTRY *PRENDERHAL_SURFACE_STATE_ENTRY; 443 typedef const struct _RENDERHAL_KERNEL_PARAM CRENDERHAL_KERNEL_PARAM, *PCRENDERHAL_KERNEL_PARAM; 444 445 //! 446 //! Structure RENDERHAL_SETTINGS 447 //! \brief RenderHal Settings - creation parameters for RenderHal 448 //! 449 typedef struct _RENDERHAL_SETTINGS 450 { 451 int32_t iMediaStates; 452 453 PRENDERHAL_DYN_HEAP_SETTINGS pDynSettings; // Dynamic State Heap Settings 454 455 } RENDERHAL_SETTINGS, *PRENDERHAL_SETTINGS; 456 457 //! 458 //! Enum RENDERHAL_COMPONENT 459 //! \brief RenderHal client component ID (for debugging/timing) 460 //! 461 typedef enum _RENDERHAL_COMPONENT 462 { 463 RENDERHAL_COMPONENT_UNKNOWN = 0, 464 RENDERHAL_COMPONENT_COMP, 465 RENDERHAL_COMPONENT_DNDI, 466 RENDERHAL_COMPONENT_VEBOX, 467 RENDERHAL_COMPONENT_CM, 468 RENDERHAL_COMPONENT_PACKET, 469 RENDERHAL_COMPONENT_16ALIGN, 470 RENDERHAL_COMPONENT_FAST1TON, 471 RENDERHAL_COMPONENT_HDR, 472 RENDERHAL_COMPONENT_COUNT_BASE, 473 RENDERHAL_COMPONENT_RENDER_COPY, 474 RENDERHAL_COMPONENT_RESERVED_NUM = 16, 475 RENDERHAL_COMPONENT_COUNT 476 } RENDERHAL_COMPONENT; 477 478 //! 479 //! \brief Scaling Mode enum 480 //! 481 typedef enum _RENDERHAL_SCALING_MODE 482 { 483 RENDERHAL_SCALING_NEAREST, 484 RENDERHAL_SCALING_BILINEAR, 485 RENDERHAL_SCALING_AVS 486 } RENDERHAL_SCALING_MODE; 487 488 //! 489 //! \brief Surface types enum 490 //! IMPORTANT : SurfaceType_Layer[] must be updated to match this enum type 491 //! 492 typedef enum _RENDERHAL_SURFACE_TYPE 493 { 494 RENDERHAL_SURF_NONE = 0, 495 RENDERHAL_SURF_IN_BACKGROUND, 496 RENDERHAL_SURF_IN_PRIMARY, 497 RENDERHAL_SURF_IN_SUBSTREAM, 498 RENDERHAL_SURF_IN_REFERENCE, 499 RENDERHAL_SURF_OUT_RENDERTARGET, 500 RENDERHAL_SURF_TYPE_COUNT //!< Keep this line at the end 501 } RENDERHAL_SURFACE_TYPE; 502 503 //! 504 //! \brief Batch buffer types enum 505 //! 506 typedef enum _RENDERHAL_BB_TYPE 507 { 508 RENDERHAL_BB_TYPE_UNKNOWN = 0, // Batch Buffer created by unknown client 509 RENDERHAL_BB_TYPE_CM = 6, // Batch Buffer created by Media Development Framework (CM) component 510 RENDERHAL_BB_TYPE_COUNT 511 } RENDERHAL_BB_TYPE; 512 513 //! 514 //! \brief Sample Type enum 515 //! 516 typedef enum _RENDERHAL_SAMPLE_TYPE 517 { 518 RENDERHAL_SAMPLE_PROGRESSIVE, 519 RENDERHAL_SAMPLE_SINGLE_TOP_FIELD, 520 RENDERHAL_SAMPLE_SINGLE_BOTTOM_FIELD, 521 RENDERHAL_SAMPLE_INTERLEAVED_EVEN_FIRST_TOP_FIELD, 522 RENDERHAL_SAMPLE_INTERLEAVED_EVEN_FIRST_BOTTOM_FIELD, 523 RENDERHAL_SAMPLE_INTERLEAVED_ODD_FIRST_TOP_FIELD, 524 RENDERHAL_SAMPLE_INTERLEAVED_ODD_FIRST_BOTTOM_FIELD, 525 RENDERHAL_SAMPLE_INVALID //!< Keep this line at the end 526 } RENDERHAL_SAMPLE_TYPE; 527 528 //! 529 //! Structure RENDERHAL_GET_SURFACE_INFO 530 //! \brief Structure to retrieve Surface Infomation Parameters 531 //! 532 typedef struct _RENDERHAL_GET_SURFACE_INFO 533 { 534 uint32_t ArraySlice; 535 uint32_t MipSlice; 536 MOS_S3D_CHANNEL S3dChannel; 537 } RENDERHAL_GET_SURFACE_INFO, *PRENDERHAL_GET_SURFACE_INFO; 538 539 //! 540 //! \brief Structure of power control info 541 //! 542 typedef struct _RENDERHAL_POWEROPTION 543 { 544 uint16_t nSlice; //!< Number of slices to use: 0 (default), 1, 2... 545 uint16_t nSubSlice; //!< Number of subslices to use: 0 (default), 1, 2... 546 uint16_t nEU; //!< Number of EUs to use: 0 (default), 1, 2... 547 } RENDERHAL_POWEROPTION, *PRENDERHAL_POWEROPTION; 548 549 //! 550 //! Structure RENDERHAL_SURFACE 551 //! \brief RENDERHAL surface definition 552 //! 553 typedef struct _RENDERHAL_SURFACE 554 { 555 MOS_SURFACE OsSurface; //!< Surface provided by the client 556 557 // Auxiliary rendering parameters 558 RENDERHAL_SURFACE_TYPE SurfType; //!< Surface Type (context) 559 RENDERHAL_SCALING_MODE ScalingMode; //!< Scaling Mode 560 MHW_ROTATION Rotation; //!< Rotation Mode 561 uint32_t ChromaSiting; //!< Chroma Siting 562 563 // Src/Dst rectangles 564 RECT rcSrc; //!< Source rectangle 565 RECT rcDst; //!< Destination rectangle 566 RECT rcMaxSrc; //!< Max source rectangle 567 568 // Auxiliary VP parameters provided by client 569 bool bDeinterlaceEnable; //!< Active Deinterlace messages 570 bool bQueryVariance; //!< enable variance query 571 bool bInterlacedScaling; //!< Interlaced scaling 572 void *pDeinterlaceParams; //!< Pointer to Deinterlacing parameters 573 RENDERHAL_SAMPLE_TYPE SampleType; //!< Interlaced/Progressive sample type 574 int32_t iPaletteID; //!<Palette ID 575 576 uint32_t dwWidthInUse; //!< the actual width in use 577 uint32_t dwHeightInUse; //!< the actual height in use 578 } RENDERHAL_SURFACE , *PRENDERHAL_SURFACE; 579 580 //! 581 //! Structure RENDERHAL_OFFSET_OVERRIDE 582 //! \brief structure used to alloce Surface State overrides for Kernel 583 //! 584 typedef struct _RENDERHAL_OFFSET_OVERRIDE 585 { 586 // Y plane adjustment 587 int32_t iYOffsetAdjust; //!< Surface Offset adjustment for Y plane 588 int32_t iYOffsetX; //!< X-Offset override for Y plane 589 int32_t iYOffsetY; //!< Y-Offset override for Y plane 590 591 // UV plane overrides/adjustmenty 592 int32_t iUVOffsetAdjust; //!< Surface Offset adjustment for UV plane 593 int32_t iUVOffsetX; //!< X-Offset override for UV plane 594 int32_t iUVOffsetY; //!< Y-Offset override for UV plane 595 } RENDERHAL_OFFSET_OVERRIDE, *PRENDERHAL_OFFSET_OVERRIDE; 596 597 typedef enum _RENDERHAL_SURFACE_STATE_TYPE 598 { 599 RENDERHAL_SURFACE_TYPE_INVALID = 0, 600 RENDERHAL_SURFACE_TYPE_G8 , 601 RENDERHAL_SURFACE_TYPE_G9 , 602 RENDERHAL_SURFACE_TYPE_G10 , 603 RENDERHAL_SURFACE_TYPE_ADV_G8 , 604 RENDERHAL_SURFACE_TYPE_ADV_G9 , 605 RENDERHAL_SURFACE_TYPE_ADV_G10 606 } RENDERHAL_SURFACE_STATE_TYPE, *PRENDERHAL_SURFACE_STATE_TYPE; 607 608 typedef enum _RENDERHAL_PLANE_DEFINITION 609 { 610 RENDERHAL_PLANES_PL3 = 0, 611 RENDERHAL_PLANES_NV12 , 612 RENDERHAL_PLANES_YUY2 , 613 RENDERHAL_PLANES_UYVY , 614 RENDERHAL_PLANES_YVYU , 615 RENDERHAL_PLANES_VYUY , 616 RENDERHAL_PLANES_ARGB , 617 RENDERHAL_PLANES_XRGB , 618 RENDERHAL_PLANES_ABGR , 619 RENDERHAL_PLANES_XBGR , 620 RENDERHAL_PLANES_RGB16 , 621 RENDERHAL_PLANES_RGB24 , 622 RENDERHAL_PLANES_R16U , 623 RENDERHAL_PLANES_R16S , 624 RENDERHAL_PLANES_R32U , 625 RENDERHAL_PLANES_R32S , 626 RENDERHAL_PLANES_R32F , 627 RENDERHAL_PLANES_V8U8 , 628 RENDERHAL_PLANES_R8G8_UNORM , 629 RENDERHAL_PLANES_411P , 630 RENDERHAL_PLANES_411R , 631 RENDERHAL_PLANES_422H , 632 RENDERHAL_PLANES_422V , 633 RENDERHAL_PLANES_444P , 634 RENDERHAL_PLANES_RGBP , 635 RENDERHAL_PLANES_BGRP , 636 637 RENDERHAL_PLANES_AI44_PALLETE_0 , 638 RENDERHAL_PLANES_IA44_PALLETE_0 , 639 RENDERHAL_PLANES_P8_PALLETE_0 , 640 RENDERHAL_PLANES_A8P8_PALLETE_0 , 641 RENDERHAL_PLANES_AI44_PALLETE_1 , 642 RENDERHAL_PLANES_IA44_PALLETE_1 , 643 RENDERHAL_PLANES_P8_PALLETE_1 , 644 RENDERHAL_PLANES_A8P8_PALLETE_1 , 645 646 RENDERHAL_PLANES_AYUV , 647 RENDERHAL_PLANES_STMM , 648 RENDERHAL_PLANES_L8 , 649 650 RENDERHAL_PLANES_PL3_ADV , 651 RENDERHAL_PLANES_NV12_ADV , 652 RENDERHAL_PLANES_YUY2_ADV , 653 RENDERHAL_PLANES_UYVY_ADV , 654 RENDERHAL_PLANES_YVYU_ADV , 655 RENDERHAL_PLANES_VYUY_ADV , 656 RENDERHAL_PLANES_ARGB_ADV , 657 RENDERHAL_PLANES_ABGR_ADV , 658 RENDERHAL_PLANES_AYUV_ADV , 659 RENDERHAL_PLANES_STMM_ADV , 660 RENDERHAL_PLANES_L8_ADV , 661 RENDERHAL_PLANES_A8_ADV , 662 RENDERHAL_PLANES_A8 , 663 RENDERHAL_PLANES_R8 , 664 RENDERHAL_PLANES_NV12_2PLANES , 665 RENDERHAL_PLANES_NV12_2PLANES_ADV , 666 RENDERHAL_PLANES_411P_ADV , 667 RENDERHAL_PLANES_411R_ADV , 668 RENDERHAL_PLANES_422H_ADV , 669 RENDERHAL_PLANES_422V_ADV , 670 RENDERHAL_PLANES_444P_ADV , 671 RENDERHAL_PLANES_RGBP_ADV , 672 RENDERHAL_PLANES_BGRP_ADV , 673 RENDERHAL_PLANES_R16_UNORM , 674 RENDERHAL_PLANES_Y8 , 675 RENDERHAL_PLANES_Y1 , 676 RENDERHAL_PLANES_Y16U , 677 RENDERHAL_PLANES_Y16S , 678 RENDERHAL_PLANES_A16B16G16R16 , 679 RENDERHAL_PLANES_A16B16G16R16_ADV , 680 RENDERHAL_PLANES_R10G10B10A2 , 681 RENDERHAL_PLANES_R10G10B10A2_ADV , 682 RENDERHAL_PLANES_B10G10R10A2 , 683 RENDERHAL_PLANES_L16 , 684 RENDERHAL_PLANES_NV21 , 685 RENDERHAL_PLANES_YV12 , 686 RENDERHAL_PLANES_P016 , 687 RENDERHAL_PLANES_P016_2PLANES_ADV , 688 RENDERHAL_PLANES_P010 , 689 RENDERHAL_PLANES_P010_1PLANE , 690 RENDERHAL_PLANES_P010_1PLANE_ADV , 691 RENDERHAL_PLANES_IRW0 , 692 RENDERHAL_PLANES_IRW1 , 693 RENDERHAL_PLANES_IRW2 , 694 RENDERHAL_PLANES_IRW3 , 695 RENDERHAL_PLANES_A16B16G16R16F , 696 RENDERHAL_PLANES_R16G16_UNORM , 697 RENDERHAL_PLANES_R16_FLOAT , 698 RENDERHAL_PLANES_A16R16G16B16F , 699 RENDERHAL_PLANES_YUY2_2PLANES , 700 RENDERHAL_PLANES_Y210_ADV , 701 RENDERHAL_PLANES_Y210_RT , 702 RENDERHAL_PLANES_Y210 , 703 RENDERHAL_PLANES_Y210_1PLANE_ADV , 704 RENDERHAL_PLANES_R16G16_SINT , 705 RENDERHAL_PLANES_R24_UNORM_X8_TYPELESS, 706 RENDERHAL_PLANES_R32_FLOAT_X8X24_TYPELESS, 707 RENDERHAL_PLANES_P208, 708 RENDERHAL_PLANES_P208_1PLANE_ADV, 709 RENDERHAL_PLANES_Y416_RT, 710 RENDERHAL_PLANES_R32G32B32A32F, 711 RENDERHAL_PLANES_Y8_ADV, 712 713 RENDERHAL_PLANES_DEFINITION_COUNT 714 } RENDERHAL_PLANE_DEFINITION, *PRENDERHAL_PLANE_DEFINITION; 715 716 typedef enum _RENDERHAL_SS_BOUNDARY 717 { 718 RENDERHAL_SS_BOUNDARY_SRCRECT = 0, // use for sources read via sampler 719 RENDERHAL_SS_BOUNDARY_DSTRECT , // use for RT by default 720 RENDERHAL_SS_BOUNDARY_MAXSRCRECT, // use max source rect 721 RENDERHAL_SS_BOUNDARY_ORIGINAL, // use for surfs that are not source or RT 722 } RENDERHAL_SS_BOUNDARY; 723 724 //! 725 //! \brief Surface cache attributes 726 //! 727 #define RENDERHAL_MEMORY_OBJECT_CONTROL uint32_t 728 729 typedef struct _RENDERHAL_KERNEL_PARAM 730 { 731 int32_t GRF_Count; // Number of registers 732 int32_t BT_Count; // Number of BT entries 733 int32_t Sampler_Count; // Number of samplers 734 int32_t Thread_Count; // Number of threads (max) 735 int32_t GRF_Start_Register; // Start register 736 int32_t CURBE_Length; // Constant URB length (in 256-bits) 737 int32_t block_width; // Block width 738 int32_t block_height; // Block height 739 int32_t blocks_x; // Blocks in x 740 int32_t blocks_y; // Blocks in y 741 } RENDERHAL_KERNEL_PARAM, *PRENDERHAL_KERNEL_PARAM; 742 743 typedef struct _RENDERHAL_CLONE_KERNEL_PARAM 744 { 745 bool isClone; // If kernel has been cloned from another kernel (i.e. share same kernel binary) 746 bool isHeadKernel; // If kernel is the "head" kernel (i.e. this allocation contains the kernel binary) 747 int32_t referenceCount; // Number of cloned kernels currently pointing to the head kernel 748 int32_t cloneKernelID; // Kernel ID of source kernel (i.e. kernel used to clone) 749 int32_t kernelBinaryAllocID; // Allocation ID of the head kernel that contains the actual kernel binary 750 uint32_t dwOffsetForAllocID; // Save the offset for this allocation ID, if clone using a different offset to point to head kernel binary 751 }RENDERHAL_CLONE_KERNEL_PARAM, *PRENDERHAL_CLONE_KERNEL_PARAM; 752 753 typedef struct tagKdll_CacheEntry Kdll_CacheEntry; 754 typedef struct _RENDERHAL_KRN_ALLOCATION *PRENDERHAL_KRN_ALLOCATION; 755 typedef struct _RENDERHAL_KRN_ALLOC_LIST *PRENDERHAL_KRN_ALLOC_LIST; 756 757 typedef struct _RENDERHAL_KRN_ALLOCATION 758 { 759 int32_t iKID; // Interface descriptor ID for the kernel (for 2nd level buffer) 760 int32_t iKUID; // Kernel Unique ID 761 int32_t iKCID; // Kernel Cache ID 762 uint32_t dwSync; // Kernel last sync (used to determine whether the kernel may be unloaded) 763 FrameTrackerTokenFlat trackerToken; // Kernel last sync with multiple trackers 764 uint32_t dwOffset; // Kernel offset in GSH (from GSH base, 0 is KAC entry is available) 765 int32_t iSize; // Kernel block size in GSH (0 if not loaded) 766 uint32_t dwFlags : 4; // Kernel allocation flag 767 uint32_t dwCount : 28; // Kernel refresh counter 768 RENDERHAL_KERNEL_PARAM Params; // Kernel parameters for RenderHal (states, rendering, etc) 769 PMHW_KERNEL_PARAM pMhwKernelParam; // Pointer to Kernel parameters for MHW 770 Kdll_CacheEntry *pKernelEntry; // Pointer to Kernel entry for VP/KDLL 771 RENDERHAL_CLONE_KERNEL_PARAM cloneKernelParams; // CM - Clone kernel information 772 int32_t iAllocIndex; // Kernel allocation index (index in kernel allocation table) 773 774 // DSH - Dynamic list of kernel allocations 775 PMHW_STATE_HEAP_MEMORY_BLOCK pMemoryBlock; // Memory block in ISH 776 PRENDERHAL_KRN_ALLOCATION pNext; // Next kernel in list 777 PRENDERHAL_KRN_ALLOCATION pPrev; // Prev kernel in list 778 PRENDERHAL_KRN_ALLOC_LIST pList; // Points to current list, regardless of flag 779 uint32_t Reserved : 16; // Reserved - used for debugging 780 uint32_t : 16; // 781 char *szKernelName; // Kernel name - used for debugging 782 } RENDERHAL_KRN_ALLOCATION, *PRENDERHAL_KRN_ALLOCATION; 783 784 typedef struct _RENDERHAL_KRN_ALLOC_LIST 785 { 786 PRENDERHAL_KRN_ALLOCATION pHead; // Head of the list 787 PRENDERHAL_KRN_ALLOCATION pTail; // Tail of the list 788 int32_t iCount; // Number of objects 789 } RENDERHAL_KRN_ALLOC_LIST, *PRENDERHAL_KRN_ALLOC_LIST; 790 791 typedef struct _RENDERHAL_MEDIA_STATE *PRENDERHAL_MEDIA_STATE; 792 793 typedef struct _RENDERHAL_DYNAMIC_STATE *PRENDERHAL_DYNAMIC_STATE; 794 795 typedef struct _RENDERHAL_MEDIA_STATE 796 { 797 // set at creation time 798 uint32_t dwOffset; // Media State Base Address (from GSH base) - VFE 799 int32_t *piAllocation; // Kernel allocation table 800 801 // set at runtime 802 uint32_t dwSyncTag; // Sync Tag 803 FrameTrackerTokenFlat trackerToken; 804 uint32_t dwSyncCount; // Number of sync tags 805 int32_t iCurbeOffset; // Current CURBE Offset 806 uint32_t bBusy : 1; // 1 if the state is in use (must sync before use) 807 uint32_t : 15; 808 uint32_t Reserved: 16; 809 810 PRENDERHAL_MEDIA_STATE pPrev; // Next Media State 811 PRENDERHAL_MEDIA_STATE pNext; // Previous Media State 812 PRENDERHAL_DYNAMIC_STATE pDynamicState; // Dynamic states (nullptr if DSH not in use) 813 } RENDERHAL_MEDIA_STATE, *PRENDERHAL_MEDIA_STATE; 814 815 typedef struct _RENDERHAL_MEDIA_STATE_LIST 816 { 817 PRENDERHAL_MEDIA_STATE pHead; // Head of the list 818 PRENDERHAL_MEDIA_STATE pTail; // Tail of the list 819 int32_t iCount; // Number of objects 820 } RENDERHAL_MEDIA_STATE_LIST, *PRENDERHAL_MEDIA_STATE_LIST; 821 822 struct RENDERHAL_TR_RESOURCE { 823 MOS_RESOURCE osResource; 824 bool locked; 825 uint32_t *data; 826 uint32_t currentTrackerId; 827 }; 828 829 typedef struct _RENDERHAL_STATE_HEAP_SETTINGS 830 { 831 // Global GSH Allocation parameters 832 int32_t iSyncSize; // Sync area for sync, perf, debug 833 834 // Media State Allocation parameters 835 int32_t iMediaStateHeaps; // Number of Media State heaps 836 int32_t iMediaIDs; // Number of Media Interface Descriptors 837 int32_t iCurbeSize; // Size of CURBE area 838 int32_t iSamplers; // Number of Samplers/ID 839 int32_t iSamplersAVS; // Number of AVS Samplers/ID 840 int32_t iSamplersVA; // Number of Video Analytics Samplers/ID 841 int32_t iKernelCount; // Number of Kernels that can be loaded 842 int32_t iKernelHeapSize; // Size of GSH block for kernels 843 int32_t iKernelBlockSize; // Kernel allocation block 844 845 // Media VFE/ID configuration, limits 846 int32_t iPerThreadScratchSize; // Size of the Scratch memory per Thread 847 int32_t iSipSize; // SIP size 848 849 // Surface State Heap Settings 850 int32_t iSurfaceStateHeaps; // Number of SSH instances (same as iMediaStateHeaps) 851 int32_t iBindingTables; // Number of BT per SSH instance 852 int32_t iSurfaceStates; // Number of Surfaces per SSH 853 int32_t iSurfacesPerBT; // Number of Surfaces per BT 854 int32_t iBTAlignment; // BT Alignment size 855 } RENDERHAL_STATE_HEAP_SETTINGS, *PRENDERHAL_STATE_HEAP_SETTINGS; 856 857 typedef struct _RENDERHAL_STATE_HEAP 858 { 859 //--------------------------- 860 // General State Heap 861 //--------------------------- 862 uint32_t dwSizeGSH; // GSH size 863 MOS_RESOURCE GshOsResource; // GSH OS Buffer 864 bool bGshLocked; // GSH is locked 865 uint8_t *pGshBuffer; // Pointer to GSH buffer data 866 867 // Dynamic GSH sync 868 uint32_t dwOffsetSync; // Offset of sync/perf data in GSH 869 uint32_t dwSizeSync; // Size of sync data 870 871 // Synchronization / Performance / Statistics 872 volatile uint32_t *pSync; // Pointer to sync area (when locked) 873 uint32_t dwNextTag; // Next sync tag value to use 874 uint32_t dwSyncTag; // Last sync tag completed 875 uint32_t dwFrameId; // Last frame id completed 876 877 // Media states 878 int32_t iCurMediaState; // Current Media State Index 879 int32_t iNextMediaState; // Next Media State Index 880 PRENDERHAL_MEDIA_STATE pCurMediaState; // Current Media state in use 881 882 uint32_t dwOffsetMediaID; // Offset to Media IDs from Media State Base 883 uint32_t dwSizeMediaID; // Size of each Media ID 884 885 MHW_ID_ENTRY_PARAMS CurIDEntryParams = {}; // Parameters for current Interface Descriptor Entry 886 887 // Performance capture 888 uint32_t dwOffsetStartTime; // Offset to the start time of the media state 889 uint32_t dwStartTimeSize; // Size of Start time 890 uint32_t dwOffsetEndTime; // Offset to the end time of the media state 891 uint32_t dwEndTimeSize; // Size of end time 892 uint32_t dwOffsetComponentID; // Render Component 893 uint32_t dwComponentIDSize; // Render ComponentID size 894 uint32_t dwOffsetReserved; // Reserved (Curbe should be 64 aligned) 895 uint32_t dwReservedSize; // 64 - (start time + end time + component) 896 897 uint32_t dwOffsetCurbe; // Offset to Media CURBE data from Media State Base 898 uint32_t dwSizeCurbe; // Size of CURBE area 899 900 uint32_t dwOffsetSampler; // Offset to Media Samplers from Media State Base 901 uint32_t dwSizeSampler; // Size of Samplers 902 903 uint32_t dwOffsetSamplerIndirect; // Offset to Media Samplers Indirect State from Media State Base 904 uint32_t dwSizeSamplerIndirect; // Size of Samplers Indirect State 905 906 uint32_t dwOffsetSampler8x8Table; // Offset to Media Sampler State Table for AVS from Media State Base 907 uint32_t dwSizeSampler8x8Table; // Size of Sampler State Table for AVS 908 909 uint32_t dwOffsetSamplerVA; // Offset to Video Analytics Samplers from Media State Base 910 uint32_t dwSizeSamplerVA; // Size of VA Samplers 911 912 uint32_t dwOffsetSamplerAVS; // Offset to 8x8 Samplers from Media State Base 913 uint32_t dwSizeSamplerAVS; // Size of 8x8 Samplers 914 915 uint32_t dwSizeSamplers; // Size of All Samplers 916 917 PRENDERHAL_MEDIA_STATE pMediaStates; // Media state table 918 919 // Dynamic Media states 920 PMHW_MEMORY_POOL pMediaStatesMemPool; // Media state memory allocations 921 RENDERHAL_MEDIA_STATE_LIST FreeStates; // Free media state objects (pool) 922 RENDERHAL_MEDIA_STATE_LIST ReservedStates; // Reserved media states 923 RENDERHAL_MEDIA_STATE_LIST SubmittedStates; // Submitted media states 924 925 //--------------------------- 926 // Surface State Heap 927 //--------------------------- 928 uint32_t dwSizeSSH; // SSH size 929 MOS_RESOURCE SshOsResource; // SSH OS Buffer 930 bool bSshLocked; // SSH is locked 931 uint8_t *pSshBuffer; // Pointer to SSH buffer base 932 uint32_t dwSshIntanceSize; // SSH instance size 933 934 // BT size, offsets to BT/SS entries in SSH 935 int32_t iBindingTableSize; // Size of each BT (in bytes) 936 int32_t iBindingTableOffset; // First BT offset in SSH buffer 937 int32_t iSurfaceStateOffset; // First SS offset in SSH buffer 938 939 // Array of Surface State control structures 940 PRENDERHAL_SURFACE_STATE_ENTRY pSurfaceEntry; 941 942 // Current allocations 943 int32_t iCurSshBufferIndex; // Current SSH Buffer instance in the SSH heap 944 int32_t iCurrentBindingTable; // Current BT 945 int32_t iCurrentSurfaceState; // Current SS 946 947 //--------------------------- 948 // Instruction State Heap 949 //--------------------------- 950 uint32_t dwSizeISH; // ISH size 951 MOS_RESOURCE IshOsResource; // ISH OS Buffer 952 bool bIshLocked; // ISH is locked 953 uint8_t *pIshBuffer; // Pointer to ISH buffer data 954 uint32_t dwKernelBase; // Offset of kernels in ISH 955 956 // Kernel Allocation 957 int32_t iKernelSize; // Kernel heap size 958 int32_t iKernelUsed; // Kernel heap used size 959 uint8_t *pKernelLoadMap; // Kernel load map 960 uint32_t dwAccessCounter; // Incremented when a kernel is loaded/used, for dynamic allocation 961 int32_t iKernelUsedForDump; // The kernel size to be dumped in oca buffer. 962 963 // Kernel Spill Area 964 uint32_t dwScratchSpaceSize; // Size of the Scratch Area 965 uint32_t dwScratchSpaceBase; // Base of the Scratch area 966 967 // System Routine 968 uint32_t dwSipBase; // Base of the System Routine 969 970 // Arrays created dynamically 971 PRENDERHAL_KRN_ALLOCATION pKernelAllocation; // Kernel allocation table (or linked list) 972 973 // Dynamic Kernel States 974 PMHW_MEMORY_POOL pKernelAllocMemPool; // Kernel states memory pool (mallocs) 975 RENDERHAL_KRN_ALLOC_LIST KernelAllocationPool; // Pool of kernel allocation objects 976 RENDERHAL_KRN_ALLOC_LIST KernelsSubmitted; // Kernel submission list 977 RENDERHAL_KRN_ALLOC_LIST KernelsAllocated; // kernel allocation list (kernels in ISH not currently being executed) 978 CmHashTable kernelHashTable; // Kernel hash table for faster kernel search 979 980 } RENDERHAL_STATE_HEAP, *PRENDERHAL_STATE_HEAP; 981 982 typedef struct _RENDERHAL_DYNAMIC_MEDIA_STATE_PARAMS 983 { 984 int32_t iMaxMediaIDs; // Maximum number of media interface descriptors 985 int32_t iMaxThreads; // Maximum number of threads to be executed (0 = limited to HW threads) - for scratch space allocation 986 int32_t iMaxSpillSize; // Maximum spill sizes among all kernels to be executed - used for scratch space allocation 987 int32_t iMaxCurbeOffset; // Maximum offset reserved for CURBE 988 int32_t iMaxCurbeSize; // Maximum size reserved for CURBE 989 int32_t iMaxSamplerIndex3D; // Maximum 3D sampler index 990 int32_t iMaxSamplerIndexAVS; // Maximum AVS sampler index 991 int32_t iMaxSamplerIndexConv; // Maximum Conv sampler index 992 int32_t iMaxSamplerIndexMisc; // Maximum Misc (VA) sampler index 993 int32_t iMax8x8Tables; // Maximum Number of 8x8 tables per MediaID 994 } RENDERHAL_DYNAMIC_MEDIA_STATE_PARAMS, *PRENDERHAL_DYNAMIC_MEDIA_STATE_PARAMS; 995 996 typedef struct _RENDERHAL_INTERFACE_DESCRIPTOR_PARAMS 997 { 998 int32_t iMediaID; 999 int32_t iBindingTableID; 1000 int32_t iCurbeOffset; 1001 int32_t iCurbeLength; 1002 int32_t iCrsThrdConstDataLn; 1003 int32_t iNumberThreadsInGroup; 1004 bool blGlobalBarrierEnable; 1005 bool blBarrierEnable; 1006 int32_t iSLMSize; 1007 } RENDERHAL_INTERFACE_DESCRIPTOR_PARAMS, *PRENDERHAL_INTERFACE_DESCRIPTOR_PARAMS; 1008 1009 //! 1010 //! \brief ======== HW Abstraction Params =================================== 1011 //! 1012 1013 typedef struct _RENDERHAL_SURFACE_STATE_PARAMS 1014 { 1015 RENDERHAL_SURFACE_STATE_TYPE Type : 5; // Type of surface state 1016 uint32_t bRenderTarget : 1; // Render target flag 1017 uint32_t bVertStride : 1; // VL Stride 1018 uint32_t bVertStrideOffs : 1; // VL Stride Offset 1019 uint32_t bWidthInDword_Y : 1; // Width in dwords 1020 uint32_t bWidthInDword_UV : 1; 1021 uint32_t bAVS : 1; // AVS scaling 1022 RENDERHAL_SS_BOUNDARY Boundary : 3; // boundary to be aligned to rcSrc/rcDst/actual wd/ht 1023 uint32_t bWidth16Align : 1; // When VDI Walker is enabled, input surface width must be 16 aligned 1024 uint32_t b2PlaneNV12NeededByKernel : 1; // Kernel needs surface state for both Y and UV 1025 uint32_t bForceNV12 : 1; // Forces format to be treated as NV12. Only used in FRC. 1026 uint32_t bUseSinglePlane : 1; // 1 indicates using one plane only 1027 uint32_t b32MWColorFillKern : 1; // Flag for 32x32 Media walker + ColorFill kernel case 1028 uint32_t bVASurface : 1; // Value is 1 if VA surface, 0 if AVS surface 1029 uint32_t AddressControl : 2; // 0 clamp, 1 mirror, 2, 3 reserved 1030 uint32_t bWAUseSrcHeight : 1; // Surface state height use src height or surface height 1031 uint32_t bWAUseSrcWidth : 1; // Surface state width use src width or surface width 1032 uint32_t bForce3DLUTR16G16 : 1; // Flag for 3D LUT source and targetsurface 1033 uint32_t bChromasiting : 1; // Flag for chromasiting use 1034 uint32_t bVmeUse : 1; // Flag for VME use 1035 uint32_t bBufferUse : 1; // Flags for 1D buffer use 1036 uint32_t : 3; 1037 RENDERHAL_MEMORY_OBJECT_CONTROL MemObjCtl; // Caching attributes 1038 } RENDERHAL_SURFACE_STATE_PARAMS, *PRENDERHAL_SURFACE_STATE_PARAMS; 1039 1040 typedef struct _RENDERHAL_SURFACE_STATE_ENTRY 1041 { 1042 RENDERHAL_SURFACE_STATE_TYPE Type; // Type of surface state 1043 PMOS_SURFACE pSurface; // Pointer to OS surface 1044 uint8_t *pSurfaceState; // Pointer to Surface State 1045 SURFACE_STATE_TOKEN_COMMON SurfaceToken; // SurfaceS Token 1046 int32_t iSurfStateID; // Surface state ID 1047 uint32_t dwSurfStateOffset; // Surface state offset (SSH) 1048 uint32_t dwFormat; // Surface format 1049 uint32_t dwWidth; // Surface width 1050 uint32_t dwHeight; // Surface heigth 1051 uint32_t dwPitch; // Surface pitch 1052 uint32_t dwQPitch; // Surface qpitch 1053 uint32_t YUVPlane : 2; // Plane 1054 uint32_t bAVS : 1; // AVS scaling 1055 uint32_t bRenderTarget : 1; // Render target flag 1056 uint32_t bVertStride : 1; // VL Stride 1057 uint32_t bVertStrideOffs : 1; // VL Stride Offset 1058 uint32_t bWidthInDword : 1; // Width in dwords 1059 uint32_t bTiledSurface : 1; // Tiled surface 1060 uint32_t bTileWalk : 1; // Walk 0-X; 1-Y 1061 uint32_t bHalfPitchChroma : 1; // Half pitch for choma (AVS) 1062 uint32_t bInterleaveChroma: 1; // Interleaved chroma (AVS) 1063 uint32_t DirectionV : 3; // UV direction (AVS) 1064 uint32_t DirectionU : 1; // UV direction (AVS) 1065 uint32_t AddressControl : 2; // 0 Clamp, 1 Mirror, 2, 3 resserved 1066 uint32_t : 15; // RESERVED 1067 uint16_t wUXOffset; // (X,Y) offset U (AVS/ADI) 1068 uint16_t wUYOffset; // 1069 uint16_t wVXOffset; // (X,Y) offset V (AVS/ADI) 1070 uint16_t wVYOffset; // 1071 } RENDERHAL_SURFACE_STATE_ENTRY, *PRENDERHAL_SURFACE_STATE_ENTRY; 1072 1073 //! 1074 // \brief Helper parameters used by Mhw_SendGenericPrologCmd and to initiate command buffer attributes 1075 //! 1076 typedef struct _RENDERHAL_GENERIC_PROLOG_PARAMS 1077 { 1078 bool bMmcEnabled = 0; 1079 bool bEnableMediaFrameTracking = 0; 1080 uint32_t dwMediaFrameTrackingTag = 0; 1081 uint32_t dwMediaFrameTrackingAddrOffset = 0; 1082 PMOS_RESOURCE presMediaFrameTrackingSurface = nullptr; ~_RENDERHAL_GENERIC_PROLOG_PARAMS_RENDERHAL_GENERIC_PROLOG_PARAMS1083 virtual ~_RENDERHAL_GENERIC_PROLOG_PARAMS() {} 1084 } RENDERHAL_GENERIC_PROLOG_PARAMS, *PRENDERHAL_GENERIC_PROLOG_PARAMS; 1085 1086 //! 1087 // \brief Settings help to decide the value of L3 cache enabling register used for renderhal 1088 //! 1089 typedef struct _RENDERHAL_L3_CACHE_SETTINGS 1090 { 1091 bool bEnableSLM; // Enable SLM cache configuration 1092 bool bOverride; // Override cache settings 1093 1094 // Override values 1095 bool bL3CachingEnabled; 1096 1097 bool bCntlRegOverride; 1098 bool bCntlReg2Override; 1099 bool bCntlReg3Override; 1100 bool bSqcReg1Override; 1101 bool bSqcReg4Override; 1102 bool bLra1RegOverride; 1103 1104 uint32_t dwCntlReg; 1105 uint32_t dwCntlReg2; 1106 uint32_t dwCntlReg3; 1107 uint32_t dwSqcReg1; 1108 uint32_t dwSqcReg4; 1109 uint32_t dwLra1Reg; 1110 } RENDERHAL_L3_CACHE_SETTINGS, *PRENDERHAL_L3_CACHE_SETTINGS; 1111 1112 //! 1113 // \brief Settings of Predication 1114 //! 1115 typedef struct _RENDERHAL_PREDICATION_SETTINGS 1116 { 1117 MOS_RESOURCE *pPredicationResource; // Resource for predication 1118 MOS_RESOURCE *ptempPredicationBuffer; // Additional temp buffer for Predication due to the limitation of Cond_BB_End 1119 uint64_t predicationResOffset; // Offset for Predication resource 1120 bool predicationNotEqualZero; // Predication mode 1121 bool predicationEnabled; // Indicates whether or not Predication is enabled 1122 } RENDERHAL_PREDICATION_SETTINGS; 1123 1124 //! 1125 // \brief Settings of SetMarker 1126 //! 1127 typedef struct _RENDERHAL_SETMARKER_SETTINGS 1128 { 1129 MOS_RESOURCE *pSetMarkerResource; // Resource for SetMarker 1130 bool setMarkerEnabled; // Indicates whether or not SetMarker is enabled 1131 uint32_t setMarkerNumTs; // Number Timestamp for SetMarker 1132 } RENDERHAL_SETMARKER_SETTINGS; 1133 1134 typedef MhwMiInterface *PMHW_MI_INTERFACE; 1135 1136 //! 1137 // \brief Hardware dependent render engine interface 1138 //! 1139 typedef struct _RENDERHAL_INTERFACE 1140 { 1141 // MOS/MHW Interfaces 1142 PMOS_INTERFACE pOsInterface; 1143 MhwCpInterface *pCpInterface; 1144 PXMHW_STATE_HEAP_INTERFACE pMhwStateHeap; 1145 PMHW_MI_INTERFACE pMhwMiInterface; 1146 MhwRenderInterface *pMhwRenderInterface; 1147 1148 // RenderHal State Heap 1149 PRENDERHAL_STATE_HEAP pStateHeap; 1150 uint32_t dwStateHeapSize; 1151 1152 // Linked list of batch buffers for synchronization 1153 PMHW_BATCH_BUFFER pBatchBufferList; // List of BB submitted 1154 1155 PMHW_MEMORY_POOL pBatchBufferMemPool; // Batch Buffer memory allocations (malloc) 1156 PMHW_BATCH_BUFFER_LIST BatchBufferPool; // Pool of BB objects (no GFX buffer) 1157 PMHW_BATCH_BUFFER_LIST BatchBuffersAllocated; // List of BB allocated (not executing, backed by GFX buffer) 1158 1159 // Auxiliary 1160 PLATFORM Platform; 1161 MEDIA_FEATURE_TABLE *pSkuTable; 1162 MEDIA_WA_TABLE *pWaTable; 1163 1164 // Hardware dependent parameters 1165 MHW_VFE_SCOREBOARD VfeScoreboard; 1166 PCMHW_SURFACE_PLANES pPlaneDefinitions; 1167 1168 // Settings and capabilities 1169 PMHW_RENDER_ENGINE_CAPS pHwCaps; // HW Capabilities 1170 PMHW_RENDER_STATE_SIZES pHwSizes; // Sizes of HW commands/states 1171 RENDERHAL_STATE_HEAP_SETTINGS StateHeapSettings; // State Heap Settings 1172 RENDERHAL_DYN_HEAP_SETTINGS DynamicHeapSettings; // Dynamic State Heap Settings 1173 1174 // MHW parameters 1175 MHW_STATE_BASE_ADDR_PARAMS StateBaseAddressParams; 1176 MHW_SIP_STATE_PARAMS SipStateParams; 1177 MHW_WALKER_MODE MediaWalkerMode; // Media object walker mode from Regkey: repel, dual mode, quad mode 1178 1179 RENDERHAL_SURFACE_STATE_TYPE SurfaceTypeDefault; // Surface State type default 1180 RENDERHAL_SURFACE_STATE_TYPE SurfaceTypeAdvanced; // Surface State type advanced 1181 1182 RENDERHAL_L3_CACHE_SETTINGS L3CacheSettings; // L3 Cache settings 1183 1184 bool bEnableYV12SinglePass; // Enabled YV12 single pass in 3D sampler 1185 bool bEnableP010SinglePass; // Enabled P010 single pass in sampler 1186 bool bSIPKernel; // SIP loaded 1187 bool bCSRKernel; // CSR loaded 1188 bool bTurboMode; // Turbo mode info to pass in cmdBuf 1189 bool bVDIWalker; // VDI Walker info from Regkey 1190 bool bRequestSingleSlice; // Single Slice Request flag 1191 bool bEUSaturationNoSSD; // No slice shutdown, must request 2 slices [CM EU saturation on] 1192 bool bEnableGpgpuMidBatchPreEmption; // Middle Batch Buffer Preemption 1193 bool bEnableGpgpuMidThreadPreEmption; // Middle Thread Preemption 1194 bool bComputeContextInUse; // Compute Context use for media 1195 1196 uint32_t dwMaskCrsThdConDataRdLn; // Unifies pfnSetupInterfaceDescriptor for g75,g8,... 1197 uint32_t dwMinNumberThreadsInGroup; // Unifies pfnSetupInterfaceDescriptor for g75,g8,... 1198 uint32_t dwCurbeBlockAlign; // Unifies pfnLoadCurbeData - Curbe Block Alignment 1199 uint32_t dwScratchSpaceMaxThreads; // Unifies pfnGetScratchSpaceSize - Threads used for scratch space calculation 1200 uint32_t dwSamplerAvsIncrement; // Unifies pfnSetSamplerStates 1201 1202 const void *sseuTable; // pointer of const VphalSseuSetting table on a platform 1203 1204 uint32_t dwIndirectHeapSize; 1205 uint32_t dwTimeoutMs; 1206 int32_t iMaxPalettes; 1207 int32_t iMaxPaletteEntries; 1208 MHW_PALETTE_PARAMS Palette[RENDERHAL_PALETTE_MAX]; 1209 1210 int32_t iMaxChromaKeys; 1211 int32_t iChromaKeyCount; 1212 MHW_CHROMAKEY_PARAMS ChromaKey[RENDERHAL_CHROMA_KEY_MAX]; 1213 1214 bool bHasCombinedAVSSamplerState; 1215 1216 // GD2 kernel debugging 1217 bool bIsaAsmDebugEnable; 1218 uint8_t cIsaAsmDebugSurfaceBTI; 1219 RENDERHAL_SURFACE IsaAsmDebugSurface; 1220 1221 // Performance collection 1222 bool bKerneltimeDump; 1223 double kernelTime[RENDERHAL_COMPONENT_COUNT]; 1224 1225 // Auxiliary data - for debugging purposes 1226 int32_t iMediaStatesInUse; // Media states in use 1227 int32_t iKernelsInUse; // Kernels in use 1228 int32_t iBuffersInUse; // BB in use 1229 1230 // Power option to control slice/subslice/EU shutdown 1231 RENDERHAL_POWEROPTION PowerOption; 1232 1233 // Indicates whether it's MDF load or not 1234 bool IsMDFLoad; 1235 1236 bool bDynamicStateHeap; //!< Indicates that DSH is in use 1237 1238 1239 FrameTrackerProducer trackerProducer; // Resource to mark command buffer completion 1240 RENDERHAL_TR_RESOURCE veBoxTrackerRes; // Resource to mark command buffer completion 1241 uint32_t currentTrackerIndex; // Record the tracker index 1242 1243 HeapManager *dgsheapManager; // Dynamic general state heap manager 1244 1245 #if (_DEBUG || _RELEASE_INTERNAL) 1246 // Dump state for VP debugging 1247 void *pStateDumper; 1248 #endif 1249 1250 // Pointer to vphal oca dumper object to dump vphal parameters. 1251 void *pVphalOcaDumper; 1252 1253 // Predication 1254 RENDERHAL_PREDICATION_SETTINGS PredicationParams; //!< Predication 1255 MOS_RESOURCE PredicationBuffer; //!< Predication buffer 1256 1257 // CSC Coefficient 1258 bool bCmfcCoeffUpdate; //!< CMFC CSC Coefficient Surface update flag 1259 int32_t iKernelAllocationID; //!< CMFC CSC Kernel Allocation ID 1260 PMOS_RESOURCE pCmfcCoeffSurface; //!< CMFC CSC Coefficient Surface 1261 1262 // SetMarker 1263 RENDERHAL_SETMARKER_SETTINGS SetMarkerParams; //!< SetMarker 1264 1265 // Indicates whether it's AVS or not 1266 bool bIsAVS; 1267 1268 bool isMMCEnabled; 1269 1270 MediaPerfProfiler *pPerfProfiler = nullptr; //!< Performance data profiler 1271 bool eufusionBypass = false; 1272 1273 //--------------------------- 1274 // HW interface functions 1275 //--------------------------- 1276 MOS_STATUS (* pfnInitialize)( 1277 PRENDERHAL_INTERFACE pRenderHal, 1278 PRENDERHAL_SETTINGS pSettings); 1279 1280 MOS_STATUS (* pfnDestroy) ( 1281 PRENDERHAL_INTERFACE pRenderHal); 1282 1283 MOS_STATUS (* pfnReset) ( 1284 PRENDERHAL_INTERFACE pRenderHal); 1285 1286 //--------------------------- 1287 // State Heap Functions 1288 //--------------------------- 1289 MOS_STATUS (* pfnAllocateStateHeaps) ( 1290 PRENDERHAL_INTERFACE pRenderHal, 1291 PRENDERHAL_STATE_HEAP_SETTINGS pSettings); 1292 1293 MOS_STATUS (* pfnFreeStateHeaps) ( 1294 PRENDERHAL_INTERFACE pRenderHal); 1295 1296 MOS_STATUS (* pfnRefreshSync) ( 1297 PRENDERHAL_INTERFACE pRenderHal); 1298 1299 //--------------------------- 1300 // SSH, surface states 1301 //--------------------------- 1302 MOS_STATUS (* pfnAssignSshInstance) ( 1303 PRENDERHAL_INTERFACE pRenderHal); 1304 1305 MOS_STATUS (* pfnGetSurfaceStateEntries) ( 1306 PRENDERHAL_INTERFACE pRenderHal, 1307 PRENDERHAL_SURFACE pRenderHalSurface, 1308 PRENDERHAL_SURFACE_STATE_PARAMS pParams, 1309 int32_t *piNumEntries, 1310 PRENDERHAL_SURFACE_STATE_ENTRY *ppSurfaceEntries); 1311 1312 MOS_STATUS (* pfnSetupSurfaceState) ( 1313 PRENDERHAL_INTERFACE pRenderHal, 1314 PRENDERHAL_SURFACE pRenderHalSurface, 1315 PRENDERHAL_SURFACE_STATE_PARAMS pParams, 1316 int32_t *piNumEntries, 1317 PRENDERHAL_SURFACE_STATE_ENTRY *ppSurfaceEntries, 1318 PRENDERHAL_OFFSET_OVERRIDE pOffsetOverride); 1319 1320 MOS_STATUS (*pfnSetupBufferSurfaceState) ( 1321 PRENDERHAL_INTERFACE pRenderHal, 1322 PRENDERHAL_SURFACE pRenderHalSurface, 1323 PRENDERHAL_SURFACE_STATE_PARAMS pParams, 1324 PRENDERHAL_SURFACE_STATE_ENTRY *ppSurfaceEntry); 1325 1326 MOS_STATUS (* pfnAssignSurfaceState) ( 1327 PRENDERHAL_INTERFACE pRenderHal, 1328 RENDERHAL_SURFACE_STATE_TYPE Type, 1329 PRENDERHAL_SURFACE_STATE_ENTRY *ppSurfaceEntry); 1330 1331 void (* pfnGetAlignUnit) ( 1332 uint16_t *pwWidthAlignUnit, 1333 uint16_t *pwHeightAlignUnit, 1334 PRENDERHAL_SURFACE pRenderHalSurface); 1335 1336 void (* pfnAdjustBoundary) ( 1337 PRENDERHAL_INTERFACE pRenderHal, 1338 PRENDERHAL_SURFACE pRenderHalSurface, 1339 RENDERHAL_SS_BOUNDARY Boundary, 1340 uint32_t *pdwSurfaceWidth, 1341 uint32_t *pdwSurfaceHeight); 1342 1343 uint32_t (* pfnSetSurfacesPerBT) ( 1344 PRENDERHAL_INTERFACE pRenderHal, 1345 uint32_t dwSurfacesPerBT); 1346 1347 uint16_t (* pfnCalculateYOffset) ( 1348 PMOS_INTERFACE pOsInterface, 1349 PMOS_RESOURCE pOsResource); 1350 1351 MOS_STATUS (* pfnAssignBindingTable) ( 1352 PRENDERHAL_INTERFACE pRenderHal, 1353 int32_t *piBindingTable); 1354 1355 MOS_STATUS (* pfnBindSurfaceState) ( 1356 PRENDERHAL_INTERFACE pRenderHal, 1357 int32_t iBindingTableIndex, 1358 int32_t iBindingTableEntry, 1359 PRENDERHAL_SURFACE_STATE_ENTRY pSurfaceEntry); 1360 1361 uint32_t (* pfnGetSurfaceMemoryObjectControl) ( 1362 PRENDERHAL_INTERFACE pRenderHal, 1363 PRENDERHAL_SURFACE_STATE_PARAMS pParams); 1364 1365 //--------------------------- 1366 // State Setup - HW + OS Specific 1367 //--------------------------- 1368 MOS_STATUS (* pfnSetupSurfaceStatesOs) ( 1369 PRENDERHAL_INTERFACE pRenderHal, 1370 PRENDERHAL_SURFACE_STATE_PARAMS pParams, 1371 PRENDERHAL_SURFACE_STATE_ENTRY pSurfaceStateEntry); 1372 1373 //--------------------------- 1374 // Batch Buffer 1375 //--------------------------- 1376 MOS_STATUS (* pfnAllocateBB) ( 1377 PRENDERHAL_INTERFACE pRenderHal, 1378 PMHW_BATCH_BUFFER pBatchBuffer, 1379 int32_t iSize); 1380 1381 MOS_STATUS (* pfnFreeBB) ( 1382 PRENDERHAL_INTERFACE pRenderHal, 1383 PMHW_BATCH_BUFFER pBatchBuffer); 1384 1385 MOS_STATUS (* pfnLockBB) ( 1386 PRENDERHAL_INTERFACE pRenderHal, 1387 PMHW_BATCH_BUFFER pBatchBuffer); 1388 1389 MOS_STATUS (* pfnUnlockBB) ( 1390 PRENDERHAL_INTERFACE pRenderHal, 1391 PMHW_BATCH_BUFFER pBatchBuffer); 1392 1393 //--------------------------- 1394 // Media State 1395 //--------------------------- 1396 PRENDERHAL_MEDIA_STATE (* pfnAssignMediaState) ( 1397 PRENDERHAL_INTERFACE pRenderHal, 1398 RENDERHAL_COMPONENT componentID); 1399 1400 //--------------------------- 1401 // Allocation 1402 //--------------------------- 1403 MOS_STATUS (* pfnEnablePalette) ( 1404 PRENDERHAL_INTERFACE pRenderHal, 1405 int32_t iPaletteID, 1406 int32_t iPaletteSize); 1407 1408 MOS_STATUS (* pfnAllocatePaletteID) ( 1409 PRENDERHAL_INTERFACE pRenderHal, 1410 int32_t *pPaletteID); 1411 1412 MOS_STATUS (* pfnFreePaletteID) ( 1413 PRENDERHAL_INTERFACE pRenderHal, 1414 int32_t *pPaletteID); 1415 1416 MOS_STATUS (* pfnGetPaletteEntry) ( 1417 PRENDERHAL_INTERFACE pRenderHal, 1418 int32_t iPaletteID, 1419 int32_t iInNumEntries, 1420 int32_t *piOutNumEntries, 1421 void **pPaletteData); 1422 1423 int32_t (* pfnAllocateChromaKey) ( 1424 PRENDERHAL_INTERFACE pRenderHal, 1425 uint32_t dwLow, 1426 uint32_t dwHigh); 1427 1428 int32_t (* pfnLoadCurbeData) ( 1429 PRENDERHAL_INTERFACE pRenderHal, 1430 PRENDERHAL_MEDIA_STATE pMediaState, 1431 void *pData, 1432 int32_t iSize); 1433 1434 MOS_STATUS (* pfnSetSamplerStates) ( 1435 PRENDERHAL_INTERFACE pRenderHal, 1436 int32_t iMediaID, 1437 PMHW_SAMPLER_STATE_PARAM pSamplerParams, 1438 int32_t iSamplers); 1439 1440 int32_t (* pfnAllocateMediaID) ( 1441 PRENDERHAL_INTERFACE pRenderHal, 1442 int32_t iKernelAllocationID, 1443 int32_t iBindingTableID, 1444 int32_t iCurbeOffset, 1445 int32_t iCurbeLength, 1446 int32_t iCrsThrdConstDataLn, 1447 PMHW_GPGPU_WALKER_PARAMS pGpGpuWalkerParams); 1448 1449 int32_t (* pfnGetMediaID) ( 1450 PRENDERHAL_INTERFACE pRenderHal, 1451 PRENDERHAL_MEDIA_STATE pMediaState, 1452 PRENDERHAL_KRN_ALLOCATION pKernelAllocation); 1453 1454 MOS_STATUS (* pfnSetupInterfaceDescriptor) ( 1455 PRENDERHAL_INTERFACE pRenderHal, 1456 PRENDERHAL_MEDIA_STATE pMediaState, 1457 PRENDERHAL_KRN_ALLOCATION pKernelAllocation, 1458 PRENDERHAL_INTERFACE_DESCRIPTOR_PARAMS pInterfaceDescriptorParams); 1459 1460 uint32_t (* pfnEncodeSLMSize)(PRENDERHAL_INTERFACE pRenderHal, uint32_t SLMSize); 1461 1462 //--------------------------- 1463 // Kernels 1464 //--------------------------- 1465 int32_t (* pfnLoadKernel) ( 1466 PRENDERHAL_INTERFACE pRenderHal, 1467 PCRENDERHAL_KERNEL_PARAM pParameters, 1468 PMHW_KERNEL_PARAM pKernel, 1469 Kdll_CacheEntry *pKernelEntry); 1470 1471 MOS_STATUS (* pfnUnloadKernel) ( 1472 PRENDERHAL_INTERFACE pRenderHal, 1473 int32_t iKernelAllocationID); 1474 1475 void (* pfnResetKernels) ( 1476 PRENDERHAL_INTERFACE pRenderHal); 1477 1478 void (* pfnTouchKernel) ( 1479 PRENDERHAL_INTERFACE pRenderHal, 1480 int32_t iKernelAllocationID); 1481 1482 int32_t (* pfnGetKernelOffset) ( 1483 PRENDERHAL_INTERFACE pRenderHal, 1484 int32_t iKernelAllocationIndex); 1485 1486 MOS_STATUS (* pfnUnregisterKernel) ( 1487 PRENDERHAL_INTERFACE pRenderHal, 1488 PRENDERHAL_KRN_ALLOCATION pKernelAllocation); 1489 1490 //--------------------------- 1491 // New Dynamic State Heap interfaces 1492 //--------------------------- 1493 MOS_STATUS(*pfnAssignSpaceInStateHeap)( 1494 uint32_t trackerIndex, 1495 FrameTrackerProducer *trackerProducer, 1496 HeapManager *heapManager, 1497 MemoryBlock *block, 1498 uint32_t size); 1499 1500 PRENDERHAL_MEDIA_STATE (* pfnAssignDynamicState) ( 1501 PRENDERHAL_INTERFACE pRenderHal, 1502 PRENDERHAL_DYNAMIC_MEDIA_STATE_PARAMS pParams, 1503 RENDERHAL_COMPONENT componentID); 1504 1505 MOS_STATUS (* pfnReleaseDynamicState) ( 1506 PRENDERHAL_INTERFACE pRenderHal, 1507 PRENDERHAL_MEDIA_STATE pMediaState); 1508 1509 MOS_STATUS (* pfnSubmitDynamicState) ( 1510 PRENDERHAL_INTERFACE pRenderHal, 1511 PRENDERHAL_MEDIA_STATE pMediaState); 1512 1513 int32_t (* pfnAllocateDynamicMediaID) ( 1514 PRENDERHAL_INTERFACE pRenderHal, 1515 PRENDERHAL_KRN_ALLOCATION pKernelAllocation, 1516 int32_t iBindingTableID, 1517 int32_t iCurbeOffset, 1518 int32_t iCurbeLength, 1519 int32_t iCrsThrdConstDataLn, 1520 PMHW_GPGPU_WALKER_PARAMS pGpGpuWalkerParams); 1521 1522 PRENDERHAL_KRN_ALLOCATION (* pfnLoadDynamicKernel) ( 1523 PRENDERHAL_INTERFACE pRenderHal, 1524 PCRENDERHAL_KERNEL_PARAM pParameters, 1525 PMHW_KERNEL_PARAM pKernel, 1526 uint32_t *pdwLoaded); 1527 1528 PRENDERHAL_KRN_ALLOCATION (* pfnSearchDynamicKernel) ( 1529 PRENDERHAL_INTERFACE pRenderHal, 1530 int32_t iKernelUniqueID, 1531 int32_t iCacheID); 1532 1533 PRENDERHAL_KRN_ALLOCATION (* pfnAllocateDynamicKernel) ( 1534 PRENDERHAL_INTERFACE pRenderHal, 1535 int32_t iKernelUniqueID, 1536 int32_t iCacheID); 1537 1538 MOS_STATUS (* pfnUnloadDynamicKernel) ( 1539 PRENDERHAL_INTERFACE pRenderHal, 1540 PRENDERHAL_KRN_ALLOCATION pKernelAllocation); 1541 1542 MOS_STATUS (* pfnRefreshDynamicKernels) ( 1543 PRENDERHAL_INTERFACE pRenderHal, 1544 uint32_t dwSpaceNeeded, 1545 uint32_t *pdwSizes, 1546 int32_t iCount); 1547 1548 void (* pfnResetDynamicKernels) ( 1549 PRENDERHAL_INTERFACE pRenderHal); 1550 1551 void (* pfnTouchDynamicKernel) ( 1552 PRENDERHAL_INTERFACE pRenderHal, 1553 PRENDERHAL_KRN_ALLOCATION pKernelAllocation); 1554 1555 MOS_STATUS (* pfnExpandKernelStateHeap)( 1556 PRENDERHAL_INTERFACE pRenderHal, 1557 uint32_t dwAdditionalKernelSpaceNeeded); 1558 1559 //--------------------------- 1560 // ISA ASM Debug support functions 1561 //--------------------------- 1562 int32_t (* pfnLoadDebugKernel)( 1563 PRENDERHAL_INTERFACE pRenderHal, 1564 PMHW_KERNEL_PARAM pKernel); 1565 1566 MOS_STATUS (* pfnLoadSipKernel) ( 1567 PRENDERHAL_INTERFACE pRenderHal, 1568 void *pSipKernel, 1569 uint32_t dwSipSize); 1570 1571 MOS_STATUS (* pfnSendSipStateCmd) ( 1572 PRENDERHAL_INTERFACE pRenderHal, 1573 PMOS_COMMAND_BUFFER pCmdBuffer); 1574 1575 //--------------------------- 1576 // HW interface configuration functions 1577 //--------------------------- 1578 MOS_STATUS (* pfnSetVfeStateParams) ( 1579 PRENDERHAL_INTERFACE pRenderHal, 1580 uint32_t dwDebugCounterControl, 1581 uint32_t dwMaximumNumberofThreads, 1582 uint32_t dwCURBEAllocationSize, 1583 uint32_t dwURBEntryAllocationSize, 1584 PMHW_VFE_SCOREBOARD pScoreboardParams); 1585 1586 bool (* pfnGetMediaWalkerStatus) ( 1587 PRENDERHAL_INTERFACE pRenderHal); 1588 1589 //--------------------------- 1590 // Command buffer programming functions 1591 //--------------------------- 1592 MOS_STATUS (* pfnSendStateBaseAddress) ( 1593 PRENDERHAL_INTERFACE pRenderHal, 1594 PMOS_COMMAND_BUFFER pCmdBuffer); 1595 1596 MOS_STATUS (* pfnSendMediaStates) ( 1597 PRENDERHAL_INTERFACE pRenderHal, 1598 PMOS_COMMAND_BUFFER pCmdBuffer, 1599 PMHW_WALKER_PARAMS pWalkerParams, 1600 PMHW_GPGPU_WALKER_PARAMS pGpGpuWalkerParams); 1601 1602 MOS_STATUS (* pfnInitCommandBuffer) ( 1603 PRENDERHAL_INTERFACE pRenderHal, 1604 PMOS_COMMAND_BUFFER pCmdBuffer, 1605 PRENDERHAL_GENERIC_PROLOG_PARAMS pGenericPrologParams); 1606 1607 MOS_STATUS (* pfnSendSurfaces) ( 1608 PRENDERHAL_INTERFACE pRenderHal, 1609 PMOS_COMMAND_BUFFER pCmdBuffer); 1610 1611 MOS_STATUS (* pfnSendSyncTag) ( 1612 PRENDERHAL_INTERFACE pRenderHal, 1613 PMOS_COMMAND_BUFFER pCmdBuffer); 1614 1615 MOS_STATUS (*pfnSendCscCoeffSurface) ( 1616 PRENDERHAL_INTERFACE pRenderHal, 1617 PMOS_COMMAND_BUFFER pCmdBuffer, 1618 PMOS_RESOURCE presCscCoeff, 1619 Kdll_CacheEntry *pKernelEntry); 1620 1621 void (* pfnSetupPrologParams) ( 1622 PRENDERHAL_INTERFACE renderHal, 1623 RENDERHAL_GENERIC_PROLOG_PARAMS *prologParams, 1624 PMOS_RESOURCE osResource, 1625 uint32_t offset, 1626 uint32_t tag); 1627 1628 // Samplers and other states 1629 MOS_STATUS (*pfnGetSamplerOffsetAndPtr) ( 1630 PRENDERHAL_INTERFACE pRenderHal, 1631 int32_t iMediaID, 1632 int32_t iSamplerID, 1633 PMHW_SAMPLER_STATE_PARAM pSamplerParams, 1634 uint32_t *pdwSamplerOffset, 1635 void **ppSampler); 1636 1637 MOS_STATUS (* pfnSendCurbeLoad) ( 1638 PRENDERHAL_INTERFACE pRenderHal, 1639 PMOS_COMMAND_BUFFER pCmdBuffer); 1640 1641 MOS_STATUS (* pfnSendMediaIdLoad) ( 1642 PRENDERHAL_INTERFACE pRenderHal, 1643 PMOS_COMMAND_BUFFER pCmdBuffer); 1644 1645 MOS_STATUS (* pfnSendChromaKey) ( 1646 PRENDERHAL_INTERFACE pRenderHal, 1647 PMOS_COMMAND_BUFFER pCmdBuffer); 1648 1649 MOS_STATUS (* pfnSendPalette) ( 1650 PRENDERHAL_INTERFACE pRenderHal, 1651 PMOS_COMMAND_BUFFER pCmdBuffer); 1652 1653 MOS_STATUS (* pfnSendSurfaceStateEntry) ( 1654 PRENDERHAL_INTERFACE pRenderHal, 1655 PMOS_COMMAND_BUFFER pCmdBuffer, 1656 PMHW_SURFACE_STATE_SEND_PARAMS pParams); 1657 1658 MOS_STATUS (* pfnSetSurfaceStateToken)( 1659 PRENDERHAL_INTERFACE pRenderHal, 1660 PMHW_SURFACE_TOKEN_PARAMS pParams, 1661 void *pSurfaceStateToken); 1662 1663 MOS_STATUS (* pfnSetSurfaceStateBuffer)( 1664 PRENDERHAL_INTERFACE pRenderHal, 1665 PMHW_RCS_SURFACE_PARAMS pParams, 1666 void *pSurfaceState); 1667 1668 //----------------------------- 1669 // Slice Shutdown Mode function 1670 //----------------------------- 1671 void (* pfnSetSliceShutdownMode) ( 1672 PRENDERHAL_INTERFACE pRenderHal, 1673 bool bMode); 1674 1675 //----------------------------- 1676 // General Slice Shut Down Mode function 1677 //----------------------------- 1678 void( *pfnSetPowerOptionMode ) ( 1679 PRENDERHAL_INTERFACE pRenderHal, 1680 PRENDERHAL_POWEROPTION pMode); 1681 1682 //----------------------------- 1683 // Enable Middle Batch Buffer Preemption 1684 //----------------------------- 1685 void (* pfnEnableGpgpuMiddleBatchBufferPreemption) ( 1686 PRENDERHAL_INTERFACE pRenderHal); 1687 1688 //----------------------------- 1689 // Enable Middle Thread Preemption 1690 //----------------------------- 1691 void (* pfnEnableGpgpuMiddleThreadPreemption) ( 1692 PRENDERHAL_INTERFACE pRenderHal); 1693 1694 //--------------------------- 1695 // Generic HAL Layer Commands and State Functions 1696 //--------------------------- 1697 void (* pfnConvertToNanoSeconds) ( 1698 PRENDERHAL_INTERFACE pRenderHal, 1699 uint64_t iTicks, 1700 uint64_t *piNs); 1701 1702 MOS_STATUS (* pfnSendRcsStatusTag) ( 1703 PRENDERHAL_INTERFACE pRenderHal, // [in] Hardware interface 1704 PMOS_COMMAND_BUFFER pCmdBuffer); // [in] Command Buffer 1705 1706 MOS_STATUS (* pfnSendTimingData) ( 1707 PRENDERHAL_INTERFACE pRenderHal, // [in] Hardware interface 1708 PMOS_COMMAND_BUFFER pCmdBuffer, // [in] Command Buffer 1709 bool bStartTime); // [in] Start Timestamp flag 1710 1711 uint32_t (* pfnGetScratchSpaceSize)( 1712 PRENDERHAL_INTERFACE pRenderHal, // [in] Hardware interface 1713 uint32_t iPerThreadScratchSpaceSize); // [in] Per thread scrach space size 1714 1715 bool (* pfnIs2PlaneNV12Needed) ( 1716 PRENDERHAL_INTERFACE pRenderHal, 1717 PRENDERHAL_SURFACE pRenderHalSurface, 1718 RENDERHAL_SS_BOUNDARY Boundary); 1719 1720 uint8_t (* pfnSetChromaDirection) ( 1721 PRENDERHAL_INTERFACE pRenderHal, 1722 PRENDERHAL_SURFACE pRenderHalSurface); 1723 1724 bool(*pfnPerThreadScratchSpaceStart2K) ( 1725 PRENDERHAL_INTERFACE pRenderHal); 1726 1727 //--------------------------- 1728 // Overwrite L3 Cache control register 1729 //--------------------------- 1730 MOS_STATUS (* pfnEnableL3Caching) ( 1731 PRENDERHAL_INTERFACE pRenderHal, 1732 PRENDERHAL_L3_CACHE_SETTINGS pCacheSettings); 1733 1734 MOS_STATUS(*pfnSetCacheOverrideParams) ( 1735 PRENDERHAL_INTERFACE pRenderHal, 1736 PRENDERHAL_L3_CACHE_SETTINGS pCacheSettings, 1737 bool bEnableSLM); 1738 1739 //----------------------------- 1740 //Platform related interface 1741 XRenderHal_Platform_Interface *pRenderHalPltInterface; 1742 } RENDERHAL_INTERFACE; 1743 1744 //! 1745 //! \brief Functions 1746 //! 1747 1748 //! 1749 //! \brief Init Interface 1750 //! \details Initializes Render Hal Interface structure, responsible for HW 1751 //! abstraction of Render Engine for MDF/VP 1752 //! \param PRENDERHAL_INTERFACE pRenderHal 1753 //! [in] Pointer to Hardware Interface Structure 1754 //! \param MhwCpInterface** ppCpInterface 1755 //! [in/out] Pointer of pointer to MHW CP Interface Structure, which 1756 //! is created during renderhal initialization 1757 //! \param PMOS_INTERFACE pOsInterface 1758 //! [in] Pointer to OS Interface Structure 1759 //! \return MOS_STATUS 1760 //! MOS_STATUS_UNKNOWN : Invalid parameters 1761 //! 1762 MOS_STATUS RenderHal_InitInterface( 1763 PRENDERHAL_INTERFACE pRenderHal, 1764 MhwCpInterface **ppCpInterface, 1765 PMOS_INTERFACE pOsInterface); 1766 1767 //! 1768 //! \brief Init Interface using Dynamic State Heap 1769 //! \details Initializes RenderHal Interface structure, responsible for HW 1770 //! abstraction of HW Rendering Engine for CM(MDF) and VP. 1771 //! \param PRENDERHAL_INTERFACE pRenderHal 1772 //! [in] Pointer to RenderHal Interface Structure 1773 //! \param MhwCpInterface** ppCpInterface 1774 //! [in/out] Pointer of pointer to MHW CP Interface Structure, which 1775 //! is created during renderhal initialization 1776 //! \param PMOS_INTERFACE pOsInterface 1777 //! [in] Pointer to OS Interface Structure 1778 //! \return MOS_STATUS 1779 //! MOS_STATUS_UNKNOWN : Invalid parameters 1780 //! 1781 MOS_STATUS RenderHal_InitInterface_Dynamic( 1782 PRENDERHAL_INTERFACE pRenderHal, 1783 MhwCpInterface **ppCpInterface, 1784 PMOS_INTERFACE pOsInterface); 1785 1786 //! 1787 //! \brief Get Pixels Per Sample 1788 //! \details Get Number of Pixels per Dataport Sample 1789 //! \param MOS_FORMAT format 1790 //! [in] Surface Format 1791 //! \param uint32_t *pdwPixelsPerSampleUV 1792 //! [in] Pointer to dwPixelsPerSampleUV 1793 //! \return void 1794 //! 1795 void RenderHal_GetPixelsPerSample( 1796 MOS_FORMAT format, 1797 uint32_t *pdwPixelsPerSampleUV); 1798 1799 //! 1800 //! \brief Set Surface for HW Access 1801 //! \details Common Function for setting up surface state 1802 //! \param PRENDERHAL_INTERFACE pRenderHal 1803 //! [in] Pointer to Hardware Interface Structure 1804 //! \param PRENDERHAL_SURFACE pRenderHalSurface 1805 //! [in] Pointer to Render Hal Surface 1806 //! \param PRENDERHAL_SURFACE_STATE_PARAMS pSurfaceParams 1807 //! [in] Pointer to Surface Params 1808 //! \param int32_t iBindingTable 1809 //! [in] Binding Table to bind surface 1810 //! \param int32_t iBTEntry 1811 //! [in] Binding Table Entry index 1812 //! \param bool bWrite 1813 //! [in] Write mode flag 1814 //! \return MOS_STATUS 1815 //! MOS_STATUS_SUCCESS if success. Error code otherwise 1816 //! 1817 MOS_STATUS RenderHal_SetSurfaceForHwAccess( 1818 PRENDERHAL_INTERFACE pRenderHal, 1819 PRENDERHAL_SURFACE pRenderHalSurface, 1820 PRENDERHAL_SURFACE_STATE_PARAMS pSurfaceParams, 1821 int32_t iBindingTable, 1822 int32_t iBTEntry, 1823 bool bWrite); 1824 1825 //! 1826 //! \brief Set Buffer Surface for HW Access 1827 //! \details Common Function for setting up buffer surface state 1828 //! \param PRENDERHAL_INTERFACE pRenderHal 1829 //! [in] Pointer to Hardware Interface Structure 1830 //! \param PRENDERHAL_SURFACE pRenderHalSurface 1831 //! [in] Pointer to Render Hal Surface 1832 //! \param PRENDERHAL_SURFACE_STATE_PARAMS pSurfaceParams 1833 //! [in] Pointer to Surface Params 1834 //! \param int32_t iBindingTable 1835 //! [in] Binding Table to Bind Surface 1836 //! \param int32_t iBTEntry 1837 //! [in] Binding Table Entry index 1838 //! \param bool bWrite 1839 //! Write mode flag 1840 //! \return MOS_STATUS 1841 //! MOS_STATUS_SUCCESS if success. Error code otherwise 1842 //! 1843 MOS_STATUS RenderHal_SetBufferSurfaceForHwAccess( 1844 PRENDERHAL_INTERFACE pRenderHal, 1845 PRENDERHAL_SURFACE pRenderHalSurface, 1846 PRENDERHAL_SURFACE_STATE_PARAMS pSurfaceParams, 1847 int32_t iBindingTable, 1848 int32_t iBTEntry, 1849 bool bWrite); 1850 1851 //! 1852 //! \brief Get Surface Info from OsResource 1853 //! \details Update surface info in PRENDERHAL_SURFACE based on allocated OsResource 1854 //! \param PMOS_INTERFACE pOsInterface 1855 //! [in] Pointer to MOS_INTERFACE 1856 //! \param PRENDERHAL_GET_SURFACE_INFO pInfo 1857 //! [in] Pointer to RENDERHAL_GET_SURFACE_INFO 1858 //! \param PMOS_SURFACE pSurface 1859 //! [in/out] Pointer to PMOS_SURFACE 1860 //! \return MOS_STATUS 1861 //! Return MOS_STATUS_SUCCESS if successful, otherwise failed 1862 //! 1863 MOS_STATUS RenderHal_GetSurfaceInfo( 1864 PMOS_INTERFACE pOsInterface, 1865 PRENDERHAL_GET_SURFACE_INFO pInfo, 1866 PMOS_SURFACE pSurface); 1867 1868 //! 1869 //! \brief Send Media States 1870 //! \details Send Media States 1871 //! \param PRENDERHAL_INTERFACE pRenderHal 1872 //! [in] Pointer to Hardware Interface Structure 1873 //! \param PMOS_COMMAND_BUFFER pCmdBuffer 1874 //! [in] Pointer to Command Buffer 1875 //! \param PRENDERHAL_GPGPU_WALKER_PARAMS pGpGpuWalkerParams 1876 //! [in] Pointer to GPGPU walker parameters 1877 //! \return MOS_STATUS 1878 //! 1879 MOS_STATUS RenderHal_SendMediaStates( 1880 PRENDERHAL_INTERFACE pRenderHal, 1881 PMOS_COMMAND_BUFFER pCmdBuffer, 1882 PMHW_WALKER_PARAMS pWalkerParams, 1883 PMHW_GPGPU_WALKER_PARAMS pGpGpuWalkerParams); 1884 1885 //! 1886 //! \brief Issue command to write timestamp 1887 //! \param [in] pRenderHal 1888 //! \param [in] pCmdBuffer 1889 //! \param [in] bStartTime 1890 //! \return MOS_STATUS 1891 //! 1892 MOS_STATUS RenderHal_SendTimingData( 1893 PRENDERHAL_INTERFACE pRenderHal, 1894 PMOS_COMMAND_BUFFER pCmdBuffer, 1895 bool bStartTime); 1896 1897 // Constants defined in RenderHal interface 1898 extern const MHW_PIPE_CONTROL_PARAMS g_cRenderHal_InitPipeControlParams; 1899 extern const MHW_VFE_PARAMS g_cRenderHal_InitVfeParams; 1900 extern const MHW_MEDIA_STATE_FLUSH_PARAM g_cRenderHal_InitMediaStateFlushParams; 1901 extern const RENDERHAL_KERNEL_PARAM g_cRenderHal_InitKernelParams; 1902 1903 #endif // __RENDERHAL_H__ 1904