summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firefox.spec11
-rw-r--r--mozilla-1619882-1.patch349
-rw-r--r--mozilla-1619882-2.patch155
-rw-r--r--mozilla-1619882-3.patch51
4 files changed, 565 insertions, 1 deletions
diff --git a/firefox.spec b/firefox.spec
index d911068..be43f2d 100644
--- a/firefox.spec
+++ b/firefox.spec
@@ -118,7 +118,7 @@ ExcludeArch: s390x
Summary: Mozilla Firefox Web browser
Name: firefox
Version: 76.0.1
-Release: 4%{?nss_tag}%{?dist}
+Release: 5%{?nss_tag}%{?dist}
URL: https://www.mozilla.org/firefox/
License: MPLv1.1 or GPLv2+ or LGPLv2+
Source0: https://archive.mozilla.org/pub/firefox/releases/%{version}%{?pre_version}/source/firefox-%{version}%{?pre_version}.source.tar.xz
@@ -196,6 +196,9 @@ Patch582: mozilla-1619543.patch
Patch583: mozilla-1632059.patch
Patch584: firefox-disable-ffvpx-with-vapi.patch
Patch585: firefox-vaapi-extra-frames.patch
+Patch586: mozilla-1619882-1.patch
+Patch587: mozilla-1619882-2.patch
+Patch588: mozilla-1619882-3.patch
# PGO/LTO patches
Patch600: pgo.patch
@@ -409,6 +412,9 @@ This package contains results of tests executed during build.
%patch583 -p1 -b .mozilla-1632059
%patch584 -p1 -b .firefox-disable-ffvpx-with-vapi
%patch585 -p1 -b .firefox-vaapi-extra-frames
+%patch586 -p1 -b .mozilla-1619882-1
+%patch587 -p1 -b .mozilla-1619882-2
+%patch588 -p1 -b .mozilla-1619882-3
# PGO patches
%patch600 -p1 -b .pgo
@@ -983,6 +989,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
#---------------------------------------------------------------------
%changelog
+* Mon May 25 2020 Martin Stransky <stransky@redhat.com> - 76.0.1-5
+- Added fix for mozbz#1619882 - video flickering when va-api is used.
+
* Thu May 21 2020 Jan Grulich <jgrulich@redhat.com> - 76.0.1-4
- Add support for PipeWire 0.3
diff --git a/mozilla-1619882-1.patch b/mozilla-1619882-1.patch
new file mode 100644
index 0000000..25ff321
--- /dev/null
+++ b/mozilla-1619882-1.patch
@@ -0,0 +1,349 @@
+diff --git a/gfx/layers/ipc/LayersSurfaces.ipdlh b/gfx/layers/ipc/LayersSurfaces.ipdlh
+--- a/gfx/layers/ipc/LayersSurfaces.ipdlh
++++ b/gfx/layers/ipc/LayersSurfaces.ipdlh
+@@ -71,6 +71,8 @@
+ uint32_t[] offsets;
+ YUVColorSpace yUVColorSpace;
+ FileDescriptor[] fence;
++ uint32_t uid;
++ FileDescriptor[] refCount;
+ };
+
+ struct SurfaceTextureDescriptor {
+diff --git a/widget/gtk/WaylandDMABufSurface.h b/widget/gtk/WaylandDMABufSurface.h
+--- a/widget/gtk/WaylandDMABufSurface.h
++++ b/widget/gtk/WaylandDMABufSurface.h
+@@ -40,6 +40,23 @@
+
+ class WaylandDMABufSurfaceRGBA;
+
++class DMABufRefcount {
++ public:
++ DMABufRefcount();
++ DMABufRefcount(int aFd);
++
++ bool Created() { return mFd > 0; };
++ int GetFD() { return mFd; }
++ uint64_t GetRefcount();
++ void RefAdd();
++ void Release();
++
++ ~DMABufRefcount();
++
++ private:
++ int mFd;
++};
++
+ class WaylandDMABufSurface {
+ public:
+ NS_INLINE_DECL_THREADSAFE_REFCOUNTING(WaylandDMABufSurface)
+@@ -82,6 +99,14 @@
+ void FenceWait();
+ void FenceDelete();
+
++ void SetUID(uint32_t aUID) { mUID = aUID; };
++ uint32_t GetUID() { return mUID; };
++
++ void GlobalRefCountCreate();
++ bool IsGlobalRefSet();
++ void GlobalRefAdd();
++ void GlobalRefRelease();
++
+ WaylandDMABufSurface(SurfaceType aSurfaceType);
+
+ protected:
+@@ -89,6 +114,8 @@
+ virtual void ReleaseSurface() = 0;
+ bool FenceCreate(int aFd);
+
++ bool GlobalRefCountImport(int aFd);
++
+ virtual ~WaylandDMABufSurface() { FenceDelete(); };
+
+ SurfaceType mSurfaceType;
+@@ -102,6 +129,9 @@
+
+ EGLSyncKHR mSync;
+ RefPtr<mozilla::gl::GLContext> mGL;
++
++ mozilla::UniquePtr<DMABufRefcount> mGlobalRefCount;
++ uint32_t mUID;
+ };
+
+ class WaylandDMABufSurfaceRGBA : public WaylandDMABufSurface {
+diff --git a/widget/gtk/WaylandDMABufSurface.cpp b/widget/gtk/WaylandDMABufSurface.cpp
+--- a/widget/gtk/WaylandDMABufSurface.cpp
++++ b/widget/gtk/WaylandDMABufSurface.cpp
+@@ -17,6 +17,8 @@
+ #include <unistd.h>
+ #include <sys/time.h>
+ #include <dlfcn.h>
++#include <sys/mman.h>
++#include <sys/eventfd.h>
+
+ #include "mozilla/widget/gbm.h"
+ #include "mozilla/widget/va_drmcommon.h"
+@@ -57,6 +59,73 @@
+ # define VA_FOURCC_NV12 0x3231564E
+ #endif
+
++void DMABufRefcount::RefAdd() {
++ uint64_t counter;
++ read(mFd, &counter, sizeof(counter));
++ counter++;
++ write(mFd, &counter, sizeof(counter));
++}
++
++void DMABufRefcount::Release() {
++ uint64_t counter;
++ read(mFd, &counter, sizeof(counter));
++ counter--;
++ write(mFd, &counter, sizeof(counter));
++}
++
++uint64_t DMABufRefcount::GetRefcount() {
++ uint64_t counter;
++ read(mFd, &counter, sizeof(counter));
++ write(mFd, &counter, sizeof(counter));
++ return counter;
++}
++
++DMABufRefcount::DMABufRefcount()
++ : mFd(eventfd(1, EFD_CLOEXEC | EFD_NONBLOCK)) {}
++
++DMABufRefcount::DMABufRefcount(int aFd) : mFd(aFd) {}
++
++DMABufRefcount::~DMABufRefcount() {
++ if (mFd > 0) {
++ close(mFd);
++ }
++}
++
++void WaylandDMABufSurface::GlobalRefCountCreate() {
++ MOZ_ASSERT(!mGlobalRefCount);
++ mGlobalRefCount = MakeUnique<DMABufRefcount>();
++ if (!mGlobalRefCount->Created()) {
++ NS_WARNING("Failed to create dmabuf global ref count!");
++ mGlobalRefCount = nullptr;
++ }
++}
++
++bool WaylandDMABufSurface::GlobalRefCountImport(int aFd) {
++ MOZ_ASSERT(!mGlobalRefCount);
++ mGlobalRefCount = MakeUnique<DMABufRefcount>(aFd);
++ if (!mGlobalRefCount->Created()) {
++ NS_WARNING("Failed to import dmabuf global ref count!");
++ mGlobalRefCount = nullptr;
++ return false;
++ }
++ return true;
++}
++
++bool WaylandDMABufSurface::IsGlobalRefSet() {
++ MOZ_ASSERT(mGlobalRefCount);
++ return mGlobalRefCount->GetRefcount() > 1;
++}
++
++void WaylandDMABufSurface::GlobalRefAdd() {
++ MOZ_ASSERT(mGlobalRefCount);
++ mGlobalRefCount->RefAdd();
++}
++
++void WaylandDMABufSurface::GlobalRefRelease() {
++ MOZ_ASSERT(mGlobalRefCount);
++ mGlobalRefCount->Release();
++}
++
+ WaylandDMABufSurface::WaylandDMABufSurface(SurfaceType aSurfaceType)
+ : mSurfaceType(aSurfaceType),
+ mBufferModifier(DRM_FORMAT_MOD_INVALID),
+@@ -64,7 +133,9 @@
+ mDrmFormats(),
+ mStrides(),
+ mOffsets(),
+- mSync(0) {
++ mSync(0),
++ mGlobalRefCount(nullptr),
++ mUID(0) {
+ for (auto& slot : mDmabufFds) {
+ slot = -1;
+ }
+@@ -316,6 +387,7 @@
+ mBufferPlaneCount = desc.fds().Length();
+ mGbmBufferFlags = desc.flags();
+ MOZ_RELEASE_ASSERT(mBufferPlaneCount <= DMABUF_BUFFER_PLANES);
++ mUID = desc.uid();
+
+ for (int i = 0; i < mBufferPlaneCount; i++) {
+ mDmabufFds[i] = desc.fds()[i].ClonePlatformHandle().release();
+@@ -329,6 +401,13 @@
+ close(fd);
+ }
+ }
++
++ if (desc.refCount().Length() > 0) {
++ int fd = desc.refCount()[0].ClonePlatformHandle().release();
++ if (!GlobalRefCountImport(fd)) {
++ close(fd);
++ }
++ }
+ }
+
+ bool WaylandDMABufSurfaceRGBA::Create(const SurfaceDescriptor& aDesc) {
+@@ -346,6 +425,7 @@
+ AutoTArray<uint32_t, DMABUF_BUFFER_PLANES> offsets;
+ AutoTArray<uintptr_t, DMABUF_BUFFER_PLANES> images;
+ AutoTArray<ipc::FileDescriptor, 1> fenceFDs;
++ AutoTArray<ipc::FileDescriptor, 1> refCountFDs;
+
+ width.AppendElement(mWidth);
+ height.AppendElement(mHeight);
+@@ -362,9 +442,14 @@
+ egl->fDupNativeFenceFDANDROID(egl->Display(), mSync)));
+ }
+
+- aOutDescriptor = SurfaceDescriptorDMABuf(
+- mSurfaceType, mBufferModifier, mGbmBufferFlags, fds, width, height,
+- format, strides, offsets, GetYUVColorSpace(), fenceFDs);
++ if (mGlobalRefCount) {
++ refCountFDs.AppendElement(ipc::FileDescriptor(mGlobalRefCount->GetFD()));
++ }
++
++ aOutDescriptor =
++ SurfaceDescriptorDMABuf(mSurfaceType, mBufferModifier, mGbmBufferFlags,
++ fds, width, height, format, strides, offsets,
++ GetYUVColorSpace(), fenceFDs, mUID, refCountFDs);
+
+ return true;
+ }
+@@ -693,6 +778,7 @@
+ mBufferPlaneCount = aDesc.fds().Length();
+ mBufferModifier = aDesc.modifier();
+ mColorSpace = aDesc.yUVColorSpace();
++ mUID = aDesc.uid();
+
+ MOZ_RELEASE_ASSERT(mBufferPlaneCount <= DMABUF_BUFFER_PLANES);
+ for (int i = 0; i < mBufferPlaneCount; i++) {
+@@ -710,6 +796,13 @@
+ close(fd);
+ }
+ }
++
++ if (aDesc.refCount().Length() > 0) {
++ int fd = aDesc.refCount()[0].ClonePlatformHandle().release();
++ if (!GlobalRefCountImport(fd)) {
++ close(fd);
++ }
++ }
+ }
+
+ bool WaylandDMABufSurfaceNV12::Serialize(
+@@ -721,6 +814,7 @@
+ AutoTArray<uint32_t, DMABUF_BUFFER_PLANES> strides;
+ AutoTArray<uint32_t, DMABUF_BUFFER_PLANES> offsets;
+ AutoTArray<ipc::FileDescriptor, 1> fenceFDs;
++ AutoTArray<ipc::FileDescriptor, 1> refCountFDs;
+
+ for (int i = 0; i < mBufferPlaneCount; i++) {
+ width.AppendElement(mWidth[i]);
+@@ -737,9 +831,13 @@
+ egl->fDupNativeFenceFDANDROID(egl->Display(), mSync)));
+ }
+
++ if (mGlobalRefCount) {
++ refCountFDs.AppendElement(ipc::FileDescriptor(mGlobalRefCount->GetFD()));
++ }
++
+ aOutDescriptor = SurfaceDescriptorDMABuf(
+ mSurfaceType, mBufferModifier, 0, fds, width, height, format, strides,
+- offsets, GetYUVColorSpace(), fenceFDs);
++ offsets, GetYUVColorSpace(), fenceFDs, mUID, refCountFDs);
+ return true;
+ }
+
+diff --git a/widget/gtk/WindowSurfaceWayland.h b/widget/gtk/WindowSurfaceWayland.h
+--- a/widget/gtk/WindowSurfaceWayland.h
++++ b/widget/gtk/WindowSurfaceWayland.h
+@@ -36,8 +36,6 @@
+ int aImageDataSize);
+
+ private:
+- int CreateTemporaryFile(int aSize);
+-
+ wl_shm_pool* mShmPool;
+ int mShmPoolFd;
+ int mAllocatedSize;
+diff --git a/widget/gtk/WindowSurfaceWayland.cpp b/widget/gtk/WindowSurfaceWayland.cpp
+--- a/widget/gtk/WindowSurfaceWayland.cpp
++++ b/widget/gtk/WindowSurfaceWayland.cpp
+@@ -206,42 +206,25 @@
+ return mWindowSurfaceWayland->GetWaylandDisplay();
+ }
+
+-int WaylandShmPool::CreateTemporaryFile(int aSize) {
+- const char* tmppath = getenv("XDG_RUNTIME_DIR");
+- MOZ_RELEASE_ASSERT(tmppath, "Missing XDG_RUNTIME_DIR env variable.");
+-
+- nsPrintfCString tmpname("%s/mozilla-shared-XXXXXX", tmppath);
+-
+- char* filename;
+- int fd = -1;
+- int ret = 0;
+-
+- if (tmpname.GetMutableData(&filename)) {
+- fd = mkstemp(filename);
+- if (fd >= 0) {
+- int flags = fcntl(fd, F_GETFD);
+- if (flags >= 0) {
+- fcntl(fd, F_SETFD, flags | FD_CLOEXEC);
+- }
+- }
+- }
+-
++static int WaylandAllocateShmMemory(int aSize) {
++ static int counter = 0;
++ nsPrintfCString shmName("/wayland.mozilla.ipc.%d", counter++);
++ int fd = shm_open(shmName.get(), O_CREAT | O_RDWR | O_EXCL, 0600);
+ if (fd >= 0) {
+- unlink(tmpname.get());
++ shm_unlink(shmName.get());
+ } else {
+- printf_stderr("Unable to create mapping file %s\n", filename);
++ printf_stderr("Unable to SHM memory segment\n");
+ MOZ_CRASH();
+ }
+
++ int ret = 0;
+ #ifdef HAVE_POSIX_FALLOCATE
+ do {
+ ret = posix_fallocate(fd, 0, aSize);
+ } while (ret == EINTR);
+ if (ret != 0) {
+ close(fd);
+- MOZ_CRASH_UNSAFE_PRINTF(
+- "posix_fallocate() fails on %s size %d error code %d\n", filename,
+- aSize, ret);
++ MOZ_CRASH("posix_fallocate() fails to allocate shm memory");
+ }
+ #else
+ do {
+@@ -249,8 +232,7 @@
+ } while (ret < 0 && errno == EINTR);
+ if (ret < 0) {
+ close(fd);
+- MOZ_CRASH_UNSAFE_PRINTF("ftruncate() fails on %s size %d error code %d\n",
+- filename, aSize, ret);
++ MOZ_CRASH("ftruncate() fails to allocate shm memory");
+ }
+ #endif
+
+@@ -259,7 +241,7 @@
+
+ WaylandShmPool::WaylandShmPool(nsWaylandDisplay* aWaylandDisplay, int aSize)
+ : mAllocatedSize(aSize) {
+- mShmPoolFd = CreateTemporaryFile(mAllocatedSize);
++ mShmPoolFd = WaylandAllocateShmMemory(mAllocatedSize);
+ mImageData = mmap(nullptr, mAllocatedSize, PROT_READ | PROT_WRITE, MAP_SHARED,
+ mShmPoolFd, 0);
+ MOZ_RELEASE_ASSERT(mImageData != MAP_FAILED,
+
diff --git a/mozilla-1619882-2.patch b/mozilla-1619882-2.patch
new file mode 100644
index 0000000..2733186
--- /dev/null
+++ b/mozilla-1619882-2.patch
@@ -0,0 +1,155 @@
+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
+@@ -10,17 +10,26 @@
+ #include "FFmpegLibWrapper.h"
+ #include "FFmpegDataDecoder.h"
+ #include "SimpleMap.h"
++#ifdef MOZ_WAYLAND_USE_VAAPI
++# include "mozilla/widget/WaylandDMABufSurface.h"
++# include <list>
++#endif
+
+ namespace mozilla {
+
+ #ifdef MOZ_WAYLAND_USE_VAAPI
++
+ class VAAPIFrameHolder {
+ public:
+- VAAPIFrameHolder(FFmpegLibWrapper* aLib, AVBufferRef* aVAAPIDeviceContext,
++ VAAPIFrameHolder(RefPtr<WaylandDMABufSurface> aSurface,
++ FFmpegLibWrapper* aLib, AVBufferRef* aVAAPIDeviceContext,
+ AVBufferRef* aAVHWFramesContext, AVBufferRef* aHWFrame);
+ ~VAAPIFrameHolder();
+
++ bool IsUsed() { return mSurface->IsGlobalRefSet(); }
++
+ private:
++ RefPtr<WaylandDMABufSurface> mSurface;
+ FFmpegLibWrapper* mLib;
+ AVBufferRef* mVAAPIDeviceContext;
+ AVBufferRef* mAVHWFramesContext;
+@@ -97,6 +106,7 @@
+
+ MediaResult CreateImageVAAPI(int64_t aOffset, int64_t aPts, int64_t aDuration,
+ MediaDataDecoder::DecodedData& aResults);
++ void ReleaseUnusedVAAPIFrames();
+ #endif
+
+ /**
+@@ -112,6 +122,7 @@
+ AVBufferRef* mVAAPIDeviceContext;
+ const bool mDisableHardwareDecoding;
+ VADisplay mDisplay;
++ std::list<UniquePtr<VAAPIFrameHolder>> mFrameHolders;
+ #endif
+ RefPtr<KnowsCompositor> mImageAllocator;
+ RefPtr<ImageContainer> mImageContainer;
+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
+@@ -122,19 +122,30 @@
+ return AV_PIX_FMT_NONE;
+ }
+
+-VAAPIFrameHolder::VAAPIFrameHolder(FFmpegLibWrapper* aLib,
++VAAPIFrameHolder::VAAPIFrameHolder(RefPtr<WaylandDMABufSurface> aSurface,
++ FFmpegLibWrapper* aLib,
+ AVBufferRef* aVAAPIDeviceContext,
+ AVBufferRef* aAVHWFramesContext,
+ AVBufferRef* aHWFrame)
+- : mLib(aLib),
++ : mSurface(aSurface),
++ mLib(aLib),
+ mVAAPIDeviceContext(mLib->av_buffer_ref(aVAAPIDeviceContext)),
+ mAVHWFramesContext(mLib->av_buffer_ref(aAVHWFramesContext)),
+- mHWFrame(mLib->av_buffer_ref(aHWFrame)){};
++ mHWFrame(mLib->av_buffer_ref(aHWFrame)) {
++ FFMPEG_LOG("VAAPIFrameHolder is adding dmabuf surface UID = %d\n",
++ mSurface->GetUID());
++ // Create global refcount object to track mSurface usage over
++ // processes.
++ mSurface->GlobalRefCountCreate();
++}
+
+ VAAPIFrameHolder::~VAAPIFrameHolder() {
++ FFMPEG_LOG("VAAPIFrameHolder is releasing dmabuf surface UID = %d\n",
++ mSurface->GetUID());
+ mLib->av_buffer_unref(&mHWFrame);
+ mLib->av_buffer_unref(&mAVHWFramesContext);
+ mLib->av_buffer_unref(&mVAAPIDeviceContext);
++ mSurface = nullptr;
+ }
+
+ AVCodec* FFmpegVideoDecoder<LIBAV_VER>::FindVAAPICodec() {
+@@ -418,6 +428,13 @@
+ NS_WARNING("FFmpeg h264 decoder failed to allocate frame.");
+ return MediaResult(NS_ERROR_OUT_OF_MEMORY, __func__);
+ }
++
++# ifdef MOZ_WAYLAND_USE_VAAPI
++ if (mVAAPIDeviceContext) {
++ ReleaseUnusedVAAPIFrames();
++ }
++# endif
++
+ res = mLib->avcodec_receive_frame(mCodecContext, mFrame);
+ if (res == int(AVERROR_EOF)) {
+ return NS_ERROR_DOM_MEDIA_END_OF_STREAM;
+@@ -624,9 +641,16 @@
+ }
+
+ #ifdef MOZ_WAYLAND_USE_VAAPI
+-static void VAAPIFrameReleaseCallback(VAAPIFrameHolder* aVAAPIFrameHolder) {
+- auto frameHolder = static_cast<VAAPIFrameHolder*>(aVAAPIFrameHolder);
+- delete frameHolder;
++void FFmpegVideoDecoder<LIBAV_VER>::ReleaseUnusedVAAPIFrames() {
++ std::list<UniquePtr<VAAPIFrameHolder>>::iterator holder =
++ mFrameHolders.begin();
++ while (holder != mFrameHolders.end()) {
++ if (!(*holder)->IsUsed()) {
++ holder = mFrameHolders.erase(holder);
++ } else {
++ holder++;
++ }
++ }
+ }
+
+ MediaResult FFmpegVideoDecoder<LIBAV_VER>::CreateImageVAAPI(
+@@ -663,20 +687,28 @@
+ RESULT_DETAIL("Unable to allocate WaylandDMABufSurfaceNV12."));
+ }
+
++# ifdef MOZ_LOGGING
++ static int uid = 0;
++ surface->SetUID(++uid);
++ FFMPEG_LOG("Created dmabuf UID = %d HW surface %x\n", uid, surface_id);
++# endif
++
+ surface->SetYUVColorSpace(GetFrameColorSpace());
+
+ // mFrame->buf[0] is a reference to H264 VASurface for this mFrame.
+- // We need create WaylandDMABUFSurfaceImage on top of it,
++ // We need create WaylandDMABUFSurface on top of it,
+ // create EGLImage/Texture on top of it and render it by GL.
+
+ // FFmpeg tends to reuse the particual VASurface for another frame
+ // even when the mFrame is not released. To keep VASurface as is
+- // we explicitly reference it and keep until WaylandDMABUFSurfaceImage
+- // is live.
+- RefPtr<layers::Image> im = new layers::WaylandDMABUFSurfaceImage(
+- surface, VAAPIFrameReleaseCallback,
+- new VAAPIFrameHolder(mLib, mVAAPIDeviceContext,
+- mCodecContext->hw_frames_ctx, mFrame->buf[0]));
++ // we explicitly reference it and keep until there's any reference to
++ // attached WaylandDMABUFSurface.
++ auto holder = MakeUnique<VAAPIFrameHolder>(surface, mLib, mVAAPIDeviceContext,
++ mCodecContext->hw_frames_ctx,
++ mFrame->buf[0]);
++ mFrameHolders.push_back(std::move(holder));
++
++ RefPtr<layers::Image> im = new layers::WaylandDMABUFSurfaceImage(surface);
+
+ RefPtr<VideoData> vp = VideoData::CreateFromImage(
+ mInfo.mDisplay, aOffset, TimeUnit::FromMicroseconds(aPts),
+
diff --git a/mozilla-1619882-3.patch b/mozilla-1619882-3.patch
new file mode 100644
index 0000000..4233c31
--- /dev/null
+++ b/mozilla-1619882-3.patch
@@ -0,0 +1,51 @@
+diff --git a/gfx/layers/WaylandDMABUFSurfaceImage.h b/gfx/layers/WaylandDMABUFSurfaceImage.h
+--- a/gfx/layers/WaylandDMABUFSurfaceImage.h
++++ b/gfx/layers/WaylandDMABUFSurfaceImage.h
+@@ -13,29 +13,16 @@
+ #include "mozilla/layers/TextureClient.h"
+
+ namespace mozilla {
+-class VAAPIFrameHolder;
+-}
+-
+-namespace mozilla {
+ namespace layers {
+
+-typedef void (*AVFrameReleaseCallback)(VAAPIFrameHolder* aFrameHolder);
+-
+ class WaylandDMABUFSurfaceImage : public Image {
+ public:
+- explicit WaylandDMABUFSurfaceImage(WaylandDMABufSurface* aSurface,
+- AVFrameReleaseCallback aReleaseCallback,
+- VAAPIFrameHolder* aFrameHolder)
+- : Image(nullptr, ImageFormat::WAYLAND_DMABUF),
+- mSurface(aSurface),
+- mReleaseCallback(aReleaseCallback),
+- mFrameHolder(aFrameHolder) {}
++ explicit WaylandDMABUFSurfaceImage(WaylandDMABufSurface* aSurface)
++ : Image(nullptr, ImageFormat::WAYLAND_DMABUF), mSurface(aSurface) {
++ mSurface->GlobalRefAdd();
++ }
+
+- ~WaylandDMABUFSurfaceImage() {
+- if (mReleaseCallback) {
+- mReleaseCallback(mFrameHolder);
+- }
+- }
++ ~WaylandDMABUFSurfaceImage() { mSurface->GlobalRefRelease(); }
+
+ WaylandDMABufSurface* GetSurface() { return mSurface; }
+
+@@ -52,11 +39,6 @@
+ private:
+ RefPtr<WaylandDMABufSurface> mSurface;
+ RefPtr<TextureClient> mTextureClient;
+-
+- // When WaylandDMABUFSurfaceImage is created on top of ffmpeg frame located at
+- // GPU memory we need to keep it until painting of the frame is finished.
+- AVFrameReleaseCallback mReleaseCallback;
+- VAAPIFrameHolder* mFrameHolder;
+ };
+
+ } // namespace layers
+
bgstack15