Fix WebGL mem leaks (mzbz#1773968)

This commit is contained in:
Martin Stransky 2022-06-13 16:36:43 +02:00
parent 33fd704cce
commit bfdfd329b2
2 changed files with 86 additions and 1 deletions

80
D149135.diff Normal file
View File

@ -0,0 +1,80 @@
diff --git a/widget/gtk/DMABufSurface.cpp b/widget/gtk/DMABufSurface.cpp
--- a/widget/gtk/DMABufSurface.cpp
+++ b/widget/gtk/DMABufSurface.cpp
@@ -642,11 +642,11 @@
void DMABufSurfaceRGBA::ReleaseTextures() {
LOGDMABUF(("DMABufSurfaceRGBA::ReleaseTextures() UID %d\n", mUID));
FenceDelete();
- if (!mTexture) {
+ if (!mTexture && mEGLImage == LOCAL_EGL_NO_IMAGE) {
return;
}
if (!mGL) {
#ifdef NIGHTLY
@@ -663,17 +663,17 @@
const auto& egl = gle->mEgl;
if (mTexture && mGL->MakeCurrent()) {
mGL->fDeleteTextures(1, &mTexture);
mTexture = 0;
- mGL = nullptr;
}
if (mEGLImage != LOCAL_EGL_NO_IMAGE) {
egl->fDestroyImage(mEGLImage);
mEGLImage = LOCAL_EGL_NO_IMAGE;
}
+ mGL = nullptr;
}
void DMABufSurfaceRGBA::ReleaseSurface() {
MOZ_ASSERT(!IsMapped(), "We can't release mapped buffer!");
@@ -1325,11 +1325,11 @@
FenceDelete();
bool textureActive = false;
for (int i = 0; i < mBufferPlaneCount; i++) {
- if (mTexture[i]) {
+ if (mTexture[i] || mEGLImage[i] != LOCAL_EGL_NO_IMAGE) {
textureActive = true;
break;
}
}
@@ -1346,18 +1346,23 @@
"leaking textures!");
return;
#endif
}
- if (textureActive && mGL->MakeCurrent()) {
- mGL->fDeleteTextures(DMABUF_BUFFER_PLANES, mTexture);
- for (int i = 0; i < DMABUF_BUFFER_PLANES; i++) {
- mTexture[i] = 0;
- }
- ReleaseEGLImages(mGL);
- mGL = nullptr;
+ if (!mGL->MakeCurrent()) {
+ NS_WARNING(
+ "DMABufSurfaceYUV::ReleaseTextures(): Failed to create GL context "
+ "current. We're leaking textures!");
+ return;
}
+
+ mGL->fDeleteTextures(DMABUF_BUFFER_PLANES, mTexture);
+ for (int i = 0; i < DMABUF_BUFFER_PLANES; i++) {
+ mTexture[i] = 0;
+ }
+ ReleaseEGLImages(mGL);
+ mGL = nullptr;
}
bool DMABufSurfaceYUV::VerifyTextureCreation() {
LOGDMABUF(("DMABufSurfaceYUV::VerifyTextureCreation() UID %d", mUID));

View File

@ -163,7 +163,7 @@ ExcludeArch: aarch64
Summary: Mozilla Firefox Web browser
Name: firefox
Version: 101.0.1
Release: 1%{?pre_tag}%{?dist}
Release: 2%{?pre_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
@ -267,6 +267,7 @@ Patch435: D146275.diff
Patch440: D147635.diff
Patch441: D147636.diff
Patch442: D147637.diff
Patch443: D149135.diff
# PGO/LTO patches
Patch600: pgo.patch
@ -532,6 +533,7 @@ This package contains results of tests executed during build.
%patch440 -p1 -b .D147635.diff
%patch441 -p1 -b .D147636.diff
%patch442 -p1 -b .D147637.diff
%patch443 -p1 -b .D149135.diff
# More VA-API fixes
%patch422 -p1 -b .D147720.diff
@ -1108,6 +1110,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
#---------------------------------------------------------------------
%changelog
* Mon Jun 13 2022 Martin Stransky <stransky@redhat.com>- 101.0.1-2
- Fix WebGL mem leaks (mzbz#1773968)
* Thu Jun 9 2022 Martin Stransky <stransky@redhat.com>- 101.0.1-1
- Updated to 101.0.1
- More VA-API sandbox fixes (mzbz#1769182)