diff options
Diffstat (limited to 'mozilla-1634213.patch')
-rw-r--r-- | mozilla-1634213.patch | 96 |
1 files changed, 96 insertions, 0 deletions
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<SurfaceFactory_DMABUF>(gl, caps, ipcChannel, flags); ++ if (gl->GetContextType() == GLContextType::EGL && ++ gfxPlatformGtk::GetPlatform()->UseWaylandDMABufWebGL()) { ++ auto DMABUFFactory = ++ MakeUnique<SurfaceFactory_DMABUF>(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<SharedSurface> 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. + |