Closed Bug 1967366 Opened 1 year ago Closed 1 year ago

[KDE] Firefox crashes during playback of HDR video with gfx.wayland.hdr enabled - invalid dmabuf modifiers

Categories

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

defect

Tracking

()

RESOLVED FIXED
141 Branch
Tracking Status
firefox141 --- fixed

People

(Reporter: anton, Assigned: stransky)

References

(Blocks 1 open bug)

Details

Attachments

(8 files, 1 external file, 1 obsolete file)

Enable HDR in KDE
Set gfx.wayland.hdr to True
Open a mp4 video file with HDR (colormatrix bt.2020-ncl). A local file from disk (file:///home/test.mp4)
Firefox crashes

Crash report: https://crash-stats.mozilla.org/report/index/2e28c859-4048-4cae-95a7-d8cd30250520

MOZ_CRASH Reason:

(kde) zwp_linux_buffer_params_v1#86: error 7: importing the supplied dmabufs failed
 Proxy: WP:E WP:CA WP:CPCA

Top 10 frames:

0  libxul.so  MOZ_CrashSequence(void*, long)  mfbt/Assertions.h:248
0  libxul.so  MOZ_Crash(char const*, int, char const*)  mfbt/Assertions.h:381
0  libxul.so  mozilla::widget::WlLogHandler(char const*, __va_list_tag*)  widget/gtk/nsWaylandDisplay.cpp:634
1  libwayland-client.so.0  wl_log  /usr/src/debug/wayland-1.23.1-1.fc42.x86_64/src/wayland-util.c:463
2  libwayland-client.so.0  display_handle_error  /usr/src/debug/wayland-1.23.1-1.fc42.x86_64/src/wayland-client.c:1091
3  libffi.so.8  ffi_call_unix64  /usr/src/debug/libffi-3.4.6-5.fc42.x86_64/src/x86/unix64.S:104
4  libffi.so.8  ffi_call_int  /usr/src/debug/libffi-3.4.6-5.fc42.x86_64/src/x86/ffi64.c:673
5  libffi.so.8  ffi_call  /usr/src/debug/libffi-3.4.6-5.fc42.x86_64/src/x86/ffi64.c:710
6  libwayland-client.so.0  wl_closure_invoke  /usr/src/debug/wayland-1.23.1-1.fc42.x86_64/src/connection.c:1228
7  libwayland-client.so.0  dispatch_event  /usr/src/debug/wayland-1.23.1-1.fc42.x86_64/src/wayland-client.c:1674
Summary: Firefox crashes with gfx.wayland.hdr during playback of HDR video → Firefox crashes during playback of HDR video with gfx.wayland.hdr enabled

Moving this bug to a component that I believe is a better fit. If this isn’t the right place, please feel free to move it to a more appropriate one.
Thanks!

Component: General → Widget: Gtk
Product: Firefox → Core

Please run latest nightly with MOZ_LOG="Dmabuf:5" env variable on terminal and attach the log here.
https://fedoraproject.org/wiki/How_to_debug_Firefox_problems#Testing_Mozilla_Nightly_binaries
Thanks.

Flags: needinfo?(anton)
Attached file firefox.log.txt —
Flags: needinfo?(anton)

I should mention that I always use nightly
Name Firefox
Version 140.0a1
Build ID 20250522090848

Please share the test video so I can reproduce it.
Thanks.

Attached video hdr.mp4 —

Just checked if it crashes with http url
MOZ_LOG="Dmabuf:5" firefox --profile /home/a/.mozilla/firefox/d1q2wc6n.TEST https://bugzilla.mozilla.org/attachment.cgi?id=9490324
Seems the same crash

Please attach your about:support page.
Thanks.

Flags: needinfo?(anton)
Attached file support.txt —
Flags: needinfo?(anton)
Attached file backtrace (obsolete) —
Attached file firefox-gdb-bt.txt —
Attachment #9493433 - Attachment is obsolete: true

Thanks, there's related part of the log:

[1011148.810] {Default Queue}  -> zwp_linux_dmabuf_v1#48.create_params(new id zwp_linux_buffer_params_v1#80)
[Parent 31445: Renderer]: D/Dmabuf [7fffb337f4c0]:   layer [0] modifier ffffffffffffff
[1011148.835] {Default Queue}  -> zwp_linux_buffer_params_v1#80.add(fd 399, 0, 0, 4096, 16777215, 4294967295)
[Parent 31445: Renderer]: D/Dmabuf [7fffb337f4c0]:   layer [1] modifier ffffffffffffff
[1011148.856] {Default Queue}  -> zwp_linux_buffer_params_v1#80.add(fd 400, 1, 0, 4096, 16777215, 4294967295)
[Parent 31445: Renderer]: D/Dmabuf [7fffb337f4c0]:   zwp_linux_buffer_params_v1_create_immed() [1920 x 1080], fourcc [30313050]
[1011148.878] {Default Queue}  -> zwp_linux_buffer_params_v1#80.create_immed(new id wl_buffer#69, 1920, 1080, 808530000, 0)
[Parent 31445: Renderer]: D/Dmabuf [7fffb337f4c0]:   created wl_buffer [7fffa6b94940]

[1034913.188] {Display Queue} wl_display#1.error(zwp_linux_buffer_params_v1#80, 7, "importing the supplied dmabufs failed")
[GFX1-]: (kde) Wayland protocol error: zwp_linux_buffer_params_v1#80: error 7: importing the supplied dmabufs failed

So looks like KDE doesn't like the invalid modifier here.

Does it crash immediately or do yo use any video frames before crash?
Thanks.

Flags: needinfo?(anton)
Priority: -- → P3
Summary: Firefox crashes during playback of HDR video with gfx.wayland.hdr enabled → [KDE] Firefox crashes during playback of HDR video with gfx.wayland.hdr enabled - invalid dmabuf modifiers

This looks related:

/**
 * @ingroup iface_zwp_linux_buffer_params_v1
 *
 * This request adds one dmabuf to the set in this
 * zwp_linux_buffer_params_v1.
 *
 * The 64-bit unsigned value combined from modifier_hi and modifier_lo
 * is the dmabuf layout modifier. DRM AddFB2 ioctl calls this the
 * fb modifier, which is defined in drm_mode.h of Linux UAPI.
 * This is an opaque token. Drivers use this token to express tiling,
 * compression, etc. driver-specific modifications to the base format
 * defined by the DRM fourcc code.
 *
 * Starting from version 4, the invalid_format protocol error is sent if
 * the format + modifier pair was not advertised as supported.
 *
 * Starting from version 5, the invalid_format protocol error is sent if
 * all planes don't use the same modifier.
 *
 * This request raises the PLANE_IDX error if plane_idx is too large.
 * The error PLANE_SET is raised if attempting to set a plane that
 * was already set.
 */

so perhaps we need to use advertised modifiers only.

Yes, I see it now. Your system is missing support for DRM 30313050 format ( VA_FOURCC_P010) so it can't be composited and it's not HDR capable.

Flags: needinfo?(anton)

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

Yes, I see it now. Your system is missing support for DRM 30313050 format ( VA_FOURCC_P010) so it can't be composited and it's not HDR capable.

What do you mean " it's not HDR capable."?
In windows (dualboot) it plays HDR content on youtube...
In KDE display (itself by OSD) reports HDR...

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

Does it crash immediately or do yo use any video frames before crash?
Thanks.

When debugged I only saw loading video screen placeholder (rotating circle) then it crashes

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

Yes, I see it now. Your system is missing support for DRM 30313050 format ( VA_FOURCC_P010) so it can't be composited and it's not HDR capable.

Just retested on dGPU (AMD rx560, same monitor but HDMI output, KDE HDR is On) - it still crashes

Firefox log on AMD HDMI with export KWIN_DRM_DEVICES=/dev/dri/card1 plasmashell --replace

Assignee: nobody → stransky
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true

iface_zwp_linux_buffer_params_v1 extension doesn't advertise dmabuf YUV P010 format used for HDR rendering so we see the crash here. If you believe it's a bug you need to report it at KDE bug tracker / KWin component. From application perspective HDR is not supported. You can also try MPV in HDR mode to test it.

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

iface_zwp_linux_buffer_params_v1 extension doesn't advertise dmabuf YUV P010 format used for HDR rendering so we see the crash here. If you believe it's a bug you need to report it at KDE bug tracker / KWin component. From application perspective HDR is not supported. You can also try MPV in HDR mode to test it.

Just tested with Gnome OS nightly with HDR enabled
firefox plays video without issues

Attached file firefox-gnome.log —

It works with neon-unstable-developer-20250609-0038.iso and current nightly

Pushed by stransky@redhat.com: https://github.com/mozilla-firefox/firefox/commit/6a6c58d13bab https://hg.mozilla.org/integration/autoland/rev/9422332054cd [Wayland] Disable direct HDR rendering if Wayland compositor is missing support for YUV formats r=emilio
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 141 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: