1 /*============================================================================== 2 Copyright(c) 2017 Intel Corporation 3 4 Permission is hereby granted, free of charge, to any person obtaining a 5 copy of this software and associated documentation files(the "Software"), 6 to deal in the Software without restriction, including without limitation 7 the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 and / or sell copies of the Software, and to permit persons to whom the 9 Software is furnished to do so, subject to the following conditions: 10 11 The above copyright notice and this permission notice shall be included 12 in all copies or substantial portions of the Software. 13 14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 18 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20 OTHER DEALINGS IN THE SOFTWARE. 21 ============================================================================*/ 22 23 #pragma once 24 25 #include "GmmCommonULT.h" 26 27 //=========================================================================== 28 // typedef: 29 // TEST_RESOURCE_TYPE_ENUM 30 // 31 // Description: 32 // Decribes Resource types to test 33 // when editing/adding existing/new enum, make sure to update corresponding 34 // string array CTestResource::TestResourceTypeStr[]. 35 //---------------------------------------------------------------------------- 36 typedef enum TEST_RESOURCE_TYPE_ENUM 37 { 38 TEST_RESOURCE_1D, 39 TEST_RESOURCE_2D, 40 TEST_RESOURCE_3D, 41 TEST_RESOURCE_CUBE, 42 TEST_RESOURCE_BUFFER, 43 TEST_RESOURCE_MAX 44 }TEST_RESOURCE_TYPE; 45 46 //=========================================================================== 47 // typedef: 48 // TEST_RESOURCE_TYPE_ENUM 49 // 50 // Description: 51 // Decribes Resource Tile Types to test . 52 // when editing/adding existing/new enum, make sure to update corresponding 53 // string array CTestResource::TestTileTypeStr[]. 54 //---------------------------------------------------------------------------- 55 typedef enum TEST_TILE_TYPE_ENUM 56 { 57 TEST_LINEAR, 58 TEST_TILEX, 59 TEST_TILEY, 60 TEST_TILEYS, 61 TEST_TILEYF, 62 TEST_TILEY_MAX = TEST_TILEYF, 63 TEST_TILE4, 64 TEST_TILE64, 65 TEST_TILE_MAX 66 }TEST_TILE_TYPE; 67 68 69 //=========================================================================== 70 // typedef: 71 // TEST_BPP_ENUM 72 // 73 // Description: 74 // Decribes BPP to test - 8, 16, 32, 64, 128 (Ignore 24/96 until need arises) 75 // when editing/adding existing/new enum, make sure to update corresponding 76 // string array CTestResource::TestBppStr[]. 77 //---------------------------------------------------------------------------- 78 typedef enum TEST_BPP_ENUM 79 { 80 TEST_BPP_8, 81 TEST_BPP_16, 82 TEST_BPP_32, 83 TEST_BPP_64, 84 TEST_BPP_128, 85 TEST_BPP_MAX 86 }TEST_BPP; 87 88 typedef enum TEST_MSAA_Samples 89 { 90 MSAA_None, 91 MSAA_2x, 92 MSAA_4x, 93 MSAA_8x, 94 MSAA_16x, 95 TEST_MSAA_MAX = MSAA_16x //Should be equal to last MSAA type 96 } TEST_MSAA; 97 98 //=========================================================================== 99 // GmmLib ULT macros for size alignment. Compitable with 64-bit numbers. 100 //--------------------------------------------------------------------------- 101 #define GMM_ULT_ALIGN(x, a) (((x) + ((a) - 1)) - (((x) + ((a) - 1)) & ((a) - 1))) // Alt implementation with bitwise not (~) has issue with uint32 align used with 64-bit value, since ~'ed value will remain 32-bit. 102 #define GMM_ULT_ALIGN_FLOOR(x, a) ((x) - ((x) & ((a) - 1))) 103 #define GMM_ULT_MAX(a, b) ((a) > (b)) ? (a) : (b) 104 #define GMM_ULT_MIN(a,b) (((a) < (b)) ? (a) : (b)) 105 #define GMM_ULT_ALIGN_NP2(x, a) (((a) > 0) ? ((x) + (((a) - 1) - (((x) + ((a) - 1)) % (a)))) : (x)) //Next power of 2 106 #define GMM_ULT_MAX_MIPMAP 15 107 #define GMM_ULT_MAX_MIPTAIL_SLOTS 15 108 ////////////////////////////////////////////////////////////////////////// 109 // typdef: 110 // TEST_MIPTAIL_SLOT_OFFSET_REC 111 // 112 // Description: 113 // Structure to hold the offset of the mip resources for unit level testing 114 ////////////////////////////////////////////////////////////////////////// 115 typedef struct TEST_MIPTAIL_SLOT_OFFSET_REC 116 { 117 uint32_t X; 118 uint32_t Y; 119 uint32_t Z; 120 }TEST_MIPTAIL_SLOT_OFFSET; 121 122 123 ///////////////////////////////////////////////////////////////////////// 124 /// Fixture class for Resource. - This is Resource Test Case to test 125 /// all generic resource types, tile types, bpp and special allocations. 126 /// Contains Base implementation and inherits CommonULT class 127 ///////////////////////////////////////////////////////////////////////// 128 class CTestResource : public CommonULT 129 { 130 protected: 131 132 ///////////////////////////////////////////////////////////////////////////////////// 133 /// Returns GMM format for given test BPP input. 134 /// 135 /// @param[in] Bpp: test Bpp value 136 /// 137 /// @return ::GMM_RESOURCE_FORMAT 138 ///////////////////////////////////////////////////////////////////////////////////// SetResourceFormat(TEST_BPP Bpp)139 GMM_RESOURCE_FORMAT SetResourceFormat(TEST_BPP Bpp) 140 { 141 switch (Bpp) 142 { 143 case TEST_BPP_8: 144 return GMM_FORMAT_GENERIC_8BIT; 145 case TEST_BPP_16: 146 return GMM_FORMAT_GENERIC_16BIT; 147 case TEST_BPP_32: 148 return GMM_FORMAT_GENERIC_32BIT; 149 case TEST_BPP_64: 150 return GMM_FORMAT_GENERIC_64BIT; 151 case TEST_BPP_128: 152 return GMM_FORMAT_GENERIC_128BIT; 153 default: 154 break; 155 } 156 157 return GMM_FORMAT_INVALID; 158 } 159 160 ///////////////////////////////////////////////////////////////////////////////////// 161 /// Returns Bpp (bytes per pixel) for a given bpp (bits per pixel) enum. 162 /// 163 /// @param[in] bpp: test bpp value 164 /// 165 /// @return Bytes per pixel 166 ///////////////////////////////////////////////////////////////////////////////////// GetBppValue(TEST_BPP bpp)167 uint32_t GetBppValue(TEST_BPP bpp) 168 { 169 uint32_t Bpp = 0; 170 switch (bpp) 171 { 172 case TEST_BPP_8: 173 Bpp = 8; 174 break; 175 case TEST_BPP_16: 176 Bpp = 16; 177 break; 178 case TEST_BPP_32: 179 Bpp = 32; 180 break; 181 case TEST_BPP_64: 182 Bpp = 64; 183 break; 184 case TEST_BPP_128: 185 Bpp = 128; 186 break; 187 default: 188 break; 189 } 190 191 return Bpp >> 3; 192 } 193 194 ///////////////////////////////////////////////////////////////////////////////////// 195 /// Set the tile flag in Gmm ResCreate Params 196 /// 197 /// @param[in] Parms: Gmm Rescreate params 198 /// @param[in] Tile: Tile Type 199 /// 200 ///////////////////////////////////////////////////////////////////////////////////// SetTileFlag(GMM_RESCREATE_PARAMS & Params,TEST_TILE_TYPE Tile)201 void SetTileFlag(GMM_RESCREATE_PARAMS &Params, TEST_TILE_TYPE Tile) 202 { 203 switch (Tile) 204 { 205 case TEST_LINEAR: 206 Params.Flags.Info.Linear = 1; 207 break; 208 case TEST_TILEX: 209 Params.Flags.Info.TiledX = 1; 210 break; 211 case TEST_TILEY: 212 if (pGfxAdapterInfo->SkuTable.FtrTileY) 213 { 214 Params.Flags.Info.TiledY = 1; 215 } 216 else 217 { 218 Params.Flags.Info.Tile4 = 1; 219 } 220 break; 221 case TEST_TILEYF: 222 Params.Flags.Info.TiledY = 1; 223 Params.Flags.Info.TiledYf = 1; 224 break; 225 case TEST_TILEYS: 226 if (pGfxAdapterInfo->SkuTable.FtrTileY) 227 { 228 Params.Flags.Info.TiledY = 1; 229 Params.Flags.Info.TiledYs = 1; 230 } 231 else 232 { 233 Params.Flags.Info.Tile64 = 1; 234 } 235 break; 236 default: 237 break; 238 } 239 } 240 241 ///////////////////////////////////////////////////////////////////////////////////// 242 /// Set the tile flag in Gmm Custom ResCreate Params 243 /// 244 /// @param[in] Parms: Gmm Rescreate params 245 /// @param[in] Tile: Tile Type 246 /// 247 ///////////////////////////////////////////////////////////////////////////////////// SetTileFlag_Custom(GMM_RESCREATE_CUSTOM_PARAMS & Params,TEST_TILE_TYPE Tile)248 void SetTileFlag_Custom(GMM_RESCREATE_CUSTOM_PARAMS& Params, TEST_TILE_TYPE Tile) 249 { 250 switch (Tile) 251 { 252 case TEST_LINEAR: 253 Params.Flags.Info.Linear = 1; 254 break; 255 case TEST_TILEX: 256 Params.Flags.Info.TiledX = 1; 257 break; 258 case TEST_TILEY: 259 if (pGfxAdapterInfo->SkuTable.FtrTileY) 260 { 261 Params.Flags.Info.TiledY = 1; 262 } 263 else 264 { 265 Params.Flags.Info.Tile4 = 1; 266 } 267 break; 268 case TEST_TILEYF: 269 Params.Flags.Info.TiledY = 1; 270 Params.Flags.Info.TiledYf = 1; 271 break; 272 case TEST_TILEYS: 273 if (pGfxAdapterInfo->SkuTable.FtrTileY) 274 { 275 Params.Flags.Info.TiledY = 1; 276 Params.Flags.Info.TiledYs = 1; 277 } 278 else 279 { 280 Params.Flags.Info.Tile64 = 1; 281 } 282 break; 283 default: 284 break; 285 } 286 } 287 288 ///////////////////////////////////////////////////////////////////////////////////// 289 /// Sets Resource Type in GmmParams 290 /// 291 /// @param[in] Params: GmmParams 292 /// @param[in] ResType: Resource type 293 /// 294 ///////////////////////////////////////////////////////////////////////////////////// SetResType(GMM_RESCREATE_PARAMS & Params,TEST_RESOURCE_TYPE ResType)295 void SetResType(GMM_RESCREATE_PARAMS& Params, TEST_RESOURCE_TYPE ResType) 296 { 297 Params.Type = static_cast<GMM_RESOURCE_TYPE>((ResType == TEST_RESOURCE_BUFFER) ? ResType + 2 : ResType + 1); 298 } 299 300 ///////////////////////////////////////////////////////////////////////////////////// 301 /// Sets RenderTarget or Depth Gpu Flags in GmmParams 302 /// 303 /// @param[in] Params: GmmParams 304 /// @param[in] IsRT: true for RT, false for Depth 305 /// 306 ///////////////////////////////////////////////////////////////////////////////////// SetResGpuFlags(GMM_RESCREATE_PARAMS & Params,bool IsRT)307 void SetResGpuFlags(GMM_RESCREATE_PARAMS& Params, bool IsRT) 308 { 309 if (IsRT) 310 { 311 Params.Flags.Gpu.Depth = 0; 312 Params.Flags.Gpu.RenderTarget = 1; 313 } 314 else 315 { 316 Params.Flags.Gpu.Depth = 1; 317 Params.Flags.Gpu.RenderTarget = 0; 318 } 319 } 320 321 ///////////////////////////////////////////////////////////////////////////////////// 322 /// Sets ArraySize in GmmParams 323 /// 324 /// @param[in] Params: GmmParams 325 /// @param[in] Size: Array Size 326 /// 327 ///////////////////////////////////////////////////////////////////////////////////// SetResArraySize(GMM_RESCREATE_PARAMS & Params,int Size)328 void SetResArraySize(GMM_RESCREATE_PARAMS& Params, int Size) 329 { 330 Params.ArraySize = Size; 331 } 332 333 ///////////////////////////////////////////////////////////////////////////////////// 334 /// Get the Tile dimension and H/V Align for MSS and MCS surfaces 335 /// 336 /// @param[in] Bpp: bits per pixel 337 /// @param[in] isRT: Request is for RT or Depth MSS 338 /// @param[in] Tiling: Tile Type 339 /// @param[in] MSAA: Num of Samples 340 /// @param[out] HAlign: H Align for MSS 341 /// @param[out] VAlign: V Align for MSS 342 /// @param[out] TileDimX: Tile Width for given Tile, Resource, bpp 343 /// @param[out] TileDimY: Tile Height for given Tile, Resource, bpp 344 /// @param[out] MCSHAlign: H Align for MCS 345 /// @param[out] MCSVAlign: V Align for MCS 346 /// 347 ///////////////////////////////////////////////////////////////////////////////////// GetAlignmentAndTileDimensionsForMSAA(TEST_BPP Bpp,bool isRT,TEST_TILE_TYPE Tiling,TEST_MSAA MSAA,uint32_t & TileDimX,uint32_t & TileDimY,uint32_t & HAlign,uint32_t & VAlign,uint32_t & ExpectedMCSBpp,uint32_t & MCSHAlign,uint32_t & MCSVAlign)348 void GetAlignmentAndTileDimensionsForMSAA(TEST_BPP Bpp, bool isRT, TEST_TILE_TYPE Tiling, TEST_MSAA MSAA, 349 uint32_t& TileDimX, uint32_t& TileDimY, uint32_t& HAlign, uint32_t& VAlign, 350 uint32_t& ExpectedMCSBpp, uint32_t &MCSHAlign, uint32_t &MCSVAlign) 351 { 352 const uint32_t MSSTileSize[TEST_TILE_MAX][TEST_BPP_MAX][2] = { 353 {{64, 1}, {64, 1}, {64, 1}, {64, 1}, {64, 1}}, //Linear - no Tile Size, but min PitchAlign = 64 354 {{512, 8}, {512, 8}, {512, 8}, {512, 8}, {512, 8}}, //TileX 355 {{128, 32}, {128, 32}, {128, 32}, {128, 32}, {128, 32}}, //TileY 356 {{256, 256}, {512, 128}, {512, 128}, {1024, 64}, {1024, 64}}, //TileYs 357 {{64, 64}, {128, 32}, {128, 32}, {256, 16}, {256, 16}}, //TileYf 358 {{128, 32}, {128, 32}, {128, 32}, {128, 32}, {128, 32}}, //Tile4 359 {{256, 256}, {512, 128}, {512, 128}, {1024, 64}, {1024, 64}} //Tile64 360 }; 361 uint32_t WMul = 1, HMul = 1; 362 363 HAlign = 16; // RT H/VAlign 364 VAlign = 4; 365 366 if (!isRT) 367 { 368 HAlign = (Bpp == TEST_BPP_16) ? 8 : 4; //Depth 16bit = 8x4, ow 4x4 369 VAlign = 4; 370 MCSHAlign = 4; //MCS uses base H/VAlign for 8bpp 371 } 372 373 uint32_t Tile[2] = {MSSTileSize[Tiling][Bpp][0], MSSTileSize[Tiling][Bpp][1]}; 374 if (Tiling == TEST_TILEYS || Tiling == TEST_TILEYF || Tiling == TEST_TILE64) 375 { 376 GetInterleaveMSSPattern(MSAA, WMul, HMul, isRT, Bpp); 377 378 //Std Tiling interleaves MSAA into 1x, decreasing std Tile size for MSAA'd sample 379 //Std Tiling types should have std size alignment always 380 Tile[0] = HAlign = (isRT) ? (MSSTileSize[Tiling][Bpp][0] / WMul) : MSSTileSize[Tiling][Bpp][0]; 381 Tile[1] = VAlign = (isRT) ? (MSSTileSize[Tiling][Bpp][1] / HMul) : MSSTileSize[Tiling][Bpp][1]; 382 383 HAlign /= pow(2.0, Bpp); //Unit alignment in pixels 384 } 385 TileDimX = Tile[0]; 386 TileDimY = Tile[1]; 387 388 ExpectedMCSBpp = (MSAA == MSAA_2x || MSAA == MSAA_4x) ? 1 : 389 (MSAA == MSAA_8x) ? 4 : 8; 390 391 uint32_t ExpectedMcsBppIdx = log2(ExpectedMCSBpp); 392 393 MCSHAlign = isRT ? HAlign : MCSHAlign; //MCS uses base H/V ALign for 8bpp 394 MCSVAlign = VAlign; 395 396 MCSHAlign = (isRT && (Tiling == TEST_TILEYS || Tiling == TEST_TILEYF)) ? 397 MSSTileSize[Tiling][ExpectedMcsBppIdx][0] / (WMul * ExpectedMCSBpp) : //Std Tile dim in pixels 398 (Tiling == TEST_TILEYS || Tiling == TEST_TILEYF) ? 399 MSSTileSize[Tiling][ExpectedMcsBppIdx][0] / ExpectedMCSBpp : MCSHAlign; //For legacy tile, MCS alignment is base (RT or Depth) alignment 400 MCSVAlign = (isRT && (Tiling == TEST_TILEYS || Tiling == TEST_TILEYF)) ? MSSTileSize[Tiling][ExpectedMcsBppIdx][1] / HMul : 401 (Tiling == TEST_TILEYS || Tiling == TEST_TILEYF) ? MSSTileSize[Tiling][ExpectedMcsBppIdx][1] : MCSVAlign; 402 } 403 404 ///////////////////////////////////////////////////////////////////////////////////// 405 /// Get the interleave pattern for given Num Samples 406 /// 407 /// @param[in] MSAA: Num of Samples 408 /// @param[in] IsRT: !RT means Depth resource 409 /// @param[out] WidthMultiplier: Number of samples arranged side-by-side 410 /// @param[out] HeightMultiplier: Number of samples arranged top-bottom 411 /// 412 ///////////////////////////////////////////////////////////////////////////////////// GetInterleaveMSSPattern(TEST_MSAA MSAA,uint32_t & WidthMultiplier,uint32_t & HeightMultiplier,bool IsRT,TEST_BPP Bpp)413 void GetInterleaveMSSPattern(TEST_MSAA MSAA, uint32_t &WidthMultiplier, uint32_t &HeightMultiplier, bool IsRT, TEST_BPP Bpp) 414 { 415 WidthMultiplier = 1; HeightMultiplier = 1; 416 417 switch (MSAA) 418 { 419 case MSAA_2x: 420 if (IsRT && pGfxAdapterInfo->SkuTable.FtrXe2PlusTiling && (Bpp == TEST_BPP_128)) 421 { 422 HeightMultiplier = 2; 423 } 424 else 425 { 426 WidthMultiplier = 2; 427 } 428 break; 429 case MSAA_4x: 430 WidthMultiplier = 2; 431 HeightMultiplier = 2; 432 break; 433 case MSAA_8x: 434 WidthMultiplier = 4; 435 HeightMultiplier = 2; 436 if (IsRT && pGfxAdapterInfo->SkuTable.FtrXe2PlusTiling && ((Bpp == TEST_BPP_8) || (Bpp == TEST_BPP_32))) 437 { 438 WidthMultiplier = 2; 439 HeightMultiplier = 4; 440 } 441 else if (IsRT && !pGfxAdapterInfo->SkuTable.FtrTileY && !pGfxAdapterInfo->SkuTable.FtrXe2PlusTiling) 442 { 443 WidthMultiplier = 2; 444 HeightMultiplier = 2; 445 } 446 break; 447 case MSAA_16x: 448 WidthMultiplier = 4; 449 HeightMultiplier = 4; 450 if (IsRT && pGfxAdapterInfo->SkuTable.FtrXe2PlusTiling && (Bpp == TEST_BPP_64)) 451 { 452 WidthMultiplier = 8; 453 HeightMultiplier = 2; 454 } 455 else if (IsRT && !pGfxAdapterInfo->SkuTable.FtrTileY && !pGfxAdapterInfo->SkuTable.FtrXe2PlusTiling) 456 { 457 WidthMultiplier = 2; 458 HeightMultiplier = 2; 459 } 460 break; 461 default: 462 break; 463 464 } 465 } 466 467 ///////////////////////////////////////////////////////////////////////////////////// 468 /// Verifies if HAlign matches the expected value. Fails test if value doesn't match 469 /// 470 /// @param[in] ResourceInfo: ResourceInfo returned by GmmLib 471 /// @param[in] ExpectedValue: expected value to check against 472 ///////////////////////////////////////////////////////////////////////////////////// 473 template <bool Verify> VerifyResourceHAlign(GMM_RESOURCE_INFO * ResourceInfo,uint32_t ExpectedValue)474 void VerifyResourceHAlign(GMM_RESOURCE_INFO *ResourceInfo, uint32_t ExpectedValue) 475 { 476 if(Verify) 477 { 478 EXPECT_EQ(ExpectedValue, ResourceInfo->GetHAlign()); 479 } 480 } 481 482 ///////////////////////////////////////////////////////////////////////////////////// 483 /// Verifies if HAlign matches the expected value. Fails test if value doesn't match 484 /// 485 /// @param[in] ResourceInfo: ResourceInfo returned by GmmLib 486 /// @param[in] ExpectedValue: expected value to check against 487 ///////////////////////////////////////////////////////////////////////////////////// 488 template <bool Verify> VerifyResourceVAlign(GMM_RESOURCE_INFO * ResourceInfo,uint32_t ExpectedValue)489 void VerifyResourceVAlign(GMM_RESOURCE_INFO *ResourceInfo, uint32_t ExpectedValue) 490 { 491 if(Verify) 492 { 493 EXPECT_EQ(ExpectedValue, ResourceInfo->GetVAlign()); 494 } 495 } 496 497 ///////////////////////////////////////////////////////////////////////////////////// 498 /// Verifies if Pitch (in bytes) matches the expected value. Fails test if value 499 /// doesn't match 500 /// 501 /// @param[in] ResourceInfo: ResourceInfo returned by GmmLib 502 /// @param[in] ExpectedValue: expected value to check against 503 ///////////////////////////////////////////////////////////////////////////////////// 504 template <bool Verify> VerifyResourcePitch(GMM_RESOURCE_INFO * ResourceInfo,uint32_t ExpectedValue)505 void VerifyResourcePitch(GMM_RESOURCE_INFO *ResourceInfo, uint32_t ExpectedValue) 506 { 507 if(Verify) 508 { 509 EXPECT_EQ(ExpectedValue, ResourceInfo->GetRenderPitch()); 510 } 511 } 512 513 ///////////////////////////////////////////////////////////////////////////////////// 514 /// Verifies if Pitch in tiles matches the expected value. Fails test if value 515 /// doesn't match 516 /// 517 /// @param[in] ResourceInfo: ResourceInfo returned by GmmLib 518 /// @param[in] ExpectedValue: expected value to check against 519 ///////////////////////////////////////////////////////////////////////////////////// 520 template <bool Verify> VerifyResourcePitchInTiles(GMM_RESOURCE_INFO * ResourceInfo,uint32_t ExpectedValue)521 void VerifyResourcePitchInTiles(GMM_RESOURCE_INFO *ResourceInfo, uint32_t ExpectedValue) 522 { 523 if(Verify) 524 { 525 EXPECT_EQ(ExpectedValue, ResourceInfo->GetRenderPitchTiles()); 526 } 527 } 528 529 ///////////////////////////////////////////////////////////////////////////////////// 530 /// Verifies if Size matches the expected value. Fails test if value doesn't match 531 /// 532 /// @param[in] ResourceInfo: ResourceInfo returned by GmmLib 533 /// @param[in] ExpectedValue: expected value to check against 534 ///////////////////////////////////////////////////////////////////////////////////// 535 template <bool Verify> VerifyResourceSize(GMM_RESOURCE_INFO * ResourceInfo,uint64_t ExpectedValue)536 void VerifyResourceSize(GMM_RESOURCE_INFO *ResourceInfo, uint64_t ExpectedValue) 537 { 538 if(Verify) 539 { 540 EXPECT_EQ(ExpectedValue, ResourceInfo->GetSizeMainSurface()); 541 } 542 } 543 544 ///////////////////////////////////////////////////////////////////////////////////// 545 /// Verifies if AuxCCSize matches the expected value. Fails test if value doesn't match 546 /// 547 /// @param[in] ResourceInfo: ResourceInfo returned by GmmLib 548 /// @param[in] ExpectedValue: expected value to check against 549 ///////////////////////////////////////////////////////////////////////////////////// 550 template <bool Verify> VerifyResourceAuxCCSize(GMM_RESOURCE_INFO * ResourceInfo,uint64_t ExpectedValue)551 void VerifyResourceAuxCCSize(GMM_RESOURCE_INFO *ResourceInfo, uint64_t ExpectedValue) 552 { 553 if(Verify) 554 { 555 EXPECT_EQ(ExpectedValue, ResourceInfo->GetSizeAuxSurface(GMM_AUX_CC)); 556 } 557 } 558 559 ///////////////////////////////////////////////////////////////////////////////////// 560 /// Verifies if QPitch matches the expected value. Fails test if value doesn't match 561 /// 562 /// @param[in] ResourceInfo: ResourceInfo returned by GmmLib 563 /// @param[in] ExpectedValue: expected value to check against 564 ///////////////////////////////////////////////////////////////////////////////////// 565 template <bool Verify> VerifyResourceQPitch(GMM_RESOURCE_INFO * ResourceInfo,uint64_t ExpectedValue)566 void VerifyResourceQPitch(GMM_RESOURCE_INFO *ResourceInfo, uint64_t ExpectedValue) 567 { 568 if(Verify) 569 { 570 EXPECT_EQ(ExpectedValue, ResourceInfo->GetQPitch()); 571 } 572 } 573 574 ///////////////////////////////////////////////////////////////////////////////////// 575 /// Verifies if Tile4 info flag is set or not. Fails test if Tile4 flag is not set 576 /// 577 /// @param[in] ResourceInfo: ResourceInfo returned by GmmLib 578 /// @param[in] ExpectedValue: expected value to check against 579 ///////////////////////////////////////////////////////////////////////////////////// 580 template <bool Verify> VerifyResourceTile4(GMM_RESOURCE_INFO * ResourceInfo,bool ExpectedValue)581 void VerifyResourceTile4(GMM_RESOURCE_INFO *ResourceInfo, bool ExpectedValue) 582 { 583 if(Verify) 584 { 585 EXPECT_EQ(true, (GMM_IS_4KB_TILE(ResourceInfo->GetResFlags()))); 586 } 587 } 588 589 public: 590 CTestResource(); 591 ~CTestResource(); 592 593 static void SetUpTestCase(); 594 static void TearDownTestCase(); 595 596 }; 597 598 599 ///////////////////////////////////////////////////////////////////////// 600 /// Fixture class for Resources targeted for CpuBlt. This is CpuBlt resource 601 /// test case. Inherits CTestResource class. 602 /// @see CTestResource class 603 ///////////////////////////////////////////////////////////////////////// 604 class CTestCpuBltResource : public CTestResource 605 { 606 public: 607 CTestCpuBltResource(); 608 ~CTestCpuBltResource(); 609 610 static void SetUpTestCase(); 611 static void TearDownTestCase(); 612 613 }; 614 615 ///////////////////////////////////////////////////////////////////////// 616 /// Helper function - builds list of input tuples 617 /// 618 /// @param[in/out] List: vector of tuple<int,int,int,bool,int,int> 619 /// @param[in] maxTestDimension: Number of elements in TestDimensions[] 620 /// @param[in] TestArray: Number fo elements in TestArraySize 621 /// 622 /// @return Number of tuples in the list 623 /// @see GmmGen9ResourceULT.cpp 624 ///////////////////////////////////////////////////////////////////////// 625 int BuildInputIterator(std::vector<std::tuple<int, int, int, bool, int, int>> &List, int maxTestDimension, int TestArray, bool XEHPPlus); 626