Refactor blitter functions for images, make blitProperties const

Change-Id: I5a9aa96771a6b29113bb81d39ec32adc6e3c778c
Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>
Related-To: NEO-4692
This commit is contained in:
Kamil Kopryk
2020-06-03 14:42:08 +02:00
committed by sys_ocldev
parent b558c9ca30
commit 74c4536a8c
6 changed files with 95 additions and 57 deletions

View File

@@ -276,4 +276,26 @@ HWTEST2_F(BlitTests, givenMemoryAndImageWhenDispatchCopyImageCallThenCommandAdde
cmdList, ptrOffset(stream.getCpuBase(), 0), stream.getUsed()));
auto itor = find<XY_COPY_BLT *>(cmdList.begin(), cmdList.end());
EXPECT_NE(cmdList.end(), itor);
}
}
HWTEST2_F(BlitTests, givenGen9AndGetBlitAllocationPropertiesThenCorrectValuesAreReturned, IsGen9) {
using XY_COPY_BLT = typename FamilyType::XY_COPY_BLT;
MockGraphicsAllocation alloc;
uint32_t pitch = 0x10;
uint32_t qPitch = 0x20;
GMM_TILE_TYPE tileType = GMM_NOT_TILED;
uint32_t mipTailLod = 0;
auto expectedPitch = pitch;
auto expectedQPitch = qPitch;
auto expectedtileType = tileType;
auto expectedMipTailLod = mipTailLod;
NEO::BlitCommandsHelper<FamilyType>::getBlitAllocationProperties(alloc, pitch, qPitch, tileType, mipTailLod);
EXPECT_EQ(expectedPitch, pitch);
EXPECT_EQ(expectedQPitch, qPitch);
EXPECT_EQ(expectedtileType, tileType);
EXPECT_EQ(expectedMipTailLod, mipTailLod);
}

View File

@@ -149,14 +149,22 @@ HWTEST2_F(BlitTests, givenSrcAndDestinationImagesWhenAppendSliceOffsetsThenAdres
BlitProperties properties = {};
properties.srcAllocation = &mockAllocationSrc;
properties.dstAllocation = &mockAllocationDst;
properties.dstSlicePitch = 0x1000;
properties.srcSlicePitch = 0x2000;
properties.srcSize.y = 0x10;
properties.srcRowPitch = 0x10;
auto srcSlicePitch = properties.srcSize.y * properties.srcRowPitch;
properties.dstSize.y = 0x20;
properties.dstRowPitch = 0x20;
auto dstSlicePitch = properties.dstSize.y * properties.dstRowPitch;
properties.srcOffset = {0x10, 0x10, 0x10};
properties.dstOffset = {0x20, 0x20, 0x20};
uint32_t index = 7;
BlitCommandsHelper<FamilyType>::appendSliceOffsets(properties, bltCmd, index);
auto expectesSrcOffset = (index + properties.srcOffset.z) * properties.srcSlicePitch;
auto expectesDstOffset = (index + properties.dstOffset.z) * properties.dstSlicePitch;
auto expectesSrcOffset = (index + properties.srcOffset.z) * srcSlicePitch;
auto expectesDstOffset = (index + properties.dstOffset.z) * dstSlicePitch;
EXPECT_EQ(bltCmd.getSourceBaseAddress(), ptrOffset(mockAllocationSrc.getGpuAddress(), expectesSrcOffset));
EXPECT_EQ(bltCmd.getDestinationBaseAddress(), ptrOffset(mockAllocationDst.getGpuAddress(), expectesDstOffset));
}
@@ -263,4 +271,4 @@ HWTEST2_F(BlitTests, givenTiledSrcAndDestinationWhenGmmReturnsNotAlignedPitchThe
BlitCommandsHelper<FamilyType>::appendBlitCommandsForImages(properties, bltCmd);
EXPECT_EQ(bltCmd.getDestinationPitch(), expectedPitch / sizeof(uint32_t));
EXPECT_EQ(bltCmd.getSourcePitch(), expectedPitch / sizeof(uint32_t));
}
}