https://bugs.kde.org/show_bug.cgi?id=518008
Bug ID: 518008
Summary: Spectacle/KPipeWire on hybrid AMD+NVIDIA systems can
select the wrong recording device, crashing MP4/H.264
and producing invalid WebM/VP9 files
Classification: Frameworks and Libraries
Product: KPipeWire
Version First 6.6.3
Reported In:
Platform: NixOS
OS: Linux
Status: REPORTED
Severity: crash
Priority: NOR
Component: general
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Target Milestone: ---
SUMMARY
On my hybrid AMD+NVIDIA laptop, Spectacle/KPipeWire recording on Wayland could
choose the wrong GPU/render device for the recording pipeline.
Before a local fix, KPipeWire selected AMD VAAPI on /dev/dri/renderD129 even
though the active session/compositor was on NVIDIA. In that state:
- MP4/H.264 recording crashed Spectacle
- WebM/VP9 recording produced an invalid/corrupt file
This appears to be caused by KPipeWire inferring GPU/render devices
independently in multiple places instead of resolving the current session
render node once and using it consistently.
STEPS TO REPRODUCE
1. Use a hybrid AMD+NVIDIA laptop on Plasma Wayland, where the
compositor/session is running on the NVIDIA dGPU and multiple render nodes
exist.
2. Start a screen recording in Spectacle.
3. Record with MP4/H.264 or WebM/VP9 and stop the recording.
OBSERVED RESULT
KPipeWire selected AMD VAAPI for recording on this hybrid system:
kpipewire_vaapi_logging: VAAPI: Mesa Gallium driver 26.0.2 for AMD Radeon
Graphics (radeonsi, renoir, ACO, DRM 3.64, 6.19.8) in use for device
"/dev/dri/renderD129"
With MP4/H.264, Spectacle crashed. Relevant stack frames:
Program terminated with signal SIGSEGV, Segmentation fault.
#4 ff_hw_base_encode_receive_packet
#6 avcodec_send_frame
#7 Encoder::finish() from libKPipeWireRecord.so.6
#8 PipeWireProduce::stateChanged(pw_stream_state) from libKPipeWireRecord.so.6
With WebM/VP9, the output file was invalid/corrupt. Relevant errors:
[matroska,webm @ ...] Duplicate element
[matroska,webm @ ...] 0x00 at pos 100 (0x64) invalid as first byte of an EBML
number
[matroska,webm @ ...] Duplicate element
[matroska,webm @ ...] 0x00 at pos 167 (0xa7) invalid as first byte of an EBML
number
[matroska,webm @ ...] Element at 0x5d ending at 0x1aec0100000066 exceeds
containing master element ending at 0x1409
qt.multimedia.ffmpeg.mediadataholder: Could not open media. FFmpeg error
description: End of file
EXPECTED RESULT
KPipeWire should resolve the current session render node once and use that same
GPU consistently for:
- VAAPI device selection
- DMA-BUF import
- stream modifier negotiation
Recording should not crash for MP4/H.264 and should not produce invalid
WebM/VP9 files.
SOFTWARE/OS VERSIONS
Operating System: NixOS Unstable channel
KDE Plasma Version: 6.6.3
KDE Frameworks Version: 6.24.0
Qt Version: 6.10.2
Kernel Version: 6.19.8 (64-bit)
Graphics Platform: Wayland
Processors: 12 × AMD Ryzen 5 4600H with Radeon Graphics
Memory: 40 GiB of RAM (38.6 GiB usable)
Graphics Processor 1: NVIDIA GeForce GTX 1650
Graphics Processor 2: AMD Radeon Graphics
ADDITIONAL INFORMATION
I tested a local fix that introduces a shared session render-node resolver and
uses it consistently across:
- vaapiutils.cpp
- dmabufhandler.cpp
- pipewiresourcestream.cpp
With that patch:
- the recording pipeline uses the session render node instead of a foreign GPU
- MP4/H.264 no longer crashes
- WebM/VP9 produces a valid file
The patch will be in the MR
--
You are receiving this mail because:
You are watching all bug changes.