Skip to content

Commit e195b0e

Browse files
Initialize TBX stream only when hardwareContext is not created
Change-Id: I05d8c5c395cc342ea699333dd59966913f9a98df
1 parent 56eced2 commit e195b0e

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

runtime/command_stream/tbx_command_stream_receiver_hw.inl

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -177,13 +177,14 @@ CommandStreamReceiver *TbxCommandStreamReceiverHw<GfxFamily>::create(const Hardw
177177
csr = new TbxCommandStreamReceiverHw<GfxFamily>(hwInfoIn, executionEnvironment);
178178
}
179179

180-
// Open our stream
181-
csr->stream->open(nullptr);
182-
183-
// Add the file header.
184-
bool streamInitialized = csr->stream->init(AubMemDump::SteppingValues::A, csr->aubDeviceId);
185-
csr->streamInitialized = streamInitialized;
180+
if (csr->hardwareContext == nullptr) {
181+
// Open our stream
182+
csr->stream->open(nullptr);
186183

184+
// Add the file header.
185+
bool streamInitialized = csr->stream->init(AubMemDump::SteppingValues::A, csr->aubDeviceId);
186+
csr->streamInitialized = streamInitialized;
187+
}
187188
return csr;
188189
}
189190

unit_tests/command_stream/tbx_command_stream_tests.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,3 +440,16 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenMakeCoherentIsC
440440

441441
EXPECT_TRUE(mockHardwareContext->readMemoryCalled);
442442
}
443+
444+
HWTEST_F(TbxCommandStreamTests, givenTbxCsrWhenHardwareContextIsCreatedThenTbxStreamInCsrIsNotInitialized) {
445+
const HardwareInfo &hwInfo = *platformDevices[0];
446+
MockAubManager *mockManager = new MockAubManager();
447+
MockAubCenter *mockAubCenter = new MockAubCenter(&hwInfo, false, "");
448+
mockAubCenter->aubManager = std::unique_ptr<MockAubManager>(mockManager);
449+
ExecutionEnvironment executionEnvironment;
450+
executionEnvironment.aubCenter = std::unique_ptr<MockAubCenter>(mockAubCenter);
451+
auto tbxCsr = std::unique_ptr<TbxCommandStreamReceiverHw<FamilyType>>(reinterpret_cast<TbxCommandStreamReceiverHw<FamilyType> *>(
452+
TbxCommandStreamReceiverHw<FamilyType>::create(hwInfo, false, executionEnvironment)));
453+
454+
EXPECT_FALSE(tbxCsr->streamInitialized);
455+
}

0 commit comments

Comments
 (0)