Move OsContext id setting to constructor.

Change-Id: I1b809befc02536257800e3667307b8deabd5c95d
This commit is contained in:
Mrozek, Michal
2018-09-12 07:47:55 +02:00
committed by sys_ocldev
parent 8e33ec04c5
commit 581805cc88
15 changed files with 39 additions and 27 deletions

View File

@@ -1825,13 +1825,24 @@ TEST(GraphicsAllocation, givenSharedHandleBasedConstructorWhenGraphicsAllocation
}
TEST(ResidencyDataTest, givenOsContextWhenItIsRegisteredToMemoryManagerThenRefCountIncreases) {
auto osContext = new OsContext(nullptr);
auto osContext = new OsContext(nullptr, 0u);
OsAgnosticMemoryManager memoryManager;
memoryManager.registerOsContext(osContext);
EXPECT_EQ(1u, memoryManager.getOsContextCount());
EXPECT_EQ(1, osContext->getRefInternalCount());
}
TEST(ResidencyDataTest, givenTwoOsContextsWhenTheyAreRegistredFromHigherToLowerThenProperSizeIsReturned) {
auto osContext2 = new OsContext(nullptr, 1u);
auto osContext = new OsContext(nullptr, 0u);
OsAgnosticMemoryManager memoryManager;
memoryManager.registerOsContext(osContext2);
memoryManager.registerOsContext(osContext);
EXPECT_EQ(2u, memoryManager.getOsContextCount());
EXPECT_EQ(1, osContext->getRefInternalCount());
EXPECT_EQ(1, osContext2->getRefInternalCount());
}
TEST(ResidencyDataTest, givenResidencyDataWhenUpdateCompletionDataIsCalledThenItIsProperlyUpdated) {
struct mockResidencyData : public ResidencyData {
using ResidencyData::completionData;
@@ -1839,9 +1850,8 @@ TEST(ResidencyDataTest, givenResidencyDataWhenUpdateCompletionDataIsCalledThenIt
mockResidencyData residency;
OsContext osContext(nullptr);
OsContext osContext2(nullptr);
osContext2.setContextId(1u);
OsContext osContext(nullptr, 0u);
OsContext osContext2(nullptr, 1u);
auto lastFenceValue = 45llu;
auto lastFenceValue2 = 23llu;