Fix dont use srcTile type to calculate dst pitch value

Change-Id: I0d31cd5979f092bcf826898c7034b7b50a3c3c03
Signed-off-by: Maciej Plewka <maciej.plewka@intel.com>
This commit is contained in:
Maciej Plewka
2020-06-18 11:27:32 +02:00
committed by sys_ocldev
parent 0e76e9db66
commit a3bb60e17c
3 changed files with 72 additions and 2 deletions

View File

@@ -924,7 +924,7 @@ HWTEST2_F(CommandListCreate, givenNullEventWhenAppendEventAfterWalkerThenNothing
EXPECT_EQ(commandList->commandContainer.getCommandStream()->getUsed(), usedBefore);
}
HWTEST2_F(CommandListCreate, givenCopyOnlyCommandListWhenAppenBlitFillCalledWithLargePatternSizeThenInternalAllocHasPattern, Platforms) {
HWTEST2_F(CommandListCreate, givenCopyOnlyCommandListWhenAppendBlitFillCalledWithLargePatternSizeThenInternalAllocHasPattern, Platforms) {
MockCommandListForMemFill<gfxCoreFamily> cmdList;
cmdList.initialize(device, true);
uint64_t pattern[4] = {1, 2, 3, 4};

View File

@@ -158,7 +158,7 @@ void BlitCommandsHelper<Family>::appendBlitCommandsForImages(const BlitPropertie
getBlitAllocationProperties(*dstAllocation, dstPitch, dstQPitch, dstTileType, mipTailLod);
srcPitch = (srcTileType == GMM_NOT_TILED) ? srcPitch : srcPitch / 4;
dstPitch = (srcTileType == GMM_NOT_TILED) ? dstPitch : dstPitch / 4;
dstPitch = (dstTileType == GMM_NOT_TILED) ? dstPitch : dstPitch / 4;
blitCmd.setSourcePitch(srcPitch);
blitCmd.setDestinationPitch(dstPitch);

View File

@@ -272,3 +272,73 @@ HWTEST2_F(BlitTests, givenTiledSrcAndDestinationWhenGmmReturnsNotAlignedPitchThe
EXPECT_EQ(bltCmd.getDestinationPitch(), expectedPitch / sizeof(uint32_t));
EXPECT_EQ(bltCmd.getSourcePitch(), expectedPitch / sizeof(uint32_t));
}
HWTEST2_F(BlitTests, givenDstTiledImageAndNotTiledSourceWhenAppendBlitCommandsForImagesThenPitchIsValueInDwords, IsGen12LP) {
constexpr uint32_t TILED_Y_PITCH_ALIGNMENT = 128;
using XY_COPY_BLT = typename FamilyType::XY_COPY_BLT;
auto gmmSrc = std::make_unique<MockGmm>();
auto gmmDst = std::make_unique<MockGmm>();
GMM_RESCREATE_PARAMS gmmParams = {};
auto myResourecInfoSrc = std::make_unique<MyMockResourecInfo>(pDevice->getRootDeviceEnvironment().getGmmClientContext(), &gmmParams);
auto myResourecInfoDst = std::make_unique<MyMockResourecInfo>(pDevice->getRootDeviceEnvironment().getGmmClientContext(), &gmmParams);
myResourecInfoSrc->pitch = 0x100;
myResourecInfoDst->pitch = 0x200;
gmmSrc->gmmResourceInfo.reset(myResourecInfoSrc.release());
gmmDst->gmmResourceInfo.reset(myResourecInfoDst.release());
auto flags = gmmDst->gmmResourceInfo->getResourceFlags();
flags->Info.TiledY = true;
MockGraphicsAllocation mockAllocationSrc(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages);
MockGraphicsAllocation mockAllocationDst(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages);
mockAllocationSrc.setGmm(gmmSrc.get(), 0);
mockAllocationDst.setGmm(gmmDst.get(), 0);
auto bltCmd = FamilyType::cmdInitXyCopyBlt;
BlitProperties properties = {};
properties.dstRowPitch = 0x1000;
properties.srcRowPitch = 0x1000;
properties.srcAllocation = &mockAllocationSrc;
properties.dstAllocation = &mockAllocationDst;
auto expectedPitch = alignUp<uint32_t>(static_cast<uint32_t>(gmmDst->gmmResourceInfo->getRenderPitch()), TILED_Y_PITCH_ALIGNMENT);
BlitCommandsHelper<FamilyType>::appendBlitCommandsForImages(properties, bltCmd);
EXPECT_EQ(bltCmd.getDestinationPitch(), expectedPitch / sizeof(uint32_t));
EXPECT_EQ(bltCmd.getSourcePitch(), properties.srcRowPitch);
}
HWTEST2_F(BlitTests, givenSrcTiledImageAndNotTiledDstWhenAppendBlitCommandsForImagesThenPitchIsValueInDwords, IsGen12LP) {
constexpr uint32_t TILED_Y_PITCH_ALIGNMENT = 128;
using XY_COPY_BLT = typename FamilyType::XY_COPY_BLT;
auto gmmSrc = std::make_unique<MockGmm>();
auto gmmDst = std::make_unique<MockGmm>();
GMM_RESCREATE_PARAMS gmmParams = {};
auto myResourecInfoSrc = std::make_unique<MyMockResourecInfo>(pDevice->getRootDeviceEnvironment().getGmmClientContext(), &gmmParams);
auto myResourecInfoDst = std::make_unique<MyMockResourecInfo>(pDevice->getRootDeviceEnvironment().getGmmClientContext(), &gmmParams);
myResourecInfoSrc->pitch = 0x100;
myResourecInfoDst->pitch = 0x200;
gmmSrc->gmmResourceInfo.reset(myResourecInfoSrc.release());
gmmDst->gmmResourceInfo.reset(myResourecInfoDst.release());
auto flags = gmmSrc->gmmResourceInfo->getResourceFlags();
flags->Info.TiledY = true;
MockGraphicsAllocation mockAllocationSrc(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages);
MockGraphicsAllocation mockAllocationDst(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages);
mockAllocationSrc.setGmm(gmmSrc.get(), 0);
mockAllocationDst.setGmm(gmmDst.get(), 0);
auto bltCmd = FamilyType::cmdInitXyCopyBlt;
BlitProperties properties = {};
properties.dstRowPitch = 0x1000;
properties.srcRowPitch = 0x1000;
properties.srcAllocation = &mockAllocationSrc;
properties.dstAllocation = &mockAllocationDst;
auto expectedPitch = alignUp<uint32_t>(static_cast<uint32_t>(gmmSrc->gmmResourceInfo->getRenderPitch()), TILED_Y_PITCH_ALIGNMENT);
BlitCommandsHelper<FamilyType>::appendBlitCommandsForImages(properties, bltCmd);
EXPECT_EQ(bltCmd.getSourcePitch(), expectedPitch / sizeof(uint32_t));
EXPECT_EQ(bltCmd.getDestinationPitch(), properties.dstRowPitch);
}