summaryrefslogtreecommitdiff
path: root/D149135.diff
diff options
context:
space:
mode:
Diffstat (limited to 'D149135.diff')
-rw-r--r--D149135.diff80
1 files changed, 80 insertions, 0 deletions
diff --git a/D149135.diff b/D149135.diff
new file mode 100644
index 0000000..6e93f2b
--- /dev/null
+++ b/D149135.diff
@@ -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));
+
+
bgstack15