|
14 | 14 | #include "runtime/command_stream/command_stream_receiver.h" |
15 | 15 | #include "runtime/command_stream/linear_stream.h" |
16 | 16 | #include "runtime/command_stream/preemption.h" |
| 17 | +#include "runtime/command_stream/scratch_space_controller.h" |
17 | 18 | #include "runtime/event/user_event.h" |
18 | 19 | #include "runtime/helpers/cache_policy.h" |
19 | 20 | #include "runtime/helpers/preamble.h" |
@@ -253,3 +254,60 @@ HWTEST_F(CommandStreamReceiverFlushTaskGmockTests, givenMockCsrWhenCollectStateB |
253 | 254 | EXPECT_EQ(gshPatch.sourceAllocation, generalStateBase); |
254 | 255 | EXPECT_EQ(gshPatch.targetAllocationOffset, commandOffset + STATE_BASE_ADDRESS::PATCH_CONSTANTS::GENERALSTATEBASEADDRESS_BYTEOFFSET); |
255 | 256 | } |
| 257 | + |
| 258 | +HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverFlushTaskGmockTests, givenPatchInfoCollectionEnabledWhenScratchSpaceIsProgrammedThenPatchInfoIsCollected) { |
| 259 | + DebugManagerStateRestore dbgRestore; |
| 260 | + DebugManager.flags.AddPatchInfoCommentsForAUBDump.set(true); |
| 261 | + |
| 262 | + CommandQueueHw<FamilyType> commandQueue(nullptr, pDevice, 0); |
| 263 | + auto &commandStream = commandQueue.getCS(4096u); |
| 264 | + |
| 265 | + std::unique_ptr<MockCsrHw2<FamilyType>> mockCsr(new MockCsrHw2<FamilyType>(*pDevice->executionEnvironment)); |
| 266 | + mockCsr->overwriteFlatBatchBufferHelper(new MockFlatBatchBufferHelper<FamilyType>(*pDevice->executionEnvironment)); |
| 267 | + |
| 268 | + bool stateBaseAddressDirty; |
| 269 | + bool vfeStateDirty; |
| 270 | + mockCsr->getScratchSpaceController()->setRequiredScratchSpace(nullptr, 10u, 0u, 1u, 0u, stateBaseAddressDirty, vfeStateDirty); |
| 271 | + |
| 272 | + DispatchFlags flags; |
| 273 | + mockCsr->requiredScratchSize = 0x200000; |
| 274 | + |
| 275 | + mockCsr->programVFEState(commandStream, flags, 10); |
| 276 | + ASSERT_EQ(1u, mockCsr->getFlatBatchBufferHelper().getPatchInfoCollection().size()); |
| 277 | + EXPECT_EQ(mockCsr->getScratchSpaceController()->getScratchPatchAddress(), mockCsr->getFlatBatchBufferHelper().getPatchInfoCollection().at(0).sourceAllocation); |
| 278 | +} |
| 279 | + |
| 280 | +HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverFlushTaskGmockTests, givenPatchInfoCollectionDisabledWhenScratchSpaceIsProgrammedThenPatchInfoIsNotCollected) { |
| 281 | + CommandQueueHw<FamilyType> commandQueue(nullptr, pDevice, 0); |
| 282 | + auto &commandStream = commandQueue.getCS(4096u); |
| 283 | + |
| 284 | + std::unique_ptr<MockCsrHw2<FamilyType>> mockCsr(new MockCsrHw2<FamilyType>(*pDevice->executionEnvironment)); |
| 285 | + mockCsr->overwriteFlatBatchBufferHelper(new MockFlatBatchBufferHelper<FamilyType>(*pDevice->executionEnvironment)); |
| 286 | + |
| 287 | + bool stateBaseAddressDirty; |
| 288 | + bool vfeStateDirty; |
| 289 | + mockCsr->getScratchSpaceController()->setRequiredScratchSpace(nullptr, 10u, 0u, 1u, 0u, stateBaseAddressDirty, vfeStateDirty); |
| 290 | + |
| 291 | + DispatchFlags flags; |
| 292 | + mockCsr->requiredScratchSize = 0x200000; |
| 293 | + |
| 294 | + mockCsr->programVFEState(commandStream, flags, 10); |
| 295 | + EXPECT_EQ(0u, mockCsr->getFlatBatchBufferHelper().getPatchInfoCollection().size()); |
| 296 | +} |
| 297 | + |
| 298 | +HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverFlushTaskGmockTests, givenPatchInfoCollectionEnabledWhenMediaVfeStateIsProgrammedWithEmptyScratchThenPatchInfoIsNotCollected) { |
| 299 | + DebugManagerStateRestore dbgRestore; |
| 300 | + DebugManager.flags.AddPatchInfoCommentsForAUBDump.set(true); |
| 301 | + |
| 302 | + CommandQueueHw<FamilyType> commandQueue(nullptr, pDevice, 0); |
| 303 | + auto &commandStream = commandQueue.getCS(4096u); |
| 304 | + |
| 305 | + std::unique_ptr<MockCsrHw2<FamilyType>> mockCsr(new MockCsrHw2<FamilyType>(*pDevice->executionEnvironment)); |
| 306 | + mockCsr->overwriteFlatBatchBufferHelper(new MockFlatBatchBufferHelper<FamilyType>(*pDevice->executionEnvironment)); |
| 307 | + |
| 308 | + DispatchFlags flags; |
| 309 | + mockCsr->requiredScratchSize = 0x200000; |
| 310 | + |
| 311 | + mockCsr->programVFEState(commandStream, flags, 10); |
| 312 | + EXPECT_EQ(0u, mockCsr->getFlatBatchBufferHelper().getPatchInfoCollection().size()); |
| 313 | +} |
0 commit comments