summaryrefslogtreecommitdiff
path: root/mozilla-1645671.patch
diff options
context:
space:
mode:
authorMartin Stransky <stransky@redhat.com>2020-08-03 11:11:24 +0200
committerMartin Stransky <stransky@redhat.com>2020-08-03 11:11:24 +0200
commitcd18e999f576523b6b3f2076bca625d5e04d1178 (patch)
tree079f9f2ca8ec126e972ca0218531bed12c605289 /mozilla-1645671.patch
parentAdded VA-API fix for mozbz#1645671 (diff)
downloadlibrewolf-fedora-ff-cd18e999f576523b6b3f2076bca625d5e04d1178.tar.gz
librewolf-fedora-ff-cd18e999f576523b6b3f2076bca625d5e04d1178.tar.bz2
librewolf-fedora-ff-cd18e999f576523b6b3f2076bca625d5e04d1178.zip
Updated fix for mozbz#1645671
Diffstat (limited to 'mozilla-1645671.patch')
-rw-r--r--mozilla-1645671.patch123
1 files changed, 48 insertions, 75 deletions
diff --git a/mozilla-1645671.patch b/mozilla-1645671.patch
index 8e9e31e..0943469 100644
--- a/mozilla-1645671.patch
+++ b/mozilla-1645671.patch
@@ -1,94 +1,67 @@
-diff --git a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h
---- a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h
-+++ b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h
-@@ -156,7 +156,7 @@
- MediaDataDecoder::DecodedData& aResults);
-
- void ReleaseUnusedVAAPIFrames();
-- DMABufSurfaceWrapper* GetUnusedDMABufSurfaceWrapper();
-+ int GetUnusedDMABufSurfaceWrapperIndex();
- void ReleaseDMABufSurfaces();
- #endif
-
-@@ -174,7 +174,7 @@
- const bool mDisableHardwareDecoding;
- VADisplay mDisplay;
- bool mUseDMABufSurfaces;
-- nsTArray<DMABufSurfaceWrapper> mDMABufSurfaces;
-+ nsTArray<UniquePtr<DMABufSurfaceWrapper>> mDMABufSurfaces;
- #endif
- RefPtr<KnowsCompositor> mImageAllocator;
- RefPtr<ImageContainer> mImageContainer;
+changeset: 544864:a8603f131703
+tag: tip
+parent: 544861:161920b70ae4
+user: Martin Stransky <stransky@redhat.com>
+date: Fri Jul 31 13:39:48 2020 +0200
+files: dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h
+description:
+Bug 1645671 [Linux/VA-API] Create DMABufSurfaceWrapper directly at nsTAttay and disable DMABufSurfaceWrapper class copy and assignment constructors, r?jya
+
+When DMABufSurfaceWrapper is added to nsTArray, a temporary local DMABufSurfaceWrapper object is created. When the temporary
+object is deleted after the adding, associated dmabuf data is released which leads to rendering artifact during VA-API video playback.
+
+As a fix in this patch we create DMABufSurfaceWrapper 'in-place' at nsTAttay.
+We also disable DMABufSurfaceWrapper class copy and assignment constructors to avoid similar potential issues.
+
+Differential Revision: https://phabricator.services.mozilla.com/D85152
+
+
diff --git a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
--- a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
+++ b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
-@@ -698,21 +698,20 @@
- void FFmpegVideoDecoder<LIBAV_VER>::ReleaseUnusedVAAPIFrames() {
- int len = mDMABufSurfaces.Length();
- for (int i = 0; i < len; i++) {
-- if (!mDMABufSurfaces[i].IsUsed()) {
-- mDMABufSurfaces[i].ReleaseVAAPIData();
-+ if (!mDMABufSurfaces[i]->IsUsed()) {
-+ mDMABufSurfaces[i]->ReleaseVAAPIData();
- }
- }
- }
-
--DMABufSurfaceWrapper*
--FFmpegVideoDecoder<LIBAV_VER>::GetUnusedDMABufSurfaceWrapper() {
-+int FFmpegVideoDecoder<LIBAV_VER>::GetUnusedDMABufSurfaceWrapperIndex() {
- int len = mDMABufSurfaces.Length();
- for (int i = 0; i < len; i++) {
-- if (!mDMABufSurfaces[i].IsUsed()) {
-- return &(mDMABufSurfaces[i]);
-+ if (!mDMABufSurfaces[i]->IsUsed()) {
-+ return i;
- }
- }
-- return nullptr;
-+ return -1;
- }
-
- void FFmpegVideoDecoder<LIBAV_VER>::ReleaseDMABufSurfaces() {
-@@ -763,8 +762,8 @@
-
- RefPtr<DMABufSurfaceYUV> surface;
-
-- DMABufSurfaceWrapper* surfaceWrapper = GetUnusedDMABufSurfaceWrapper();
-- if (!surfaceWrapper) {
-+ int surfaceWrapperIndex = GetUnusedDMABufSurfaceWrapperIndex();
-+ if (surfaceWrapperIndex < 0) {
- if (mVAAPIDeviceContext) {
- surface = DMABufSurfaceYUV::CreateYUVSurface(vaDesc);
- } else {
-@@ -776,16 +775,16 @@
- return MediaResult(NS_ERROR_OUT_OF_MEMORY,
+@@ -777,17 +777,17 @@ MediaResult FFmpegVideoDecoder<LIBAV_VER
RESULT_DETAIL("Unable to get DMABufSurfaceYUV"));
}
--
+
# ifdef MOZ_LOGGING
static int uid = 0;
surface->SetUID(++uid);
FFMPEG_LOG("Created new DMABufSurface UID = %d", uid);
# endif
- mDMABufSurfaces.AppendElement(DMABufSurfaceWrapper(surface, mLib));
-- surfaceWrapper = &(mDMABufSurfaces[mDMABufSurfaces.Length() - 1]);
-+ mDMABufSurfaces.AppendElement(
-+ MakeUnique<DMABufSurfaceWrapper>(surface, mLib));
-+ surfaceWrapperIndex = mDMABufSurfaces.Length() - 1;
++ mDMABufSurfaces.EmplaceBack(surface, mLib);
+ surfaceWrapper = &(mDMABufSurfaces[mDMABufSurfaces.Length() - 1]);
} else {
-- surface = surfaceWrapper->GetDMABufSurface();
-+ surface = mDMABufSurfaces[surfaceWrapperIndex]->GetDMABufSurface();
+ surface = surfaceWrapper->GetDMABufSurface();
bool ret;
if (mVAAPIDeviceContext) {
-@@ -803,7 +802,7 @@
- }
+ ret = surface->UpdateYUVData(vaDesc);
+ } else {
+diff --git a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h
+--- a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h
++++ b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h
+@@ -70,16 +70,22 @@ class DMABufSurfaceWrapper final {
+ // Check if DMABufSurface is used by any gecko rendering process
+ // (WebRender or GL compositor) or by DMABUFSurfaceImage/VideoData.
+ bool IsUsed() const { return mSurface->IsGlobalRefSet(); }
- if (mVAAPIDeviceContext) {
-- surfaceWrapper->LockVAAPIData(mCodecContext, mFrame);
-+ mDMABufSurfaces[surfaceWrapperIndex]->LockVAAPIData(mCodecContext, mFrame);
+ RefPtr<DMABufSurfaceYUV> GetDMABufSurface() const {
+ return mSurface->GetAsDMABufSurfaceYUV();
}
- surface->SetYUVColorSpace(GetFrameColorSpace());
++ // Don't allow DMABufSurfaceWrapper plain copy as it leads to
++ // enexpected DMABufSurface/HW buffer releases and we don't want to
++ // deep copy them.
++ DMABufSurfaceWrapper(const DMABufSurfaceWrapper&) = delete;
++ const DMABufSurfaceWrapper& operator=(DMABufSurfaceWrapper const&) = delete;
++
+ private:
+ const RefPtr<DMABufSurface> mSurface;
+ const FFmpegLibWrapper* mLib;
+ AVBufferRef* mAVHWFramesContext;
+ AVBufferRef* mHWAVBuffer;
+ };
+ #endif
+
bgstack15