Improve creating HwContextController

Change-Id: If81ec18793a5af7fb58d66bb26a3bc476eaf94e0
Signed-off-by: Dunajski, Bartosz <bartosz.dunajski@intel.com>
This commit is contained in:
Dunajski, Bartosz
2019-02-15 13:22:19 +01:00
committed by sys_ocldev
parent 9af011809f
commit af2dc200c5
2 changed files with 9 additions and 4 deletions

View File

@@ -95,8 +95,12 @@ void CommandStreamReceiverSimulatedCommonHw<GfxFamily>::setupContext(OsContext &
auto &engineType = osContext.getEngineType();
if (aubManager && !(engineType.type == lowPriorityGpgpuEngine.type && engineType.id == lowPriorityGpgpuEngine.id)) {
if (osContext.getNumDevicesSupported() == 1) {
hardwareContextController = std::make_unique<HardwareContextController>(*aubManager, osContext,
deviceIndex, engineIndex, flags);
} else {
hardwareContextController = std::make_unique<HardwareContextController>(*aubManager, osContext, engineIndex, flags);
}
}
}

View File

@@ -803,7 +803,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenProcess
memoryManager->freeGraphicsMemory(gfxImageAllocation);
}
HWTEST_F(AubCommandStreamReceiverTests, givenOsContextWithMultipleDevicesSupportedWhenSetupIsCalledThenAbort) {
HWTEST_F(AubCommandStreamReceiverTests, givenOsContextWithMultipleDevicesSupportedWhenSetupIsCalledThenCreateMultipleHardwareContexts) {
MockAubCenter *mockAubCenter = new MockAubCenter(platformDevices[0], false, "", CommandStreamReceiverType::CSR_AUB);
mockAubCenter->aubManager = std::make_unique<MockAubManager>();
pDevice->executionEnvironment->aubCenter.reset(mockAubCenter);
@@ -811,8 +811,9 @@ HWTEST_F(AubCommandStreamReceiverTests, givenOsContextWithMultipleDevicesSupport
uint32_t numSupportedDevices = 3;
OsContext osContext(nullptr, 1, numSupportedDevices, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled);
auto aubCsr = std::make_unique<AUBCommandStreamReceiverHw<FamilyType>>(*platformDevices[0], "", true, *pDevice->executionEnvironment);
aubCsr->setupContext(osContext);
EXPECT_THROW(aubCsr->setupContext(osContext), std::exception);
EXPECT_EQ(numSupportedDevices, aubCsr->hardwareContextController->hardwareContexts.size());
}
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenGraphicsAllocationTypeIsntNonAubWritableThenWriteMemoryIsAllowed) {