Closed Bug 1729656 Opened 3 years ago Closed 3 years ago

Don't use gfxPlatform to configure DMABuf

Categories

(Core :: Widget: Gtk, defect, P2)

x86_64
Linux
defect

Tracking

()

RESOLVED FIXED
94 Branch
Tracking Status
firefox-esr78 --- unaffected
firefox-esr91 --- disabled
firefox92 --- disabled
firefox93 --- disabled
firefox94 --- fixed

People

(Reporter: jan, Assigned: stransky)

References

(Blocks 3 open bugs, Regression, )

Details

(Keywords: crash, nightly-community, regression)

Crash Data

Attachments

(1 file)

+++ This bug was initially created as a clone of Bug #1725538 +++

bug 1725538 has been fixed. Original behavior is back:

MOZ_X11_EGL=1 mozregression --launch 2021-09-07 --pref gfx.webrender.all:true layers.gpu-process.force-enabled:true webgl.out-of-process:true webgl.out-of-process.force:true widget.dmabuf-webgl.enabled:false -a https://webglsamples.org/aquarium/aquarium.html

It does not appear your computer supports WebGL.
Click here for more information.
Status: SendPWebGLConstructor failed

I think I've found out what's going on and possibly a solution.

MOZ_X11_EGL=1 mozregression --launch 2021-09-10 --pref gfx.webrender.all:true layers.gpu-process.force-enabled:true webgl.out-of-process:true webgl.out-of-process.force:true widget.dmabuf-webgl.enabled:false -a https://webglsamples.org/aquarium/aquarium.html -B debug -P stdout

0:35.73 INFO: b'Assertion failure: !XRE_IsGPUProcess() (GFX: Not allowed in GPU process.), at /builds/worker/checkouts/gecko/gfx/thebes/gfxPlatform.cpp:752'

0:35.85 INFO: b'###!!! [Child][MessageChannel] Error: (msgtype=0xFFFB,name=SHMEM_CREATED_MESSAGE) Channel error: cannot send/recv'

Current behavior:

Compositing Dmabuf WebGL behavior of MOZ_X11_EGL + OOP WebGL + GPU process
WR does not matter GPU process crash + SendPWebGLConstructor failed
SW WR does not matter WebGL works

Encountered behavior seems to match this logic: https://searchfox.org/mozilla-central/rev/1761c710b035d7dc8892dfa8e56589b4e095221f/gfx/layers/CanvasRenderer.cpp#114-119

Assumed solution:
Android checks gfx::gfxVars::UseAHardwareBufferSharedSurface() before choosing TextureType::AndroidHardwareBuffer.
Therefore I assume the same should be done for Dmabuf:
The gl.GetContextType() == GLContextType::EGL && gfxPlatformGtk::GetPlatform()->UseDMABufWebGL()) check should be removed from SharedSurface.cpp and be made at TexTypeForWebgl() where we order the TextureType::DMABUF.

  • Its first condition, gl.GetContextType() == GLContextType::EGL, could be replaced with gfx::gfxVars::UseEGL().

Behavior evolution:

  1. good: bug 1654957 fixed OOP WebGL + GPU process. Dmabuf WebGL was Wayland-only at that time.
  2. tab crash bp-b7f64743-719d-476f-9df2-ef1a20210910: Dmabuf WebGL has been allowed for X11. It gets chosen without condition. SharedSurface.cpp caused a GPU process crash before returning the nullptr.
  3. Some check has been added if we have heard back from SharedSurface.cpp: No tab crash anymore, instead: "SendPWebGLConstructor failed"

good=good
bad=tab crash
MOZ_X11_EGL=1 mozregression --good 2020-08-10 --bad 2020-08-19 --pref gfx.webrender.all:true layers.gpu-process.force-enabled:true webgl.out-of-process:true webgl.out-of-process.force:true widget.dmabuf-webgl.enabled:false -a https://webglsamples.org/aquarium/aquarium.html

6:13.55 INFO: Last good revision: 5d63045bb341739c7eff24fc3bac085ab873c4b5 (2020-08-11)
6:13.55 INFO: First bad revision: 74b3be6fcb93aba5e967179e49676f4fb6422851 (2020-08-12)
6:13.55 INFO: Pushlog:
https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=5d63045bb341739c7eff24fc3bac085ab873c4b5&tochange=74b3be6fcb93aba5e967179e49676f4fb6422851

likely:

5e401631f3ef750246698f5a3ebb1e608fd9a160 Martin Stransky — Bug 1655026 [Linux] Enable WebGL DMABuf backend for X11/EGL, r=jgilbert

bad=tab crash
good=SendPWebGLConstructor failed
MOZ_X11_EGL=1 mozregression --find-fix --bad 2020-08-19 --good 2020-09-01 --pref gfx.webrender.all:true layers.gpu-process.force-enabled:true webgl.out-of-process:true webgl.out-of-process.force:true widget.dmabuf-webgl.enabled:false -a https://webglsamples.org/aquarium/aquarium.html

2:16.61 INFO: First good revision: 61ed3192760a3aaef282c089c064fc8dd3890125 (2020-08-26)
2:16.61 INFO: Last bad revision: a8f04609cdd89e6dd4f6e8c3f24daca3b6dc33be (2020-08-25)
2:16.61 INFO: Pushlog:
https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=a8f04609cdd89e6dd4f6e8c3f24daca3b6dc33be&tochange=61ed3192760a3aaef282c089c064fc8dd3890125

likely:

2c9d59a24ce81fe3073d2f647f440e3b4e278d3b David Parks — Bug 1659523: Secure bool and enum serialization in remote WebGL r=jgilbert
cb77639a7d0e1dbc07cdddc79c2ceb16da474ede David Parks — Bug 1659523: Check CanSend() before calling Send() when allocating Shmems r=nika
6d5443ce7e9546cbdc1fcfaef1d6d23462e50d3f David Parks — Bug 1659523: Wait for SpecialPowers to set pref before running WebGL tests r=jgilbert
8aab07ad0abc5cf83f11eee74f049742b11b1033 David Parks — Bug 1659523: Free WebGL command shmem when actor is destroyed r=jgilbert

Has Regression Range: --- → yes
Has STR: --- → yes
Flags: needinfo?(stransky)
Regressed by: 1655026

bp-3b7b8928-1828-4c3a-95c5-e76330210918

MOZ_RELEASE_ASSERT(!XRE_IsGPUProcess()) (GFX: Not allowed in GPU process.)

Crash Signature: [@ gfxPlatform::Init | mozilla::gl::SurfaceFactory::Create ]
Keywords: crash, regression

Hello, i one of persons affected by this crash - Nvidia + EGL+ GPU Process + OOP WebGL.
If you need reliable source of crashes this is very reliable one - https://js13kgames.com/entries/q1k3 (click Play The Game). In my case absolutely every time i try to launch it i get crash report like this https://crash-stats.mozilla.org/report/index/ec8d1542-f58f-4349-b183-f20200210919

