Open Bug 1819807 Opened 2 years ago Updated 5 months ago

NVidia PRIME offloading does not support 32bit EGL contexts

Categories

(Core :: Graphics: WebRender, defect)

Firefox 110
x86_64
Linux
defect

Tracking

()

UNCONFIRMED

People

(Reporter: flubba86, Unassigned)

References

(Blocks 1 open bug)

Details

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/110.0

Steps to reproduce:

On a laptop with Intel Integrated graphics, and NVidia RTX A1000 card. With latest Mesa upstream Intel drivers, and latest proprietary NVidia v525 drivers.

Intel integrated graphics is set up as Primary GPU, and NVidia card is offload GPU.

OS: Ubuntu 22.04

Running Firefox v110.0.1 in EGL mode with NVidia Prime:
~> __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia MOZ_X11_EGL=1 firefox
"[GFX1-]: Failed to create EGLSurface!: 0x3009",
"[GFX1-]: Failed to create EGLSurface. 1 renderers, 0 active.",
"[GFX1-]: Handling webrender error 3",
"[GFX1-]: Fallback WR to SW-WR"

Actual results:

~> __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia MOZ_X11_EGL=1 firefox
MOZ_X11_EGL=1 firefox
"[GFX1-]: Failed to create EGLSurface!: 0x3009",
"[GFX1-]: Failed to create EGLSurface. 1 renderers, 0 active.",
"[GFX1-]: Handling webrender error 3",
"[GFX1-]: Fallback WR to SW-WR"

Exactly the same issue can be seen in the last couple of comments in this related bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1739611

Reproducing the same issue using GLMark2-ES2
~> _NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia glmark2-es2
Error: eglCreateWindowSurface failed with error: 0x3009
Error: eglCreateWindowSurface failed with error: 0x3009
Error: CanvasGeneric: Invalid EGL state
Error: main: Could not initialize canvas

Works fine on the integrated graphics:
~> _NV_PRIME_RENDER_OFFLOAD=0 glmark2-es2

glmark2 2021.02

=======================================================
OpenGL Information
GL_VENDOR: Intel
GL_RENDERER: Mesa Intel(R) Graphics (ADL GT2)
GL_VERSION: OpenGL ES 3.2 Mesa 22.3.6

After doing some research I found the same issue was observed in OBS, and they fixed it by switching to 24bit (no alpha channel) EGL context. https://github.com/obsproject/obs-studio/issues/6984

This is confirmed by checking available buffer configs when using PRIME:
~> __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia glmark2-es2 --debug
Debug: Using eglGetPlatformDisplayEXT()
Debug: Got 28 suitable EGLConfigs:
Debug:
Debug: cfg buf rgb colorbuffer dp st config native support surface sample
Debug: id sz lum r g b a th cl caveat render visid type buf ns
Debug: ------------------------------------------------------------------------
Debug: 0x4 32 rgb 8 8 8 8 24 0 None false 0x2a9 0x807 0 0
Debug: 0x5 32 rgb 8 8 8 8 24 0 None false 0x2a9 0x807 0 0
Debug: 0x1 32 rgb 8 8 8 8 24 8 None false 0x2a9 0x807 0 0
Debug: 0x2 32 rgb 8 8 8 8 24 8 None false 0x2a9 0x807 0 0
Debug: 0xd 32 rgb 8 8 8 8 24 0 None false 0x2a9 0x805 1 2
Debug: 0xe 32 rgb 8 8 8 8 24 0 None false 0x2a9 0x805 1 2
Debug: 0xa 32 rgb 8 8 8 8 24 8 None false 0x2a9 0x805 1 2
Debug: 0xb 32 rgb 8 8 8 8 24 8 None false 0x2a9 0x805 1 2
Debug: 0x13 32 rgb 8 8 8 8 24 0 None false 0x2a9 0x805 1 4
Debug: 0x14 32 rgb 8 8 8 8 24 0 None false 0x2a9 0x805 1 4
Debug: 0x10 32 rgb 8 8 8 8 24 8 None false 0x2a9 0x805 1 4
Debug: 0x11 32 rgb 8 8 8 8 24 8 None false 0x2a9 0x805 1 4
Debug: 0x19 32 rgb 8 8 8 8 24 0 None false 0x2a9 0x805 1 8
Debug: 0x1a 32 rgb 8 8 8 8 24 0 None false 0x2a9 0x805 1 8
Debug: 0x16 32 rgb 8 8 8 8 24 8 None false 0x2a9 0x805 1 8
Debug: 0x17 32 rgb 8 8 8 8 24 8 None false 0x2a9 0x805 1 8
Debug: 0x1f 32 rgb 8 8 8 8 24 0 None false 0x2a9 0x805 1 16
Debug: 0x20 32 rgb 8 8 8 8 24 0 None false 0x2a9 0x805 1 16
Debug: 0x1c 32 rgb 8 8 8 8 24 8 None false 0x2a9 0x805 1 16
Debug: 0x1d 32 rgb 8 8 8 8 24 8 None false 0x2a9 0x805 1 16
Debug: 0x25 32 rgb 8 8 8 8 24 0 None false 0x2a9 0x805 1 32
Debug: 0x26 32 rgb 8 8 8 8 24 0 None false 0x2a9 0x805 1 32
Debug: 0x22 32 rgb 8 8 8 8 24 8 None false 0x2a9 0x805 1 32
Debug: 0x23 32 rgb 8 8 8 8 24 8 None false 0x2a9 0x805 1 32
Debug: 0x2b 32 rgb 8 8 8 8 24 0 None false 0x2a9 0x805 1 64
Debug: 0x2c 32 rgb 8 8 8 8 24 0 None false 0x2a9 0x805 1 64
Debug: 0x28 32 rgb 8 8 8 8 24 8 None false 0x2a9 0x805 1 64
Debug: 0x29 32 rgb 8 8 8 8 24 8 None false 0x2a9 0x805 1 64

