diff options
author | Lim Siew Hoon <siew.hoon.lim@intel.com> | 2022-02-11 10:24:40 +0800 |
---|---|---|
committer | Anuj Mittal <anuj.mittal@intel.com> | 2022-02-11 12:50:06 +0800 |
commit | 298339bc21356ce1e19a1219722a1d1f9d577b52 (patch) | |
tree | 71863331fd36a806cf5ee921db9074a722165d1f | |
parent | ee9574a26178e7136ee95667729f2ea445706ae0 (diff) | |
download | meta-intel-298339bc21356ce1e19a1219722a1d1f9d577b52.tar.gz |
intel-media-driver: upgrade 21.3.5 -> 22.1.1
Drops patches already merged.
* 0001-MOS-user-setting-reentrant.patch
* 0001-Media-Common-Fix-the-user-setting-memory-free.patch
Signed-off-by: Lim Siew Hoon <siew.hoon.lim@intel.com>
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
-rw-r--r-- | recipes-multimedia/libva/files/0001-MOS-user-setting-reentrant.patch | 476 | ||||
-rw-r--r-- | recipes-multimedia/libva/files/0001-Media-Common-Fix-the-user-setting-memory-free.patch | 86 | ||||
-rw-r--r-- | recipes-multimedia/libva/intel-media-driver_22.1.1.bb (renamed from recipes-multimedia/libva/intel-media-driver_21.3.5.bb) | 4 |
3 files changed, 1 insertions, 565 deletions
diff --git a/recipes-multimedia/libva/files/0001-MOS-user-setting-reentrant.patch b/recipes-multimedia/libva/files/0001-MOS-user-setting-reentrant.patch deleted file mode 100644 index 9b9cfe35..00000000 --- a/recipes-multimedia/libva/files/0001-MOS-user-setting-reentrant.patch +++ /dev/null | |||
@@ -1,476 +0,0 @@ | |||
1 | From b2c07abaf546f84529b39cb4ae443ed2a5bc35e9 Mon Sep 17 00:00:00 2001 | ||
2 | From: jinchung <you@example.com> | ||
3 | Date: Wed, 3 Nov 2021 14:02:51 +0000 | ||
4 | Subject: [PATCH] [MOS] user setting reentrant | ||
5 | |||
6 | Fix for registry key reentrant on Linux during multiple processes | ||
7 | |||
8 | Upstream-Status: Submitted [internal innersource] | ||
9 | innersource PR #45124 | ||
10 | |||
11 | Signed-off-by: Teng, Jin Chung <jin.chung.teng@intel.com> | ||
12 | Signed-off-by: Wang, Pingli <pingli.wang@intel.com> | ||
13 | --- | ||
14 | .../common/os/mos_utilities_specific.cpp | 2 +- | ||
15 | .../linux/common/os/mos_utilities_specific.h | 2 +- | ||
16 | .../agnostic/common/os/mos_utilities_next.cpp | 15 ++- | ||
17 | .../agnostic/common/os/mos_utilities_next.h | 2 +- | ||
18 | .../common/os/mos_utilities_specific_next.cpp | 107 +++++++----------- | ||
19 | .../common/os/mos_utilities_specific_next.h | 71 ++++++------ | ||
20 | 6 files changed, 89 insertions(+), 110 deletions(-) | ||
21 | |||
22 | diff --git a/media_driver/linux/common/os/mos_utilities_specific.cpp b/media_driver/linux/common/os/mos_utilities_specific.cpp | ||
23 | index ae414360..62eb4593 100644 | ||
24 | --- a/media_driver/linux/common/os/mos_utilities_specific.cpp | ||
25 | +++ b/media_driver/linux/common/os/mos_utilities_specific.cpp | ||
26 | @@ -589,7 +589,7 @@ static int32_t _UserFeature_FindValue(MOS_UF_KEY UFKey, char * const pcValueName | ||
27 | |||
28 | iResult = -1; | ||
29 | |||
30 | - for ( i = 0; i < (int32_t)UFKey.ulValueNum; i++ ) | ||
31 | + for ( i = 0; i < UFKey.ulValueNum; i++ ) | ||
32 | { | ||
33 | iResult = strcmp(UFKey.pValueArray[i].pcValueName, pcValueName); | ||
34 | if ( iResult == 0 ) | ||
35 | diff --git a/media_driver/linux/common/os/mos_utilities_specific.h b/media_driver/linux/common/os/mos_utilities_specific.h | ||
36 | index 81d84537..3d1cda35 100644 | ||
37 | --- a/media_driver/linux/common/os/mos_utilities_specific.h | ||
38 | +++ b/media_driver/linux/common/os/mos_utilities_specific.h | ||
39 | @@ -116,7 +116,7 @@ typedef struct _MOS_UF_VALUE { | ||
40 | typedef struct _MOS_UF_KEY { | ||
41 | void *UFKey; | ||
42 | char pcKeyName[MAX_USERFEATURE_LINE_LENGTH]; | ||
43 | - uint32_t ulValueNum; | ||
44 | + int32_t ulValueNum; | ||
45 | MOS_UF_VALUE *pValueArray; | ||
46 | } MOS_UF_KEY; | ||
47 | |||
48 | diff --git a/media_softlet/agnostic/common/os/mos_utilities_next.cpp b/media_softlet/agnostic/common/os/mos_utilities_next.cpp | ||
49 | index 8427ec17..74ba75b9 100644 | ||
50 | --- a/media_softlet/agnostic/common/os/mos_utilities_next.cpp | ||
51 | +++ b/media_softlet/agnostic/common/os/mos_utilities_next.cpp | ||
52 | @@ -1930,9 +1930,18 @@ MOS_STATUS MosUtilities::MosUserFeatureReadValueFromMapID( | ||
53 | &ufKey, | ||
54 | ufInfo)) != MOS_STATUS_SUCCESS) | ||
55 | { | ||
56 | - MOS_OS_NORMALMESSAGE("Failed to open user feature for reading eStatus:%d.", eStatus); | ||
57 | - eStatus = MOS_STATUS_USER_FEATURE_KEY_OPEN_FAILED; | ||
58 | - goto finish; | ||
59 | + MOS_OS_NORMALMESSAGE("Failed to open user feature for concurrency."); | ||
60 | + if ((eStatus = MosUserFeatureOpen( | ||
61 | + pUserFeature->Type, | ||
62 | + pUserFeature->pcPath, | ||
63 | + KEY_READ, | ||
64 | + &ufKey, | ||
65 | + ufInfo)) != MOS_STATUS_SUCCESS) | ||
66 | + { | ||
67 | + MOS_OS_NORMALMESSAGE("Failed to open user feature for reading eStatus:%d.", eStatus); | ||
68 | + eStatus = MOS_STATUS_USER_FEATURE_KEY_OPEN_FAILED; | ||
69 | + goto finish; | ||
70 | + } | ||
71 | } | ||
72 | |||
73 | // Initialize Read Value | ||
74 | diff --git a/media_softlet/agnostic/common/os/mos_utilities_next.h b/media_softlet/agnostic/common/os/mos_utilities_next.h | ||
75 | index f492a2c7..65aa3729 100644 | ||
76 | --- a/media_softlet/agnostic/common/os/mos_utilities_next.h | ||
77 | +++ b/media_softlet/agnostic/common/os/mos_utilities_next.h | ||
78 | @@ -653,7 +653,7 @@ public: | ||
79 | //! | ||
80 | //! \brief Unlink the user feature key Desc Fields table items to key value map | ||
81 | //! \details Unlink the user feature key Desc Fields table items to key value map | ||
82 | - //! according to ID sequence and do some post processing by calling MOS_DestroyUserFeatureData | ||
83 | + //! according to ID sequence and do some post processing by calling MOSDestroyUserFeatureData | ||
84 | //! \param [in] pUserFeatureKey | ||
85 | //! Pointer to the User Feature Value needed to be destroyed | ||
86 | //! \return MOS_STATUS | ||
87 | diff --git a/media_softlet/linux/common/os/mos_utilities_specific_next.cpp b/media_softlet/linux/common/os/mos_utilities_specific_next.cpp | ||
88 | index 81ee4bdf..584ba086 100644 | ||
89 | --- a/media_softlet/linux/common/os/mos_utilities_specific_next.cpp | ||
90 | +++ b/media_softlet/linux/common/os/mos_utilities_specific_next.cpp | ||
91 | @@ -47,7 +47,8 @@ | ||
92 | #include <unistd.h> // fork | ||
93 | #include <algorithm> | ||
94 | |||
95 | -const char *MosUtilitiesSpecificNext::m_szUserFeatureFile = USER_FEATURE_FILE; | ||
96 | +const char *MosUtilitiesSpecificNext::m_szUserFeatureFile = USER_FEATURE_FILE; | ||
97 | +MOS_PUF_KEYLIST MosUtilitiesSpecificNext::m_ufKeyList = nullptr; | ||
98 | |||
99 | double MosUtilities::MosGetTime() | ||
100 | { | ||
101 | @@ -540,7 +541,7 @@ void MosUtilities::MosSleep(uint32_t mSec) | ||
102 | |||
103 | iResult = -1; | ||
104 | |||
105 | - for ( i = 0; i < (int32_t)UFKey.ulValueNum; i++ ) | ||
106 | + for ( i = 0; i < UFKey.ulValueNum; i++ ) | ||
107 | { | ||
108 | iResult = strcmp(UFKey.pValueArray[i].pcValueName, pcValueName); | ||
109 | if ( iResult == 0 ) | ||
110 | @@ -566,7 +567,7 @@ MOS_STATUS MosUtilitiesSpecificNext::UserFeatureAdd(MOS_PUF_KEYLIST *pKeyList, M | ||
111 | return MOS_STATUS_INVALID_PARAMETER; | ||
112 | } | ||
113 | |||
114 | - pNewNode = (MOS_UF_KEYNODE*)MOS_AllocMemory(sizeof(MOS_UF_KEYNODE)); | ||
115 | + pNewNode = (MOS_UF_KEYNODE*)MOS_AllocAndZeroMemory(sizeof(MOS_UF_KEYNODE)); | ||
116 | if (pNewNode == nullptr) | ||
117 | { | ||
118 | return MOS_STATUS_NO_SPACE; | ||
119 | @@ -604,41 +605,34 @@ MOS_STATUS MosUtilitiesSpecificNext::UserFeatureSet(MOS_PUF_KEYLIST *pKeyList, M | ||
120 | } | ||
121 | |||
122 | // Prepare the ValueBuff of the NewKey | ||
123 | - if ((ulValueBuf = MOS_AllocMemory(NewKey.pValueArray[0].ulValueLen)) == nullptr) | ||
124 | + if ((ulValueBuf = MOS_AllocAndZeroMemory(NewKey.pValueArray[0].ulValueLen)) == nullptr) | ||
125 | { | ||
126 | return MOS_STATUS_NO_SPACE; | ||
127 | } | ||
128 | + MOS_AtomicIncrement(&MosUtilities::m_mosMemAllocFakeCounter); //ulValueBuf does not count it, because it is freed after the MEMNJA final report. | ||
129 | + MOS_OS_NORMALMESSAGE("ulValueBuf %p for key %s", ulValueBuf, NewKey.pValueArray[0].pcValueName); | ||
130 | |||
131 | if ( (iPos = UserFeatureFindValue(*Key, NewKey.pValueArray[0].pcValueName)) == NOT_FOUND) | ||
132 | { | ||
133 | //not found, add a new value to key struct. | ||
134 | //reallocate memory for appending this value. | ||
135 | - pValueArray = (MOS_UF_VALUE*)MOS_AllocMemory(sizeof(MOS_UF_VALUE)*(Key->ulValueNum+1)); | ||
136 | - if (pValueArray == nullptr) | ||
137 | + iPos = MOS_AtomicIncrement(&Key->ulValueNum); | ||
138 | + if (iPos >= UF_CAPABILITY) | ||
139 | { | ||
140 | - MOS_FreeMemory(ulValueBuf); | ||
141 | - return MOS_STATUS_NO_SPACE; | ||
142 | + MOS_OS_ASSERTMESSAGE("user setting value icount %d must less than UF_CAPABILITY(64)", iPos); | ||
143 | + return MOS_STATUS_USER_FEATURE_KEY_READ_FAILED; | ||
144 | } | ||
145 | |||
146 | - MosUtilities::MosSecureMemcpy(pValueArray, | ||
147 | - sizeof(MOS_UF_VALUE)*(Key->ulValueNum), | ||
148 | - Key->pValueArray, | ||
149 | - sizeof(MOS_UF_VALUE)*(Key->ulValueNum)); | ||
150 | - | ||
151 | - MOS_FreeMemory(Key->pValueArray); | ||
152 | - | ||
153 | - Key->pValueArray = pValueArray; | ||
154 | - | ||
155 | - iPos = Key->ulValueNum; | ||
156 | - MosUtilities::MosSecureStrcpy(Key->pValueArray[Key->ulValueNum].pcValueName, | ||
157 | + MosUtilities::MosSecureStrcpy(Key->pValueArray[iPos].pcValueName, | ||
158 | MAX_USERFEATURE_LINE_LENGTH, | ||
159 | NewKey.pValueArray[0].pcValueName); | ||
160 | - Key->ulValueNum ++; | ||
161 | } | ||
162 | else | ||
163 | { | ||
164 | //if found, the previous value buffer needs to be freed before reallocating | ||
165 | MOS_FreeMemory(Key->pValueArray[iPos].ulValueBuf); | ||
166 | + MOS_AtomicDecrement(&MosUtilities::m_mosMemAllocFakeCounter); | ||
167 | + MOS_OS_NORMALMESSAGE("ulValueBuf %p for key %s", ulValueBuf, NewKey.pValueArray[0].pcValueName); | ||
168 | } | ||
169 | |||
170 | Key->pValueArray[iPos].ulValueLen = NewKey.pValueArray[0].ulValueLen; | ||
171 | @@ -733,7 +727,7 @@ MOS_STATUS MosUtilitiesSpecificNext::UserFeatureDumpFile(const char * const szF | ||
172 | iCurId = 0; | ||
173 | eStatus = MOS_STATUS_SUCCESS; | ||
174 | |||
175 | - CurKey = (MOS_UF_KEY*)MOS_AllocMemory(sizeof(MOS_UF_KEY)); | ||
176 | + CurKey = (MOS_UF_KEY*)MOS_AllocAndZeroMemory(sizeof(MOS_UF_KEY)); | ||
177 | if (CurKey == nullptr) | ||
178 | { | ||
179 | return MOS_STATUS_NO_SPACE; | ||
180 | @@ -771,7 +765,7 @@ MOS_STATUS MosUtilitiesSpecificNext::UserFeatureDumpFile(const char * const szF | ||
181 | // if the CurKey didn't be added in pKeyList, free it. | ||
182 | MOS_FreeMemory(CurKey); | ||
183 | } | ||
184 | - CurKey = (MOS_UF_KEY*)MOS_AllocMemory(sizeof(MOS_UF_KEY)); | ||
185 | + CurKey = (MOS_UF_KEY*)MOS_AllocAndZeroMemory(sizeof(MOS_UF_KEY)); | ||
186 | if (CurKey == nullptr) | ||
187 | { | ||
188 | eStatus = MOS_STATUS_NO_SPACE; | ||
189 | @@ -796,7 +790,7 @@ MOS_STATUS MosUtilitiesSpecificNext::UserFeatureDumpFile(const char * const szF | ||
190 | CurKey->ulValueNum = 0; | ||
191 | |||
192 | // allocate capability length for valuearray. | ||
193 | - CurValue = (MOS_UF_VALUE*)MOS_AllocMemory(sizeof(MOS_UF_VALUE)*UF_CAPABILITY); | ||
194 | + CurValue = (MOS_UF_VALUE*)MOS_AllocAndZeroMemory(sizeof(MOS_UF_VALUE)*UF_CAPABILITY); | ||
195 | if (CurValue == nullptr) | ||
196 | { | ||
197 | eStatus = MOS_STATUS_NO_SPACE; | ||
198 | @@ -826,6 +820,7 @@ MOS_STATUS MosUtilitiesSpecificNext::UserFeatureDumpFile(const char * const szF | ||
199 | if (iCount < 0 || iCount >= UF_CAPABILITY) | ||
200 | { | ||
201 | eStatus = MOS_STATUS_USER_FEATURE_KEY_READ_FAILED; | ||
202 | + MOS_OS_ASSERTMESSAGE("user setting value icount %d, and it must meet 0 < icount < UF_CAPABILITY(64)", iCount); | ||
203 | break; | ||
204 | } | ||
205 | |||
206 | @@ -987,7 +982,7 @@ MOS_STATUS MosUtilitiesSpecificNext::UserFeatureDumpDataToFile(const char *szFil | ||
207 | fprintf(File, "%s\n", UF_KEY_ID); | ||
208 | fprintf(File, "\t0x%.8x\n", (uint32_t)(uintptr_t)pKeyTmp->pElem->UFKey); | ||
209 | fprintf(File, "\t%s\n", pKeyTmp->pElem->pcKeyName); | ||
210 | - for ( j = 0; j < (int32_t)pKeyTmp->pElem->ulValueNum; j ++ ) | ||
211 | + for ( j = 0; j < pKeyTmp->pElem->ulValueNum; j ++ ) | ||
212 | { | ||
213 | fprintf(File, "\t\t%s\n", UF_VALUE_ID); | ||
214 | if ( strlen(pKeyTmp->pElem->pValueArray[j].pcValueName) > 0 ) | ||
215 | @@ -1015,10 +1010,9 @@ MOS_STATUS MosUtilitiesSpecificNext::UserFeatureDumpDataToFile(const char *szFil | ||
216 | break; | ||
217 | } //switch (pKeyTmp->pElem->pValueArray[j].ulValueType) | ||
218 | } | ||
219 | - } // for ( j = 0; j < (int32_t)pKeyTmp->pElem->ulValueNum; j ++ ) | ||
220 | + } // for ( j = 0; j < pKeyTmp->pElem->ulValueNum; j ++ ) | ||
221 | } //for (pKeyTmp = pKeyList; pKeyTmp; pKeyTmp = pKeyTmp->pNext) | ||
222 | fclose(File); | ||
223 | - MosUtilities::MosUserFeatureNotifyChangeKeyValue(nullptr, false, nullptr, true); | ||
224 | |||
225 | return MOS_STATUS_SUCCESS; | ||
226 | } | ||
227 | @@ -1055,12 +1049,10 @@ MOS_STATUS MosUtilitiesSpecificNext::UserFeatureSetValue( | ||
228 | MOS_UF_KEY NewKey; | ||
229 | MOS_UF_VALUE NewValue; | ||
230 | MOS_STATUS eStatus; | ||
231 | - MOS_PUF_KEYLIST pKeyList; | ||
232 | |||
233 | eStatus = MOS_STATUS_UNKNOWN; | ||
234 | - pKeyList = nullptr; | ||
235 | |||
236 | - if ( (strKey== nullptr) || (pcValueName == nullptr) ) | ||
237 | + if ((strKey == nullptr) || (pcValueName == nullptr) || (m_ufKeyList == nullptr)) | ||
238 | { | ||
239 | return MOS_STATUS_INVALID_PARAMETER; | ||
240 | } | ||
241 | @@ -1083,18 +1075,11 @@ MOS_STATUS MosUtilitiesSpecificNext::UserFeatureSetValue( | ||
242 | NewKey.pValueArray = &NewValue; | ||
243 | NewKey.ulValueNum = 1; | ||
244 | |||
245 | - if ((eStatus = UserFeatureDumpFile(m_szUserFeatureFile, &pKeyList)) != MOS_STATUS_SUCCESS) | ||
246 | + if ( ( eStatus = UserFeatureSet(&MosUtilitiesSpecificNext::m_ufKeyList, NewKey)) == MOS_STATUS_SUCCESS ) | ||
247 | { | ||
248 | - UserFeatureFreeKeyList(pKeyList); | ||
249 | - return eStatus; | ||
250 | + MosUtilities::MosUserFeatureNotifyChangeKeyValue(nullptr, false, nullptr, true); | ||
251 | } | ||
252 | |||
253 | - if ( ( eStatus = UserFeatureSet(&pKeyList, NewKey)) == MOS_STATUS_SUCCESS ) | ||
254 | - { | ||
255 | - eStatus = UserFeatureDumpDataToFile(m_szUserFeatureFile, pKeyList); | ||
256 | - } | ||
257 | - | ||
258 | - UserFeatureFreeKeyList(pKeyList); | ||
259 | return eStatus; | ||
260 | } | ||
261 | |||
262 | @@ -1114,9 +1099,9 @@ MOS_STATUS MosUtilitiesSpecificNext::UserFeatureQueryValue( | ||
263 | char strTempValueName[MAX_USERFEATURE_LINE_LENGTH]; | ||
264 | |||
265 | eStatus = MOS_STATUS_UNKNOWN; | ||
266 | - pKeyList = nullptr; | ||
267 | + pKeyList = MosUtilitiesSpecificNext::m_ufKeyList; | ||
268 | |||
269 | - if ( (strKey == nullptr) || (pcValueName == nullptr)) | ||
270 | + if ( (strKey == nullptr) || (pcValueName == nullptr) || (pKeyList == nullptr)) | ||
271 | { | ||
272 | return MOS_STATUS_INVALID_PARAMETER; | ||
273 | } | ||
274 | @@ -1129,21 +1114,17 @@ MOS_STATUS MosUtilitiesSpecificNext::UserFeatureQueryValue( | ||
275 | NewKey.pValueArray = &NewValue; | ||
276 | NewKey.ulValueNum = 1; | ||
277 | |||
278 | - if ((eStatus = UserFeatureDumpFile(m_szUserFeatureFile, &pKeyList)) == MOS_STATUS_SUCCESS) | ||
279 | + if ( (eStatus = UserFeatureQuery(pKeyList, &NewKey)) == MOS_STATUS_SUCCESS ) | ||
280 | { | ||
281 | - if ( (eStatus = UserFeatureQuery(pKeyList, &NewKey)) == MOS_STATUS_SUCCESS ) | ||
282 | + if(uiValueType != nullptr) | ||
283 | { | ||
284 | - if(uiValueType != nullptr) | ||
285 | - { | ||
286 | - *uiValueType = NewKey.pValueArray[0].ulValueType; | ||
287 | - } | ||
288 | - if (nDataSize != nullptr) | ||
289 | - { | ||
290 | - *nDataSize = NewKey.pValueArray[0].ulValueLen; | ||
291 | - } | ||
292 | + *uiValueType = NewKey.pValueArray[0].ulValueType; | ||
293 | + } | ||
294 | + if (nDataSize != nullptr) | ||
295 | + { | ||
296 | + *nDataSize = NewKey.pValueArray[0].ulValueLen; | ||
297 | } | ||
298 | } | ||
299 | - UserFeatureFreeKeyList(pKeyList); | ||
300 | |||
301 | return eStatus; | ||
302 | } | ||
303 | @@ -1155,16 +1136,9 @@ MOS_STATUS MosUtilitiesSpecificNext::UserFeatureGetKeyIdbyName(const char *pcKe | ||
304 | MOS_STATUS eStatus; | ||
305 | MOS_PUF_KEYLIST pTempNode; | ||
306 | |||
307 | - pKeyList = nullptr; | ||
308 | + pKeyList = MosUtilitiesSpecificNext::m_ufKeyList; | ||
309 | iResult = -1; | ||
310 | |||
311 | - if ((eStatus = UserFeatureDumpFile(m_szUserFeatureFile, &pKeyList)) != | ||
312 | - MOS_STATUS_SUCCESS ) | ||
313 | - { | ||
314 | - UserFeatureFreeKeyList(pKeyList); | ||
315 | - return eStatus; | ||
316 | - } | ||
317 | - | ||
318 | eStatus = MOS_STATUS_INVALID_PARAMETER; | ||
319 | |||
320 | for(pTempNode=pKeyList; pTempNode; pTempNode=pTempNode->pNext) | ||
321 | @@ -1177,7 +1151,6 @@ MOS_STATUS MosUtilitiesSpecificNext::UserFeatureGetKeyIdbyName(const char *pcKe | ||
322 | break; | ||
323 | } | ||
324 | } | ||
325 | - UserFeatureFreeKeyList(pKeyList); | ||
326 | |||
327 | return eStatus; | ||
328 | } | ||
329 | @@ -1188,7 +1161,7 @@ MOS_STATUS MosUtilitiesSpecificNext::UserFeatureGetKeyNamebyId(void *UFKey, cha | ||
330 | MOS_PUF_KEYLIST pTempNode; | ||
331 | MOS_STATUS eStatus; | ||
332 | |||
333 | - pKeyList = nullptr; | ||
334 | + pKeyList = MosUtilitiesSpecificNext::m_ufKeyList; | ||
335 | |||
336 | switch((uintptr_t)UFKey) | ||
337 | { | ||
338 | @@ -1201,13 +1174,6 @@ MOS_STATUS MosUtilitiesSpecificNext::UserFeatureGetKeyNamebyId(void *UFKey, cha | ||
339 | eStatus = MOS_STATUS_SUCCESS; | ||
340 | break; | ||
341 | default: | ||
342 | - if ((eStatus = UserFeatureDumpFile(m_szUserFeatureFile, &pKeyList)) != | ||
343 | - MOS_STATUS_SUCCESS ) | ||
344 | - { | ||
345 | - UserFeatureFreeKeyList(pKeyList); | ||
346 | - return eStatus; | ||
347 | - } | ||
348 | - | ||
349 | eStatus = MOS_STATUS_UNKNOWN; | ||
350 | |||
351 | for(pTempNode=pKeyList;pTempNode;pTempNode=pTempNode->pNext) | ||
352 | @@ -1219,7 +1185,6 @@ MOS_STATUS MosUtilitiesSpecificNext::UserFeatureGetKeyNamebyId(void *UFKey, cha | ||
353 | break; | ||
354 | } | ||
355 | } | ||
356 | - UserFeatureFreeKeyList(pKeyList); | ||
357 | break; | ||
358 | } | ||
359 | |||
360 | @@ -1364,6 +1329,7 @@ MOS_STATUS MosUtilities::MosOsUtilitiesInit(MOS_CONTEXT_HANDLE mosCtx) | ||
361 | //Init MOS User Feature Key from mos desc table | ||
362 | eStatus = MosDeclareUserFeatureKeysForAllDescFields(); | ||
363 | |||
364 | + MosUtilitiesSpecificNext::UserFeatureDumpFile(MosUtilitiesSpecificNext::m_szUserFeatureFile, &MosUtilitiesSpecificNext::m_ufKeyList); | ||
365 | #if _MEDIA_RESERVED | ||
366 | m_codecUserFeatureExt = new CodechalUserSettingsMgr(); | ||
367 | m_vpUserFeatureExt = new VphalUserSettingsMgr(); | ||
368 | @@ -1425,6 +1391,9 @@ MOS_STATUS MosUtilities::MosOsUtilitiesClose(MOS_CONTEXT_HANDLE mosCtx) | ||
369 | // so if there still is another active lib instance, logs would still be printed. | ||
370 | MosUtilDebug::MosMessageClose(); | ||
371 | #endif | ||
372 | + MosUtilitiesSpecificNext::UserFeatureDumpDataToFile(MosUtilitiesSpecificNext::m_szUserFeatureFile, MosUtilitiesSpecificNext::m_ufKeyList); | ||
373 | + MosUtilitiesSpecificNext::UserFeatureFreeKeyList(MosUtilitiesSpecificNext::m_ufKeyList); | ||
374 | + MosUtilitiesSpecificNext::m_ufKeyList = nullptr; | ||
375 | } | ||
376 | m_mutexLock.Unlock(); | ||
377 | return eStatus; | ||
378 | diff --git a/media_softlet/linux/common/os/mos_utilities_specific_next.h b/media_softlet/linux/common/os/mos_utilities_specific_next.h | ||
379 | index 792123a6..878ce4e6 100644 | ||
380 | --- a/media_softlet/linux/common/os/mos_utilities_specific_next.h | ||
381 | +++ b/media_softlet/linux/common/os/mos_utilities_specific_next.h | ||
382 | @@ -110,6 +110,41 @@ static MOS_STATUS MosUserFeatureOpenKeyFile( | ||
383 | uint32_t samDesired, | ||
384 | void **phkResult); | ||
385 | |||
386 | +/*---------------------------------------------------------------------------- | ||
387 | + | Name : UserFeatureDumpFile | ||
388 | + | Purpose : This function read the whole User Feature File and dump User Feature File | ||
389 | + | data to key linked list. | ||
390 | + | Arguments : szFileName [in] User Feature File name. | ||
391 | + | pKeyList [out] Key Linked list. | ||
392 | + | Returns : MOS_STATUS_SUCCESS Operation success. | ||
393 | + | MOS_STATUS_USER_FEATURE_KEY_READ_FAILED User Feature File can't be open as read. | ||
394 | + | MOS_STATUS_NO_SPACE no space left for allocate | ||
395 | + | MOS_STATUS_UNKNOWN unknown user feature type found in User Feature File | ||
396 | + | MOS_STATUS_INVALID_PARAMETER unknown items found in User Feature File | ||
397 | + | Comments : | ||
398 | + \---------------------------------------------------------------------------*/ | ||
399 | +static MOS_STATUS UserFeatureDumpFile(const char *const szFileName, MOS_PUF_KEYLIST *pKeyList); | ||
400 | + | ||
401 | +/*---------------------------------------------------------------------------- | ||
402 | +| Name : UserFeatureDumpDataToFile | ||
403 | +| Purpose : This function dump key linked list data to File. | ||
404 | +| Arguments : szFileName [in] A handle to the File. | ||
405 | +| pKeyList [in] Reserved, any LPDWORD type value. | ||
406 | +| Returns : MOS_STATUS_SUCCESS Operation success. | ||
407 | +| MOS_STATUS_USER_FEATURE_KEY_WRITE_FAILED File can't be written. | ||
408 | +| Comments : | ||
409 | +\---------------------------------------------------------------------------*/ | ||
410 | + | ||
411 | +static MOS_STATUS UserFeatureDumpDataToFile(const char *szFileName, MOS_PUF_KEYLIST pKeyList); | ||
412 | + | ||
413 | +/*---------------------------------------------------------------------------- | ||
414 | +| Name : UserFeatureFreeKeyList | ||
415 | +| Purpose : Free key list | ||
416 | +| Arguments : pKeyList [in] key list to be free. | ||
417 | +| Returns : None | ||
418 | +| Comments : | ||
419 | +\---------------------------------------------------------------------------*/ | ||
420 | +static void UserFeatureFreeKeyList(MOS_PUF_KEYLIST pKeyList); | ||
421 | |||
422 | private: | ||
423 | |||
424 | @@ -174,41 +209,6 @@ private: | ||
425 | |||
426 | static MOS_STATUS UserFeatureReadNextTokenFromFile(FILE *pFile, const char *szFormat, char *szToken); | ||
427 | |||
428 | - /*---------------------------------------------------------------------------- | ||
429 | - | Name : UserFeatureDumpFile | ||
430 | - | Purpose : This function read the whole User Feature File and dump User Feature File | ||
431 | - | data to key linked list. | ||
432 | - | Arguments : szFileName [in] User Feature File name. | ||
433 | - | pKeyList [out] Key Linked list. | ||
434 | - | Returns : MOS_STATUS_SUCCESS Operation success. | ||
435 | - | MOS_STATUS_USER_FEATURE_KEY_READ_FAILED User Feature File can't be open as read. | ||
436 | - | MOS_STATUS_NO_SPACE no space left for allocate | ||
437 | - | MOS_STATUS_UNKNOWN unknown user feature type found in User Feature File | ||
438 | - | MOS_STATUS_INVALID_PARAMETER unknown items found in User Feature File | ||
439 | - | Comments : | ||
440 | - \---------------------------------------------------------------------------*/ | ||
441 | - static MOS_STATUS UserFeatureDumpFile(const char * const szFileName, MOS_PUF_KEYLIST* pKeyList); | ||
442 | - | ||
443 | - /*---------------------------------------------------------------------------- | ||
444 | - | Name : UserFeatureDumpDataToFile | ||
445 | - | Purpose : This function dump key linked list data to File. | ||
446 | - | Arguments : szFileName [in] A handle to the File. | ||
447 | - | pKeyList [in] Reserved, any LPDWORD type value. | ||
448 | - | Returns : MOS_STATUS_SUCCESS Operation success. | ||
449 | - | MOS_STATUS_USER_FEATURE_KEY_WRITE_FAILED File can't be written. | ||
450 | - | Comments : | ||
451 | - \---------------------------------------------------------------------------*/ | ||
452 | - static MOS_STATUS UserFeatureDumpDataToFile(const char *szFileName, MOS_PUF_KEYLIST pKeyList); | ||
453 | - | ||
454 | - /*---------------------------------------------------------------------------- | ||
455 | - | Name : UserFeatureFreeKeyList | ||
456 | - | Purpose : Free key list | ||
457 | - | Arguments : pKeyList [in] key list to be free. | ||
458 | - | Returns : None | ||
459 | - | Comments : | ||
460 | - \---------------------------------------------------------------------------*/ | ||
461 | - static void UserFeatureFreeKeyList(MOS_PUF_KEYLIST pKeyList); | ||
462 | - | ||
463 | /*---------------------------------------------------------------------------- | ||
464 | | Name : UserFeatureSetValue | ||
465 | | Purpose : Modify or add a value of the specified user feature key. | ||
466 | @@ -290,6 +290,7 @@ private: | ||
467 | |||
468 | public: | ||
469 | static const char* m_szUserFeatureFile; | ||
470 | + static MOS_PUF_KEYLIST m_ufKeyList; | ||
471 | static int32_t m_mosTraceFd; | ||
472 | static const char* const m_mosTracePath; | ||
473 | static std::map<std::string, std::map<std::string, std::string>> m_regBuffer; | ||
474 | -- | ||
475 | 2.31.1 | ||
476 | |||
diff --git a/recipes-multimedia/libva/files/0001-Media-Common-Fix-the-user-setting-memory-free.patch b/recipes-multimedia/libva/files/0001-Media-Common-Fix-the-user-setting-memory-free.patch deleted file mode 100644 index e513e0aa..00000000 --- a/recipes-multimedia/libva/files/0001-Media-Common-Fix-the-user-setting-memory-free.patch +++ /dev/null | |||
@@ -1,86 +0,0 @@ | |||
1 | From 437e63b6c35eb5d12aac18d7f76ce1a702ad16e0 Mon Sep 17 00:00:00 2001 | ||
2 | From: Lim Siew Hoon <siew.hoon.lim@intel.com> | ||
3 | Date: Thu, 2 Dec 2021 15:50:33 +0000 | ||
4 | Subject: [PATCH] [Media Common] Fix the user setting memory free | ||
5 | |||
6 | From 4b8a411f2b8df112cbb5dbf8562735700cd15cf1 Mon Sep 17 00:00:00 2001 | ||
7 | From: "Wang, Pingli" <pingli.wang@intel.com> | ||
8 | Date: Thu, 2 Dec 2021 17:57:50 +0800 | ||
9 | Subject: [PATCH] [Media Common]Fix the user setting memory free | ||
10 | |||
11 | This commit fix the #1300 | ||
12 | |||
13 | Signed-off-by: Wang, Pingli <pingli.wang@intel.com> | ||
14 | |||
15 | This patch was imported from iHD media-driver git server | ||
16 | (https://github.com/intel/media-driver.git) as of pull request | ||
17 | https://github.com/intel/media-driver/pull/1305. | ||
18 | |||
19 | Upstream-status: Submitted | ||
20 | |||
21 | Signed-off-by: Lim Siew Hoon <siew.hoon.lim@intel.com> | ||
22 | --- | ||
23 | media_softlet/linux/common/os/mos_utilities_specific_next.cpp | 4 ++++ | ||
24 | media_softlet/linux/common/os/mos_utilities_specific_next.h | 4 ++++ | ||
25 | 2 files changed, 8 insertions(+) | ||
26 | |||
27 | diff --git a/media_softlet/linux/common/os/mos_utilities_specific_next.cpp b/media_softlet/linux/common/os/mos_utilities_specific_next.cpp | ||
28 | index 584ba086..c138cb08 100644 | ||
29 | --- a/media_softlet/linux/common/os/mos_utilities_specific_next.cpp | ||
30 | +++ b/media_softlet/linux/common/os/mos_utilities_specific_next.cpp | ||
31 | @@ -70,6 +70,7 @@ double MosUtilities::MosGetTime() | ||
32 | //! | ||
33 | const char *const MosUtilitiesSpecificNext::m_mosTracePath = "/sys/kernel/debug/tracing/trace_marker_raw"; | ||
34 | int32_t MosUtilitiesSpecificNext::m_mosTraceFd = -1; | ||
35 | +MosMutex MosUtilitiesSpecificNext::m_userSettingMutex; | ||
36 | |||
37 | std::map<std::string, std::map<std::string, std::string>> MosUtilitiesSpecificNext::m_regBuffer; | ||
38 | |||
39 | @@ -612,6 +613,7 @@ MOS_STATUS MosUtilitiesSpecificNext::UserFeatureSet(MOS_PUF_KEYLIST *pKeyList, M | ||
40 | MOS_AtomicIncrement(&MosUtilities::m_mosMemAllocFakeCounter); //ulValueBuf does not count it, because it is freed after the MEMNJA final report. | ||
41 | MOS_OS_NORMALMESSAGE("ulValueBuf %p for key %s", ulValueBuf, NewKey.pValueArray[0].pcValueName); | ||
42 | |||
43 | + m_userSettingMutex.Lock(); | ||
44 | if ( (iPos = UserFeatureFindValue(*Key, NewKey.pValueArray[0].pcValueName)) == NOT_FOUND) | ||
45 | { | ||
46 | //not found, add a new value to key struct. | ||
47 | @@ -620,6 +622,7 @@ MOS_STATUS MosUtilitiesSpecificNext::UserFeatureSet(MOS_PUF_KEYLIST *pKeyList, M | ||
48 | if (iPos >= UF_CAPABILITY) | ||
49 | { | ||
50 | MOS_OS_ASSERTMESSAGE("user setting value icount %d must less than UF_CAPABILITY(64)", iPos); | ||
51 | + m_userSettingMutex.Unlock(); | ||
52 | return MOS_STATUS_USER_FEATURE_KEY_READ_FAILED; | ||
53 | } | ||
54 | |||
55 | @@ -646,6 +649,7 @@ MOS_STATUS MosUtilitiesSpecificNext::UserFeatureSet(MOS_PUF_KEYLIST *pKeyList, M | ||
56 | NewKey.pValueArray[0].ulValueBuf, | ||
57 | NewKey.pValueArray[0].ulValueLen); | ||
58 | |||
59 | + m_userSettingMutex.Unlock(); | ||
60 | return MOS_STATUS_SUCCESS; | ||
61 | } | ||
62 | |||
63 | diff --git a/media_softlet/linux/common/os/mos_utilities_specific_next.h b/media_softlet/linux/common/os/mos_utilities_specific_next.h | ||
64 | index 878ce4e6..57e505d0 100644 | ||
65 | --- a/media_softlet/linux/common/os/mos_utilities_specific_next.h | ||
66 | +++ b/media_softlet/linux/common/os/mos_utilities_specific_next.h | ||
67 | @@ -30,6 +30,8 @@ | ||
68 | #include "mos_defs.h" | ||
69 | #include "mos_utilities_specific.h" | ||
70 | |||
71 | +class MosMutex; | ||
72 | + | ||
73 | class MosUtilitiesSpecificNext | ||
74 | { | ||
75 | public: | ||
76 | @@ -294,5 +296,7 @@ public: | ||
77 | static int32_t m_mosTraceFd; | ||
78 | static const char* const m_mosTracePath; | ||
79 | static std::map<std::string, std::map<std::string, std::string>> m_regBuffer; | ||
80 | +private: | ||
81 | + static MosMutex m_userSettingMutex; | ||
82 | }; | ||
83 | #endif // __MOS_UTILITIES_SPECIFIC_NEXT_H__ | ||
84 | -- | ||
85 | 2.31.1 | ||
86 | |||
diff --git a/recipes-multimedia/libva/intel-media-driver_21.3.5.bb b/recipes-multimedia/libva/intel-media-driver_22.1.1.bb index dc6cd8cb..5cca6bbd 100644 --- a/recipes-multimedia/libva/intel-media-driver_21.3.5.bb +++ b/recipes-multimedia/libva/intel-media-driver_22.1.1.bb | |||
@@ -19,11 +19,9 @@ REQUIRED_DISTRO_FEATURES = "opengl" | |||
19 | DEPENDS += "libva gmmlib" | 19 | DEPENDS += "libva gmmlib" |
20 | 20 | ||
21 | SRC_URI = "git://github.com/intel/media-driver.git;protocol=https;nobranch=1 \ | 21 | SRC_URI = "git://github.com/intel/media-driver.git;protocol=https;nobranch=1 \ |
22 | file://0001-MOS-user-setting-reentrant.patch \ | ||
23 | file://0001-Media-Common-Fix-the-user-setting-memory-free.patch \ | ||
24 | " | 22 | " |
25 | 23 | ||
26 | SRCREV = "ec4dc5d653733c21f8bf390794674052b5abdb09" | 24 | SRCREV = "31c1b995f49ef118a4b02f0b8e45bccdacf0d15e" |
27 | S = "${WORKDIR}/git" | 25 | S = "${WORKDIR}/git" |
28 | 26 | ||
29 | COMPATIBLE_HOST:x86-x32 = "null" | 27 | COMPATIBLE_HOST:x86-x32 = "null" |