Bug 265482 - www/firefox 103.0: WebGL no longer works with nvidia driver
Summary: www/firefox 103.0: WebGL no longer works with nvidia driver
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Only Me
Assignee: freebsd-gecko (Nobody)
URL: https://www.freshports.org/x11/nvidia...
Keywords:
Depends on:
Blocks:
 
Reported: 2022-07-28 17:41 UTC by marek
Modified: 2023-08-29 20:36 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description marek 2022-07-28 17:41:30 UTC
Since Firefox 103 I have no hardware acceleration for WebGL. I'm using NVidia GeForce 1650 with the latest drivers from ports. Not sure if it is partially related to bug #265409

When I run Firefox, I got:

$ MOZ_LOG="Dmabuf:5" firefox
[Parent 5772: Main Thread]: D/Dmabuf We're missing DRM render device!
[Parent 5772: Main Thread]: D/Dmabuf nsDMABufDevice::Configure()
[Parent 5772: Main Thread]: D/Dmabuf Loading DMABuf system library libgbm.so.1 ...
[Parent 5772: Main Thread]: D/Dmabuf Failed to create drm render device
[Child 5779: Main Thread]: D/Dmabuf We're missing DRM render device!
[Child 5857: Main Thread]: D/Dmabuf We're missing DRM render device!
[Child 5777: Main Thread]: D/Dmabuf We're missing DRM render device!
[Child 5867: Main Thread]: D/Dmabuf We're missing DRM render device!
[Child 5912: Main Thread]: D/Dmabuf We're missing DRM render device!


My setup is:
FreeBSD 13.1-RELEASE releng/13.1-n250148-fc952ac2212 GENERIC amd64

Packages:
firefox-103.0_1,2
nvidia-driver-510.60.02
nvidia-settings-470.86
nvidia-xconfig-470.86
Comment 1 Jan Beich freebsd_committer freebsd_triage 2022-07-28 19:15:30 UTC
Try disabling widget.dmabuf-webgl.enabled in about:config. x11/nvidia-driver currently lacks nvidia-drm.ko to expose /dev/dri/renderD128 for DMABUF. See also
https://gitter.im/FreeBSDDesktop/Lobby?at=627c635510cfc315bc75313f

