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 Buggy McBugFace (bugbot) - Saturday, 25 November 2023, 20:16 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Maxime Gauduin (Alucryd)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:

The current version will crash Firefox tab if used to provide HW video acceleration as described in https://wiki.archlinux.org/title/Firefox#Hardware_video_acceleration
The reason for this is described here: https://bugzilla.mozilla.org/show_bug.cgi?id=1693073#c17. One of the libva-vdpau-driver clones was patched specifically to prevent this: https://github.com/xtknight/vdpau-va-driver-vp9/pull/14 I believe this patch needs to be ported to the package

Additional info:
* package version(s)
0.7.4-5
* config and/or log files etc.
* link to upstream bug report, if any
https://bugzilla.mozilla.org/show_bug.cgi?id=1693073

Steps to reproduce:
1. Configure VA-API to use libva-vdpau-driver
2. Enable HW acceleration in Firefox https://wiki.archlinux.org/title/Firefox#Hardware_video_acceleration
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 (libX11.so.6 + 0x2f090)
#1 0x00007f382efd6c07 __vaDriverInit_1_10 (vdpau_drv_video.so + 0x6c07)
#2 0x00007f3827041c7f n/a (libva.so.2 + 0x3c7f)
#3 0x00007f382704783a vaInitialize (libva.so.2 + 0x983a)
#4 0x00007f3840bf0b59 n/a (libxul.so + 0x674db59)
#5 0x00007f3840bf0e72 n/a (libxul.so + 0x674de72)
#6 0x00007f3840bf14a6 n/a (libxul.so + 0x674e4a6)
#7 0x00007f3840bc76d8 n/a (libxul.so + 0x67246d8)
#8 0x00007f383f363375 n/a (libxul.so + 0x4ec0375)
#9 0x00007f383edfade8 n/a (libxul.so + 0x4957de8)
#10 0x00007f383e55fbdf n/a (libxul.so + 0x40bcbdf)
#11 0x00007f383dfcf0a5 n/a (libxul.so + 0x3b2c0a5)
#12 0x00007f383e541b7b n/a (libxul.so + 0x409eb7b)
#13 0x00007f383ee81d8d n/a (libxul.so + 0x49ded8d)
#14 0x00007f383ee8188c n/a (libxul.so + 0x49de88c)
#15 0x00007f38483e7008 n/a (libnspr4.so + 0x2b008)
#16 0x00007f3848952259 start_thread (libpthread.so.0 + 0x9259)
#17 0x00007f38484fd5e3 __clone (libc.so.6 + 0xfe5e3)
This task depends upon

Closed by  Buggy McBugFace (bugbot)
Saturday, 25 November 2023, 20:16 GMT
Reason for closing:  Moved
Additional comments about closing:  https://gitlab.archlinux.org/archlinux/p ackaging/packages/libva-vdpau-driver/iss ues/1
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/libX11.so.6
(gdb) bt
#0 0x00007ffff4b60090 in XDisplayString () at /usr/lib/libX11.so.6
#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/libva.so.2
#5 0x00007ffff4eb983a in vaInitialize () at /usr/lib/libva.so.

Also /usr/lib/gstreamer-1.0/libgstva.so (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 */
return VA_STATUS_ERROR_UNKNOWN;
}
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/libva.so.2
#8 0x00007ffff4eb983a in vaInitialize () at /usr/lib/libva.so.2

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.).
Comment by michael Lojkovic (zerophase) - Thursday, 17 November 2022, 18:21 GMT
The bug is getting worse. I never had to install anything special for almost a year of using Firefox with NVidia drivers. There's a bug somewhere causing this issue probably in the vdpau driver. The issue was none existent for almost a year, and with recent updates happens every five minutes with Firefox. I'm also getting crashes in Lutris. Don't know if that's related as well.

I'm guessing it's older NVidia cards getting hit by this.

Loading...