Arch Linux

Please read this before reporting a bug:

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!

FS#72241 - [libva-vdpau-driver] Crashes firefox - patch needed

Attached to Project: Arch Linux
Opened by Marcin Rze┼║nicki (mrzeznicki) - Sunday, 26 September 2021, 09:49 GMT
Last edited by Jan Alexander Steffens (heftig) - Wednesday, 29 September 2021, 07:14 GMT
Task Type Bug Report
Category Packages: Extra
Status Assigned   Reopened
Assigned To Maxime Gauduin (Alucryd)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No



The current version will crash Firefox tab if used to provide HW video acceleration as described in
The reason for this is described here: One of the libva-vdpau-driver clones was patched specifically to prevent this: I believe this patch needs to be ported to the package

Additional info:
* package version(s)
* config and/or log files etc.
* link to upstream bug report, if any

Steps to reproduce:
1. Configure VA-API to use libva-vdpau-driver
2. Enable HW acceleration in Firefox
3. Visit Netflix
4. Examine the coredump produced by the crashing tab
Program terminated with signal SIGSEGV, Segmentation fault.
Stack trace of thread 8671:
#0 0x00007f38465ff090 XDisplayString ( + 0x2f090)
#1 0x00007f382efd6c07 __vaDriverInit_1_10 ( + 0x6c07)
#2 0x00007f3827041c7f n/a ( + 0x3c7f)
#3 0x00007f382704783a vaInitialize ( + 0x983a)
#4 0x00007f3840bf0b59 n/a ( + 0x674db59)
#5 0x00007f3840bf0e72 n/a ( + 0x674de72)
#6 0x00007f3840bf14a6 n/a ( + 0x674e4a6)
#7 0x00007f3840bc76d8 n/a ( + 0x67246d8)
#8 0x00007f383f363375 n/a ( + 0x4ec0375)
#9 0x00007f383edfade8 n/a ( + 0x4957de8)
#10 0x00007f383e55fbdf n/a ( + 0x40bcbdf)
#11 0x00007f383dfcf0a5 n/a ( + 0x3b2c0a5)
#12 0x00007f383e541b7b n/a ( + 0x409eb7b)
#13 0x00007f383ee81d8d n/a ( + 0x49ded8d)
#14 0x00007f383ee8188c n/a ( + 0x49de88c)
#15 0x00007f38483e7008 n/a ( + 0x2b008)
#16 0x00007f3848952259 start_thread ( + 0x9259)
#17 0x00007f38484fd5e3 __clone ( + 0xfe5e3)
This task depends upon

Comment by Jan Alexander Steffens (heftig) - Wednesday, 29 September 2021, 07:10 GMT
HW video acceleration is not a supported Firefox feature and no patches will be added for it.
Comment by Jan Alexander Steffens (heftig) - Wednesday, 29 September 2021, 07:13 GMT
Sorry, I thought this was a patch to Firefox. libva-vdpau-driver is not my package.
Comment by Arzet Ro (arzeth) - Wednesday, 03 November 2021, 07:33 GMT
NVIDIA 495.47, i3 WM, X11, [testing].
The same backtrace is with mpv --hwdec=vaapi-copy (--hwdec=vaapi silently fails for some reason, so mpv fallbacks to software decoding).

mpv's bt:

0x00007ffff4b60090 in XDisplayString () from /usr/lib/
(gdb) bt
#0 0x00007ffff4b60090 in XDisplayString () at /usr/lib/
#1 0x00007fffe000d7b5 in vdpau_common_Initialize (driver_data=0x5555558d5cc0) at vdpau_driver.c:188
#2 vdpau_Initialize_Current (ctx=0x5555558d4bd0) at /usr/src/debug/libva-vdpau-driver-0.7.4/src/vdpau_driver_template.h:561
#3 __vaDriverInit_1_13 (ctx=0x5555558d4bd0) at vdpau_driver.c:317
#4 0x00007ffff4eb3c7f in () at /usr/lib/
#5 0x00007ffff4eb983a in vaInitialize () at /usr/lib/

Also /usr/lib/gstreamer-1.0/ (used by wine) has been segfaulting for >5 months.

If I add a check
if (!driver_data->x11_dpy) {
/* vaGetDisplayDRM() doesn't fill ->x11_dpy */
then SIGFPE:
#0 0x00007fffe000a556 in object_heap_destroy (heap=heap@entry=0x5555558d5a40) at object_heap.c:275
#1 0x00007fffe000d34e in destroy_heap (destroy_func=0x7fffe000d2a0 <destroy_buffer_cb>, user_data=0x5555558d58f0, heap=0x5555558d5a40, name=0x7fffe001b1c0 "buffer") at vdpau_driver.c:138
#2 destroy_heap (user_data=0x5555558d58f0, destroy_func=0x7fffe000d2a0 <destroy_buffer_cb>, heap=0x5555558d5a40, name=0x7fffe001b1c0 "buffer") at vdpau_driver.c:116
#3 vdpau_common_Terminate (driver_data=0x5555558d58f0) at vdpau_driver.c:159
#4 vdpau_Terminate_Current (ctx=ctx@entry=0x5555558d4800) at /usr/src/debug/libva-vdpau-driver-0.7.4/src/vdpau_driver_template.h:537
#5 0x00007fffe000d9ce in vdpau_Initialize_Current (ctx=0x5555558d4800) at /usr/src/debug/libva-vdpau-driver-0.7.4/src/vdpau_driver_template.h:563
#6 __vaDriverInit_1_13 (ctx=0x5555558d4800) at vdpau_driver.c:319
#7 0x00007ffff4eb3c7f in () at /usr/lib/
#8 0x00007ffff4eb983a in vaInitialize () at /usr/lib/

So I also added one line: if (heap->heap_increment)
before for (i = 0; i < heap->heap_size / heap->heap_increment; i++) {
into src/object_heap.c

With this two fixes, mpv doesn't segfault and tabs in Firefox no longer crash when both media.ffmpeg.vaapi.enabled and media.ffmpeg.vaapi-drm-display.enabled are true.
Instead they just fallback to something else (SW, etc.).