mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Ensure shared handle be closed once on Linux
Related-To: NEO-5644 Signed-off-by: Slawomir Milczarek <slawomir.milczarek@intel.com>
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
d60225d995
commit
693f2ff384
@ -573,6 +573,25 @@ TEST_F(DrmMemoryManagerWithExplicitExpectationsTest, givenDrmMemoryManagerCreate
|
||||
EXPECT_NE(nullptr, drmMemoryManger.peekGemCloseWorker());
|
||||
}
|
||||
|
||||
TEST_F(DrmMemoryManagerTest, GivenAllocationWhenClosingSharedHandleThenSucceeds) {
|
||||
mock->ioctl_expected.primeFdToHandle = 1;
|
||||
mock->ioctl_expected.gemWait = 1;
|
||||
mock->ioctl_expected.gemClose = 1;
|
||||
|
||||
osHandle handle = 1u;
|
||||
this->mock->outputHandle = 2u;
|
||||
size_t size = 4096u;
|
||||
AllocationProperties properties(rootDeviceIndex, false, size, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, {});
|
||||
|
||||
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, false);
|
||||
EXPECT_EQ(handle, graphicsAllocation->peekSharedHandle());
|
||||
|
||||
memoryManager->closeSharedHandle(graphicsAllocation);
|
||||
EXPECT_EQ(Sharing::nonSharedResource, graphicsAllocation->peekSharedHandle());
|
||||
|
||||
memoryManager->freeGraphicsMemory(graphicsAllocation);
|
||||
}
|
||||
|
||||
TEST_F(DrmMemoryManagerTest, GivenAllocationWhenFreeingThenSucceeds) {
|
||||
mock->ioctl_expected.gemUserptr = 1;
|
||||
mock->ioctl_expected.gemWait = 1;
|
||||
|
Reference in New Issue
Block a user