Move KMD Notify logic from CSR to specialized helper

- Decission about timeout enabling and value moved out of CSR
- Timeout multiplier is no longer Linux specific

Change-Id: I6858fe2f811ef13802b95e0470e310210a9dea8b
This commit is contained in:
Dunajski, Bartosz
2018-04-09 10:05:32 +02:00
committed by sys_ocldev
parent 10ada58bd6
commit 87f8f735f9
10 changed files with 63 additions and 53 deletions

View File

@@ -60,10 +60,6 @@ struct KmdNotifyTests : public ::testing::Test {
MyCsr(const HardwareInfo &hwInfo) : UltCommandStreamReceiver<Family>(hwInfo) {}
MOCK_METHOD1(waitForFlushStamp, bool(FlushStamp &flushStampToWait));
MOCK_METHOD3(waitForCompletionWithTimeout, bool(bool enableTimeout, int64_t timeoutMs, uint32_t taskCountToWait));
int64_t computeTimeoutMultiplierRetValue = 1u;
protected:
int64_t computeTimeoutMultiplier(bool useQuickKmdSleep, uint32_t taskCountDiff) const override { return computeTimeoutMultiplierRetValue; };
};
HardwareInfo localHwInfo = **platformDevices;
@@ -204,11 +200,44 @@ HWTEST_F(KmdNotifyTests, givenQuickSleepRequestWhenItsSporadicWaitOptimizationIs
HWTEST_F(KmdNotifyTests, givenComputeTimeoutMultiplierWhenWaitCalledThenUseNewTimeout) {
auto csr = new ::testing::NiceMock<MyCsr<FamilyType>>(device->getHardwareInfo());
csr->computeTimeoutMultiplierRetValue = 3;
device->resetCommandStreamReceiver(csr);
*device->getTagAddress() = taskCountToWait;
taskCountToWait += 5;
auto expectedTimeout = device->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds *
csr->computeTimeoutMultiplierRetValue;
(taskCountToWait - *device->getTagAddress());
auto updateHwTag = [&](bool, int64_t, uint32_t) {
*device->getTagAddress() = taskCountToWait;
return true;
};
EXPECT_CALL(*csr, waitForCompletionWithTimeout(true, expectedTimeout, ::testing::_)).Times(1).WillOnce(::testing::Invoke(updateHwTag));
csr->waitForTaskCountWithKmdNotifyFallback(taskCountToWait, 1, false);
}
HWTEST_F(KmdNotifyTests, givenTaskCountEqualToHwTagWhenWaitCalledThenDontMultiplyTimeout) {
auto csr = new ::testing::NiceMock<MyCsr<FamilyType>>(device->getHardwareInfo());
device->resetCommandStreamReceiver(csr);
*device->getTagAddress() = taskCountToWait;
auto expectedTimeout = device->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds;
EXPECT_CALL(*csr, waitForCompletionWithTimeout(true, expectedTimeout, ::testing::_)).Times(1).WillOnce(::testing::Return(true));
csr->waitForTaskCountWithKmdNotifyFallback(taskCountToWait, 1, false);
}
HWTEST_F(KmdNotifyTests, givenTaskCountLowerThanHwTagWhenWaitCalledThenDontMultiplyTimeout) {
auto csr = new ::testing::NiceMock<MyCsr<FamilyType>>(device->getHardwareInfo());
device->resetCommandStreamReceiver(csr);
*device->getTagAddress() = taskCountToWait + 5;
auto expectedTimeout = device->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds;
EXPECT_CALL(*csr, waitForCompletionWithTimeout(true, expectedTimeout, ::testing::_)).Times(1).WillOnce(::testing::Return(true));