Closed Bug 1850696 Opened 1 year ago Closed 1 year ago

[GFX1-]: unexpected remote texture size: Size(0,0) expected: Size(630,500) WebGL

Categories

(Core :: Graphics: CanvasWebGL, defect, P3)

Firefox 117
Unspecified
Linux
defect

Tracking

()

RESOLVED DUPLICATE of bug 1851377

People

(Reporter: o2q2tcedsh0, Assigned: sotaro)

References

(Depends on 1 open bug)

Details

Attachments

(3 files)

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

Steps to reproduce:

Debian Stable Gnome Wayland - Kernel(Sid) - 6.4.0-3-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.4.11-1 (2023-08-17) x86_64 GNU/Linu

Firefox 117(unpacked to /opt) from download-installer.cdn.mozilla.net... Firefox executed native with env MOZ_ENABLE_WAYLAND=1.

Hardware: Intel i5-10400 (UHD 630)

Got to:
https://www.wetteronline.de/wettertrend/berlin?start=8

Actual results:

This often appears in the terminal.

libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_17
libva info: va_openDriver() returns 0
[GFX1-]: unexpected remote texture size: Size(0,0) expected: Size(630,500)
WebGL(0x7f718a4a5600)::LoseContext(0)

Expected results:

I think this should not appear. [GFX1-]: unexpected remote texture size: Size(0,0) expected: Size(630,500)
WebGL(0x7f718a4a5600)::LoseContext(0)

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

Component: Untriaged → Graphics
Product: Firefox → Core

Thanks for the bug report. Could you please navigate to about:support, copy the information to your clipboard then attach it to this bug?

Sotaro, any ideas what could be causing this remote texture issue?

Severity: -- → S3
Flags: needinfo?(sotaro.ikeda.g)
Flags: needinfo?(o2q2tcedsh0)
Attached file rawdata.txt
Flags: needinfo?(o2q2tcedsh0)
Attached file about:support