Only 24bit contexts are available.

Finally, testing witth GLMark2-ES2 when disabling the Alpha Channel, it works:

~> __NV_PRIME_RENDER_OFFLOAD=1 glmark2-es2 --visual-config red=8:green=8:blue=8:alpha=0:buffer=1

glmark2 2021.02

=======================================================
OpenGL Information
GL_VENDOR: NVIDIA Corporation
GL_RENDERER: NVIDIA RTX A1000 Laptop GPU/PCIe/SSE2
GL_VERSION: OpenGL ES 3.2 NVIDIA 530.30.02

working

Expected results:

I expect if Firefox can request a 24bit EGL context in Prime offloading situations, then it will solve this issue.

Sorry about the formatting, seems the submission form didn't like my markdown. It seems to format differently than the comment dialogs.

OS: Unspecified → Linux
Hardware: Unspecified → x86_64

The Bugbug bot thinks this bug should belong to the 'Core::Graphics: WebRender' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Graphics: WebRender
Product: Firefox → Core

Thanks for the report!
How does Firefox behave if you start it with your env vars and MOZ_ENABLE_WAYLAND=1 on Wayland?
$ __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia MOZ_ENABLE_WAYLAND=1 path/to/firefox


https://download.nvidia.com/XFree86/Linux-x86_64/435.17/README/primerenderoffload.html

PRIME render offload is the ability to have an X screen rendered by one GPU, but choose certain applications within that X screen to be rendered on a different GPU.

Running Firefox v110.0.1 in EGL mode with NVidia Prime:
~> __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia MOZ_X11_EGL=1 firefox
"[GFX1-]: Failed to create EGLSurface!: 0x3009",
"[GFX1-]: Failed to create EGLSurface. 1 renderers, 0 active.",
"[GFX1-]: Handling webrender error 3",
"[GFX1-]: Fallback WR to SW-WR"

Copying between two GPUs is not more performant as using the primary GPU with Dmabuf WebGL etc.
0x3009 is EGL_BAD_MATCH. The driver does not support transparent OpenGL windows.
Firefox' window and its toolbar panels have round corners, therefore they need transparency. You get Software WebRender as expected.

Blocks: wr-nv-linux
Severity: -- → S3

Hi, I just wanted to add that I am having the same error and general behaviour as OP.
I cannot test under wayland, as I am running Debian and wayland is disabled when using the proprietary NVIDIA

If it is indeed only due to the transparency, wouldn't it make sense to be able to disable such a non-essential feature if it meant enabling HW acceleration support in many more cases ?

Thank you

You need to log in before you can comment on or make changes to this bug.