mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-30 01:35:20 +08:00
fix: do not unregister shared allocation
Allocations imported from shared handle are not using registerAlloc in drm manager but on free, unregister was called. This could lead to problems with allocation size tracking. This change will skip the unregisterAllocation call if allocation is imported from shared handle. Signed-off-by: Dominik Dabek <dominik.dabek@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
14c8f1f15d
commit
ac8dcdb298
@@ -3055,6 +3055,22 @@ TEST_F(DrmMemoryManagerBasic, givenMemoryManagerWhenCreateAllocationFromHandleIs
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
}
|
||||
|
||||
TEST_F(DrmMemoryManagerBasic, givenMemoryManagerWhenCreateAllocationFromHandleIsCalledThenAllocationIsNotRegisteredNorUnregistered) {
|
||||
std::unique_ptr<TestedDrmMemoryManager> memoryManager(new (std::nothrow) TestedDrmMemoryManager(false,
|
||||
false,
|
||||
true,
|
||||
executionEnvironment));
|
||||
TestedDrmMemoryManager::OsHandleData osHandleData{1u};
|
||||
AllocationProperties properties(rootDeviceIndex, false, MemoryConstants::pageSize, AllocationType::sharedBuffer, false, {});
|
||||
|
||||
auto allocation = memoryManager->createGraphicsAllocationFromSharedHandle(osHandleData, properties, false, false, true, nullptr);
|
||||
EXPECT_NE(nullptr, allocation);
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
EXPECT_EQ(0u, memoryManager->registerSysMemAllocCalled);
|
||||
EXPECT_EQ(0u, memoryManager->registerLocalMemAllocCalled);
|
||||
EXPECT_EQ(0u, memoryManager->unregisterAllocationCalled);
|
||||
}
|
||||
|
||||
TEST_F(DrmMemoryManagerWithExplicitExpectationsTest, givenDisabledForcePinAndEnabledValidateHostMemoryWhenPinBBAllocationFailsThenUnrecoverableIsCalled) {
|
||||
this->mock = static_cast<DrmMockCustom *>(executionEnvironment->rootDeviceEnvironments[0]->osInterface->getDriverModel()->as<Drm>());
|
||||
this->mock->reset();
|
||||
|
||||
Reference in New Issue
Block a user