@@ -53,10 +53,12 @@ namespace decode
5353 __MEDIA_USER_FEATURE_VALUE_NULLHW_PROXY_REPEAT_COUNT,
5454 MediaUserSetting::Group::Device);
5555
56- if (m_dataStoreBuf == nullptr )
56+ MOS_GPU_CONTEXT gpuContext = osInterface->pfnGetGpuContext (osInterface);
57+ if (m_dataStoreBufMap.find (gpuContext) == m_dataStoreBufMap.end ())
5758 {
58- m_dataStoreBuf = m_allocator->AllocateBuffer (2 * sizeof (uint32_t ), " Store data buffer" , resourceInternalReadWriteCache, notLockableVideoMem, true , 0 );
59- DECODE_CHK_NULL (m_dataStoreBuf);
59+ MOS_BUFFER* dataStoreBuf = m_allocator->AllocateBuffer (2 * sizeof (uint32_t ), " Store data buffer" , resourceInternalReadWriteCache, notLockableVideoMem, true , 0 );
60+ DECODE_CHK_NULL (dataStoreBuf);
61+ m_dataStoreBufMap[gpuContext] = dataStoreBuf;
6062 }
6163 if (m_secondLevelBBArray == nullptr )
6264 {
@@ -75,12 +77,32 @@ namespace decode
7577 MOS_STATUS DecodeNullHWProxyTestPkt::Destory ()
7678 {
7779 DECODE_CHK_NULL (m_allocator);
78- DECODE_CHK_STATUS (m_allocator->Destroy (m_dataStoreBuf));
80+ for (auto & pair : m_dataStoreBufMap)
81+ {
82+ DECODE_CHK_STATUS (m_allocator->Destroy (pair.second ));
83+ }
84+ m_dataStoreBufMap.clear ();
7985 DECODE_CHK_STATUS (m_allocator->Destroy (m_secondLevelBBArray));
8086
8187 return MOS_STATUS_SUCCESS;
8288 }
8389
90+ MOS_BUFFER* DecodeNullHWProxyTestPkt::GetCurrentDataStoreBuf (MOS_INTERFACE *osInterface)
91+ {
92+ DECODE_FUNC_CALL ();
93+ if (osInterface == nullptr )
94+ {
95+ return nullptr ;
96+ }
97+ MOS_GPU_CONTEXT gpuContext = osInterface->pfnGetGpuContext (osInterface);
98+ auto it = m_dataStoreBufMap.find (gpuContext);
99+ if (it != m_dataStoreBufMap.end ())
100+ {
101+ return it->second ;
102+ }
103+ return nullptr ;
104+ }
105+
84106 MOS_STATUS DecodeNullHWProxyTestPkt::Init2ndLevelCmdBuffer (MHW_BATCH_BUFFER& batchBuffer, uint8_t * batchBufBase)
85107 {
86108 DECODE_FUNC_CALL ();
@@ -158,14 +180,17 @@ namespace decode
158180 return eStatus;
159181 }
160182
161- MOS_STATUS DecodeNullHWProxyTestPkt::Pack2ndLevelCmds (DecodePipeline* pipeline, MOS_COMMAND_BUFFER& cmdBuffer)
183+ MOS_STATUS DecodeNullHWProxyTestPkt::Pack2ndLevelCmds (DecodePipeline* pipeline, MOS_INTERFACE *osInterface, MOS_COMMAND_BUFFER& cmdBuffer)
162184 {
163185 DECODE_FUNC_CALL ();
164186
187+ MOS_BUFFER* dataStoreBuf = GetCurrentDataStoreBuf (osInterface);
188+ DECODE_CHK_NULL (dataStoreBuf);
189+
165190 // MI_ATOMIC: ADD 1 TO ORIGINAL DATA
166191 auto &par = m_miItf->GETPAR_MI_ATOMIC ();
167192 par = {};
168- par.pOsResource = &m_dataStoreBuf ->OsResource ;
193+ par.pOsResource = &dataStoreBuf ->OsResource ;
169194 par.dwResourceOffset = sizeof (uint32_t );
170195 par.dwDataSize = sizeof (uint32_t );
171196 par.Operation = mhw::mi::MHW_MI_ATOMIC_INC;
@@ -176,7 +201,7 @@ namespace decode
176201 uint32_t compData = m_repeatCount;
177202
178203 DECODE_CHK_STATUS (SendCondBbEndCmd (
179- &m_dataStoreBuf ->OsResource , 0 , compData, false , true , compareOperation, &cmdBuffer));
204+ &dataStoreBuf ->OsResource , 0 , compData, false , true , compareOperation, &cmdBuffer));
180205
181206 // Chained BB loop
182207 auto &chainedBBStartPar = m_miItf->GETPAR_MI_BATCH_BUFFER_START ();
@@ -201,10 +226,13 @@ namespace decode
201226 DECODE_CHK_NULL (osInterface);
202227 DECODE_CHK_NULL (m_miItf);
203228
229+ MOS_BUFFER* dataStoreBuf = GetCurrentDataStoreBuf (osInterface);
230+ DECODE_CHK_NULL (dataStoreBuf);
231+
204232 // add 2nd level BB before start status reporting
205233 auto &par = m_miItf->MHW_GETPAR_F (MI_STORE_DATA_IMM)();
206234 par = {};
207- par.pOsResource = &m_dataStoreBuf ->OsResource ;
235+ par.pOsResource = &dataStoreBuf ->OsResource ;
208236 par.dwResourceOffset = 0 ;
209237 par.dwValue = 0xFFFFFF ;
210238
@@ -224,7 +252,7 @@ namespace decode
224252 DECODE_CHK_NULL (batchBufBase);
225253 DECODE_CHK_STATUS (Init2ndLevelCmdBuffer (*m_batchBuf, batchBufBase));
226254 m_statusCheckCmdBuffer.cmdBuf1stLvl = cmdBuffer;
227- DECODE_CHK_STATUS (Pack2ndLevelCmds (pipeline, m_statusCheckCmdBuffer));
255+ DECODE_CHK_STATUS (Pack2ndLevelCmds (pipeline, osInterface, m_statusCheckCmdBuffer));
228256 if (!osInterface->pfnIsMismatchOrderProgrammingSupported ())
229257 {
230258 DECODE_CHK_STATUS (m_miItf->AddMiBatchBufferEnd (&m_statusCheckCmdBuffer, nullptr ));
0 commit comments