Initialize TBX stream only when hardwareContext is not created

Change-Id: I05d8c5c395cc342ea699333dd59966913f9a98df
This commit is contained in:
Hoppe, Mateusz 2018-12-28 15:26:25 +01:00 committed by sys_ocldev
parent 56eced2faa
commit e195b0e380
2 changed files with 20 additions and 6 deletions

View File

@ -177,13 +177,14 @@ CommandStreamReceiver *TbxCommandStreamReceiverHw<GfxFamily>::create(const Hardw
csr = new TbxCommandStreamReceiverHw<GfxFamily>(hwInfoIn, executionEnvironment);
}
// Open our stream
csr->stream->open(nullptr);
// Add the file header.
bool streamInitialized = csr->stream->init(AubMemDump::SteppingValues::A, csr->aubDeviceId);
csr->streamInitialized = streamInitialized;
if (csr->hardwareContext == nullptr) {
// Open our stream
csr->stream->open(nullptr);
// Add the file header.
bool streamInitialized = csr->stream->init(AubMemDump::SteppingValues::A, csr->aubDeviceId);
csr->streamInitialized = streamInitialized;
}
return csr;
}

View File

@ -440,3 +440,16 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenMakeCoherentIsC
EXPECT_TRUE(mockHardwareContext->readMemoryCalled);
}
HWTEST_F(TbxCommandStreamTests, givenTbxCsrWhenHardwareContextIsCreatedThenTbxStreamInCsrIsNotInitialized) {
const HardwareInfo &hwInfo = *platformDevices[0];
MockAubManager *mockManager = new MockAubManager();
MockAubCenter *mockAubCenter = new MockAubCenter(&hwInfo, false, "");
mockAubCenter->aubManager = std::unique_ptr<MockAubManager>(mockManager);
ExecutionEnvironment executionEnvironment;
executionEnvironment.aubCenter = std::unique_ptr<MockAubCenter>(mockAubCenter);
auto tbxCsr = std::unique_ptr<TbxCommandStreamReceiverHw<FamilyType>>(reinterpret_cast<TbxCommandStreamReceiverHw<FamilyType> *>(
TbxCommandStreamReceiverHw<FamilyType>::create(hwInfo, false, executionEnvironment)));
EXPECT_FALSE(tbxCsr->streamInitialized);
}