Move OsContext to Device

Change-Id: I030b65372fbdc075423d22720e9da34ac65b8e68
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2018-08-27 15:48:29 +02:00
committed by sys_ocldev
parent c014c49102
commit 92bfd2e3d2
58 changed files with 615 additions and 429 deletions

View File

@@ -1789,3 +1789,26 @@ TEST(GraphicsAllocation, givenSharedHandleBasedConstructorWhenGraphicsAllocation
GraphicsAllocation graphicsAllocation(addressWithTrailingBitSet, 1u, sharedHandle);
EXPECT_EQ(expectedGpuAddress, graphicsAllocation.getGpuAddress());
}
TEST(ResidencyDataTest, givenResidencyDataWithOsContextWhenDestructorIsCalledThenDecrementRefCount) {
OsContext *osContext = new OsContext(nullptr);
osContext->incRefInternal();
EXPECT_EQ(1, osContext->getRefInternalCount());
{
ResidencyData residencyData;
residencyData.addOsContext(osContext);
EXPECT_EQ(2, osContext->getRefInternalCount());
}
EXPECT_EQ(1, osContext->getRefInternalCount());
osContext->decRefInternal();
}
TEST(ResidencyDataTest, givenResidencyDataWhenAddTheSameOsContextTwiceThenIncrementRefCounterOnlyOnce) {
OsContext *osContext = new OsContext(nullptr);
ResidencyData residencyData;
EXPECT_EQ(0, osContext->getRefInternalCount());
residencyData.addOsContext(osContext);
EXPECT_EQ(1, osContext->getRefInternalCount());
residencyData.addOsContext(osContext);
EXPECT_EQ(1, osContext->getRefInternalCount());
}