summaryrefslogtreecommitdiff
path: root/D149238.diff
diff options
context:
space:
mode:
authorMartin Stransky <stransky@redhat.com>2022-06-14 14:33:53 +0200
committerMartin Stransky <stransky@redhat.com>2022-06-14 14:33:53 +0200
commit92e16f9069e32c692765fface7cfc01813c81bf9 (patch)
treecda70bb5a8c2e0c069540484d3a2e44f5655476e /D149238.diff
parentFix WebGL mem leaks (mzbz#1773968) (diff)
downloadlibrewolf-fedora-ff-92e16f9069e32c692765fface7cfc01813c81bf9.tar.gz
librewolf-fedora-ff-92e16f9069e32c692765fface7cfc01813c81bf9.tar.bz2
librewolf-fedora-ff-92e16f9069e32c692765fface7cfc01813c81bf9.zip
Added more VA-API and WebGL fixes
Diffstat (limited to 'D149238.diff')
-rw-r--r--D149238.diff100
1 files changed, 100 insertions, 0 deletions
diff --git a/D149238.diff b/D149238.diff
new file mode 100644
index 0000000..290c536
--- /dev/null
+++ b/D149238.diff
@@ -0,0 +1,100 @@
+diff -up firefox-101.0.1/gfx/config/gfxVars.h.D149238.diff firefox-101.0.1/gfx/config/gfxVars.h
+--- firefox-101.0.1/gfx/config/gfxVars.h.D149238.diff 2022-06-14 14:28:15.301514131 +0200
++++ firefox-101.0.1/gfx/config/gfxVars.h 2022-06-14 14:29:32.221087732 +0200
+@@ -91,7 +91,8 @@ class gfxVarReceiver;
+ _(AllowWebGPU, bool, false) \
+ _(UseVP8HwDecode, bool, false) \
+ _(UseVP9HwDecode, bool, false) \
+- _(HwDecodedVideoNoCopy, bool, false)
++ _(HwDecodedVideoNoCopy, bool, false) \
++ _(UseDMABufSurfaceExport, bool, true)
+
+ /* Add new entries above this line. */
+
+diff -up firefox-101.0.1/gfx/gl/SharedSurfaceDMABUF.cpp.D149238.diff firefox-101.0.1/gfx/gl/SharedSurfaceDMABUF.cpp
+--- firefox-101.0.1/gfx/gl/SharedSurfaceDMABUF.cpp.D149238.diff 2022-06-14 14:28:15.297513997 +0200
++++ firefox-101.0.1/gfx/gl/SharedSurfaceDMABUF.cpp 2022-06-14 14:28:15.301514131 +0200
+@@ -9,6 +9,7 @@
+ #include "GLContextEGL.h"
+ #include "MozFramebuffer.h"
+ #include "mozilla/layers/LayersSurfaces.h" // for SurfaceDescriptor, etc
++#include "mozilla/gfx/gfxVars.h"
+
+ namespace mozilla::gl {
+
+@@ -27,22 +28,39 @@ UniquePtr<SharedSurface_DMABUF> SharedSu
+ const auto& context = gle->mContext;
+ const auto& egl = *(gle->mEgl);
+
+- if (!HasDmaBufExtensions(gle)) {
+- return nullptr;
+- }
+-
+- auto fb = MozFramebuffer::Create(desc.gl, desc.size, 0, false);
+- if (!fb) return nullptr;
+-
+- const auto buffer = reinterpret_cast<EGLClientBuffer>(fb->ColorTex());
+- const auto image =
+- egl.fCreateImage(context, LOCAL_EGL_GL_TEXTURE_2D, buffer, nullptr);
+- if (!image) return nullptr;
+-
+- const RefPtr<DMABufSurface> surface = DMABufSurfaceRGBA::CreateDMABufSurface(
+- desc.gl, image, desc.size.width, desc.size.height);
+- if (!surface) return nullptr;
++ RefPtr<DMABufSurface> surface;
++ UniquePtr<MozFramebuffer> fb;
+
++ if (!HasDmaBufExtensions(gle) || !gfx::gfxVars::UseDMABufSurfaceExport()) {
++ // Use MESA_image_dma_buf_export is not supported or it's broken.
++ // Create dmabuf surface directly via. GBM and create
++ // EGLImage/framebuffer over it.
++ const auto flags = static_cast<DMABufSurfaceFlags>(
++ DMABUF_TEXTURE | DMABUF_USE_MODIFIERS | DMABUF_ALPHA);
++ surface = DMABufSurfaceRGBA::CreateDMABufSurface(desc.size.width,
++ desc.size.height, flags);
++ if (!surface || !surface->CreateTexture(desc.gl)) {
++ return nullptr;
++ }
++ const auto tex = surface->GetTexture();
++ fb = MozFramebuffer::CreateForBacking(desc.gl, desc.size, 0, false,
++ LOCAL_GL_TEXTURE_2D, tex);
++ if (!fb) return nullptr;
++ } else {
++ // Use MESA_image_dma_buf_export so create EGLImage/framebuffer directly
++ // and derive dmabuf from it.
++ fb = MozFramebuffer::Create(desc.gl, desc.size, 0, false);
++ if (!fb) return nullptr;
++
++ const auto buffer = reinterpret_cast<EGLClientBuffer>(fb->ColorTex());
++ const auto image =
++ egl.fCreateImage(context, LOCAL_EGL_GL_TEXTURE_2D, buffer, nullptr);
++ if (!image) return nullptr;
++
++ surface = DMABufSurfaceRGBA::CreateDMABufSurface(
++ desc.gl, image, desc.size.width, desc.size.height);
++ if (!surface) return nullptr;
++ }
+ return AsUnique(new SharedSurface_DMABUF(desc, std::move(fb), surface));
+ }
+
+diff -up firefox-101.0.1/gfx/thebes/gfxPlatform.cpp.D149238.diff firefox-101.0.1/gfx/thebes/gfxPlatform.cpp
+--- firefox-101.0.1/gfx/thebes/gfxPlatform.cpp.D149238.diff 2022-06-08 23:06:36.000000000 +0200
++++ firefox-101.0.1/gfx/thebes/gfxPlatform.cpp 2022-06-14 14:28:15.302514165 +0200
+@@ -2851,6 +2851,17 @@ void gfxPlatform::InitWebGLConfig() {
+ gfxVars::SetAllowEglRbab(false);
+ }
+ }
++
++ if (kIsWayland || kIsX11) {
++ // Disable EGL_MESA_image_dma_buf_export on mesa/radeonsi due to
++ // https://gitlab.freedesktop.org/mesa/mesa/-/issues/6666
++ nsString adapterDriverVendor;
++ gfxInfo->GetAdapterDriverVendor(adapterDriverVendor);
++ if (adapterDriverVendor.Find("mesa") != -1 &&
++ adapterDriverVendor.Find("radeonsi") != -1) {
++ gfxVars::SetUseDMABufSurfaceExport(false);
++ }
++ }
+ }
+
+ void gfxPlatform::InitWebGPUConfig() {
bgstack15