Fixed double free issue running with multiple channel
decoding with vaapisink plugins in gstreamer-vaapi master.

Signed-off-by: Lim Siew Hoon <[email protected]>
---
 ...mon-Fix-the-user-setting-memory-free.patch | 86 +++++++++++++++++++
 .../libva/intel-media-driver_21.3.5.bb        |  1 +
 2 files changed, 87 insertions(+)
 create mode 100644 
recipes-multimedia/libva/files/0001-Media-Common-Fix-the-user-setting-memory-free.patch

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
new file mode 100644
index 00000000..e513e0aa
--- /dev/null
+++ 
b/recipes-multimedia/libva/files/0001-Media-Common-Fix-the-user-setting-memory-free.patch
@@ -0,0 +1,86 @@
+From 437e63b6c35eb5d12aac18d7f76ce1a702ad16e0 Mon Sep 17 00:00:00 2001
+From: Lim Siew Hoon <[email protected]>
+Date: Thu, 2 Dec 2021 15:50:33 +0000
+Subject: [PATCH] [Media Common] Fix the user setting memory free
+
+From 4b8a411f2b8df112cbb5dbf8562735700cd15cf1 Mon Sep 17 00:00:00 2001
+From: "Wang, Pingli" <[email protected]>
+Date: Thu, 2 Dec 2021 17:57:50 +0800
+Subject: [PATCH] [Media Common]Fix the user setting memory free
+
+This commit fix the #1300
+
+Signed-off-by: Wang, Pingli <[email protected]>
+
+This patch was imported from iHD media-driver git server
+(https://github.com/intel/media-driver.git) as of pull request
+https://github.com/intel/media-driver/pull/1305.
+
+Upstream-status: Submitted
+
+Signed-off-by: Lim Siew Hoon <[email protected]>
+---
+ media_softlet/linux/common/os/mos_utilities_specific_next.cpp | 4 ++++
+ media_softlet/linux/common/os/mos_utilities_specific_next.h   | 4 ++++
+ 2 files changed, 8 insertions(+)
+
+diff --git a/media_softlet/linux/common/os/mos_utilities_specific_next.cpp 
b/media_softlet/linux/common/os/mos_utilities_specific_next.cpp
+index 584ba086..c138cb08 100644
+--- a/media_softlet/linux/common/os/mos_utilities_specific_next.cpp
++++ b/media_softlet/linux/common/os/mos_utilities_specific_next.cpp
+@@ -70,6 +70,7 @@ double MosUtilities::MosGetTime()
+ //!
+ const char *const MosUtilitiesSpecificNext::m_mosTracePath  = 
"/sys/kernel/debug/tracing/trace_marker_raw";
+ int32_t           MosUtilitiesSpecificNext::m_mosTraceFd    = -1;
++MosMutex          MosUtilitiesSpecificNext::m_userSettingMutex;
+ 
+ std::map<std::string, std::map<std::string, std::string>> 
MosUtilitiesSpecificNext::m_regBuffer;
+ 
+@@ -612,6 +613,7 @@ MOS_STATUS 
MosUtilitiesSpecificNext::UserFeatureSet(MOS_PUF_KEYLIST *pKeyList, M
+     MOS_AtomicIncrement(&MosUtilities::m_mosMemAllocFakeCounter);  
//ulValueBuf does not count it, because it is freed after the MEMNJA final 
report.
+     MOS_OS_NORMALMESSAGE("ulValueBuf %p for key %s", ulValueBuf, 
NewKey.pValueArray[0].pcValueName);
+ 
++    m_userSettingMutex.Lock();
+     if ( (iPos = UserFeatureFindValue(*Key, 
NewKey.pValueArray[0].pcValueName)) == NOT_FOUND)
+     {
+         //not found, add a new value to key struct.
+@@ -620,6 +622,7 @@ MOS_STATUS 
MosUtilitiesSpecificNext::UserFeatureSet(MOS_PUF_KEYLIST *pKeyList, M
+         if (iPos >= UF_CAPABILITY)
+         {
+             MOS_OS_ASSERTMESSAGE("user setting value icount %d must less than 
UF_CAPABILITY(64)", iPos);
++            m_userSettingMutex.Unlock();
+             return MOS_STATUS_USER_FEATURE_KEY_READ_FAILED;
+         }
+ 
+@@ -646,6 +649,7 @@ MOS_STATUS 
MosUtilitiesSpecificNext::UserFeatureSet(MOS_PUF_KEYLIST *pKeyList, M
+                      NewKey.pValueArray[0].ulValueBuf,
+                      NewKey.pValueArray[0].ulValueLen);
+ 
++    m_userSettingMutex.Unlock();
+     return MOS_STATUS_SUCCESS;
+ }
+ 
+diff --git a/media_softlet/linux/common/os/mos_utilities_specific_next.h 
b/media_softlet/linux/common/os/mos_utilities_specific_next.h
+index 878ce4e6..57e505d0 100644
+--- a/media_softlet/linux/common/os/mos_utilities_specific_next.h
++++ b/media_softlet/linux/common/os/mos_utilities_specific_next.h
+@@ -30,6 +30,8 @@
+ #include "mos_defs.h"
+ #include "mos_utilities_specific.h"
+ 
++class MosMutex;
++
+ class MosUtilitiesSpecificNext
+ {
+ public:
+@@ -294,5 +296,7 @@ public:
+     static int32_t              m_mosTraceFd;
+     static const char* const    m_mosTracePath;
+     static std::map<std::string, std::map<std::string, std::string>> 
m_regBuffer;
++private:
++    static MosMutex             m_userSettingMutex;
+ };
+ #endif // __MOS_UTILITIES_SPECIFIC_NEXT_H__
+-- 
+2.31.1
+
diff --git a/recipes-multimedia/libva/intel-media-driver_21.3.5.bb 
b/recipes-multimedia/libva/intel-media-driver_21.3.5.bb
index cc32b86b..dc6cd8cb 100644
--- a/recipes-multimedia/libva/intel-media-driver_21.3.5.bb
+++ b/recipes-multimedia/libva/intel-media-driver_21.3.5.bb
@@ -20,6 +20,7 @@ DEPENDS += "libva gmmlib"
 
 SRC_URI = "git://github.com/intel/media-driver.git;protocol=https;nobranch=1 \
            file://0001-MOS-user-setting-reentrant.patch \
+           file://0001-Media-Common-Fix-the-user-setting-memory-free.patch \
           "
 
 SRCREV = "ec4dc5d653733c21f8bf390794674052b5abdb09"
-- 
2.17.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#7369): 
https://lists.yoctoproject.org/g/meta-intel/message/7369
Mute This Topic: https://lists.yoctoproject.org/mt/87456344/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-intel/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to