> all nvidia-drm internal changes are in and will be present in a
> couple driver release cycles (roughly fall ish I'm guessing). So at
> that time I'll start populating my github with driver versions with
> the nvidia-drm patches applied and everyone can start testing

I wonder how WebGL in Firefox works on Linux given https://download.nvidia.com/XFree86/Linux-x86_64/510.60.02/README/kms.html still says "NVIDIA's DRM KMS support is still considered experimental. It is disabled by default"
Comment 2 marek 2022-07-28 21:16:11 UTC
OK, I disabled widget.dmabuf-webgl.enabled but with no luck:

$ MOZ_LOG="Dmabuf:5" firefox
[Parent 2201: Main Thread]: D/Dmabuf We're missing DRM render device!
[Parent 2201: Main Thread]: D/Dmabuf nsDMABufDevice::Configure()
[Parent 2201: Main Thread]: D/Dmabuf IsDMABufEnabled(): Disabled by preferences.
[Child 2209: Main Thread]: D/Dmabuf We're missing DRM render device!
[Child 2209: Main Thread]: D/Dmabuf nsDMABufDevice::IsDMABufWebGLEnabled: UseDMABuf 0 mUseWebGLDmabufBackend 1 widget_dmabuf_webgl_enabled 0
[Child 2209: Main Thread]: D/Dmabuf nsDMABufDevice::IsDMABufWebGLEnabled: UseDMABuf 0 mUseWebGLDmabufBackend 1 widget_dmabuf_webgl_enabled 0
[Child 2209: Main Thread]: D/Dmabuf nsDMABufDevice::IsDMABufWebGLEnabled: UseDMABuf 0 mUseWebGLDmabufBackend 1 widget_dmabuf_webgl_enabled 0
[Child 2209: Main Thread]: D/Dmabuf nsDMABufDevice::IsDMABufWebGLEnabled: UseDMABuf 0 mUseWebGLDmabufBackend 1 widget_dmabuf_webgl_enabled 0
[Child 2209: Main Thread]: D/Dmabuf nsDMABufDevice::IsDMABufWebGLEnabled: UseDMABuf 0 mUseWebGLDmabufBackend 1 widget_dmabuf_webgl_enabled 0

Also tested it on the clear Firefox profile to avoid conflicts with other settings and the result was the same. 

So, the are two more steps to check:
- compile https://github.com/amshafer/nvidia-driver and check the results with Firefox
- check how Firefox 103 handles NVidia's devices on Linux

I will try to make these steps and report the results here.
Comment 3 marek 2022-12-25 19:59:27 UTC
> I wonder how WebGL in Firefox works on Linux given https://download.nvidia.com/XFree86/Linux-x86_64/510.60.02/README/kms.html still says "NVIDIA's DRM KMS support is still considered experimental. It is disabled by default"

I checked this on several modern Linux distros (Ubuntu, Mint, Debian) and it seems that DRM support is now enabled by default. I have not investigated it deeper, just checked the presence of nvidia_drm module and the tree of /dev/dri/

One more thing that I can confirm is that I successfully compiled nvidia-drm module from amshafer's work on github and it works with Firefox! 

The confirmed working versions are:

OS: FreeBSD 13.1-RELEASE

Packages:
drm-510-kmod-5.10.113_8 (compiled from ports, because I needed the same sources to build nvidia-drm)
firefox-108.0.1,2 

Sources:
525.60.11 branch from https://github.com/amshafer/nvidia-driver

Kernel log after loaded nvidia-drm.ko:

nvidia0: <NVIDIA GeForce GTX 1650> on vgapci0
vgapci0: child nvidia0 requested pci_enable_io
vgapci0: child nvidia0 requested pci_enable_io
nvidia-modeset: Loading NVIDIA Kernel Mode Setting Driver for UNIX platforms  525.60.11  Wed Nov 23 22:41:38 UTC 2022
sysctl_warn_reuse: can't re-use a leaf (hw.dri.debug)!
[drm] [nvidia-drm] [GPU ID 0x00000a00] Loading driver
[drm] Initialized nvidia-drm 0.0.0 20160202 for nvidia0 on minor 0

# ls -l /dev/dri/
total 0
lrwxr-xr-x  1 root  wheel   8 Dec 25 20:18 card0 -> ../drm/0
lrwxr-xr-x  1 root  wheel  10 Dec 25 20:18 renderD128 -> ../drm/128

It would be nice to see a x11/nvidia-drm in the ports tree or (probably better) integrate amshafer's patches with the next nvidia driver x11/nvidia-driver-525
Comment 4 Graham Perrin freebsd_committer freebsd_triage 2023-04-23 20:17:48 UTC
(In reply to marek from comment #0)

> nvidia-driver-510.60.02

How are things with 525.105.17 (2023-03-30, ported 2023-04-21, not yet packaged) on FreeBSD 13.2-RELEASE?
Comment 5 marek 2023-08-29 20:36:26 UTC
(In reply to Graham Perrin from comment #4)

> How are things with 525.105.17 (2023-03-30, ported 2023-04-21,
> not yet packaged) on FreeBSD 13.2-RELEASE?

Tested today with graphics/nvidia-drm-kmod port and works fine on 13.2-RELEASE:

firefox-117.0_1,2
nvidia-driver-535.98_1
nvidia-drm-510-kmod-535.98
nvidia-drm-kmod-535.98
nvidia-settings-470.86_1
nvidia-xconfig-525.116.04

As this port is pretty new (added on 20 Aug 2023), we need to wait till next quarter to see this in the quarterly tree.

My suggestion is to wait with this BR till next quarter then add annotation to www/firefox to use graphics/nvidia-drm-kmod to have hardware acceleration and close this as fixed.