(In reply to Jamie Nicol [:jnicol] from comment #2)

Thanks for the bug report. Could you please navigate to about:support, copy the information to your clipboard then attach it to this bug?

Sotaro, any ideas what could be causing this remote texture issue?

It seemed to be a side effect of lose context, though it is not yet clear what caused the lose context.

(In reply to Maddi from comment #0)

libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_17
libva info: va_openDriver() returns 0

:stransky, do you have any idea about the log?

Flags: needinfo?(stransky)
OS: Unspecified → Linux

(In reply to Sotaro Ikeda [:sotaro] from comment #6)

(In reply to Maddi from comment #0)

libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_17
libva info: va_openDriver() returns 0

:stransky, do you have any idea about the log?

This is not related - should be disabled in 118 (Bug 1839615).

Flags: needinfo?(stransky)

You may run with MOZ_LOG="Dmabuf:5" env variable and see if there's any dmabuf frame buffer allocation error.

(In reply to Martin Stránský [:stransky] (ni? me) from comment #8)

You may run with MOZ_LOG="Dmabuf:5" env variable and see if there's any dmabuf frame buffer allocation error.

[Parent 8304: CanvasRenderer]: D/Dmabuf DMABufSurfaceRGBA::ImportSurfaceDescriptor() UID 2809 size 630 x 500
[Parent 8304: CanvasRenderer]: D/Dmabuf failed to get DMABuf file descriptor: Zu viele offene Dateien
[Parent 8304: CanvasRenderer]: D/Dmabuf DMABufSurfaceRGBA::ReleaseTextures() UID 2809
[Parent 8304: CanvasRenderer]: D/Dmabuf DMABufSurface::ReleaseDMABuf() UID 2809
[Child 8586: Main Thread]: D/Dmabuf DMABufDevice::IsDMABufWebGLEnabled: UseDMABuf 1 sUseWebGLDmabufBackend 1 widget_dmabuf_webgl_enabled 1
[GFX1-]: unexpected remote texture size: Size(0,0) expected: Size(630,500)
[Parent 8304: CanvasRenderer]: D/Dmabuf DMABufSurfaceRGBA::Create() UID 2811 size 630 x 500
[Parent 8304: CanvasRenderer]: D/Dmabuf Creating with modifiers
[Parent 8304: CanvasRenderer]: D/Dmabuf Success
[Parent 8304: CanvasRenderer]: D/Dmabuf DMABufSurfaceRGBA::CreateTexture() UID 2811
[Parent 8304: CanvasRenderer]: D/Dmabuf DMABufSurfaceRGBA::ReleaseTextures() UID 2807
[Parent 8304: CanvasRenderer]: D/Dmabuf DMABufSurfaceRGBA::ReleaseTextures() UID 2807
[Parent 8304: CanvasRenderer]: D/Dmabuf DMABufSurface::ReleaseDMABuf() UID 2807
[Parent 8304: CanvasRenderer]: D/Dmabuf DMABufSurfaceRGBA::Serialize() UID 2811
[Parent 8304: CanvasRenderer]: D/Dmabuf DMABufSurfaceRGBA::ImportSurfaceDescriptor() UID 2811 size 630 x 500
[Parent 8304: CanvasRenderer]: D/Dmabuf failed to get DMABuf file descriptor: Zu viele offene Dateien

Yes, so we're running out of free file descriptors.

Flags: needinfo?(stransky)

Since Firefox 118, WebGL recycles DMABUF by Bug 1848171. I wonder if it might affect to the problem.

Hi Maddi, can you check if the problem happens with Firefox 118 or Firefox nightly?

Flags: needinfo?(o2q2tcedsh0)

(In reply to Sotaro Ikeda [:sotaro] from comment #13)

Hi Maddi, can you check if the problem happens with Firefox 118 or Firefox nightly?

This also happens with Firefox 118.0b3 and Firefox nightly(firefox-119.0a1.de.linux-x86_64.tar.bz2). The tabs crashed allways after some time.
With Firefox Nightly, the entire browser crashed and Crashreporter opened and was able to send a bug report.

Firefox Nightly crashreport
https://crash-stats.mozilla.org/report/index/6b9aa9c1-1fa5-49d5-b423-4b5620230901

Firefox Beta log:
[GFX1-]: Failed to get RenderTextureHost for extId:5041
[GFX1-]: unexpected remote texture size: Size(0,0) expected: Size(630,360)
[GFX1-]: MozFramebuffer::CreateImpl(size:Size(630,500), samples:0, depthAndStencil:false, colorTarget:0xde1, colorName:0): Incomplete: 0x0

...
[Child 8328: Main Thread]: D/Dmabuf DMABufDevice::IsDMABufWebGLEnabled: UseDMABuf 1 sUseWebGLDmabufBackend 1 widget_dmabuf_webgl_enabled 1
[Parent 7920: CanvasRenderer]: D/Dmabuf DMABufSurfaceRGBA::Create() UID 6099 size 630 x 500
[Parent 7920: CanvasRenderer]: D/Dmabuf Creating with modifiers
[Parent 7920: CanvasRenderer]: D/Dmabuf Success
[Parent 7920: CanvasRenderer]: D/Dmabuf DMABufSurfaceRGBA::CreateTexture() UID 6099
[Parent 7920: CanvasRenderer]: D/Dmabuf DMABufSurfaceRGBA::Serialize() UID 6099
[Parent 7920: CanvasRenderer]: D/Dmabuf DMABufSurfaceRGBA::ImportSurfaceDescriptor() UID 6099 size 630 x 500
[Parent 7920: CanvasRenderer]: D/Dmabuf failed to get DMABuf file descriptor: Zu viele offene Dateien
[Parent 7920: CanvasRenderer]: D/Dmabuf DMABufSurfaceRGBA::ReleaseTextures() UID 6099
[Parent 7920: CanvasRenderer]: D/Dmabuf DMABufSurface::ReleaseDMABuf() UID 6099
[Child 8478: Main Thread]: D/Dmabuf DMABufDevice::IsDMABufWebGLEnabled: UseDMABuf 1 sUseWebGLDmabufBackend 1 widget_dmabuf_webgl_enabled 1
[Parent 7920: CanvasRenderer]: D/Dmabuf DMABufSurfaceRGBA::Serialize() UID 2281
[Child 8328: Main Thread]: D/Dmabuf DMABufDevice::IsDMABufWebGLEnabled: UseDMABuf 1 sUseWebGLDmabufBackend 1 widget_dmabuf_webgl_enabled 1
[Parent 7920: CanvasRenderer]: D/Dmabuf DMABufSurfaceRGBA::Create() UID 6101 size 630 x 500
[Parent 7920: CanvasRenderer]: D/Dmabuf Creating with modifiers
[Parent 7920: CanvasRenderer]: D/Dmabuf Success
[Parent 7920: CanvasRenderer]: D/Dmabuf DMABufSurfaceRGBA::CreateTexture() UID 6101
[Parent 7920: CanvasRenderer]: D/Dmabuf DMABufSurfaceRGBA::Serialize() UID 6101
[Child 8478: Main Thread]: D/Dmabuf DMABufDevice::IsDMABufWebGLEnabled: UseDMABuf 1 sUseWebGLDmabufBackend 1 widget_dmabuf_webgl_enabled 1
[Child 8328: Main Thread]: D/Dmabuf DMABufDevice::IsDMABufWebGLEnabled: UseDMABuf 1 sUseWebGLDmabufBackend 1 widget_dmabuf_webgl_enabled 1
[Parent 7920, IPC I/O Parent] WARNING: Message needs unreceived descriptors channel:7f24d2e4bce0 message-type:11665413 header()->num_handles:1 num_fds:0 fds_i:0: file /builds/worker/checkouts/gecko/ipc/chromium/src/chrome/common/ipc_channel_posix.cc:467
Exiting due to channel error.
[Parent 7920: CanvasRenderer]: D/Dmabuf DMABufSurfaceRGBA::Create() UID 6102 size 630 x 360
[Parent 7920: CanvasRenderer]: D/Dmabuf Creating with modifiers
[Parent 7920: CanvasRenderer]: D/Dmabuf Success
[Parent 7920: CanvasRenderer]: D/Dmabuf DMABufSurfaceRGBA::CreateTexture() UID 6102
[Parent 7920: CanvasRenderer]: D/Dmabuf DMABufSurfaceRGBA::Serialize() UID 6102
[Parent 7920: CanvasRenderer]: D/Dmabuf DMABufSurfaceRGBA::ImportSurfaceDescriptor() UID 6102 size 630 x 360
[Parent 7920: CanvasRenderer]: D/Dmabuf failed to get DMABuf file descriptor: Zu viele offene Dateien
[Parent 7920: CanvasRenderer]: D/Dmabuf DMABufSurfaceRGBA::ReleaseTextures() UID 6102

Flags: needinfo?(o2q2tcedsh0)

With Firefox 117 Snap in Ubuntu 23.04 the memory goes from 1.5GB up to 10.5GB. Mit Fedora 38 und Firefox 117 steigt die CPU-Auslastung auf 98%. Only on this website.

Maddi, can you try to set widget.dmabuf-webgl.enabled to false at about:config, restart browser and try again?
Thanks.

Flags: needinfo?(stransky) → needinfo?(o2q2tcedsh0)

With Firefox 117 Snap in Ubuntu everything is okay. No more high memory consumption with these parameters(widget.dmabuf-webgl.enabled).

In Debian Stable with Firefox 117 in /opt now all work fine. No mor crash anymore.

Firefox 117 from Fedora Repo seem now okay with these parameters.

I must correct my statement above. In Fedora Firefox 117 Flatpak has big CPU usage(98%). Mabye it is an other problem, but just only on this website.
Log:
[Parent 2: Main Thread]: D/Dmabuf DMABufDevice::Configure()
[Parent 2: Main Thread]: D/Dmabuf Loading DMABuf system library libgbm.so.1 ...
[Parent 2: Main Thread]: D/Dmabuf We're missing DRM render device!
libEGL warning: wayland-egl: could not open /dev/dri/renderD128 (Datei oder Verzeichnis nicht gefunden)
libEGL warning: failed to get driver name for fd 0

libEGL warning: MESA-LOADER: failed to retrieve device information

libEGL warning: failed to get driver name for fd 0

Flags: needinfo?(o2q2tcedsh0)

Thanks, looks like the issue is caused by dmabuf buffers for WebGL which are not released (or some part of them) so we're running out of free file descriptors. I can reproduce that on https://www.wetteronline.de/wettertrend/berlin?start=8 too with 117.0.

Will try to look at it.

Flags: needinfo?(stransky)
Component: Graphics → Widget: Gtk
Priority: -- → P3

This is not related to the particular site only. I can clearly reproduce it with WebGL samples. There are such logs:

[Parent 62420: CanvasRenderer]: D/Dmabuf     failed to get GL fence file descriptor: Too many open files
[Parent 62420: CanvasRenderer]: D/Dmabuf     failed to get DMABuf file descriptor: Too many open files

Reproduction steps:

  1. Go to https://webglsamples.org/
  2. Open all samples together, one per tab
  3. cycle between opened samples by CTRL+PgUp/Down
  4. see page crashes (I see even whole browser crashes)

It's easier to reproduce on 144Hz monitor but I can reproduce it on 60Hz too but it takes more time. Looks like we keep the WebGL back buffers too long so frame descriptors are really exhausted. When Firefox is closed after reproduction steps from comment 20 I see lots of dmabuf buffer release.

As the dmabuf is allocated directly at GPU there's limited amount of GPU memory available. We may provide a fallback if dmabuf is exhausted.

:stransky, thank you for the information! It helps a lot!

Flags: needinfo?(sotaro.ikeda.g)
Assignee: nobody → sotaro.ikeda.g

I did more testing and it looks like a bug in WebGL code. If 1-2 tabs with WebGL samples are opened, 10 dmabuf buffers per tab is used. If another one is opened (say 3-4), dmabuf buffer num rises suddenly to 200 and for more tabs is 700-800. I'll investigate it today.

I use this command to list open dmabuf file descriptors:

lsof -a -p webgl_process_PID | grep "dmabuf" | wc

Okay, may found what's going on. Looks like if we hide a page with WebGL content, we still generate WebGL frames for some time but they're not processed yet. So all dmabuf buffers are hold in queue and block file descriptors infinitely as the generated queue is not released.

While plain WebGL sample uses 10 dmabuf frames for rendering as framebuffers, if it's switched from it number of dmabuf buffer is ~ 80 and it's kept until the page is shown again or closed.

So we need to release rendered frames if we don't paint them.

Moving pack to gfx and there's nothing to do n dmabuf/linux side.

Reproduction steps:

  1. open https://webglsamples.org/
  2. open aquarium test in another tab
  3. check number of opened dmabuf buffers by
lsof -a -p firefox_parent_PID | grep "dmabuf" | wc

you may see ~10 buffers used

  1. switch page back to https://webglsamples.org/, check number of buffers. You may see ~ 80 buffers opened.
Component: Widget: Gtk → Graphics: CanvasWebGL
Flags: needinfo?(stransky)

The problem might be related to Bug 1851377.

Will check that.

Flags: needinfo?(stransky)

Yes, it's solved now!

Status: UNCONFIRMED → RESOLVED
Closed: 1 year ago
Duplicate of bug: 1851377
Flags: needinfo?(stransky)
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: