@@ -93,6 +93,7 @@ struct MockDrmDirectSubmission : public DrmDirectSubmission<GfxFamily, Dispatche
93
93
using BaseClass::inputMonitorFenceDispatchRequirement;
94
94
using BaseClass::isCompleted;
95
95
using BaseClass::isNewResourceHandleNeeded;
96
+ using BaseClass::lastUllsLightExecTimestamp;
96
97
using BaseClass::miMemFenceRequired;
97
98
using BaseClass::partitionConfigSet;
98
99
using BaseClass::partitionedMode;
@@ -106,6 +107,16 @@ struct MockDrmDirectSubmission : public DrmDirectSubmission<GfxFamily, Dispatche
106
107
using BaseClass::updateTagValue;
107
108
using BaseClass::wait;
108
109
using BaseClass::workPartitionAllocation;
110
+
111
+ MockDrmDirectSubmission (const DirectSubmissionInputParams &inputParams) : BaseClass(inputParams) {
112
+ this ->lastUllsLightExecTimestamp = std::chrono::time_point<std::chrono::steady_clock>::max ();
113
+ }
114
+
115
+ std::chrono::steady_clock::time_point getCpuTimePoint () override {
116
+ return this ->callBaseGetCpuTimePoint ? BaseClass::getCpuTimePoint () : cpuTimePointReturnValue;
117
+ }
118
+ std::chrono::steady_clock::time_point cpuTimePointReturnValue{};
119
+ bool callBaseGetCpuTimePoint = true ;
109
120
};
110
121
111
122
using namespace NEO ;
@@ -810,6 +821,58 @@ HWTEST_F(DrmDirectSubmissionTest, givenDirectSubmissionLightWhenRegisterResource
810
821
executionEnvironment.memoryManager ->freeGraphicsMemory (commandBuffer);
811
822
}
812
823
824
+ HWTEST_F (DrmDirectSubmissionTest, givenDirectSubmissionLightWhenExecTimeoutReachedThenRestart) {
825
+ using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
826
+ using BATCH_BUFFER_END = typename FamilyType::MI_BATCH_BUFFER_END;
827
+ MockDrmDirectSubmission<FamilyType, RenderDispatcher<FamilyType>> drmDirectSubmission (*device->getDefaultEngine ().commandStreamReceiver );
828
+ EXPECT_TRUE (drmDirectSubmission.initialize (false ));
829
+
830
+ FlushStampTracker flushStamp (true );
831
+ BatchBuffer batchBuffer = {};
832
+ GraphicsAllocation *commandBuffer = nullptr ;
833
+ LinearStream stream;
834
+
835
+ const AllocationProperties commandBufferProperties{device->getRootDeviceIndex (), 0x1000 ,
836
+ AllocationType::commandBuffer, device->getDeviceBitfield ()};
837
+ commandBuffer = executionEnvironment.memoryManager ->allocateGraphicsMemoryWithProperties (commandBufferProperties);
838
+
839
+ stream.replaceGraphicsAllocation (commandBuffer);
840
+ stream.replaceBuffer (commandBuffer->getUnderlyingBuffer (), commandBuffer->getUnderlyingBufferSize ());
841
+ stream.getSpace (0x20 );
842
+
843
+ memset (stream.getCpuBase (), 0 , 0x20 );
844
+
845
+ batchBuffer.endCmdPtr = ptrOffset (stream.getCpuBase (), 0x20 );
846
+ batchBuffer.commandBufferAllocation = commandBuffer;
847
+ batchBuffer.usedSize = 0x40 ;
848
+ batchBuffer.taskStartAddress = 0x881112340000 ;
849
+ batchBuffer.stream = &stream;
850
+ batchBuffer.hasStallingCmds = true ;
851
+
852
+ ResidencyContainer residencyContainer{};
853
+ batchBuffer.allocationsForResidency = &residencyContainer;
854
+ drmDirectSubmission.ringStart = true ;
855
+ static_cast <DrmMemoryOperationsHandler *>(executionEnvironment.rootDeviceEnvironments [device->getRootDeviceIndex ()]->memoryOperationsInterface .get ())->obtainAndResetNewResourcesSinceLastRingSubmit ();
856
+
857
+ drmDirectSubmission.lastUllsLightExecTimestamp = std::chrono::steady_clock::time_point{};
858
+ drmDirectSubmission.cpuTimePointReturnValue = std::chrono::time_point<std::chrono::steady_clock>::max ();
859
+ drmDirectSubmission.callBaseGetCpuTimePoint = false ;
860
+
861
+ EXPECT_TRUE (drmDirectSubmission.dispatchCommandBuffer (batchBuffer, flushStamp));
862
+
863
+ HardwareParse hwParse;
864
+ hwParse.parsePipeControl = true ;
865
+ hwParse.parseCommands <FamilyType>(drmDirectSubmission.ringCommandStream , 0 );
866
+ hwParse.findHardwareCommands <FamilyType>();
867
+ auto *pipeControl = hwParse.getCommand <PIPE_CONTROL>();
868
+ EXPECT_NE (pipeControl, nullptr );
869
+ auto *bbe = hwParse.getCommand <BATCH_BUFFER_END>();
870
+ EXPECT_NE (bbe, nullptr );
871
+
872
+ drmDirectSubmission.ringStart = false ;
873
+ executionEnvironment.memoryManager ->freeGraphicsMemory (commandBuffer);
874
+ }
875
+
813
876
HWTEST_F (DrmDirectSubmissionTest, givenDirectSubmissionLightWhenNoRegisteredResourcesThenNoRestart) {
814
877
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
815
878
using BATCH_BUFFER_END = typename FamilyType::MI_BATCH_BUFFER_END;
0 commit comments