mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 06:49:52 +08:00
feature: allocating interrupt support
Related-To: NEO-8179 Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
bb6e4f6b15
commit
64af8dd956
@@ -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
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user