(In reply to V. Korn from comment #4)

Nvidia

While this bug is perfectly reproducible everywhere, GPU process on Nvidia is also affected by bug 1730991.
Workaround: Set layers.gpu-process.enabled and layers.gpu-process.force-enabled to false and restart Firefox.

(In reply to Darkspirit from comment #5)

(In reply to V. Korn from comment #4)

Nvidia

While this bug is perfectly reproducible everywhere, GPU process on Nvidia is also affected by bug 1730991.
Workaround: Set layers.gpu-process.enabled and layers.gpu-process.force-enabled to false and restart Firefox.

Not a great plan. With EGL on Nvidia events suspend\resume or switching VT makes Firefox Nightly impossible to use with severe graphical corruption. However, manual killing GPU process completely restores full Firefox functionality.

Well, it's just the case that gfxPlatformGtk::GetPlatform()->UseDMABufWebGL() can't be used in GPU process.
We'll need to find better way how to configure DMABuf pref here. If that even worked it was a pure luck.

I expect to fix that with Bug 1732951 where DMABUF will be used.

Flags: needinfo?(stransky)
Summary: X11/EGL + GPU process + OOP WebGL: SendPWebGLConstructor failed → Don't use gfxPlatform to configure DMABuf
Component: Canvas: WebGL → Widget: Gtk
Priority: -- → P2

The key part is here:
https://searchfox.org/mozilla-central/rev/3fa5cc437a4937c621ea068ba5dc246f75831633/gfx/thebes/gfxPlatformGtk.cpp#456

We need to move mUseWebGLDmabufBackend flag to GetDMABufDevice class which works independently, perhaps as nsDMABufDevice::DisableDMABufWebGL().

Assignee: nobody → stransky
Status: NEW → ASSIGNED
Pushed by stransky@redhat.com:
https://hg.mozilla.org/integration/autoland/rev/40fb20cfc436
[Wayland] Don't use gfxPlatform to configure DMABuf, r=rmader

Verified fixed, thank you :)

Dmabuf WebGL disabled + MOZ_X11_EGL + GPU process + OOP WebGL:
MOZ_LOG=Dmabuf:5 mozregression --repo try --launch c1020cf65bfa6969c7fc00a71d78c2b11065a986 --pref gfx.webrender.all:true gfx.x11-egl.force-enabled:true layers.gpu-process.force-enabled:true webgl.out-of-process:true webgl.out-of-process.force:true widget.dmabuf-webgl.enabled:false -a https://webglsamples.org/aquarium/aquarium.html -P stdout

0:32.07 INFO: b'[GPU 35728: Compositor]: D/Dmabuf DMABuf is enabled, using drm node /dev/dri/renderD128'
0:32.07 INFO: b'[GPU 35728: Compositor]: D/Dmabuf nsDMABufDevice::IsDMABufWebGLEnabled: EGL 1 mUseWebGLDmabufBackend 1 DMABufEnabled 1 widget_dmabuf_webgl_enabled 0'

Dmabuf WebGL enabled + MOZ_X11_EGL + GPU process + OOP WebGL:
MOZ_LOG=Dmabuf:5 mozregression --repo try --launch c1020cf65bfa6969c7fc00a71d78c2b11065a986 --pref gfx.webrender.all:true gfx.x11-egl.force-enabled:true layers.gpu-process.force-enabled:true webgl.out-of-process:true webgl.out-of-process.force:true widget.dmabuf-webgl.enabled:true -a https://webglsamples.org/aquarium/aquarium.html -P stdout

0:30.09 INFO: b'[GPU 36216: Compositor]: D/Dmabuf DMABuf is enabled, using drm node /dev/dri/renderD128'
0:30.09 INFO: b'[GPU 36216: Compositor]: D/Dmabuf nsDMABufDevice::IsDMABufWebGLEnabled: EGL 1 mUseWebGLDmabufBackend 1 DMABufEnabled 1 widget_dmabuf_webgl_enabled 1'
0:30.09 INFO: b'[GPU 36216: Compositor]: D/Dmabuf nsDMABufDevice::IsDMABufWebGLEnabled: EGL 1 mUseWebGLDmabufBackend 1 DMABufEnabled 1 widget_dmabuf_webgl_enabled 1'
0:30.09 INFO: b'[GPU 36216: Compositor]: D/Dmabuf DMABufSurfaceRGBA::Create() UID 1 size 1 x 1'
0:30.09 INFO: b'[GPU 36216: Compositor]: D/Dmabuf Creating without modifiers'
0:30.09 INFO: b'[GPU 36216: Compositor]: D/Dmabuf Success'
0:30.09 INFO: b'[GPU 36216: Compositor]: D/Dmabuf DMABufSurface::ReleaseDMABuf() UID 1'
0:30.09 INFO: b'[GPU 36216: Compositor]: D/Dmabuf DMABufSurfaceRGBA::Create() UID 2 size 1024 x 1024'
0:30.09 INFO: b'[GPU 36216: Compositor]: D/Dmabuf Creating without modifiers'
0:30.09 INFO: b'[GPU 36216: Compositor]: D/Dmabuf Success'
0:30.10 INFO: b'[GPU 36216: Compositor]: D/Dmabuf DMABufSurfaceRGBA::Serialize() UID 2'
0:30.10 INFO: b'[GPU 36216: Compositor]: D/Dmabuf DMABufSurfaceRGBA::ImportSurfaceDescriptor() UID 2 size 1024 x 1024'
0:30.10 INFO: b'[GPU 36216: Compositor]: D/Dmabuf DMABufSurfaceRGBA::Create() UID 4 size 1024 x 1024'
0:30.10 INFO: b'[GPU 36216: Compositor]: D/Dmabuf Creating without modifiers'
0:30.10 INFO: b'[GPU 36216: Compositor]: D/Dmabuf Success'
0:30.11 INFO: b'[GPU 36216: Compositor]: D/Dmabuf DMABufSurfaceRGBA::Serialize() UID 4'
0:30.11 INFO: b'[GPU 36216: Compositor]: D/Dmabuf DMABufSurfaceRGBA::ImportSurfaceDescriptor() UID 4 size 1024 x 1024'
0:30.18 INFO: b'[GPU 36216: Compositor]: D/Dmabuf DMABufSurfaceRGBA::Create() UID 6 size 1024 x 1024'
0:30.18 INFO: b'[GPU 36216: Compositor]: D/Dmabuf Creating without modifiers'
0:30.18 INFO: b'[GPU 36216: Compositor]: D/Dmabuf Success'
0:30.18 INFO: b'[GPU 36216: Compositor]: D/Dmabuf DMABufSurface::ReleaseDMABuf() UID 2'

Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 94 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: