Skip to content

Commit f2bbd63

Browse files
Refactor SBA handling + fix unit tests
Signed-off-by: Bartosz Dunajski <[email protected]>
1 parent 8351fc9 commit f2bbd63

32 files changed

+222
-177
lines changed

level_zero/core/source/cmdqueue/cmdqueue_hw_base.inl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ void CommandQueueHw<gfxCoreFamily>::programStateBaseAddress(uint64_t gsba, bool
4040
NEO::EncodeWA<GfxFamily>::addPipeControlBeforeStateBaseAddress(commandStream, hwInfo, isRcs);
4141
NEO::EncodeWA<GfxFamily>::encodeAdditionalPipelineSelect(commandStream, {}, true, hwInfo, isRcs);
4242

43-
auto pSbaCmd = static_cast<STATE_BASE_ADDRESS *>(commandStream.getSpace(sizeof(STATE_BASE_ADDRESS)));
43+
auto sbaCmdBuf = static_cast<STATE_BASE_ADDRESS *>(NEO::StateBaseAddressHelper<GfxFamily>::getSpaceForSbaCmd(commandStream));
4444
STATE_BASE_ADDRESS sbaCmd;
4545

4646
bool useGlobalSshAndDsh = NEO::ApiSpecificConfig::getBindlessConfiguration();
@@ -69,7 +69,7 @@ void CommandQueueHw<gfxCoreFamily>::programStateBaseAddress(uint64_t gsba, bool
6969
NEO::MemoryCompressionState::NotApplicable,
7070
false,
7171
1u);
72-
*pSbaCmd = sbaCmd;
72+
*sbaCmdBuf = sbaCmd;
7373
csr->setGSBAStateDirty(false);
7474

7575
if (NEO::Debugger::isDebugEnabled(internalUsage) && device->getL0Debugger()) {

level_zero/core/source/cmdqueue/cmdqueue_xe_hp_core_and_later.inl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ void CommandQueueHw<gfxCoreFamily>::programStateBaseAddress(uint64_t gsba, bool
3131
bool isRcs = this->getCsr()->isRcs();
3232

3333
NEO::EncodeWA<GfxFamily>::addPipeControlBeforeStateBaseAddress(commandStream, hwInfo, isRcs);
34-
auto pSbaCmd = static_cast<STATE_BASE_ADDRESS *>(commandStream.getSpace(sizeof(STATE_BASE_ADDRESS)));
34+
auto sbaCmdBuf = static_cast<STATE_BASE_ADDRESS *>(NEO::StateBaseAddressHelper<GfxFamily>::getSpaceForSbaCmd(commandStream));
35+
3536
STATE_BASE_ADDRESS sbaCmd;
3637
bool multiOsContextCapable = device->isImplicitScalingCapable();
3738
NEO::StateBaseAddressHelper<GfxFamily>::programStateBaseAddress(&sbaCmd,
@@ -51,12 +52,12 @@ void CommandQueueHw<gfxCoreFamily>::programStateBaseAddress(uint64_t gsba, bool
5152
NEO::MemoryCompressionState::NotApplicable,
5253
false,
5354
1u);
54-
*pSbaCmd = sbaCmd;
55+
*sbaCmdBuf = sbaCmd;
5556

5657
auto &hwInfoConfig = *NEO::HwInfoConfig::get(hwInfo.platform.eProductFamily);
5758
if (hwInfoConfig.isAdditionalStateBaseAddressWARequired(hwInfo)) {
58-
pSbaCmd = static_cast<STATE_BASE_ADDRESS *>(commandStream.getSpace(sizeof(STATE_BASE_ADDRESS)));
59-
*pSbaCmd = sbaCmd;
59+
sbaCmdBuf = static_cast<STATE_BASE_ADDRESS *>(commandStream.getSpace(sizeof(STATE_BASE_ADDRESS)));
60+
*sbaCmdBuf = sbaCmd;
6061
}
6162

6263
if (NEO::Debugger::isDebugEnabled(internalUsage) && device->getL0Debugger()) {

level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_4.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -861,8 +861,14 @@ HWTEST2_F(HostPointerManagerCommandListTest, givenCommandListWhenMemoryFillWithS
861861
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(
862862
cmdList, ptrOffset(commandContainer.getCommandStream()->getCpuBase(), 0), commandContainer.getCommandStream()->getUsed()));
863863

864-
auto itor = find<PIPE_CONTROL *>(cmdList.begin(), cmdList.end());
865-
EXPECT_NE(cmdList.end(), itor);
864+
auto pc = genCmdCast<PIPE_CONTROL *>(*cmdList.rbegin());
865+
866+
if (NEO::MemorySynchronizationCommands<FamilyType>::getDcFlushEnable(true, device->getHwInfo())) {
867+
EXPECT_NE(nullptr, pc);
868+
EXPECT_TRUE(pc->getDcFlushEnable());
869+
} else {
870+
EXPECT_EQ(nullptr, pc);
871+
}
866872
}
867873

868874
using SupportedPlatformsSklIcllp = IsWithinProducts<IGFX_SKYLAKE, IGFX_ICELAKE>;

level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_5.cpp

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,8 @@ HWTEST_F(CommandListCreate, givenCommandListWithCopyOnlyWhenAppendWaitEventsWith
594594

595595
HWTEST_F(CommandListCreate, givenCommandListyWhenAppendWaitEventsWithDcFlushThenPipeControlIsProgrammed) {
596596
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
597+
using SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT;
598+
597599
ze_result_t returnValue;
598600
std::unique_ptr<L0::CommandList> commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue));
599601
auto &commandContainer = commandList->commandContainer;
@@ -605,9 +607,19 @@ HWTEST_F(CommandListCreate, givenCommandListyWhenAppendWaitEventsWithDcFlushThen
605607
GenCmdList cmdList;
606608
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(
607609
cmdList, ptrOffset(commandContainer.getCommandStream()->getCpuBase(), 0), commandContainer.getCommandStream()->getUsed()));
608-
auto itor = find<PIPE_CONTROL *>(cmdList.begin(), cmdList.end());
609610

611+
auto itor = find<SEMAPHORE_WAIT *>(cmdList.begin(), cmdList.end());
610612
EXPECT_NE(cmdList.end(), itor);
613+
614+
if (NEO::MemorySynchronizationCommands<FamilyType>::getDcFlushEnable(true, device->getHwInfo())) {
615+
itor--;
616+
EXPECT_NE(nullptr, genCmdCast<PIPE_CONTROL *>(*itor));
617+
} else {
618+
if (cmdList.begin() != itor) {
619+
itor--;
620+
EXPECT_EQ(nullptr, genCmdCast<PIPE_CONTROL *>(*itor));
621+
}
622+
}
611623
}
612624

613625
HWTEST_F(CommandListCreate, givenCommandListWhenAppendWaitEventsWithDcFlushThenPipeControlIsProgrammedOnlyOnce) {
@@ -627,11 +639,18 @@ HWTEST_F(CommandListCreate, givenCommandListWhenAppendWaitEventsWithDcFlushThenP
627639
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(
628640
cmdList, ptrOffset(commandContainer.getCommandStream()->getCpuBase(), 0), commandContainer.getCommandStream()->getUsed()));
629641

630-
auto itor = find<PIPE_CONTROL *>(cmdList.begin(), cmdList.end());
642+
auto itor = find<SEMAPHORE_WAIT *>(cmdList.begin(), cmdList.end());
631643
EXPECT_NE(cmdList.end(), itor);
632-
itor++;
633-
auto itor2 = find<SEMAPHORE_WAIT *>(itor, cmdList.end());
634-
EXPECT_NE(cmdList.end(), itor2);
644+
645+
if (NEO::MemorySynchronizationCommands<FamilyType>::getDcFlushEnable(true, device->getHwInfo())) {
646+
itor--;
647+
EXPECT_NE(nullptr, genCmdCast<PIPE_CONTROL *>(*itor));
648+
} else {
649+
if (cmdList.begin() != itor) {
650+
itor--;
651+
EXPECT_EQ(nullptr, genCmdCast<PIPE_CONTROL *>(*itor));
652+
}
653+
}
635654
}
636655

637656
HWTEST_F(CommandListCreate, givenAsyncCmdQueueAndImmediateCommandListWhenAppendWaitEventsWithHostScopeThenPipeControlAndSemWaitAreAddedFromCommandList) {

level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_7.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -452,14 +452,15 @@ HWTEST2_F(CommandListCreate, givenCommandListAndHostPointersWhenMemoryCopyCalled
452452
GenCmdList genCmdList;
453453
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(
454454
genCmdList, ptrOffset(commandContainer.getCommandStream()->getCpuBase(), 0), commandContainer.getCommandStream()->getUsed()));
455-
auto itor = find<PIPE_CONTROL *>(genCmdList.begin(), genCmdList.end());
456-
ASSERT_NE(genCmdList.end(), itor);
457-
PIPE_CONTROL *cmd = nullptr;
458-
while (itor != genCmdList.end()) {
459-
cmd = genCmdCast<PIPE_CONTROL *>(*itor);
460-
itor = find<PIPE_CONTROL *>(++itor, genCmdList.end());
455+
456+
auto pc = genCmdCast<PIPE_CONTROL *>(*genCmdList.rbegin());
457+
458+
if (NEO::MemorySynchronizationCommands<FamilyType>::getDcFlushEnable(true, device->getHwInfo())) {
459+
EXPECT_NE(nullptr, pc);
460+
EXPECT_TRUE(pc->getDcFlushEnable());
461+
} else {
462+
EXPECT_EQ(nullptr, pc);
461463
}
462-
EXPECT_EQ(MemorySynchronizationCommands<FamilyType>::getDcFlushEnable(true, *defaultHwInfo), cmd->getDcFlushEnable()); // NOLINT(clang-analyzer-core.CallAndMessage)
463464
}
464465

465466
} // namespace ult

level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_memory.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -106,14 +106,15 @@ HWTEST2_F(AppendMemoryCopy, givenCommandListAndHostPointersWhenMemoryCopyRegionC
106106
GenCmdList genCmdList;
107107
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(
108108
genCmdList, ptrOffset(commandContainer.getCommandStream()->getCpuBase(), 0), commandContainer.getCommandStream()->getUsed()));
109-
auto itor = find<PIPE_CONTROL *>(genCmdList.begin(), genCmdList.end());
110-
ASSERT_NE(genCmdList.end(), itor);
111-
PIPE_CONTROL *cmd = nullptr;
112-
while (itor != genCmdList.end()) {
113-
cmd = genCmdCast<PIPE_CONTROL *>(*itor);
114-
itor = find<PIPE_CONTROL *>(++itor, genCmdList.end());
109+
110+
auto pc = genCmdCast<PIPE_CONTROL *>(*genCmdList.rbegin());
111+
112+
if (NEO::MemorySynchronizationCommands<FamilyType>::getDcFlushEnable(true, device->getHwInfo())) {
113+
EXPECT_NE(nullptr, pc);
114+
EXPECT_TRUE(pc->getDcFlushEnable());
115+
} else {
116+
EXPECT_EQ(nullptr, pc);
115117
}
116-
EXPECT_EQ(MemorySynchronizationCommands<FamilyType>::getDcFlushEnable(true, *defaultHwInfo), cmd->getDcFlushEnable()); // NOLINT(clang-analyzer-core.CallAndMessage)
117118
}
118119

119120
HWTEST2_F(AppendMemoryCopy, givenImmediateCommandListWhenAppendingMemoryCopyThenSuccessIsReturned, IsAtLeastSkl) {

level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_wait_on_events.cpp

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ HWTEST_F(CommandListAppendWaitOnEvent, WhenAppendingWaitOnEventsThenEventGraphic
112112

113113
HWTEST_F(CommandListAppendWaitOnEvent, givenEventWithWaitScopeFlagDeviceWhenAppendingWaitOnEventThenPCWithDcFlushIsGenerated) {
114114
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
115+
using MI_SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT;
115116
auto usedSpaceBefore = commandList->commandContainer.getCommandStream()->getUsed();
116117

117118
const ze_event_desc_t eventDesc = {
@@ -134,14 +135,21 @@ HWTEST_F(CommandListAppendWaitOnEvent, givenEventWithWaitScopeFlagDeviceWhenAppe
134135
ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0),
135136
usedSpaceAfter));
136137

137-
auto itorPC = findAll<PIPE_CONTROL *>(cmdList.begin(), cmdList.end()).back();
138-
ASSERT_NE(cmdList.end(), itorPC);
139-
{
140-
auto cmd = genCmdCast<PIPE_CONTROL *>(*itorPC);
141-
ASSERT_NE(cmd, nullptr);
138+
auto itor = find<MI_SEMAPHORE_WAIT *>(cmdList.begin(), cmdList.end());
139+
EXPECT_NE(cmdList.end(), itor);
142140

141+
if (NEO::MemorySynchronizationCommands<FamilyType>::getDcFlushEnable(true, device->getHwInfo())) {
142+
itor--;
143+
auto cmd = genCmdCast<PIPE_CONTROL *>(*itor);
144+
145+
ASSERT_NE(nullptr, cmd);
143146
EXPECT_TRUE(cmd->getCommandStreamerStallEnable());
144-
EXPECT_EQ(MemorySynchronizationCommands<FamilyType>::getDcFlushEnable(true, *defaultHwInfo), cmd->getDcFlushEnable());
147+
EXPECT_TRUE(cmd->getDcFlushEnable());
148+
} else {
149+
if (cmdList.begin() != itor) {
150+
itor--;
151+
EXPECT_EQ(nullptr, genCmdCast<PIPE_CONTROL *>(*itor));
152+
}
145153
}
146154
}
147155

opencl/test/unit_test/command_queue/enqueue_copy_buffer_to_image_tests.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -175,24 +175,24 @@ HWTEST_F(EnqueueCopyBufferToImageTest, WhenCopyingBufferToImageThenSurfaceStateI
175175
const auto &kernelInfo = mockCmdQ->storedMultiDispatchInfo.begin()->getKernel()->getKernelInfo();
176176
uint32_t index = static_cast<uint32_t>(kernelInfo.getArgDescriptorAt(1).template as<ArgDescImage>().bindful) / sizeof(RENDER_SURFACE_STATE);
177177

178-
const auto &surfaceState = getSurfaceState<FamilyType>(&pCmdQ->getIndirectHeap(IndirectHeap::Type::SURFACE_STATE, 0), index);
178+
const auto surfaceState = getSurfaceState<FamilyType>(&pCmdQ->getIndirectHeap(IndirectHeap::Type::SURFACE_STATE, 0), index);
179179
const auto &imageDesc = dstImage->getImageDesc();
180180
// EnqueueReadImage uses multi-byte copies depending on per-pixel-size-in-bytes
181-
EXPECT_EQ(imageDesc.image_width, surfaceState.getWidth());
182-
EXPECT_EQ(imageDesc.image_height, surfaceState.getHeight());
183-
EXPECT_NE(0u, surfaceState.getSurfacePitch());
184-
EXPECT_NE(0u, surfaceState.getSurfaceType());
185-
auto surfaceFormat = surfaceState.getSurfaceFormat();
181+
EXPECT_EQ(imageDesc.image_width, surfaceState->getWidth());
182+
EXPECT_EQ(imageDesc.image_height, surfaceState->getHeight());
183+
EXPECT_NE(0u, surfaceState->getSurfacePitch());
184+
EXPECT_NE(0u, surfaceState->getSurfaceType());
185+
auto surfaceFormat = surfaceState->getSurfaceFormat();
186186
bool isRedescribedFormat =
187187
surfaceFormat == RENDER_SURFACE_STATE::SURFACE_FORMAT_R32G32B32A32_UINT ||
188188
surfaceFormat == RENDER_SURFACE_STATE::SURFACE_FORMAT_R32G32_UINT ||
189189
surfaceFormat == RENDER_SURFACE_STATE::SURFACE_FORMAT_R32_UINT ||
190190
surfaceFormat == RENDER_SURFACE_STATE::SURFACE_FORMAT_R16_UINT ||
191191
surfaceFormat == RENDER_SURFACE_STATE::SURFACE_FORMAT_R8_UINT;
192192
EXPECT_TRUE(isRedescribedFormat);
193-
EXPECT_EQ(MockGmmResourceInfo::getHAlignSurfaceStateResult, surfaceState.getSurfaceHorizontalAlignment());
194-
EXPECT_EQ(RENDER_SURFACE_STATE::SURFACE_VERTICAL_ALIGNMENT_VALIGN_4, surfaceState.getSurfaceVerticalAlignment());
195-
EXPECT_EQ(dstImage->getGraphicsAllocation(pClDevice->getRootDeviceIndex())->getGpuAddress(), surfaceState.getSurfaceBaseAddress());
193+
EXPECT_EQ(MockGmmResourceInfo::getHAlignSurfaceStateResult, surfaceState->getSurfaceHorizontalAlignment());
194+
EXPECT_EQ(RENDER_SURFACE_STATE::SURFACE_VERTICAL_ALIGNMENT_VALIGN_4, surfaceState->getSurfaceVerticalAlignment());
195+
EXPECT_EQ(dstImage->getGraphicsAllocation(pClDevice->getRootDeviceIndex())->getGpuAddress(), surfaceState->getSurfaceBaseAddress());
196196
}
197197

198198
HWTEST2_F(EnqueueCopyBufferToImageTest, WhenCopyingBufferToImageThenNumberOfPipelineSelectsIsOne, IsAtMostXeHpcCore) {

opencl/test/unit_test/command_queue/enqueue_copy_image_tests.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -193,31 +193,31 @@ HWTEST_F(EnqueueCopyImageTest, WhenCopyingImageThenSurfaceStateIsCorrect) {
193193
const auto &kernelInfo = mockCmdQ->storedMultiDispatchInfo.begin()->getKernel()->getKernelInfo();
194194
for (uint32_t i = 0; i < 2; ++i) {
195195
uint32_t index = static_cast<uint32_t>(kernelInfo.getArgDescriptorAt(i).template as<ArgDescImage>().bindful) / sizeof(RENDER_SURFACE_STATE);
196-
const auto &surfaceState = getSurfaceState<FamilyType>(&pCmdQ->getIndirectHeap(IndirectHeap::Type::SURFACE_STATE, 0), index);
196+
const auto surfaceState = getSurfaceState<FamilyType>(&pCmdQ->getIndirectHeap(IndirectHeap::Type::SURFACE_STATE, 0), index);
197197
const auto &imageDesc = dstImage->getImageDesc();
198-
EXPECT_EQ(imageDesc.image_width, surfaceState.getWidth());
199-
EXPECT_EQ(imageDesc.image_height, surfaceState.getHeight());
200-
EXPECT_NE(0u, surfaceState.getSurfacePitch());
201-
EXPECT_NE(0u, surfaceState.getSurfaceType());
202-
auto surfaceFormat = surfaceState.getSurfaceFormat();
198+
EXPECT_EQ(imageDesc.image_width, surfaceState->getWidth());
199+
EXPECT_EQ(imageDesc.image_height, surfaceState->getHeight());
200+
EXPECT_NE(0u, surfaceState->getSurfacePitch());
201+
EXPECT_NE(0u, surfaceState->getSurfaceType());
202+
auto surfaceFormat = surfaceState->getSurfaceFormat();
203203
bool isRedescribedFormat =
204204
surfaceFormat == RENDER_SURFACE_STATE::SURFACE_FORMAT_R32G32B32A32_UINT ||
205205
surfaceFormat == RENDER_SURFACE_STATE::SURFACE_FORMAT_R32G32_UINT ||
206206
surfaceFormat == RENDER_SURFACE_STATE::SURFACE_FORMAT_R32_UINT ||
207207
surfaceFormat == RENDER_SURFACE_STATE::SURFACE_FORMAT_R16_UINT ||
208208
surfaceFormat == RENDER_SURFACE_STATE::SURFACE_FORMAT_R8_UINT;
209209
EXPECT_TRUE(isRedescribedFormat);
210-
EXPECT_EQ(MockGmmResourceInfo::getHAlignSurfaceStateResult, surfaceState.getSurfaceHorizontalAlignment());
211-
EXPECT_EQ(RENDER_SURFACE_STATE::SURFACE_VERTICAL_ALIGNMENT_VALIGN_4, surfaceState.getSurfaceVerticalAlignment());
210+
EXPECT_EQ(MockGmmResourceInfo::getHAlignSurfaceStateResult, surfaceState->getSurfaceHorizontalAlignment());
211+
EXPECT_EQ(RENDER_SURFACE_STATE::SURFACE_VERTICAL_ALIGNMENT_VALIGN_4, surfaceState->getSurfaceVerticalAlignment());
212212
}
213213

214214
uint32_t srcIndex = static_cast<uint32_t>(kernelInfo.getArgDescriptorAt(0).template as<ArgDescImage>().bindful) / sizeof(RENDER_SURFACE_STATE);
215-
const auto &srcSurfaceState = getSurfaceState<FamilyType>(&pCmdQ->getIndirectHeap(IndirectHeap::Type::SURFACE_STATE, 0), srcIndex);
216-
EXPECT_EQ(srcImage->getGraphicsAllocation(pClDevice->getRootDeviceIndex())->getGpuAddress(), srcSurfaceState.getSurfaceBaseAddress());
215+
const auto srcSurfaceState = getSurfaceState<FamilyType>(&pCmdQ->getIndirectHeap(IndirectHeap::Type::SURFACE_STATE, 0), srcIndex);
216+
EXPECT_EQ(srcImage->getGraphicsAllocation(pClDevice->getRootDeviceIndex())->getGpuAddress(), srcSurfaceState->getSurfaceBaseAddress());
217217

218218
uint32_t dstIndex = static_cast<uint32_t>(kernelInfo.getArgDescriptorAt(1).template as<ArgDescImage>().bindful) / sizeof(RENDER_SURFACE_STATE);
219-
const auto &dstSurfaceState = getSurfaceState<FamilyType>(&pCmdQ->getIndirectHeap(IndirectHeap::Type::SURFACE_STATE, 0), dstIndex);
220-
EXPECT_EQ(dstImage->getGraphicsAllocation(pClDevice->getRootDeviceIndex())->getGpuAddress(), dstSurfaceState.getSurfaceBaseAddress());
219+
const auto dstSurfaceState = getSurfaceState<FamilyType>(&pCmdQ->getIndirectHeap(IndirectHeap::Type::SURFACE_STATE, 0), dstIndex);
220+
EXPECT_EQ(dstImage->getGraphicsAllocation(pClDevice->getRootDeviceIndex())->getGpuAddress(), dstSurfaceState->getSurfaceBaseAddress());
221221
}
222222

223223
HWTEST2_F(EnqueueCopyImageTest, WhenCopyingImageThenNumberOfPipelineSelectsIsOne, IsAtMostXeHpcCore) {

opencl/test/unit_test/command_queue/enqueue_copy_image_to_buffer_tests.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -169,24 +169,24 @@ HWTEST_F(EnqueueCopyImageToBufferTest, WhenCopyingImageToBufferThenSurfaceStateI
169169

170170
enqueueCopyImageToBuffer<FamilyType>();
171171

172-
const auto &surfaceState = getSurfaceState<FamilyType>(&pCmdQ->getIndirectHeap(IndirectHeap::Type::SURFACE_STATE, 0), 0);
172+
const auto surfaceState = getSurfaceState<FamilyType>(&pCmdQ->getIndirectHeap(IndirectHeap::Type::SURFACE_STATE, 0), 0);
173173
const auto &imageDesc = srcImage->getImageDesc();
174174
// EnqueueReadImage uses multi-byte copies depending on per-pixel-size-in-bytes
175-
EXPECT_EQ(imageDesc.image_width, surfaceState.getWidth());
176-
EXPECT_EQ(imageDesc.image_height, surfaceState.getHeight());
177-
EXPECT_NE(0u, surfaceState.getSurfacePitch());
178-
EXPECT_NE(0u, surfaceState.getSurfaceType());
179-
auto surfaceFormat = surfaceState.getSurfaceFormat();
175+
EXPECT_EQ(imageDesc.image_width, surfaceState->getWidth());
176+
EXPECT_EQ(imageDesc.image_height, surfaceState->getHeight());
177+
EXPECT_NE(0u, surfaceState->getSurfacePitch());
178+
EXPECT_NE(0u, surfaceState->getSurfaceType());
179+
auto surfaceFormat = surfaceState->getSurfaceFormat();
180180
bool isRedescribedFormat =
181181
surfaceFormat == RENDER_SURFACE_STATE::SURFACE_FORMAT_R32G32B32A32_UINT ||
182182
surfaceFormat == RENDER_SURFACE_STATE::SURFACE_FORMAT_R32G32_UINT ||
183183
surfaceFormat == RENDER_SURFACE_STATE::SURFACE_FORMAT_R32_UINT ||
184184
surfaceFormat == RENDER_SURFACE_STATE::SURFACE_FORMAT_R16_UINT ||
185185
surfaceFormat == RENDER_SURFACE_STATE::SURFACE_FORMAT_R8_UINT;
186186
EXPECT_TRUE(isRedescribedFormat);
187-
EXPECT_EQ(MockGmmResourceInfo::getHAlignSurfaceStateResult, surfaceState.getSurfaceHorizontalAlignment());
188-
EXPECT_EQ(RENDER_SURFACE_STATE::SURFACE_VERTICAL_ALIGNMENT_VALIGN_4, surfaceState.getSurfaceVerticalAlignment());
189-
EXPECT_EQ(srcImage->getGraphicsAllocation(pClDevice->getRootDeviceIndex())->getGpuAddress(), surfaceState.getSurfaceBaseAddress());
187+
EXPECT_EQ(MockGmmResourceInfo::getHAlignSurfaceStateResult, surfaceState->getSurfaceHorizontalAlignment());
188+
EXPECT_EQ(RENDER_SURFACE_STATE::SURFACE_VERTICAL_ALIGNMENT_VALIGN_4, surfaceState->getSurfaceVerticalAlignment());
189+
EXPECT_EQ(srcImage->getGraphicsAllocation(pClDevice->getRootDeviceIndex())->getGpuAddress(), surfaceState->getSurfaceBaseAddress());
190190
}
191191

192192
HWTEST2_F(EnqueueCopyImageToBufferTest, WhenCopyingImageToBufferThenNumberOfPipelineSelectsIsOne, IsAtMostXeHpcCore) {

0 commit comments

Comments
 (0)