mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-17 04:54:48 +08:00
fix: bcs mem fill pattern alignment
Related-To: NEO-13928 Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
3bef9f886a
commit
dd1e85a3d4
@@ -4617,7 +4617,7 @@ typedef struct tagXY_FAST_COLOR_BLT {
|
||||
return static_cast<CLIENT>(TheStructure.Common.Client);
|
||||
}
|
||||
inline void setDestinationPitch(const uint32_t value) {
|
||||
UNRECOVERABLE_IF(value > 0x3ffff);
|
||||
UNRECOVERABLE_IF(value > 0x3ffff + 1); // patched
|
||||
TheStructure.Common.DestinationPitch = value - 1;
|
||||
}
|
||||
inline uint32_t getDestinationPitch() const {
|
||||
|
||||
@@ -4605,7 +4605,7 @@ typedef struct tagXY_FAST_COLOR_BLT {
|
||||
return static_cast<CLIENT>(TheStructure.Common.Client);
|
||||
}
|
||||
inline void setDestinationPitch(const uint32_t value) {
|
||||
UNRECOVERABLE_IF(value > 0x3ffff);
|
||||
UNRECOVERABLE_IF(value > 0x3ffff + 1); // patched
|
||||
TheStructure.Common.DestinationPitch = value - 1;
|
||||
}
|
||||
inline uint32_t getDestinationPitch() const {
|
||||
|
||||
@@ -264,6 +264,7 @@ void BlitCommandsHelper<GfxFamily>::dispatchBlitMemoryFill(const BlitProperties
|
||||
const auto maxHeight = getMaxBlitHeight(rootDeviceEnvironment, true);
|
||||
|
||||
auto colorDepth = COLOR_DEPTH::COLOR_DEPTH_128_BIT_COLOR;
|
||||
size_t patternSize = 16;
|
||||
|
||||
const LookupArray<size_t, COLOR_DEPTH, 4> colorDepthLookup({{
|
||||
{1, COLOR_DEPTH::COLOR_DEPTH_8_BIT_COLOR},
|
||||
@@ -275,12 +276,13 @@ void BlitCommandsHelper<GfxFamily>::dispatchBlitMemoryFill(const BlitProperties
|
||||
auto colorDepthV = colorDepthLookup.find(blitProperties.fillPatternSize);
|
||||
if (colorDepthV.has_value()) {
|
||||
colorDepth = *colorDepthV;
|
||||
patternSize = blitProperties.fillPatternSize;
|
||||
}
|
||||
|
||||
blitCmd.setFillColor(blitProperties.fillPattern);
|
||||
blitCmd.setColorDepth(colorDepth);
|
||||
|
||||
uint64_t sizeToFill = blitProperties.copySize.x / blitProperties.fillPatternSize;
|
||||
uint64_t sizeToFill = blitProperties.copySize.x / patternSize;
|
||||
uint64_t offset = blitProperties.dstOffset.x;
|
||||
while (sizeToFill != 0) {
|
||||
auto tmpCmd = blitCmd;
|
||||
@@ -299,7 +301,7 @@ void BlitCommandsHelper<GfxFamily>::dispatchBlitMemoryFill(const BlitProperties
|
||||
}
|
||||
tmpCmd.setDestinationX2CoordinateRight(static_cast<uint32_t>(width));
|
||||
tmpCmd.setDestinationY2CoordinateBottom(static_cast<uint32_t>(height));
|
||||
tmpCmd.setDestinationPitch(static_cast<uint32_t>(width * blitProperties.fillPatternSize));
|
||||
tmpCmd.setDestinationPitch(static_cast<uint32_t>(width * patternSize));
|
||||
|
||||
appendBlitMemoryOptionsForFillBuffer(blitProperties.dstAllocation, tmpCmd, rootDeviceEnvironment);
|
||||
appendBlitFillCommand(blitProperties, tmpCmd);
|
||||
@@ -307,7 +309,7 @@ void BlitCommandsHelper<GfxFamily>::dispatchBlitMemoryFill(const BlitProperties
|
||||
auto cmd = linearStream.getSpaceForCmd<XY_COLOR_BLT>();
|
||||
*cmd = tmpCmd;
|
||||
auto blitSize = width * height;
|
||||
offset += (blitSize * blitProperties.fillPatternSize);
|
||||
offset += (blitSize * patternSize);
|
||||
sizeToFill -= blitSize;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -264,6 +264,33 @@ HWTEST_F(BlitTests, givenMemoryWhenFillPatternWithBlitThenCommandIsProgrammed) {
|
||||
EXPECT_NE(cmdList.end(), itor);
|
||||
}
|
||||
|
||||
HWTEST_F(BlitTests, givenUnalignedPatternSizeWhenDispatchingBlitFillThenSetCorrectColorDepth) {
|
||||
using XY_COLOR_BLT = typename FamilyType::XY_COLOR_BLT;
|
||||
uint32_t pattern[4] = {1, 0, 0, 0};
|
||||
uint32_t streamBuffer[100] = {};
|
||||
LinearStream stream(streamBuffer, sizeof(streamBuffer));
|
||||
MockGraphicsAllocation mockAllocation(0, 1u /*num gmms*/, AllocationType::internalHostMemory,
|
||||
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
|
||||
MemoryPool::system4KBPages, MemoryManager::maxOsContextCount);
|
||||
|
||||
size_t copySize = 0x800'0000;
|
||||
|
||||
auto blitProperties = BlitProperties::constructPropertiesForMemoryFill(&mockAllocation, copySize, pattern, 3, 0);
|
||||
|
||||
BlitCommandsHelper<FamilyType>::dispatchBlitMemoryColorFill(blitProperties, stream, pDevice->getRootDeviceEnvironmentRef());
|
||||
GenCmdList cmdList;
|
||||
|
||||
ASSERT_TRUE(FamilyType::Parse::parseCommandBuffer(cmdList, stream.getCpuBase(), stream.getUsed()));
|
||||
auto itor = find<XY_COLOR_BLT *>(cmdList.begin(), cmdList.end());
|
||||
ASSERT_NE(cmdList.end(), itor);
|
||||
|
||||
auto cmd = genCmdCast<XY_COLOR_BLT *>(*itor);
|
||||
EXPECT_EQ(cmd->getColorDepth(), XY_COLOR_BLT::COLOR_DEPTH::COLOR_DEPTH_128_BIT_COLOR);
|
||||
EXPECT_EQ(cmd->getDestinationX2CoordinateRight(), 0x4000u);
|
||||
EXPECT_EQ(cmd->getDestinationY2CoordinateBottom(), 0x200u);
|
||||
EXPECT_EQ(cmd->getDestinationPitch(), 0x4000u * 16u);
|
||||
}
|
||||
|
||||
HWTEST_F(BlitTests, givenMemorySizeBiggerThanMaxWidthButLessThanTwiceMaxWidthWhenFillPatternWithBlitThenHeightIsOne) {
|
||||
using XY_COLOR_BLT = typename FamilyType::XY_COLOR_BLT;
|
||||
uint32_t pattern[4] = {1, 0, 0, 0};
|
||||
|
||||
Reference in New Issue
Block a user