From fac8607f9311b7e6c3948750b2f0a43e8725c094 Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Mon, 25 May 2020 15:20:03 +0200 Subject: Added fix for mozbz#1634213 --- mozilla-1634213.patch | 96 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 mozilla-1634213.patch (limited to 'mozilla-1634213.patch') diff --git a/mozilla-1634213.patch b/mozilla-1634213.patch new file mode 100644 index 0000000..d2a4138 --- /dev/null +++ b/mozilla-1634213.patch @@ -0,0 +1,96 @@ +diff --git a/gfx/gl/GLScreenBuffer.cpp b/gfx/gl/GLScreenBuffer.cpp +--- a/gfx/gl/GLScreenBuffer.cpp ++++ b/gfx/gl/GLScreenBuffer.cpp +@@ -88,10 +88,14 @@ + #if defined(XP_MACOSX) + factory = SurfaceFactory_IOSurface::Create(gl, caps, ipcChannel, flags); + #elif defined(MOZ_WAYLAND) +- if (gl->GetContextType() == GLContextType::EGL) { +- if (gfxPlatformGtk::GetPlatform()->UseWaylandDMABufWebGL()) { +- factory = +- MakeUnique(gl, caps, ipcChannel, flags); ++ if (gl->GetContextType() == GLContextType::EGL && ++ gfxPlatformGtk::GetPlatform()->UseWaylandDMABufWebGL()) { ++ auto DMABUFFactory = ++ MakeUnique(gl, caps, ipcChannel, flags); ++ if (DMABUFFactory && DMABUFFactory->CanCreateSurface()) { ++ factory = std::move(DMABUFFactory); ++ } else { ++ gfxPlatformGtk::GetPlatform()->DisableWaylandDMABufWebGL(); + } + } + #elif defined(MOZ_X11) +diff --git a/gfx/gl/SharedSurfaceDMABUF.h b/gfx/gl/SharedSurfaceDMABUF.h +--- a/gfx/gl/SharedSurfaceDMABUF.h ++++ b/gfx/gl/SharedSurfaceDMABUF.h +@@ -71,6 +71,11 @@ + bool hasAlpha = mReadCaps.alpha; + return SharedSurface_DMABUF::Create(mGL, mFormats, size, hasAlpha); + } ++ ++ bool CanCreateSurface() { ++ UniquePtr test = CreateShared(gfx::IntSize(1, 1)); ++ return test != nullptr; ++ } + }; + + } // namespace gl +diff --git a/gfx/thebes/gfxPlatformGtk.h b/gfx/thebes/gfxPlatformGtk.h +--- a/gfx/thebes/gfxPlatformGtk.h ++++ b/gfx/thebes/gfxPlatformGtk.h +@@ -88,7 +88,8 @@ + + #ifdef MOZ_WAYLAND + bool UseWaylandDMABufTextures(); +- bool UseWaylandDMABufWebGL(); ++ bool UseWaylandDMABufWebGL() { return mUseWebGLDmabufBackend; } ++ void DisableWaylandDMABufWebGL() { mUseWebGLDmabufBackend = false; } + bool UseWaylandHardwareVideoDecoding(); + #endif + +@@ -110,6 +111,9 @@ + #ifdef MOZ_X11 + Display* mCompositorDisplay; + #endif ++#ifdef MOZ_WAYLAND ++ bool mUseWebGLDmabufBackend; ++#endif + }; + + #endif /* GFX_PLATFORM_GTK_H */ +diff --git a/gfx/thebes/gfxPlatformGtk.cpp b/gfx/thebes/gfxPlatformGtk.cpp +--- a/gfx/thebes/gfxPlatformGtk.cpp ++++ b/gfx/thebes/gfxPlatformGtk.cpp +@@ -116,6 +116,9 @@ + + Factory::ReleaseFTLibrary(gPlatformFTLibrary); + gPlatformFTLibrary = nullptr; ++ ++ mUseWebGLDmabufBackend = ++ IsWaylandDisplay() && nsWaylandDisplay::IsDMABufWebGLEnabled(); + } + + void gfxPlatformGtk::FlushContentDrawing() { +@@ -725,9 +728,6 @@ + bool gfxPlatformGtk::UseWaylandDMABufTextures() { + return IsWaylandDisplay() && nsWaylandDisplay::IsDMABufTexturesEnabled(); + } +-bool gfxPlatformGtk::UseWaylandDMABufWebGL() { +- return IsWaylandDisplay() && nsWaylandDisplay::IsDMABufWebGLEnabled(); +-} + bool gfxPlatformGtk::UseWaylandHardwareVideoDecoding() { + return IsWaylandDisplay() && nsWaylandDisplay::IsDMABufVAAPIEnabled() && + gfxPlatform::CanUseHardwareVideoDecoding(); +diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml +--- a/modules/libpref/init/StaticPrefList.yaml ++++ b/modules/libpref/init/StaticPrefList.yaml +@@ -9111,7 +9111,7 @@ + # Use DMABuf backend for WebGL on Wayland. + - name: widget.wayland-dmabuf-webgl.enabled + type: RelaxedAtomicBool +- value: false ++ value: true + mirror: always + + # Use VA-API for video playback on Wayland. + -- cgit