ULT: Setup max os context count before using it

Change-Id: I6005cc9faed3a5650b03663b528f302940299112
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2020-08-17 13:41:48 +02:00
committed by sys_ocldev
parent 0105960e13
commit 234d408a40
2 changed files with 4 additions and 2 deletions

View File

@ -242,7 +242,7 @@ TEST_F(DrmBufferObjectTest, givenDeleterWhenBufferObjectIsCreatedAndDeletedThenC
TEST(DrmBufferObject, givenPerContextVmRequiredWhenBoCreatedThenBindInfoIsInitializedToOsContextCount) {
auto device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
device->getRootDeviceEnvironment().executionEnvironment.setPerContextMemorySpace();
device->getExecutionEnvironment()->calculateMaxOsContextCount();
DrmMock drm(*(device->getExecutionEnvironment()->rootDeviceEnvironments[0].get()));
EXPECT_TRUE(drm.isPerContextVMRequired());
MockBufferObject bo(&drm);
@ -262,6 +262,7 @@ TEST(DrmBufferObject, givenPerContextVmRequiredWhenBoBoundAndUnboundThenCorrectB
executionEnvironment->setPerContextMemorySpace();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get());
executionEnvironment->calculateMaxOsContextCount();
executionEnvironment->rootDeviceEnvironments[0]->osInterface = std::make_unique<OSInterface>();
executionEnvironment->rootDeviceEnvironments[0]->memoryOperationsInterface = DrmMemoryOperationsHandler::create();
@ -285,4 +286,4 @@ TEST(DrmBufferObject, givenPerContextVmRequiredWhenBoBoundAndUnboundThenCorrectB
bo.unbind(osContext, 0);
EXPECT_FALSE(bo.bindInfo[contextId][0]);
}
}