Bug 265409 - www/firefox 103.0: tabs crash when using WebGL
Summary: www/firefox 103.0: tabs crash when using WebGL
Status: Closed Overcome By Events
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Some People
Assignee: freebsd-gecko (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-07-23 22:48 UTC by bsduck
Modified: 2022-07-27 21:31 UTC (History)
4 users (show)

See Also:
bugzilla: maintainer-feedback? (gecko)


Attachments
v1 ("git am)" (4.94 KB, patch)
2022-07-25 00:40 UTC, Evgenii Khramtsov
2khramtsov: maintainer-approval? (gecko)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description bsduck 2022-07-23 22:48:33 UTC
Hello,

Since the upgrade from 102 to 103, tabs trying to make use of WebGL instantly and invariably crash. For example Google Maps.

Disabling WebGL with 'webgl.disabled' in about:config stops the crashes.

13.1-STABLE amd64, latest packages

Intel HD Graphics 4000, drm-510-kmod
xf86-video-intel or modesetting (no difference)
Comment 1 Daniel Pérez 2022-07-24 09:25:52 UTC
Hello, I can confirm this also has started happening to me too in Google Sheets tabs.
Disabling WebGL as mentioned fixes this, but obviously with a noticeable performance degradation.

Firefox 103.0,2 from latest repo.
FreeBSD 14.0-CURRENT amd64
Comment 2 Evgenii Khramtsov 2022-07-24 20:30:38 UTC
Should be bisected soon (~5 steps left, ETA tomorrow), for now:

Known last good:

commit 1b05f561a6e0341a2f32b6f4811bbb2fb947b2ca
Author: Mozilla Releng Treescript <release+treescript@mozilla.org>
Date:   Sun Jun 26 19:03:24 2022 +0000

    no bug - Bumping Firefox l10n changesets r=release a=l10n-bump DONTBUILD
        
    dsb -> a0d368168f08a39ae5e25c664b367410eda3f8c3
    es-MX -> 91b2720d9ad2b23a28b51d7e774621317ffc021b
    hsb -> 69fc8b3778cdec6fc3c1c4cda45e92c020905fe8
    it -> fa18ea832f3cc21a59ceef603ea33dffbcb6b6ca
    lt -> 37fc8582da0875d1a3a48af72567a2301620d5cd
    pl -> ee21305f4f4c4cb0eef45e7bfd8467bbc9357e4a
    sk -> 81f7bae270246cb39a78d1e41e7e7c1f763d86e8
    tg -> f52e1fe09a85636d384c089ba9245bb2d939191b

Known bad:

1b05f561a6e0341a2f32b6f4811bbb2fb947b2ca

commit bca315d04612be8374dd52d56bbaac8fe4181f2e (HEAD)
Author: Barret Rennie <barret@brennie.ca>
Date:   Mon Jun 27 19:41:53 2022 +0000

    Bug 1776481 - Classify IOUtils and PathUtils under Toolkit: OS.File r=nika
        
    Differential Revision: https://phabricator.services.mozilla.com/D150272
Comment 3 Evgenii Khramtsov 2022-07-24 20:33:31 UTC
(In reply to Evgeniy Khramtsov from comment #2)

Ignore the last "1b05f561a6e0341a2f32b6f4811bbb2fb947b2ca", I can't edit comments due to bug 191677.
Comment 4 Evgenii Khramtsov 2022-07-25 00:40:56 UTC
Created attachment 235462 [details]
v1 ("git am)"

Upstream change [1][2] landed in Firefox 103:
"Bug 1776563 - Remove nsDMABufDevice::IsDMABufEnabled(), r=stransky"
caused WebGL pages (e.g. maps.google.com) to crash, as parent proccess
fails to initialize [3] dmabuf and 1776563 removed bool that prevented crash.

Backport upstream change [4][5] landed for Firefox 104:
"Bug 1779425 - Check for GbmDevice before using it, r=stransky,jgilbert"
to fix the crash by adding a check to fail cleanly instead:

[3] $ MOZ_LOG="Dmabuf:5" firefox
[Parent 39647: Main Thread]: D/Dmabuf wl_drm is available.
[Parent 39647: Main Thread]: D/Dmabuf zwp_linux_dmabuf_v1 is available.
[Parent 39647: Main Thread]: D/Dmabuf Using DRM device /dev/dri/renderD128
[Parent 39647: Main Thread]: D/Dmabuf nsDMABufDevice::Configure()
[Parent 39647: Main Thread]: D/Dmabuf Loading DMABuf system library libgbm.so.1 ...
[Parent 39647: Main Thread]: D/Dmabuf DMABuf is enabled
[...]
[Child 39675: Main Thread]: D/Dmabuf Using DRM device /dev/dri/renderD128
[Child 39675: Main Thread]: D/Dmabuf DMABufSurfaceRGBA::Create() UID 1 size 1 x 1
[Child 39675: Main Thread]: D/Dmabuf     Missing GbmDevice!
[Child 39675: Main Thread]: D/Dmabuf DMABufSurfaceRGBA::ReleaseTextures() UID 1
[Child 39675: Main Thread]: D/Dmabuf DMABufSurface::ReleaseDMABuf() UID 1
[Child 39675: Main Thread]: D/Dmabuf SurfaceFactory_DMABUF::CanCreateSurface()
failed to create surface.
[Child 39675: Main Thread]: D/Dmabuf SurfaceFactory_DMABUF::Create() failed,
fallback to SW buffers.
[...]

[1]: https://bugzilla.mozilla.org/show_bug.cgi?id=1776563
[2]: https://hg.mozilla.org/mozilla-central/rev/b66edd978d47d4f3c513c23edac2f65a83e78300

[3]: https://hg.mozilla.org/releases/mozilla-release/file/0c479fee3a5092bea2bfdb32cfdcc66039544c3e/gfx/thebes/gfxPlatformGtk.cpp#l112

[4]: https://bugzilla.mozilla.org/show_bug.cgi?id=1779425
[5]: https://hg.mozilla.org/mozilla-central/rev/c29ee933bf30

---

May I ask someone to test? I tested in 13.1/amd64 jail on top of
ports 9bf7bc98d with lang/rust reverted to 1.62 and with LTO=off
to fetch binary packages with poudriere and to test faster.
Comment 5 Evgenii Khramtsov 2022-07-25 13:57:59 UTC
(In reply to Evgeniy Khramtsov from comment #4)

Seems odd as mGbmDevice isn't null until dereferenced later in DMABufSurface.cpp https://hg.mozilla.org/releases/mozilla-release/file/0c479fee3a5092bea2bfdb32cfdcc66039544c3e/widget/gtk/DMABufLibWrapper.cpp#l253

https://hg.mozilla.org/releases/mozilla-release/file/0c479fee3a5092bea2bfdb32cfdcc66039544c3e/widget/gtk/DMABufLibWrapper.cpp#l125

https://hg.mozilla.org/releases/mozilla-release/file/0c479fee3a5092bea2bfdb32cfdcc66039544c3e/widget/gtk/DMABufSurface.cpp#l383

I had a similar problem before due to LDFLAGS+=-Wl,--as-needed in Mk/bsd.gecko, but removing it did not help here. I have no idea about C++ but I'll leave a note if I figure the cause of DMABufSurface.cpp getting a nullptr.
Comment 6 Evgenii Khramtsov 2022-07-25 22:42:18 UTC
Can the reporter or anyone else close this bug? Band-aid has landed in ports e9cf87dba5ea without PR reference, I stopped investigation after
this. --with-debug build is broken, but the root cause could be missing relocation as upstream is known to rely on fragile hacks (e.g. wrappers with dlsym(), weak symbols). DMABuf surface creation is regressed (no known good commit) so more memory copies are needed, this could be harmful if memory bandwidth is saturated with damaging large surfaces (e.g. 3840x2160 window).