Fix memory fill using bliter

Change-Id: Idf2463361c19f80e11a920aebf7ad1194cd3c2bb
Signed-off-by: Maciej Plewka <maciej.plewka@intel.com>
This commit is contained in:
Maciej Plewka
2020-09-28 17:24:59 +02:00
committed by sys_ocldev
parent 8093400baf
commit 52b785552b
2 changed files with 26 additions and 4 deletions

View File

@@ -168,7 +168,7 @@ HWTEST_F(BlitTests, givenMemorySizeTwiceBiggerThanMaxWidthWhenFillPatternWithBli
uint32_t streamBuffer[100] = {};
LinearStream stream(streamBuffer, sizeof(streamBuffer));
MockGraphicsAllocation mockAllocation(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, (2 * BlitterConstants::maxBlitWidth),
reinterpret_cast<void *>(0x1234), 0x1000, 0, (2 * BlitterConstants::maxBlitWidth * sizeof(uint32_t)),
MemoryPool::System4KBPages, mockMaxOsContextCount);
BlitCommandsHelper<FamilyType>::dispatchBlitMemoryColorFill(&mockAllocation, pattern, sizeof(uint32_t), stream, mockAllocation.getUnderlyingBufferSize(), *pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]);
GenCmdList cmdList;
@@ -179,6 +179,28 @@ HWTEST_F(BlitTests, givenMemorySizeTwiceBiggerThanMaxWidthWhenFillPatternWithBli
{
auto cmd = genCmdCast<XY_COLOR_BLT *>(*itor);
EXPECT_EQ(cmd->getTransferHeight(), 2u);
EXPECT_EQ(cmd->getDestinationPitch(), BlitterConstants::maxBlitWidth * sizeof(uint32_t));
}
}
HWTEST_F(BlitTests, givenMemorySizeIsLessThanTwicenMaxWidthWhenFillPatternWithBlitThenHeightIsOne) {
using XY_COLOR_BLT = typename FamilyType::XY_COLOR_BLT;
using COLOR_DEPTH = typename XY_COLOR_BLT::COLOR_DEPTH;
uint32_t pattern[4] = {1, 0, 0, 0};
uint32_t streamBuffer[100] = {};
LinearStream stream(streamBuffer, sizeof(streamBuffer));
MockGraphicsAllocation mockAllocation(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(0x1234), 0x1000, 0, ((BlitterConstants::maxBlitWidth + 1) * sizeof(uint32_t)),
MemoryPool::System4KBPages, mockMaxOsContextCount);
BlitCommandsHelper<FamilyType>::dispatchBlitMemoryColorFill(&mockAllocation, pattern, sizeof(uint32_t), stream, mockAllocation.getUnderlyingBufferSize(), *pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]);
GenCmdList cmdList;
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(
cmdList, ptrOffset(stream.getCpuBase(), 0), stream.getUsed()));
auto itor = find<XY_COLOR_BLT *>(cmdList.begin(), cmdList.end());
EXPECT_NE(cmdList.end(), itor);
{
auto cmd = genCmdCast<XY_COLOR_BLT *>(*itor);
EXPECT_EQ(cmd->getTransferHeight(), 1u);
}
}