summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Horak <jhorak@redhat.com>2020-06-29 14:33:43 +0200
committerJan Horak <jhorak@redhat.com>2020-06-29 14:33:43 +0200
commitae1e0bfad433b3e1b69c22e0311969bb0d10abcc (patch)
tree7b85ddfeda21f7e5a755d7aa7d862c45353eefb5
parentUpdate to 78.0 build2 (diff)
downloadlibrewolf-fedora-ff-ae1e0bfad433b3e1b69c22e0311969bb0d10abcc.tar.gz
librewolf-fedora-ff-ae1e0bfad433b3e1b69c22e0311969bb0d10abcc.tar.bz2
librewolf-fedora-ff-ae1e0bfad433b3e1b69c22e0311969bb0d10abcc.zip
Removed obsolete patches
-rw-r--r--firefox.spec14
-rw-r--r--mozilla-1619882-1.patch357
-rw-r--r--mozilla-1619882-2.patch190
-rw-r--r--mozilla-1619882-3.patch51
-rw-r--r--mozilla-1632456.patch52
-rw-r--r--mozilla-1634293.patch406
-rw-r--r--mozilla-1639197.patch15
7 files changed, 1 insertions, 1084 deletions
diff --git a/firefox.spec b/firefox.spec
index 8fee2e5..01d1964 100644
--- a/firefox.spec
+++ b/firefox.spec
@@ -179,8 +179,6 @@ Patch412: mozilla-1337988.patch
Patch415: Bug-1238661---fix-mozillaSignalTrampoline-to-work-.patch
Patch417: bug1375074-save-restore-x28.patch
Patch422: mozilla-1580174-webrtc-popup.patch
-Patch500: mozilla-1634293.patch
-Patch501: mozilla-1639197.patch
# Wayland specific upstream patches
Patch574: firefox-pipewire-0-2.patch
@@ -189,11 +187,7 @@ Patch575: firefox-pipewire-0-3.patch
#VA-API patches
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
Patch589: mozilla-1634213.patch
-Patch590: mozilla-1632456.patch
# PGO/LTO patches
Patch600: pgo.patch
@@ -365,7 +359,7 @@ This package contains results of tests executed during build.
%if 0%{?big_endian}
%patch26 -p1 -b .icu
%endif
-%patch46 -p1 -b .nss-version
+#%patch46 -p1 -b .nss-version
%patch47 -p1 -b .fedora-shebang
%patch48 -p1 -b .build-arm-wasm
%patch49 -p1 -b .build-arm-libaom
@@ -387,8 +381,6 @@ This package contains results of tests executed during build.
%patch415 -p1 -b .1238661
%endif
-%patch500 -p1 -b .mozilla-1634293
-%patch501 -p1 -b .mozilla-1639197
# Wayland specific upstream patches
%if 0%{?fedora} < 32
@@ -399,11 +391,7 @@ This package contains results of tests executed during build.
%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
%patch589 -p1 -b .mozilla-1634213
-%patch590 -p1 -b .mozilla-1632456
# PGO patches
%patch600 -p1 -b .pgo
diff --git a/mozilla-1619882-1.patch b/mozilla-1619882-1.patch
deleted file mode 100644
index 3f4cbda..0000000
--- a/mozilla-1619882-1.patch
+++ /dev/null
@@ -1,357 +0,0 @@
-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
-@@ -49,9 +49,14 @@
- SURFACE_NV12,
- };
-
-+ // Import surface from SurfaceDescriptor. This is usually
-+ // used to copy surface from another process over IPC.
-+ // When a global reference counter was created for the surface
-+ // (see bellow) it's automatically referenced.
- static already_AddRefed<WaylandDMABufSurface> CreateDMABufSurface(
- const mozilla::layers::SurfaceDescriptor& aDesc);
-
-+ // Export surface to another process via. SurfaceDescriptor.
- virtual bool Serialize(
- mozilla::layers::SurfaceDescriptor& aOutDescriptor) = 0;
-
-@@ -82,6 +87,35 @@
- void FenceWait();
- void FenceDelete();
-
-+ // Set and get a global surface UID. The UID is shared across process
-+ // and it's used to track surface lifetime in various parts of rendering
-+ // engine.
-+ void SetUID(uint32_t aUID) { mUID = aUID; };
-+ uint32_t GetUID() const { return mUID; };
-+
-+ // Creates a global reference counter objects attached to the surface.
-+ // It's created as unreferenced, i.e. IsGlobalRefSet() returns false
-+ // right after GlobalRefCountCreate() call.
-+ //
-+ // The counter is shared by all surface instances across processes
-+ // so it tracks global surface usage.
-+ //
-+ // The counter is automatically referenced when a new surface instance is
-+ // created with SurfaceDescriptor (usually copied to another process over IPC)
-+ // and it's unreferenced when surface is deleted.
-+ //
-+ // So without any additional GlobalRefAdd()/GlobalRefRelease() calls
-+ // the IsGlobalRefSet() returns true if any other process use the surface.
-+ void GlobalRefCountCreate();
-+
-+ // If global reference counter was created by GlobalRefCountCreate()
-+ // returns true when there's an active surface reference.
-+ bool IsGlobalRefSet() const;
-+
-+ // Add/Remove additional reference to the surface global reference counter.
-+ void GlobalRefAdd();
-+ void GlobalRefRelease();
-+
- WaylandDMABufSurface(SurfaceType aSurfaceType);
-
- protected:
-@@ -89,7 +123,10 @@
- virtual void ReleaseSurface() = 0;
- bool FenceCreate(int aFd);
-
-- virtual ~WaylandDMABufSurface() { FenceDelete(); };
-+ void GlobalRefCountImport(int aFd);
-+ void GlobalRefCountDelete();
-+
-+ virtual ~WaylandDMABufSurface();
-
- SurfaceType mSurfaceType;
- uint64_t mBufferModifier;
-@@ -102,6 +139,9 @@
-
- EGLSyncKHR mSync;
- RefPtr<mozilla::gl::GLContext> mGL;
-+
-+ int mGlobalRefCountFd;
-+ 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,9 @@
- #include <unistd.h>
- #include <sys/time.h>
- #include <dlfcn.h>
-+#include <sys/mman.h>
-+#include <sys/eventfd.h>
-+#include <poll.h>
-
- #include "mozilla/widget/gbm.h"
- #include "mozilla/widget/va_drmcommon.h"
-@@ -57,6 +60,61 @@
- # define VA_FOURCC_NV12 0x3231564E
- #endif
-
-+bool WaylandDMABufSurface::IsGlobalRefSet() const {
-+ if (!mGlobalRefCountFd) {
-+ return false;
-+ }
-+ struct pollfd pfd;
-+ pfd.fd = mGlobalRefCountFd;
-+ pfd.events = POLLIN;
-+ return poll(&pfd, 1, 0) == 1;
-+}
-+
-+void WaylandDMABufSurface::GlobalRefRelease() {
-+ MOZ_ASSERT(mGlobalRefCountFd);
-+ uint64_t counter;
-+ if (read(mGlobalRefCountFd, &counter, sizeof(counter)) != sizeof(counter)) {
-+ // EAGAIN means the refcount is already zero. It happens when we release
-+ // last reference to the surface.
-+ if (errno != EAGAIN) {
-+ NS_WARNING("Failed to unref dmabuf global ref count!");
-+ }
-+ }
-+}
-+
-+void WaylandDMABufSurface::GlobalRefAdd() {
-+ MOZ_ASSERT(mGlobalRefCountFd);
-+ uint64_t counter = 1;
-+ if (write(mGlobalRefCountFd, &counter, sizeof(counter)) != sizeof(counter)) {
-+ NS_WARNING("Failed to ref dmabuf global ref count!");
-+ }
-+}
-+
-+void WaylandDMABufSurface::GlobalRefCountCreate() {
-+ MOZ_ASSERT(!mGlobalRefCountFd);
-+ mGlobalRefCountFd = eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK | EFD_SEMAPHORE);
-+ if (mGlobalRefCountFd < 0) {
-+ NS_WARNING("Failed to create dmabuf global ref count!");
-+ mGlobalRefCountFd = 0;
-+ return;
-+ }
-+}
-+
-+void WaylandDMABufSurface::GlobalRefCountImport(int aFd) {
-+ MOZ_ASSERT(!mGlobalRefCountFd);
-+ mGlobalRefCountFd = aFd;
-+ GlobalRefAdd();
-+}
-+
-+void WaylandDMABufSurface::GlobalRefCountDelete() {
-+ MOZ_ASSERT(mGlobalRefCountFd);
-+ if (mGlobalRefCountFd) {
-+ GlobalRefRelease();
-+ close(mGlobalRefCountFd);
-+ mGlobalRefCountFd = 0;
-+ }
-+}
-+
- WaylandDMABufSurface::WaylandDMABufSurface(SurfaceType aSurfaceType)
- : mSurfaceType(aSurfaceType),
- mBufferModifier(DRM_FORMAT_MOD_INVALID),
-@@ -64,12 +122,19 @@
- mDrmFormats(),
- mStrides(),
- mOffsets(),
-- mSync(0) {
-+ mSync(0),
-+ mGlobalRefCountFd(0),
-+ mUID(0) {
- for (auto& slot : mDmabufFds) {
- slot = -1;
- }
- }
-
-+WaylandDMABufSurface::~WaylandDMABufSurface() {
-+ FenceDelete();
-+ GlobalRefCountDelete();
-+}
-+
- already_AddRefed<WaylandDMABufSurface>
- WaylandDMABufSurface::CreateDMABufSurface(
- const mozilla::layers::SurfaceDescriptor& aDesc) {
-@@ -316,6 +381,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 +395,10 @@
- close(fd);
- }
- }
-+
-+ if (desc.refCount().Length() > 0) {
-+ GlobalRefCountImport(desc.refCount()[0].ClonePlatformHandle().release());
-+ }
- }
-
- bool WaylandDMABufSurfaceRGBA::Create(const SurfaceDescriptor& aDesc) {
-@@ -346,6 +416,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 +433,14 @@
- egl->fDupNativeFenceFDANDROID(egl->Display(), mSync)));
- }
-
-- aOutDescriptor = SurfaceDescriptorDMABuf(
-- mSurfaceType, mBufferModifier, mGbmBufferFlags, fds, width, height,
-- format, strides, offsets, GetYUVColorSpace(), fenceFDs);
-+ if (mGlobalRefCountFd) {
-+ refCountFDs.AppendElement(ipc::FileDescriptor(mGlobalRefCountFd));
-+ }
-+
-+ aOutDescriptor =
-+ SurfaceDescriptorDMABuf(mSurfaceType, mBufferModifier, mGbmBufferFlags,
-+ fds, width, height, format, strides, offsets,
-+ GetYUVColorSpace(), fenceFDs, mUID, refCountFDs);
-
- return true;
- }
-@@ -693,6 +769,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 +787,10 @@
- close(fd);
- }
- }
-+
-+ if (aDesc.refCount().Length() > 0) {
-+ GlobalRefCountImport(aDesc.refCount()[0].ClonePlatformHandle().release());
-+ }
- }
-
- bool WaylandDMABufSurfaceNV12::Serialize(
-@@ -721,6 +802,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 +819,13 @@
- egl->fDupNativeFenceFDANDROID(egl->Display(), mSync)));
- }
-
-+ if (mGlobalRefCountFd) {
-+ refCountFDs.AppendElement(ipc::FileDescriptor(mGlobalRefCountFd));
-+ }
-+
- 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
deleted file mode 100644
index dc3ab77..0000000
--- a/mozilla-1619882-2.patch
+++ /dev/null
@@ -1,190 +0,0 @@
-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,21 +10,45 @@
- #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 {
-+// When VA-API decoding is running, ffmpeg allocates AVHWFramesContext - a pool
-+// of "hardware" frames. Every "hardware" frame (VASurface) is backed
-+// by actual piece of GPU memory which holds the decoded image data.
-+//
-+// The VASurface is wrapped by WaylandDMABufSurface and transferred to
-+// rendering queue by WaylandDMABUFSurfaceImage, where TextureClient is
-+// created and VASurface is used as a texture there.
-+//
-+// As there's a limited number of VASurfaces, ffmpeg reuses them to decode
-+// next frames ASAP even if they are still attached to WaylandDMABufSurface
-+// and used as a texture in our rendering engine.
-+//
-+// Unfortunately there isn't any obvious way how to mark particular VASurface
-+// as used. The best we can do is to hold a reference to particular AVBuffer
-+// from decoded AVFrame and AVHWFramesContext which owns the AVBuffer.
-+
-+class VAAPIFrameHolder final {
- public:
-- VAAPIFrameHolder(FFmpegLibWrapper* aLib, AVBufferRef* aVAAPIDeviceContext,
-- AVBufferRef* aAVHWFramesContext, AVBufferRef* aHWFrame);
-+ VAAPIFrameHolder(FFmpegLibWrapper* aLib, WaylandDMABufSurface* aSurface,
-+ AVCodecContext* aAVCodecContext, AVFrame* aAVFrame);
- ~VAAPIFrameHolder();
-
-+ // Check if WaylandDMABufSurface is used by any gecko rendering process
-+ // (WebRender or GL compositor) or by WaylandDMABUFSurfaceImage/VideoData.
-+ bool IsUsed() const { return mSurface->IsGlobalRefSet(); }
-+
- private:
-- FFmpegLibWrapper* mLib;
-- AVBufferRef* mVAAPIDeviceContext;
-+ const FFmpegLibWrapper* mLib;
-+ const RefPtr<WaylandDMABufSurface> mSurface;
- AVBufferRef* mAVHWFramesContext;
-- AVBufferRef* mHWFrame;
-+ AVBufferRef* mHWAVBuffer;
- };
- #endif
-
-@@ -97,6 +121,8 @@
-
- MediaResult CreateImageVAAPI(int64_t aOffset, int64_t aPts, int64_t aDuration,
- MediaDataDecoder::DecodedData& aResults);
-+ void ReleaseUnusedVAAPIFrames();
-+ void ReleaseAllVAAPIFrames();
- #endif
-
- /**
-@@ -112,6 +138,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
-@@ -123,18 +123,27 @@
- }
-
- VAAPIFrameHolder::VAAPIFrameHolder(FFmpegLibWrapper* aLib,
-- AVBufferRef* aVAAPIDeviceContext,
-- AVBufferRef* aAVHWFramesContext,
-- AVBufferRef* aHWFrame)
-+ WaylandDMABufSurface* aSurface,
-+ AVCodecContext* aAVCodecContext,
-+ AVFrame* aAVFrame)
- : mLib(aLib),
-- mVAAPIDeviceContext(mLib->av_buffer_ref(aVAAPIDeviceContext)),
-- mAVHWFramesContext(mLib->av_buffer_ref(aAVHWFramesContext)),
-- mHWFrame(mLib->av_buffer_ref(aHWFrame)){};
-+ mSurface(aSurface),
-+ mAVHWFramesContext(mLib->av_buffer_ref(aAVCodecContext->hw_frames_ctx)),
-+ mHWAVBuffer(mLib->av_buffer_ref(aAVFrame->buf[0])) {
-+ FFMPEG_LOG("VAAPIFrameHolder is adding dmabuf surface UID = %d\n",
-+ mSurface->GetUID());
-+
-+ // Create global refcount object to track mSurface usage over
-+ // gects rendering engine. We can't release it until it's used
-+ // by GL compositor / WebRender.
-+ mSurface->GlobalRefCountCreate();
-+}
-
- VAAPIFrameHolder::~VAAPIFrameHolder() {
-- mLib->av_buffer_unref(&mHWFrame);
-+ FFMPEG_LOG("VAAPIFrameHolder is releasing dmabuf surface UID = %d\n",
-+ mSurface->GetUID());
-+ mLib->av_buffer_unref(&mHWAVBuffer);
- mLib->av_buffer_unref(&mAVHWFramesContext);
-- mLib->av_buffer_unref(&mVAAPIDeviceContext);
- }
-
- AVCodec* FFmpegVideoDecoder<LIBAV_VER>::FindVAAPICodec() {
-@@ -422,6 +431,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;
-@@ -628,9 +644,20 @@
- }
-
- #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++;
-+ }
-+ }
-+}
-+
-+void FFmpegVideoDecoder<LIBAV_VER>::ReleaseAllVAAPIFrames() {
-+ mFrameHolders.clear();
- }
-
- MediaResult FFmpegVideoDecoder<LIBAV_VER>::CreateImageVAAPI(
-@@ -667,20 +694,20 @@
- 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,
-- // create EGLImage/Texture on top of it and render it by GL.
-+ // Store reference to the decoded HW buffer, see VAAPIFrameHolder struct.
-+ auto holder =
-+ MakeUnique<VAAPIFrameHolder>(mLib, surface, mCodecContext, mFrame);
-+ mFrameHolders.push_back(std::move(holder));
-
-- // 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]));
-+ RefPtr<layers::Image> im = new layers::WaylandDMABUFSurfaceImage(surface);
-
- RefPtr<VideoData> vp = VideoData::CreateFromImage(
- mInfo.mDisplay, aOffset, TimeUnit::FromMicroseconds(aPts),
-@@ -732,6 +759,7 @@
- void FFmpegVideoDecoder<LIBAV_VER>::ProcessShutdown() {
- #ifdef MOZ_WAYLAND_USE_VAAPI
- if (mVAAPIDeviceContext) {
-+ ReleaseAllVAAPIFrames();
- mLib->av_buffer_unref(&mVAAPIDeviceContext);
- }
- #endif
-
diff --git a/mozilla-1619882-3.patch b/mozilla-1619882-3.patch
deleted file mode 100644
index 4233c31..0000000
--- a/mozilla-1619882-3.patch
+++ /dev/null
@@ -1,51 +0,0 @@
-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
-
diff --git a/mozilla-1632456.patch b/mozilla-1632456.patch
deleted file mode 100644
index 2050461..0000000
--- a/mozilla-1632456.patch
+++ /dev/null
@@ -1,52 +0,0 @@
-changeset: 531979:da64e8ddf04b
-tag: tip
-parent: 531977:9a0589e208e8
-user: Martin Stransky <stransky@redhat.com>
-date: Mon May 25 22:29:45 2020 +0200
-files: dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
-description:
-Bug 1632456 [Wayland] Release mVAAPIDeviceContext when FFmpegVideoDecoder::CreateVAAPIDeviceContext() fails, r?jya
-
-Differential Revision: https://phabricator.services.mozilla.com/D76745
-
-
-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
-@@ -187,32 +187,35 @@ bool FFmpegVideoDecoder<LIBAV_VER>::Crea
- return false;
- }
- AVHWDeviceContext* hwctx = (AVHWDeviceContext*)mVAAPIDeviceContext->data;
- AVVAAPIDeviceContext* vactx = (AVVAAPIDeviceContext*)hwctx->hwctx;
-
- wl_display* display = widget::WaylandDisplayGetWLDisplay();
- if (!display) {
- FFMPEG_LOG("Can't get default wayland display.");
-+ mLib->av_buffer_unref(&mVAAPIDeviceContext);
- return false;
- }
- mDisplay = mLib->vaGetDisplayWl(display);
-
- hwctx->user_opaque = new VAAPIDisplayHolder(mLib, mDisplay);
- hwctx->free = VAAPIDisplayReleaseCallback;
-
- int major, minor;
- int status = mLib->vaInitialize(mDisplay, &major, &minor);
- if (status != VA_STATUS_SUCCESS) {
-+ mLib->av_buffer_unref(&mVAAPIDeviceContext);
- return false;
- }
-
- vactx->display = mDisplay;
-
- if (mLib->av_hwdevice_ctx_init(mVAAPIDeviceContext) < 0) {
-+ mLib->av_buffer_unref(&mVAAPIDeviceContext);
- return false;
- }
-
- mCodecContext->hw_device_ctx = mLib->av_buffer_ref(mVAAPIDeviceContext);
- return true;
- }
-
- MediaResult FFmpegVideoDecoder<LIBAV_VER>::InitVAAPIDecoder() {
-
diff --git a/mozilla-1634293.patch b/mozilla-1634293.patch
deleted file mode 100644
index 09a3274..0000000
--- a/mozilla-1634293.patch
+++ /dev/null
@@ -1,406 +0,0 @@
-diff --git a/browser/components/shell/nsGNOMEShellDBusHelper.h b/browser/components/shell/nsGNOMEShellDBusHelper.h
---- a/browser/components/shell/nsGNOMEShellDBusHelper.h
-+++ b/browser/components/shell/nsGNOMEShellDBusHelper.h
-@@ -19,6 +19,8 @@
- #define DBUS_BUS_NAME "org.mozilla.Firefox.SearchProvider"
- #define DBUS_OBJECT_PATH "/org/mozilla/Firefox/SearchProvider"
-
-+class nsGNOMEShellHistorySearchResult;
-+
- DBusHandlerResult DBusIntrospect(DBusConnection* aConnection,
- DBusMessage* aMsg);
- DBusHandlerResult DBusHandleInitialResultSet(
-diff --git a/browser/components/shell/nsGNOMEShellDBusHelper.cpp b/browser/components/shell/nsGNOMEShellDBusHelper.cpp
---- a/browser/components/shell/nsGNOMEShellDBusHelper.cpp
-+++ b/browser/components/shell/nsGNOMEShellDBusHelper.cpp
-@@ -6,7 +6,6 @@
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
- #include "nsGNOMEShellSearchProvider.h"
--#include "nsGNOMEShellDBusHelper.h"
-
- #include "nsPrintfCString.h"
- #include "RemoteUtils.h"
-@@ -174,6 +173,49 @@
- dbus_message_iter_close_container(aIter, &iterDict);
- }
-
-+/*
-+ "icon-data": a tuple of type (iiibiiay) describing a pixbuf with width,
-+ height, rowstride, has-alpha,
-+ bits-per-sample, channels,
-+ image data
-+*/
-+static void DBusAppendIcon(GnomeHistoryIcon* aIcon, DBusMessageIter* aIter) {
-+ DBusMessageIter iterDict, iterVar, iterStruct;
-+ dbus_message_iter_open_container(aIter, DBUS_TYPE_DICT_ENTRY, nullptr,
-+ &iterDict);
-+ const char* key = "icon-data";
-+ dbus_message_iter_append_basic(&iterDict, DBUS_TYPE_STRING, &key);
-+ dbus_message_iter_open_container(&iterDict, DBUS_TYPE_VARIANT, "(iiibiiay)",
-+ &iterVar);
-+ dbus_message_iter_open_container(&iterVar, DBUS_TYPE_STRUCT, nullptr,
-+ &iterStruct);
-+
-+ int width = aIcon->GetWidth();
-+ int height = aIcon->GetHeight();
-+ dbus_message_iter_append_basic(&iterStruct, DBUS_TYPE_INT32, &width);
-+ dbus_message_iter_append_basic(&iterStruct, DBUS_TYPE_INT32, &height);
-+ int rowstride = width * 4;
-+ dbus_message_iter_append_basic(&iterStruct, DBUS_TYPE_INT32, &rowstride);
-+ int hasAlpha = true;
-+ dbus_message_iter_append_basic(&iterStruct, DBUS_TYPE_BOOLEAN, &hasAlpha);
-+ int bitsPerSample = 8;
-+ dbus_message_iter_append_basic(&iterStruct, DBUS_TYPE_INT32, &bitsPerSample);
-+ int channels = 4;
-+ dbus_message_iter_append_basic(&iterStruct, DBUS_TYPE_INT32, &channels);
-+
-+ DBusMessageIter iterArray;
-+ dbus_message_iter_open_container(&iterStruct, DBUS_TYPE_ARRAY, "y",
-+ &iterArray);
-+ unsigned char* array = aIcon->GetData();
-+ dbus_message_iter_append_fixed_array(&iterArray, DBUS_TYPE_BYTE, &array,
-+ width * height * 4);
-+ dbus_message_iter_close_container(&iterStruct, &iterArray);
-+
-+ dbus_message_iter_close_container(&iterVar, &iterStruct);
-+ dbus_message_iter_close_container(&iterDict, &iterVar);
-+ dbus_message_iter_close_container(aIter, &iterDict);
-+}
-+
- /* Appends history search results to the DBUS reply.
-
- We can return those fields at GetResultMetas:
-@@ -188,11 +230,14 @@
- "description": an optional short description (1-2 lines)
- */
- static void DBusAppendResultID(
-- nsCOMPtr<nsINavHistoryContainerResultNode> aHistResultContainer,
-+ RefPtr<nsGNOMEShellHistorySearchResult> aSearchResult,
- DBusMessageIter* aIter, const char* aID) {
-+ nsCOMPtr<nsINavHistoryContainerResultNode> container =
-+ aSearchResult->GetSearchResultContainer();
-+
-+ int index = DBusGetIndexFromIDKey(aID);
- nsCOMPtr<nsINavHistoryResultNode> child;
-- aHistResultContainer->GetChild(DBusGetIndexFromIDKey(aID),
-- getter_AddRefs(child));
-+ container->GetChild(index, getter_AddRefs(child));
- nsAutoCString title;
- if (NS_FAILED(child->GetTitle(title))) {
- return;
-@@ -207,7 +252,13 @@
- const char* titleStr = title.get();
- appendStringDictionary(aIter, "id", aID);
- appendStringDictionary(aIter, "name", titleStr);
-- appendStringDictionary(aIter, "gicon", "text-html");
-+
-+ GnomeHistoryIcon* icon = aSearchResult->GetHistoryIcon(index);
-+ if (icon) {
-+ DBusAppendIcon(icon, aIter);
-+ } else {
-+ appendStringDictionary(aIter, "gicon", "text-html");
-+ }
- }
-
- /* Search the web for: "searchTerm" to the DBUS reply.
-@@ -265,8 +316,7 @@
- KEYWORD_SEARCH_STRING_LEN) == 0) {
- DBusAppendSearchID(&iterArray2, stringArray[i]);
- } else {
-- DBusAppendResultID(aSearchResult->GetSearchResultContainer(),
-- &iterArray2, stringArray[i]);
-+ DBusAppendResultID(aSearchResult, &iterArray2, stringArray[i]);
- }
- dbus_message_iter_close_container(&iterArray, &iterArray2);
- }
-diff --git a/browser/components/shell/nsGNOMEShellSearchProvider.h b/browser/components/shell/nsGNOMEShellSearchProvider.h
---- a/browser/components/shell/nsGNOMEShellSearchProvider.h
-+++ b/browser/components/shell/nsGNOMEShellSearchProvider.h
-@@ -12,9 +12,37 @@
- #include "nsINavHistoryService.h"
- #include "nsUnixRemoteServer.h"
- #include "nsCOMPtr.h"
-+#include "mozilla/UniquePtr.h"
-+#include "nsGNOMEShellDBusHelper.h"
-
- class nsGNOMEShellSearchProvider;
-
-+class GnomeHistoryIcon {
-+ public:
-+ GnomeHistoryIcon() : mTimeStamp(-1), mWidth(0), mHeight(0){};
-+
-+ // From which search is this icon
-+ void Set(int aTimeStamp, mozilla::UniquePtr<uint8_t[]> aData, int aWidth,
-+ int aHeight) {
-+ mTimeStamp = aTimeStamp;
-+ mWidth = aWidth;
-+ mHeight = aHeight;
-+ mData = std::move(aData);
-+ }
-+
-+ bool IsLoaded() { return mData && mWidth > 0 && mHeight > 0; }
-+ int GetTimeStamp() { return mTimeStamp; }
-+ uint8_t* GetData() { return mData.get(); }
-+ int GetWidth() { return mWidth; }
-+ int GetHeight() { return mHeight; }
-+
-+ private:
-+ int mTimeStamp;
-+ mozilla::UniquePtr<uint8_t[]> mData;
-+ int mWidth;
-+ int mHeight;
-+};
-+
- // nsGNOMEShellHistorySearchResult is a container with contains search results
- // which are files asynchronously by nsGNOMEShellHistoryService.
- // The search results can be opened by Firefox then.
-@@ -34,11 +62,16 @@
- mSearchTerm = nsAutoCString(aSearchTerm);
- }
- DBusConnection* GetDBusConnection() { return mConnection; }
-+ void SetTimeStamp(int aTimeStamp) { mTimeStamp = aTimeStamp; }
- int GetTimeStamp() { return mTimeStamp; }
-- void SetTimeStamp(int aTimeStamp) { mTimeStamp = aTimeStamp; }
- nsAutoCString& GetSearchTerm() { return mSearchTerm; }
-- void SetSearchResultContainer(
-+
-+ // Receive (asynchronously) history search results from history service.
-+ // This is called asynchronously by nsGNOMEShellHistoryService
-+ // when we have search results available.
-+ void ReceiveSearchResultContainer(
- nsCOMPtr<nsINavHistoryContainerResultNode> aHistResultContainer);
-+
- nsCOMPtr<nsINavHistoryContainerResultNode> GetSearchResultContainer() {
- return mHistResultContainer;
- }
-@@ -46,8 +79,12 @@
- nsUnixRemoteServer::HandleCommandLine(aBuffer, aTimestamp);
- }
-
-+ void SetHistoryIcon(int aTimeStamp, mozilla::UniquePtr<uint8_t[]> aData,
-+ int aWidth, int aHeight, int aIconIndex);
-+ GnomeHistoryIcon* GetHistoryIcon(int aIconIndex);
-+
- private:
-- void SendDBusSearchResultReply();
-+ void HandleSearchResultReply();
-
- ~nsGNOMEShellHistorySearchResult() = default;
-
-@@ -58,6 +95,7 @@
- DBusMessage* mReply;
- DBusConnection* mConnection;
- int mTimeStamp;
-+ GnomeHistoryIcon mHistoryIcons[MAX_SEARCH_RESULTS_NUM];
- };
-
- class nsGNOMEShellHistoryService {
-diff --git a/browser/components/shell/nsGNOMEShellSearchProvider.cpp b/browser/components/shell/nsGNOMEShellSearchProvider.cpp
---- a/browser/components/shell/nsGNOMEShellSearchProvider.cpp
-+++ b/browser/components/shell/nsGNOMEShellSearchProvider.cpp
-@@ -6,7 +6,6 @@
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
- #include "nsGNOMEShellSearchProvider.h"
--#include "nsGNOMEShellDBusHelper.h"
-
- #include "nsIWidget.h"
- #include "nsToolkitCompsCID.h"
-@@ -14,10 +13,113 @@
- #include "RemoteUtils.h"
- #include "base/message_loop.h" // for MessageLoop
- #include "base/task.h" // for NewRunnableMethod, etc
-+#include "nsIServiceManager.h"
-+#include "nsNetCID.h"
-+#include "nsIIOService.h"
-
- #include <dbus/dbus.h>
- #include <dbus/dbus-glib-lowlevel.h>
-
-+#include "imgIContainer.h"
-+#include "imgITools.h"
-+#include "mozilla/gfx/DataSurfaceHelpers.h"
-+
-+using namespace mozilla;
-+using namespace mozilla::gfx;
-+
-+class AsyncFaviconDataReady final : public nsIFaviconDataCallback {
-+ public:
-+ NS_DECL_ISUPPORTS
-+ NS_DECL_NSIFAVICONDATACALLBACK
-+
-+ AsyncFaviconDataReady(RefPtr<nsGNOMEShellHistorySearchResult> aSearchResult,
-+ int aIconIndex, int aTimeStamp)
-+ : mSearchResult(aSearchResult),
-+ mIconIndex(aIconIndex),
-+ mTimeStamp(aTimeStamp){};
-+
-+ private:
-+ ~AsyncFaviconDataReady() {}
-+
-+ RefPtr<nsGNOMEShellHistorySearchResult> mSearchResult;
-+ int mIconIndex;
-+ int mTimeStamp;
-+};
-+
-+NS_IMPL_ISUPPORTS(AsyncFaviconDataReady, nsIFaviconDataCallback)
-+
-+// Inspired by SurfaceToPackedBGRA
-+static UniquePtr<uint8_t[]> SurfaceToPackedRGBA(DataSourceSurface* aSurface) {
-+ IntSize size = aSurface->GetSize();
-+ CheckedInt<size_t> bufferSize =
-+ CheckedInt<size_t>(size.width * 4) * CheckedInt<size_t>(size.height);
-+ if (!bufferSize.isValid()) {
-+ return nullptr;
-+ }
-+ UniquePtr<uint8_t[]> imageBuffer(new (std::nothrow)
-+ uint8_t[bufferSize.value()]);
-+ if (!imageBuffer) {
-+ return nullptr;
-+ }
-+
-+ DataSourceSurface::MappedSurface map;
-+ if (!aSurface->Map(DataSourceSurface::MapType::READ, &map)) {
-+ return nullptr;
-+ }
-+
-+ // Convert BGRA to RGBA
-+ uint32_t* aSrc = (uint32_t*)map.mData;
-+ uint32_t* aDst = (uint32_t*)imageBuffer.get();
-+ for (int i = 0; i < size.width * size.height; i++, aDst++, aSrc++) {
-+ *aDst = *aSrc & 0xff00ff00;
-+ *aDst |= (*aSrc & 0xff) << 16;
-+ *aDst |= (*aSrc & 0xff0000) >> 16;
-+ }
-+
-+ aSurface->Unmap();
-+
-+ return imageBuffer;
-+}
-+
-+NS_IMETHODIMP
-+AsyncFaviconDataReady::OnComplete(nsIURI* aFaviconURI, uint32_t aDataLen,
-+ const uint8_t* aData,
-+ const nsACString& aMimeType,
-+ uint16_t aWidth) {
-+ // This is a callback from some previous search so we don't want it
-+ if (mTimeStamp != mSearchResult->GetTimeStamp() || !aData || !aDataLen) {
-+ return NS_ERROR_FAILURE;
-+ }
-+
-+ // Decode the image from the format it was returned to us in (probably PNG)
-+ nsCOMPtr<imgIContainer> container;
-+ nsCOMPtr<imgITools> imgtool = do_CreateInstance("@mozilla.org/image/tools;1");
-+ nsresult rv = imgtool->DecodeImageFromBuffer(
-+ reinterpret_cast<const char*>(aData), aDataLen, aMimeType,
-+ getter_AddRefs(container));
-+ NS_ENSURE_SUCCESS(rv, rv);
-+
-+ RefPtr<SourceSurface> surface = container->GetFrame(
-+ imgIContainer::FRAME_FIRST,
-+ imgIContainer::FLAG_SYNC_DECODE | imgIContainer::FLAG_ASYNC_NOTIFY);
-+
-+ if (!surface || surface->GetFormat() != SurfaceFormat::B8G8R8A8) {
-+ return NS_ERROR_FAILURE;
-+ }
-+
-+ // Allocate a new buffer that we own.
-+ RefPtr<DataSourceSurface> dataSurface = surface->GetDataSurface();
-+ UniquePtr<uint8_t[]> data = SurfaceToPackedRGBA(dataSurface);
-+ if (!data) {
-+ return NS_ERROR_OUT_OF_MEMORY;
-+ }
-+
-+ mSearchResult->SetHistoryIcon(mTimeStamp, std::move(data),
-+ surface->GetSize().width,
-+ surface->GetSize().height, mIconIndex);
-+ return NS_OK;
-+}
-+
- DBusHandlerResult nsGNOMEShellSearchProvider::HandleSearchResultSet(
- DBusMessage* aMsg, bool aInitialSearch) {
- // Discard any existing search results.
-@@ -179,7 +281,7 @@
- static void DispatchSearchResults(
- RefPtr<nsGNOMEShellHistorySearchResult> aSearchResult,
- nsCOMPtr<nsINavHistoryContainerResultNode> aHistResultContainer) {
-- aSearchResult->SetSearchResultContainer(aHistResultContainer);
-+ aSearchResult->ReceiveSearchResultContainer(aHistResultContainer);
- }
-
- nsresult nsGNOMEShellHistoryService::QueryHistory(
-@@ -242,7 +344,7 @@
- aIDKey = nsPrintfCString("%.2d:%s", aIndex, aUri.get());
- }
-
--void nsGNOMEShellHistorySearchResult::SendDBusSearchResultReply() {
-+void nsGNOMEShellHistorySearchResult::HandleSearchResultReply() {
- MOZ_ASSERT(mReply);
-
- uint32_t childCount = 0;
-@@ -254,6 +356,11 @@
- dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, "s", &iterArray);
-
- if (NS_SUCCEEDED(rv) && childCount > 0) {
-+ // Obtain the favicon service and get the favicon for the specified page
-+ nsCOMPtr<nsIFaviconService> favIconSvc(
-+ do_GetService("@mozilla.org/browser/favicon-service;1"));
-+ nsCOMPtr<nsIIOService> ios(do_GetService(NS_IOSERVICE_CONTRACTID));
-+
- if (childCount > MAX_SEARCH_RESULTS_NUM) {
- childCount = MAX_SEARCH_RESULTS_NUM;
- }
-@@ -271,6 +378,12 @@
- nsAutoCString uri;
- child->GetUri(uri);
-
-+ nsCOMPtr<nsIURI> iconIri;
-+ ios->NewURI(uri, nullptr, nullptr, getter_AddRefs(iconIri));
-+ nsCOMPtr<nsIFaviconDataCallback> callback =
-+ new AsyncFaviconDataReady(this, i, mTimeStamp);
-+ favIconSvc->GetFaviconDataForPage(iconIri, callback, 0);
-+
- nsAutoCString idKey;
- DBusGetIDKeyForURI(i, uri, idKey);
-
-@@ -292,14 +405,36 @@
- mReply = nullptr;
- }
-
--void nsGNOMEShellHistorySearchResult::SetSearchResultContainer(
-+void nsGNOMEShellHistorySearchResult::ReceiveSearchResultContainer(
- nsCOMPtr<nsINavHistoryContainerResultNode> aHistResultContainer) {
-+ // Propagate search results to nsGNOMEShellSearchProvider.
-+ // SetSearchResult() checks this is up-to-date search (our time stamp matches
-+ // latest requested search timestamp).
- if (mSearchProvider->SetSearchResult(this)) {
- mHistResultContainer = aHistResultContainer;
-- SendDBusSearchResultReply();
-+ HandleSearchResultReply();
- }
- }
-
-+void nsGNOMEShellHistorySearchResult::SetHistoryIcon(int aTimeStamp,
-+ UniquePtr<uint8_t[]> aData,
-+ int aWidth, int aHeight,
-+ int aIconIndex) {
-+ MOZ_ASSERT(mTimeStamp == aTimeStamp);
-+ MOZ_RELEASE_ASSERT(aIconIndex < MAX_SEARCH_RESULTS_NUM);
-+ mHistoryIcons[aIconIndex].Set(mTimeStamp, std::move(aData), aWidth, aHeight);
-+}
-+
-+GnomeHistoryIcon* nsGNOMEShellHistorySearchResult::GetHistoryIcon(
-+ int aIconIndex) {
-+ MOZ_RELEASE_ASSERT(aIconIndex < MAX_SEARCH_RESULTS_NUM);
-+ if (mHistoryIcons[aIconIndex].GetTimeStamp() == mTimeStamp &&
-+ mHistoryIcons[aIconIndex].IsLoaded()) {
-+ return mHistoryIcons + aIconIndex;
-+ }
-+ return nullptr;
-+}
-+
- nsGNOMEShellHistoryService* GetGNOMEShellHistoryService() {
- static nsGNOMEShellHistoryService gGNOMEShellHistoryService;
- return &gGNOMEShellHistoryService;
-
diff --git a/mozilla-1639197.patch b/mozilla-1639197.patch
deleted file mode 100644
index edb2664..0000000
--- a/mozilla-1639197.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-diff --git a/browser/components/shell/nsGNOMEShellDBusHelper.cpp b/browser/components/shell/nsGNOMEShellDBusHelper.cpp
---- a/browser/components/shell/nsGNOMEShellDBusHelper.cpp
-+++ b/browser/components/shell/nsGNOMEShellDBusHelper.cpp
-@@ -285,7 +285,9 @@
- nsAutoCString gnomeSearchTitle;
- if (GetGnomeSearchTitle(searchTerm.get(), gnomeSearchTitle)) {
- appendStringDictionary(aIter, "name", gnomeSearchTitle.get());
-- appendStringDictionary(aIter, "gicon", "org.mozilla.Firefox");
-+ // TODO: When running on flatpak/snap we may need to use
-+ // icon like org.mozilla.Firefox or so.
-+ appendStringDictionary(aIter, "gicon", "firefox");
- }
- }
-
-
bgstack15