mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-25 05:24:02 +08:00
Move OsContext to Device
Change-Id: I030b65372fbdc075423d22720e9da34ac65b8e68 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
c014c49102
commit
92bfd2e3d2
@@ -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());
|
||||
}
|
||||
Reference in New Issue
Block a user