Bug 505468

Summary: Issue: Firefox Crashes When Playing HDR Video with Wayland HDR Enabled on KDE: "importing the supplied dmabufs failed"
Product: [Plasma] kwin Reporter: Anton Valishin <anton>
Component: generic-crashAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: kdedev
Priority: NOR    
Version First Reported In: 6.3.5   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
URL: https://bugzilla.mozilla.org/show_bug.cgi?id=1967366
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: backtrace
test video file (hdr)

Description Anton Valishin 2025-06-11 10:30:21 UTC
When using Firefox on KDE Plasma with gfx.wayland.hdr enabled, attempting to play HDR video content causes Firefox to crash. The crash occurs because KDE's Wayland compositor doesn't properly support the YUV format (specifically P010) needed for HDR video rendering.
Technical Details

    The crash happens immediately when trying to play HDR video content
    Firefox attempts to use dmabuf with YUV P010 format (fourcc 30313050) for HDR rendering
    KDE's Wayland compositor rejects the buffer with error: "importing the supplied dmabufs failed"
    The specific error occurs with zwp_linux_buffer_params_v1 when Firefox tries to create a buffer with an unsupported format/modifier combination

Error Message

wl_display#1.error(zwp_linux_buffer_params_v1#80, 7, "importing the supplied dmabufs failed")

Reproduction Steps

    Enable gfx.wayland.hdr in Firefox
    Open an HDR video file (or HDR content from a website)
    Firefox crashes during video initialization

From mozilla
```
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.
```



Related 
https://bugzilla.mozilla.org/show_bug.cgi?id=1967366

Operating System: Fedora Linux 42
KDE Plasma Version: 6.3.5
KDE Frameworks Version: 6.14.0
Qt Version: 6.9.1
Kernel Version: 6.14.9-300.fc42.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 32 × 13th Gen Intel® Core™ i9-13900K
Memory: 94,0 GiB of RAM
Graphics Processor 1: Intel® Graphics
Graphics Processor 2: AMD Radeon RX 560 Series
Manufacturer: ASUS
Comment 1 Anton Valishin 2025-06-11 12:18:38 UTC
Side note...
Firefox plays video in HDR mode in Gnome OS Nightly (with HDR and  `gfx.wayland.hdr`  enabled) without issues and crashes
Comment 2 TraceyC 2025-06-11 22:14:22 UTC
As the message at the top of the summary says, if something crashed, we need a backtrace of it so we can figure out what's going on. Can you please attach a backtrace of the crash using the coredumpctl command-line program, as detailed in https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports#Retrieving_a_backtrace_using_coredumpctl ?

Thanks.
Comment 3 Anton Valishin 2025-06-11 22:17:51 UTC
Created attachment 182201 [details]
backtrace

[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
Comment 4 Anton Valishin 2025-06-11 22:18:48 UTC
Created attachment 182202 [details]
test video file (hdr)
Comment 5 TraceyC 2025-06-13 14:31:53 UTC
Searchable backtrace

Thread 33 "Renderer" hit Breakpoint 2, 0x00007fffefd41734 in DMABufSurfaceRGBA::CreateWlBuffer() ()
   from /var/home/a/.local/firefox/libxul.so
(gdb) backtrace full
#0  0x00007fffefd41734 in DMABufSurfaceRGBA::CreateWlBuffer() () from /var/home/a/.local/firefox/libxul.so
No symbol table info available.
#1  0x00007fffefd5b99b in mozilla::widget::WaylandBufferDMABUF::CreateWlBuffer() () from /var/home/a/.local/firefox/libxul.so
No symbol table info available.
#2  0x00007fffefd59db3 in mozilla::widget::WaylandBuffer::BorrowBuffer(mozilla::widget::WaylandSurfaceLock&) ()
   from /var/home/a/.local/firefox/libxul.so
No symbol table info available.
#3  0x00007fffefd60a60 in mozilla::widget::WaylandSurface::AttachLocked(mozilla::widget::WaylandSurfaceLock&, RefPtr<mozilla::widget::WaylandBuffer>) () from /var/home/a/.local/firefox/libxul.so
No symbol table info available.
#4  0x00007fffee08b253 in mozilla::layers::NativeLayerWaylandRender::CommitSurfaceToScreenLocked(mozilla::detail::BaseAutoLock<mozilla::Mutex&> const&, mozilla::widget::WaylandSurfaceLock&) () from /var/home/a/.local/firefox/libxul.so
No symbol table info available.
#5  0x00007fffee0882ec in mozilla::layers::NativeLayerWayland::UpdateLayer(double) () from /var/home/a/.local/firefox/libxul.so
No symbol table info available.
#6  0x00007fffee08795b in mozilla::layers::NativeLayerRootWayland::UpdateLayersLocked(mozilla::detail::BaseAutoLock<mozilla::Mutex&> const&) () from /var/home/a/.local/firefox/libxul.so
No symbol table info available.
#7  0x00007fffee08728d in mozilla::layers::NativeLayerRootWayland::CommitToScreenLocked(mozilla::detail::BaseAutoLock<mozilla::Mutex&> const&) () from /var/home/a/.local/firefox/libxul.so
No symbol table info available.
#8  0x00007fffee086ece in mozilla::layers::NativeLayerRootWayland::CommitToScreen() () from /var/home/a/.local/firefox/libxul.so
No symbol table info available.
#9  0x00007fffee2641ab in mozilla::wr::RenderCompositorNative::CompositorEndFrame() () from /var/home/a/.local/firefox/libxul.so
No symbol table info available.
#10 0x00007fffebc055e4 in webrender::renderer::Renderer::render_impl () from /var/home/a/.local/firefox/libxul.so
No symbol table info available.
#11 0x00007fffebaab723 in webrender::renderer::Renderer::render () from /var/home/a/.local/firefox/libxul.so
No symbol table info available.
#12 0x00007fffebaaaeff in wr_renderer_render () from /var/home/a/.local/firefox/libxul.so
No symbol table info available.
#13 0x00007fffebaa45fe in mozilla::wr::RenderThread::UpdateAndRender(mozilla::wr::WrWindowId, mozilla::layers::BaseTransactionId<mozilla::VsyncIdType> const&, mozilla::TimeStamp const&, mozilla::wr::FrameReadyParams const&, mozilla::Maybe<mozilla::gfx::IntSizeTyped<mozilla::gfx::UnknownUnits> > const&, mozilla::Maybe<mozilla::wr::ImageFormat> const&, mozilla::Maybe<mozilla::Range<unsigned char> >--Type <RET> for more, q to quit, c to continue without paging--
 const&, mozilla::wr::RendererStats*, bool*) () from /var/home/a/.local/firefox/libxul.so
