feature: allocating interrupt support

Related-To: NEO-8179

Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski
2024-06-03 16:23:41 +00:00
committed by Compute-Runtime-Automation
parent bb6e4f6b15
commit 64af8dd956
9 changed files with 85 additions and 2 deletions

View File

@@ -56,6 +56,17 @@ class MockIoctlHelper : public IoctlHelperPrelim20 {
return IoctlHelperPrelim20::isWaitBeforeBindRequired(bind);
}
bool allocateInterrupt(uint32_t &handle) override {
allocateInterruptCalled++;
return IoctlHelperPrelim20::allocateInterrupt(handle);
}
bool releaseInterrupt(uint32_t handle) override {
releaseInterruptCalled++;
latestReleaseInterruptHandle = handle;
return IoctlHelperPrelim20::releaseInterrupt(handle);
}
std::unique_ptr<MemoryInfo> createMemoryInfo() override {
std::vector<MemoryRegion> regionInfo(3);
@@ -77,5 +88,8 @@ class MockIoctlHelper : public IoctlHelperPrelim20 {
int drmParamValue = 1234;
std::optional<bool> failBind{};
std::optional<bool> waitBeforeBindRequired{};
uint32_t allocateInterruptCalled = 0;
uint32_t releaseInterruptCalled = 0;
uint32_t latestReleaseInterruptHandle = InterruptId::notUsed;
};
} // namespace NEO

View File

@@ -1700,6 +1700,30 @@ TEST_F(DrmMemoryManagerTest, givenRequiresStandard2MBHeapThenStandard2MBHeapIsAc
EXPECT_GT(gmmHelper->canonize(memoryManager->getGfxPartition(rootDeviceIndex)->getHeapLimit(HeapIndex::heapStandard2MB)), range);
}
TEST_F(DrmMemoryManagerTest, whenCallingAllocateAndReleaseInterruptThenCallIoctlHelper) {
auto mockIoctlHelper = new MockIoctlHelper(*mock);
auto &drm = static_cast<DrmMockCustom &>(memoryManager->getDrm(rootDeviceIndex));
drm.ioctlHelper.reset(mockIoctlHelper);
uint32_t handle = 0;
EXPECT_EQ(0u, mockIoctlHelper->allocateInterruptCalled);
EXPECT_EQ(0u, mockIoctlHelper->releaseInterruptCalled);
memoryManager->allocateInterrupt(handle, rootDeviceIndex);
EXPECT_EQ(1u, mockIoctlHelper->allocateInterruptCalled);
EXPECT_EQ(0u, mockIoctlHelper->releaseInterruptCalled);
handle = 123;
EXPECT_EQ(InterruptId::notUsed, mockIoctlHelper->latestReleaseInterruptHandle);
memoryManager->releaseInterrupt(handle, rootDeviceIndex);
EXPECT_EQ(1u, mockIoctlHelper->allocateInterruptCalled);
EXPECT_EQ(1u, mockIoctlHelper->releaseInterruptCalled);
EXPECT_EQ(123u, mockIoctlHelper->latestReleaseInterruptHandle);
}
TEST_F(DrmMemoryManagerTest, GivenShareableEnabledWhenAskedToCreateGraphicsAllocationThenValidAllocationIsReturnedAndStandard64KBHeapIsUsed) {
mock->ioctlHelper.reset(new MockIoctlHelper(*mock));
mock->queryMemoryInfo();