Timestamp Packet ownership

- Tag allocator: reference count tracking
- Obtain tag by command queue and pass to Event if exist during enqueue
- Handle Timestamp Packet lifetime on Event and CmdQueue destruction

Change-Id: I9a5969830ea7a9d729e6f70519d8c28ff70fcf06
Signed-off-by: Dunajski, Bartosz <bartosz.dunajski@intel.com>
This commit is contained in:
Dunajski, Bartosz
2018-08-28 14:11:25 +02:00
committed by sys_ocldev
parent b49101803c
commit da0f9381dc
11 changed files with 174 additions and 27 deletions

View File

@ -251,3 +251,21 @@ TEST_F(TagAllocatorTest, CleanupResources) {
EXPECT_EQ(0u, tagAllocator.getGraphicsAllocationsCount());
EXPECT_EQ(0u, tagAllocator.getTagPoolCount());
}
TEST_F(TagAllocatorTest, givenMultipleReferencesOnTagWhenReleasingThenReturnWhenAllRefCountsAreReleased) {
MockTagAllocator tagAllocator(memoryManager, 2, 1);
auto tag = tagAllocator.getTag();
EXPECT_NE(nullptr, tagAllocator.getUsedTagsHead());
tagAllocator.returnTag(tag);
EXPECT_EQ(nullptr, tagAllocator.getUsedTagsHead()); // only 1 reference
tag = tagAllocator.getTag();
tag->incRefCount();
EXPECT_NE(nullptr, tagAllocator.getUsedTagsHead());
tagAllocator.returnTag(tag);
EXPECT_NE(nullptr, tagAllocator.getUsedTagsHead()); // 1 reference left
tagAllocator.returnTag(tag);
EXPECT_EQ(nullptr, tagAllocator.getUsedTagsHead());
}