diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist.cpp index d32db1b904..e74e947027 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist.cpp @@ -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 cmdList; cmdList.initialize(device, true); uint64_t pattern[4] = {1, 2, 3, 4}; diff --git a/shared/source/gen12lp/command_stream_receiver_hw_gen12lp.cpp b/shared/source/gen12lp/command_stream_receiver_hw_gen12lp.cpp index c1490ea2bf..d29c5ada69 100644 --- a/shared/source/gen12lp/command_stream_receiver_hw_gen12lp.cpp +++ b/shared/source/gen12lp/command_stream_receiver_hw_gen12lp.cpp @@ -158,7 +158,7 @@ void BlitCommandsHelper::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); diff --git a/shared/test/unit_test/helpers/blit_commands_helper_tests_gen12lp.cpp b/shared/test/unit_test/helpers/blit_commands_helper_tests_gen12lp.cpp index 8f40b0a25a..6912ed11cb 100644 --- a/shared/test/unit_test/helpers/blit_commands_helper_tests_gen12lp.cpp +++ b/shared/test/unit_test/helpers/blit_commands_helper_tests_gen12lp.cpp @@ -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(); + auto gmmDst = std::make_unique(); + GMM_RESCREATE_PARAMS gmmParams = {}; + auto myResourecInfoSrc = std::make_unique(pDevice->getRootDeviceEnvironment().getGmmClientContext(), &gmmParams); + auto myResourecInfoDst = std::make_unique(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(0x1234), 0x1000, 0, sizeof(uint32_t), + MemoryPool::System4KBPages); + MockGraphicsAllocation mockAllocationDst(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY, + reinterpret_cast(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(static_cast(gmmDst->gmmResourceInfo->getRenderPitch()), TILED_Y_PITCH_ALIGNMENT); + BlitCommandsHelper::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(); + auto gmmDst = std::make_unique(); + GMM_RESCREATE_PARAMS gmmParams = {}; + auto myResourecInfoSrc = std::make_unique(pDevice->getRootDeviceEnvironment().getGmmClientContext(), &gmmParams); + auto myResourecInfoDst = std::make_unique(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(0x1234), 0x1000, 0, sizeof(uint32_t), + MemoryPool::System4KBPages); + MockGraphicsAllocation mockAllocationDst(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY, + reinterpret_cast(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(static_cast(gmmSrc->gmmResourceInfo->getRenderPitch()), TILED_Y_PITCH_ALIGNMENT); + BlitCommandsHelper::appendBlitCommandsForImages(properties, bltCmd); + EXPECT_EQ(bltCmd.getSourcePitch(), expectedPitch / sizeof(uint32_t)); + EXPECT_EQ(bltCmd.getDestinationPitch(), properties.dstRowPitch); +} \ No newline at end of file