@@ -84,7 +84,7 @@ HWTEST_F(BcsTests, givenDebugCapabilityWhenEstimatingCommandSizeThenAddAllRequir
84
84
EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite () + sizeof (typename FamilyType::MI_BATCH_BUFFER_END);
85
85
expectedSize = alignUp (expectedSize, MemoryConstants::cacheLineSize);
86
86
87
- BlitProperties blitProperties;
87
+ BlitProperties blitProperties{} ;
88
88
blitProperties.copySize = {bltSize, 1 , 1 };
89
89
BlitPropertiesContainer blitPropertiesContainer;
90
90
blitPropertiesContainer.push_back (blitProperties);
@@ -1443,20 +1443,18 @@ HWTEST_F(BcsTestsImages, givenImage1DWhenAdjustBlitPropertiesForImageIsCalledThe
1443
1443
imgDesc.image_height = 0u ;
1444
1444
imgDesc.image_depth = 0u ;
1445
1445
std::unique_ptr<Image> image (Image1dHelper<>::create (context.get (), &imgDesc));
1446
- Vec3<size_t > size{0 , 0 , 0 };
1447
- size_t bytesPerPixel = 0u ;
1448
1446
size_t expectedBytesPerPixel = image->getSurfaceFormatInfo ().surfaceFormat .ImageElementSizeInBytes ;
1449
1447
size_t expectedRowPitch = image->getImageDesc ().image_row_pitch ;
1450
1448
size_t expectedSlicePitch = image->getImageDesc ().image_slice_pitch ;
1451
- BlitterConstants::BlitDirection blitDirection = BlitterConstants::BlitDirection::HostPtrToImage;
1449
+ BlitProperties blitProperties{};
1450
+ blitProperties.dstGpuAddress = image->getGraphicsAllocation (0 )->getGpuAddress ();
1452
1451
1453
- uint64_t gpuAddress = image->getGraphicsAllocation (0 )->getGpuAddress ();
1454
- ClBlitProperties::adjustBlitPropertiesForImage (image.get (), size, bytesPerPixel, gpuAddress, rowPitch, slicePitch, blitDirection);
1452
+ ClBlitProperties::adjustBlitPropertiesForImage (image.get (), blitProperties, rowPitch, slicePitch, false );
1455
1453
1456
- EXPECT_EQ (imgDesc.image_width , size .x );
1457
- EXPECT_EQ (1u , size .y );
1458
- EXPECT_EQ (1u , size .z );
1459
- EXPECT_EQ (expectedBytesPerPixel, bytesPerPixel);
1454
+ EXPECT_EQ (imgDesc.image_width , blitProperties. dstSize .x );
1455
+ EXPECT_EQ (1u , blitProperties. dstSize .y );
1456
+ EXPECT_EQ (1u , blitProperties. dstSize .z );
1457
+ EXPECT_EQ (expectedBytesPerPixel, blitProperties. bytesPerPixel );
1460
1458
EXPECT_EQ (expectedRowPitch, rowPitch);
1461
1459
EXPECT_EQ (expectedSlicePitch, slicePitch);
1462
1460
}
@@ -1469,15 +1467,28 @@ HWTEST_F(BcsTestsImages, givenImage1DBufferWhenAdjustBlitPropertiesForImageIsCal
1469
1467
1470
1468
cl_image_desc imgDesc = Image1dBufferDefaults::imageDesc;
1471
1469
imgDesc.image_type = CL_MEM_OBJECT_IMAGE1D_BUFFER;
1472
- std::unique_ptr<Image> image (Image1dHelper<>::create (context.get (), &imgDesc));
1473
- Vec3<size_t > size{0 , 0 , 0 };
1474
- size_t bytesPerPixel = 0u ;
1475
-
1476
- uint64_t gpuAddress = image->getGraphicsAllocation (0 )->getGpuAddress ();
1470
+ cl_image_format imgFormat{};
1471
+ imgFormat.image_channel_order = CL_RGBA;
1472
+ imgFormat.image_channel_data_type = CL_UNSIGNED_INT8;
1473
+ std::unique_ptr<Image> image (Image1dHelper<>::create (context.get (), &imgDesc, &imgFormat));
1474
+ size_t expectedBytesPerPixel = 4 ;
1475
+ BlitProperties blitProperties{};
1476
+ blitProperties.srcGpuAddress = image->getGraphicsAllocation (0 )->getGpuAddress ();
1477
1477
1478
1478
for (auto &[blitDirection, expectedBlitDirection] : testParams) {
1479
- ClBlitProperties::adjustBlitPropertiesForImage (image.get (), size, bytesPerPixel, gpuAddress, rowPitch, slicePitch, blitDirection);
1480
- EXPECT_EQ (expectedBlitDirection, blitDirection);
1479
+ blitProperties.blitDirection = blitDirection;
1480
+ blitProperties.copySize = {1 , 1 , 1 };
1481
+ blitProperties.srcSize = {imgDesc.image_width , imgDesc.image_height , imgDesc.image_depth };
1482
+
1483
+ ClBlitProperties::adjustBlitPropertiesForImage (image.get (), blitProperties, rowPitch, slicePitch, true );
1484
+ EXPECT_EQ (expectedBlitDirection, blitProperties.blitDirection );
1485
+ EXPECT_EQ (expectedBytesPerPixel, blitProperties.bytesPerPixel );
1486
+ EXPECT_EQ (imgDesc.image_width , blitProperties.srcSize .x / blitProperties.bytesPerPixel );
1487
+ EXPECT_EQ (imgDesc.image_height , blitProperties.srcSize .y );
1488
+ EXPECT_EQ (imgDesc.image_depth , blitProperties.srcSize .z );
1489
+ EXPECT_EQ (1u , blitProperties.copySize .x / blitProperties.bytesPerPixel );
1490
+ EXPECT_EQ (1u , blitProperties.copySize .y );
1491
+ EXPECT_EQ (1u , blitProperties.copySize .z );
1481
1492
}
1482
1493
}
1483
1494
@@ -1490,39 +1501,35 @@ HWTEST_F(BcsTestsImages, givenImage2DArrayWhenAdjustBlitPropertiesForImageIsCall
1490
1501
imgDesc.image_type = CL_MEM_OBJECT_IMAGE2D_ARRAY;
1491
1502
1492
1503
std::unique_ptr<Image> image (Image2dArrayHelper<>::create (context.get (), &imgDesc));
1493
- Vec3<size_t > size{0 , 0 , 0 };
1494
- size_t bytesPerPixel = 0u ;
1495
1504
size_t expectedBytesPerPixel = image->getSurfaceFormatInfo ().surfaceFormat .ImageElementSizeInBytes ;
1496
1505
size_t expectedRowPitch = image->getImageDesc ().image_row_pitch ;
1497
1506
size_t expectedSlicePitch = image->getImageDesc ().image_slice_pitch ;
1498
- BlitterConstants::BlitDirection blitDirection = BlitterConstants::BlitDirection::HostPtrToImage;
1507
+ BlitProperties blitProperties{};
1508
+ blitProperties.dstGpuAddress = image->getGraphicsAllocation (0 )->getGpuAddress ();
1499
1509
1500
- uint64_t gpuAddress = image->getGraphicsAllocation (0 )->getGpuAddress ();
1501
- ClBlitProperties::adjustBlitPropertiesForImage (image.get (), size, bytesPerPixel, gpuAddress, rowPitch, slicePitch, blitDirection);
1510
+ ClBlitProperties::adjustBlitPropertiesForImage (image.get (), blitProperties, rowPitch, slicePitch, false );
1502
1511
1503
- EXPECT_EQ (imgDesc.image_width , size .x );
1504
- EXPECT_EQ (imgDesc.image_height , size .y );
1505
- EXPECT_EQ (imgDesc.image_array_size , size .z );
1506
- EXPECT_EQ (expectedBytesPerPixel, bytesPerPixel);
1512
+ EXPECT_EQ (imgDesc.image_width , blitProperties. dstSize .x );
1513
+ EXPECT_EQ (imgDesc.image_height , blitProperties. dstSize .y );
1514
+ EXPECT_EQ (imgDesc.image_array_size , blitProperties. dstSize .z );
1515
+ EXPECT_EQ (expectedBytesPerPixel, blitProperties. bytesPerPixel );
1507
1516
EXPECT_EQ (expectedRowPitch, rowPitch);
1508
1517
EXPECT_EQ (expectedSlicePitch, slicePitch);
1509
1518
}
1510
1519
1511
1520
HWTEST_F (BcsTestsImages, givenImageWithSurfaceOffsetWhenAdjustBlitPropertiesForImageIsCalledThenGpuAddressIsCorrect) {
1512
1521
cl_image_desc imgDesc = Image1dDefaults::imageDesc;
1513
1522
std::unique_ptr<Image> image (Image2dArrayHelper<>::create (context.get (), &imgDesc));
1514
- Vec3<size_t > size{0 , 0 , 0 };
1515
- size_t bytesPerPixel = 0u ;
1516
- BlitterConstants::BlitDirection blitDirection = BlitterConstants::BlitDirection::HostPtrToImage;
1517
1523
1518
1524
uint64_t surfaceOffset = 0x01000 ;
1519
1525
image->setSurfaceOffsets (surfaceOffset, 0 , 0 , 0 );
1520
- uint64_t gpuAddress = image->getGraphicsAllocation (0 )->getGpuAddress ();
1521
- uint64_t expectedGpuAddress = gpuAddress + surfaceOffset;
1526
+ BlitProperties blitProperties{};
1527
+ blitProperties.dstGpuAddress = image->getGraphicsAllocation (0 )->getGpuAddress ();
1528
+ uint64_t expectedGpuAddress = blitProperties.dstGpuAddress + surfaceOffset;
1522
1529
1523
- ClBlitProperties::adjustBlitPropertiesForImage (image.get (), size, bytesPerPixel, gpuAddress, rowPitch, slicePitch, blitDirection );
1530
+ ClBlitProperties::adjustBlitPropertiesForImage (image.get (), blitProperties, rowPitch, slicePitch, false );
1524
1531
1525
- EXPECT_EQ (gpuAddress , expectedGpuAddress);
1532
+ EXPECT_EQ (blitProperties. dstGpuAddress , expectedGpuAddress);
1526
1533
}
1527
1534
1528
1535
HWTEST_F (BcsTests, givenHostPtrToImageWhenConstructPropertiesIsCalledThenValuesAreSetCorrectly) {
0 commit comments