Skip to content

Commit 3c47c41

Browse files
Refactor HardwareParse::getSurfaceState() to return CPU memory
- if SSH indirectHeap is passed, use CPU address instead of GPU address programed in SBA command Change-Id: Id2c8973db0dfe2d9562ee835a27c4d3c28ea3351
1 parent eb65521 commit 3c47c41

8 files changed

+18
-15
lines changed

unit_tests/command_queue/enqueue_copy_buffer_to_image_tests.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2017-2018 Intel Corporation
2+
* Copyright (C) 2017-2019 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -152,7 +152,7 @@ HWTEST_F(EnqueueCopyBufferToImageTest, surfaceState) {
152152

153153
enqueueCopyBufferToImage<FamilyType>();
154154

155-
const auto &surfaceState = getSurfaceState<FamilyType>(1);
155+
const auto &surfaceState = getSurfaceState<FamilyType>(&pCmdQ->getIndirectHeap(IndirectHeap::SURFACE_STATE, 0), 1);
156156
const auto &imageDesc = dstImage->getImageDesc();
157157
// EnqueueReadImage uses multi-byte copies depending on per-pixel-size-in-bytes
158158
EXPECT_EQ(imageDesc.image_width, surfaceState.getWidth());

unit_tests/command_queue/enqueue_copy_image_tests.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2017-2018 Intel Corporation
2+
* Copyright (C) 2017-2019 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -156,7 +156,7 @@ HWTEST_F(EnqueueCopyImageTest, surfaceState) {
156156
enqueueCopyImage<FamilyType>();
157157

158158
for (uint32_t i = 0; i < 2; ++i) {
159-
const auto &surfaceState = getSurfaceState<FamilyType>(i);
159+
const auto &surfaceState = getSurfaceState<FamilyType>(&pCmdQ->getIndirectHeap(IndirectHeap::SURFACE_STATE, 0), i);
160160
const auto &imageDesc = dstImage->getImageDesc();
161161
EXPECT_EQ(imageDesc.image_width, surfaceState.getWidth());
162162
EXPECT_EQ(imageDesc.image_height, surfaceState.getHeight());
@@ -174,10 +174,10 @@ HWTEST_F(EnqueueCopyImageTest, surfaceState) {
174174
EXPECT_EQ(RENDER_SURFACE_STATE::SURFACE_VERTICAL_ALIGNMENT_VALIGN_4, surfaceState.getSurfaceVerticalAlignment());
175175
}
176176

177-
const auto &srcSurfaceState = getSurfaceState<FamilyType>(0);
177+
const auto &srcSurfaceState = getSurfaceState<FamilyType>(&pCmdQ->getIndirectHeap(IndirectHeap::SURFACE_STATE, 0), 0);
178178
EXPECT_EQ(reinterpret_cast<uint64_t>(srcImage->getCpuAddress()), srcSurfaceState.getSurfaceBaseAddress());
179179

180-
const auto &dstSurfaceState = getSurfaceState<FamilyType>(1);
180+
const auto &dstSurfaceState = getSurfaceState<FamilyType>(&pCmdQ->getIndirectHeap(IndirectHeap::SURFACE_STATE, 0), 1);
181181
EXPECT_EQ(reinterpret_cast<uint64_t>(dstImage->getCpuAddress()), dstSurfaceState.getSurfaceBaseAddress());
182182
}
183183

unit_tests/command_queue/enqueue_copy_image_to_buffer_tests.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2017-2018 Intel Corporation
2+
* Copyright (C) 2017-2019 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -153,7 +153,7 @@ HWTEST_F(EnqueueCopyImageToBufferTest, surfaceState) {
153153

154154
enqueueCopyImageToBuffer<FamilyType>();
155155

156-
const auto &surfaceState = getSurfaceState<FamilyType>(0);
156+
const auto &surfaceState = getSurfaceState<FamilyType>(&pCmdQ->getIndirectHeap(IndirectHeap::SURFACE_STATE, 0), 0);
157157
const auto &imageDesc = srcImage->getImageDesc();
158158
// EnqueueReadImage uses multi-byte copies depending on per-pixel-size-in-bytes
159159
EXPECT_EQ(imageDesc.image_width, surfaceState.getWidth());

unit_tests/command_queue/enqueue_fill_image_tests.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ HWTEST_F(EnqueueFillImageTest, surfaceState) {
163163

164164
enqueueFillImage<FamilyType>();
165165

166-
const auto &surfaceState = getSurfaceState<FamilyType>(0);
166+
const auto &surfaceState = getSurfaceState<FamilyType>(&pCmdQ->getIndirectHeap(IndirectHeap::SURFACE_STATE, 0), 0);
167167
const auto &imageDesc = image->getImageDesc();
168168
EXPECT_EQ(imageDesc.image_width, surfaceState.getWidth());
169169
EXPECT_EQ(imageDesc.image_height, surfaceState.getHeight());
@@ -172,7 +172,7 @@ HWTEST_F(EnqueueFillImageTest, surfaceState) {
172172
EXPECT_EQ(RENDER_SURFACE_STATE::SURFACE_HORIZONTAL_ALIGNMENT_HALIGN_4, surfaceState.getSurfaceHorizontalAlignment());
173173
EXPECT_EQ(RENDER_SURFACE_STATE::SURFACE_VERTICAL_ALIGNMENT_VALIGN_4, surfaceState.getSurfaceVerticalAlignment());
174174

175-
const auto &srcSurfaceState = getSurfaceState<FamilyType>(0);
175+
const auto &srcSurfaceState = getSurfaceState<FamilyType>(&pCmdQ->getIndirectHeap(IndirectHeap::SURFACE_STATE, 0), 0);
176176
EXPECT_EQ(reinterpret_cast<uint64_t>(image->getCpuAddress()), srcSurfaceState.getSurfaceBaseAddress());
177177
}
178178

unit_tests/command_queue/enqueue_read_image_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ HWTEST_F(EnqueueReadImageTest, surfaceState) {
166166

167167
// BufferToImage kernel uses BTI=1 for destSurface
168168
uint32_t bindingTableIndex = 0;
169-
const auto &surfaceState = getSurfaceState<FamilyType>(bindingTableIndex);
169+
const auto &surfaceState = getSurfaceState<FamilyType>(&pCmdQ->getIndirectHeap(IndirectHeap::SURFACE_STATE, 0), bindingTableIndex);
170170

171171
// EnqueueReadImage uses multi-byte copies depending on per-pixel-size-in-bytes
172172
const auto &imageDesc = srcImage->getImageDesc();

unit_tests/command_queue/enqueue_write_image_tests.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2017-2018 Intel Corporation
2+
* Copyright (C) 2017-2019 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -166,7 +166,7 @@ HWTEST_F(EnqueueWriteImageTest, surfaceState) {
166166

167167
// BufferToImage kernel uses BTI=1 for destSurface
168168
uint32_t bindingTableIndex = 1;
169-
const auto &surfaceState = getSurfaceState<FamilyType>(bindingTableIndex);
169+
const auto &surfaceState = getSurfaceState<FamilyType>(&pCmdQ->getIndirectHeap(IndirectHeap::SURFACE_STATE, 0), bindingTableIndex);
170170

171171
// EnqueueWriteImage uses multi-byte copies depending on per-pixel-size-in-bytes
172172
const auto &imageDesc = dstImage->getImageDesc();

unit_tests/helpers/hw_parse.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ struct HardwareParse {
9898
}
9999

100100
template <typename FamilyType>
101-
const typename FamilyType::RENDER_SURFACE_STATE &getSurfaceState(uint32_t index) {
101+
const typename FamilyType::RENDER_SURFACE_STATE &getSurfaceState(IndirectHeap *ssh, uint32_t index) {
102102
typedef typename FamilyType::BINDING_TABLE_STATE BINDING_TABLE_STATE;
103103
typedef typename FamilyType::INTERFACE_DESCRIPTOR_DATA INTERFACE_DESCRIPTOR_DATA;
104104
typedef typename FamilyType::RENDER_SURFACE_STATE RENDER_SURFACE_STATE;
@@ -108,6 +108,9 @@ struct HardwareParse {
108108

109109
auto cmdSBA = (STATE_BASE_ADDRESS *)cmdStateBaseAddress;
110110
auto surfaceStateHeap = cmdSBA->getSurfaceStateBaseAddress();
111+
if (ssh && (ssh->getHeapGpuBase() == surfaceStateHeap)) {
112+
surfaceStateHeap = reinterpret_cast<uint64_t>(ssh->getCpuBase());
113+
}
111114
EXPECT_NE(0u, surfaceStateHeap);
112115

113116
auto bindingTablePointer = interfaceDescriptorData.getBindingTablePointer();

unit_tests/scenarios/windows/enqueue_read_write_buffer_scenarios_windows_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ HWTEST_F(EnqueueBufferWindowsTest, givenMisalignedHostPtrWhenEnqueueReadBufferCa
103103
parseCommands<FamilyType>(*cmdQ);
104104

105105
if (hwInfo->capabilityTable.gpuAddressSpace == MemoryConstants::max48BitAddress) {
106-
const auto &surfaceStateDst = getSurfaceState<FamilyType>(1);
106+
const auto &surfaceStateDst = getSurfaceState<FamilyType>(&cmdQ->getIndirectHeap(IndirectHeap::SURFACE_STATE, 0), 1);
107107

108108
if (kernel->getKernelInfo().kernelArgInfo[1].kernelArgPatchInfoVector[0].size == sizeof(uint64_t)) {
109109
auto pKernelArg = (uint64_t *)(kernel->getCrossThreadData() +

0 commit comments

Comments
 (0)