@@ -84,7 +84,7 @@ HWTEST_F(BcsTests, givenDebugCapabilityWhenEstimatingCommandSizeThenAddAllRequir
8484 EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite () + sizeof (typename FamilyType::MI_BATCH_BUFFER_END);
8585 expectedSize = alignUp (expectedSize, MemoryConstants::cacheLineSize);
8686
87- BlitProperties blitProperties;
87+ BlitProperties blitProperties{} ;
8888 blitProperties.copySize = {bltSize, 1 , 1 };
8989 BlitPropertiesContainer blitPropertiesContainer;
9090 blitPropertiesContainer.push_back (blitProperties);
@@ -1443,20 +1443,18 @@ HWTEST_F(BcsTestsImages, givenImage1DWhenAdjustBlitPropertiesForImageIsCalledThe
14431443 imgDesc.image_height = 0u ;
14441444 imgDesc.image_depth = 0u ;
14451445 std::unique_ptr<Image> image (Image1dHelper<>::create (context.get (), &imgDesc));
1446- Vec3<size_t > size{0 , 0 , 0 };
1447- size_t bytesPerPixel = 0u ;
14481446 size_t expectedBytesPerPixel = image->getSurfaceFormatInfo ().surfaceFormat .ImageElementSizeInBytes ;
14491447 size_t expectedRowPitch = image->getImageDesc ().image_row_pitch ;
14501448 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 ();
14521451
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 );
14551453
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 );
14601458 EXPECT_EQ (expectedRowPitch, rowPitch);
14611459 EXPECT_EQ (expectedSlicePitch, slicePitch);
14621460}
@@ -1469,15 +1467,28 @@ HWTEST_F(BcsTestsImages, givenImage1DBufferWhenAdjustBlitPropertiesForImageIsCal
14691467
14701468 cl_image_desc imgDesc = Image1dBufferDefaults::imageDesc;
14711469 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 ();
14771477
14781478 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 );
14811492 }
14821493}
14831494
@@ -1490,39 +1501,35 @@ HWTEST_F(BcsTestsImages, givenImage2DArrayWhenAdjustBlitPropertiesForImageIsCall
14901501 imgDesc.image_type = CL_MEM_OBJECT_IMAGE2D_ARRAY;
14911502
14921503 std::unique_ptr<Image> image (Image2dArrayHelper<>::create (context.get (), &imgDesc));
1493- Vec3<size_t > size{0 , 0 , 0 };
1494- size_t bytesPerPixel = 0u ;
14951504 size_t expectedBytesPerPixel = image->getSurfaceFormatInfo ().surfaceFormat .ImageElementSizeInBytes ;
14961505 size_t expectedRowPitch = image->getImageDesc ().image_row_pitch ;
14971506 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 ();
14991509
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 );
15021511
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 );
15071516 EXPECT_EQ (expectedRowPitch, rowPitch);
15081517 EXPECT_EQ (expectedSlicePitch, slicePitch);
15091518}
15101519
15111520HWTEST_F (BcsTestsImages, givenImageWithSurfaceOffsetWhenAdjustBlitPropertiesForImageIsCalledThenGpuAddressIsCorrect) {
15121521 cl_image_desc imgDesc = Image1dDefaults::imageDesc;
15131522 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;
15171523
15181524 uint64_t surfaceOffset = 0x01000 ;
15191525 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;
15221529
1523- ClBlitProperties::adjustBlitPropertiesForImage (image.get (), size, bytesPerPixel, gpuAddress, rowPitch, slicePitch, blitDirection );
1530+ ClBlitProperties::adjustBlitPropertiesForImage (image.get (), blitProperties, rowPitch, slicePitch, false );
15241531
1525- EXPECT_EQ (gpuAddress , expectedGpuAddress);
1532+ EXPECT_EQ (blitProperties. dstGpuAddress , expectedGpuAddress);
15261533}
15271534
15281535HWTEST_F (BcsTests, givenHostPtrToImageWhenConstructPropertiesIsCalledThenValuesAreSetCorrectly) {
0 commit comments