From c0d3eade30075922f708d3b15c846320e6e2ce8f Mon Sep 17 00:00:00 2001 From: "Dunajski, Bartosz" Date: Thu, 15 Mar 2018 13:46:58 +0100 Subject: [PATCH] Disable wait timeout when flushStamp is 0 Change-Id: I416ace1f8c1a3e5aa91d9bc2425a4faa77e2fbe7 --- runtime/command_stream/command_stream_receiver_hw.inl | 4 +++- unit_tests/command_queue/command_queue_tests.cpp | 11 +++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/runtime/command_stream/command_stream_receiver_hw.inl b/runtime/command_stream/command_stream_receiver_hw.inl index 5806caf69d..3b3e27f248 100644 --- a/runtime/command_stream/command_stream_receiver_hw.inl +++ b/runtime/command_stream/command_stream_receiver_hw.inl @@ -559,7 +559,9 @@ inline void CommandStreamReceiverHw::emitNoop(LinearStream &commandSt template inline void CommandStreamReceiverHw::waitForTaskCountWithKmdNotifyFallback(uint32_t taskCountToWait, FlushStamp flushStampToWait) { - auto status = waitForCompletionWithTimeout(this->hwInfo.capabilityTable.enableKmdNotify, this->hwInfo.capabilityTable.delayKmdNotifyMicroseconds, taskCountToWait); + auto status = waitForCompletionWithTimeout(this->hwInfo.capabilityTable.enableKmdNotify && flushStampToWait != 0, + this->hwInfo.capabilityTable.delayKmdNotifyMicroseconds, + taskCountToWait); if (!status) { waitForFlushStamp(flushStampToWait); //now call blocking wait, this is to ensure that task count is reached diff --git a/unit_tests/command_queue/command_queue_tests.cpp b/unit_tests/command_queue/command_queue_tests.cpp index 68f3487881..f9952fd143 100644 --- a/unit_tests/command_queue/command_queue_tests.cpp +++ b/unit_tests/command_queue/command_queue_tests.cpp @@ -762,6 +762,17 @@ HWTEST_F(KmdNotifyTests, givenMultipleCommandQueuesWhenMarkerIsEmittedThenGraphi EXPECT_EQ(commandStreamGraphicsAllocation, commandStreamGraphicsAllocation2); } +HWTEST_F(KmdNotifyTests, givenZeroFlushStampWhenWaitIsCalledThenDisableTimeout) { + auto csr = new ::testing::NiceMock>(device->getHardwareInfo()); + device->resetCommandStreamReceiver(csr); + + EXPECT_TRUE(device->getHardwareInfo().capabilityTable.enableKmdNotify); + EXPECT_CALL(*csr, waitForCompletionWithTimeout(false, ::testing::_, taskCountToWait)).Times(1).WillOnce(::testing::Return(true)); + EXPECT_CALL(*csr, waitForFlushStamp(::testing::_)).Times(0); + + csr->waitForTaskCountWithKmdNotifyFallback(taskCountToWait, 0); +} + constexpr char sipPattern[] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 39, 41}; static_assert(false == isAligned(sizeof(sipPattern)), "Will be checking for automatic cacheline alignment, so pattern length must not be a multiple of cacheline");