No symbol table info available.
#14 0x00007fffeb65409f in mozilla::wr::RenderThread::HandleFrameOneDocInner(mozilla::wr::WrWindowId, mozilla::wr::FrameReadyParams const&, bool, mozilla::Maybe<mozilla::wr::FramePublishId>) () from /var/home/a/.local/firefox/libxul.so
No symbol table info available.
#15 0x00007fffeb653a64 in mozilla::wr::RenderThread::HandleWrNotifierEvents(mozilla::wr::WrWindowId) ()
   from /var/home/a/.local/firefox/libxul.so
No symbol table info available.
#16 0x00007fffeb653883 in mozilla::detail::RunnableMethodImpl<mozilla::storage::AsyncExecuteStatements*, nsresult (mozilla::storage::AsyncExecuteStatements::*)(mozilla::storage::ResultSet*), true, (mozilla::RunnableKind)0, RefPtr<mozilla::storage::ResultSet> >::Run() () from /var/home/a/.local/firefox/libxul.so
No symbol table info available.
#17 0x00007fffeb382b7a in NS_ProcessNextEvent(nsIThread*, bool) () from /var/home/a/.local/firefox/libxul.so
No symbol table info available.
#18 0x00007fffeb381515 in mozilla::ipc::MessagePumpForNonMainThreads::Run(base::MessagePump::Delegate*) ()
   from /var/home/a/.local/firefox/libxul.so
No symbol table info available.
#19 0x00007fffeca3bcea in nsThread::ThreadFunc(void*) () from /var/home/a/.local/firefox/libxul.so
No symbol table info available.
#20 0x00007ffff56e29c1 in _pt_root () from /var/home/a/.local/firefox/libnspr4.so
No symbol table info available.
#21 0x00005555555cb5ab in set_alt_signal_stack_and_start(PthreadCreateParams*) ()
No symbol table info available.
#22 0x00007ffff7a911d4 in start_thread (arg=<optimized out>) at pthread_create.c:448
        ret = <optimized out>
        pd = <optimized out>
        out = <optimized out>
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {140736451692224, 110070390904742784, 140736451692224, 140737488331056, 11, 
                140737488331319, 110070390929908608, 110170337441768320}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, 
            data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
        not_first_call = <optimized out>
#23 0x00007ffff7b13cec in __GI___clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
No locals.
(gdb) c
Continuing.

Thread 1 "firefox-bin" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff7a1b7c0 (LWP 31445)]
0x00007fffefd8dd39 in mozilla::widget::WlLogHandler(char const*, __va_list_tag*) () from /var/home/a/.local/firefox/libxul.so
(gdb)
Comment 6 TraceyC 2025-06-13 15:32:50 UTC
Thanks for the backtrace and example video.

I'm not able to reproduce this on git-master, KDE Neon Testing or Fedora 42 using the testing steps, the attached video and a Firefox profile with no addons

Do you have any other system settings that might be relevant?
Comment 7 Anton Valishin 2025-06-13 16:02:01 UTC
(In reply to TraceyC from comment #6)
> Thanks for the backtrace and example video.
> 
> I'm not able to reproduce this on git-master, KDE Neon Testing or Fedora 42
> using the testing steps, the attached video and a Firefox profile with no
> addons
> 
> Do you have any other system settings that might be relevant?

Firefox 
Version 	141.0a1 (nightly) 
Build ID 	20250613093648 (up to date)

You need to set 
        gfx.wayland.hdr=enabled
 in Firefox about:config. 

And you have to run it with HDR mode enabled

From the issue on Mozilla's bug tracker
> From Firefox perspective HDR is not enabled (missing support for DRM 30313050 format ( VA_FOURCC_P010))
It still crashes, although there is a patch for 
       Disable direct HDR rendering if Wayland compositor is missing support for YUV formats
       https://phabricator.services.mozilla.com/D253312
Maybe it did not land to nightly yet...

So... I've filed the bug that KWin is missing support of HDR formats and modifiers from Firefox's view when HDR is enabled
>  iface_zwp_linux_buffer_params_v1 extension doesn't advertise dmabuf YUV P010 format used for HDR rendering

Thank you
Comment 8 TraceyC 2025-06-13 20:45:51 UTC
Thanks for the additional information. I'll let the kwin maintainers take it from here.
Comment 9 Anton Valishin 2025-06-18 13:48:50 UTC
It works with neon-unstable-developer-20250609-0038.iso