Closed Bug 1766693 Opened 2 years ago Closed 2 years ago

VAAPI stopped working in FF99: FFmpeg 5.0/KDE/X11/Mesa 21 i965/Manjaro, Crash in [@ av_buffer_ref ]

Categories

(Core :: Audio/Video: Playback, defect, P3)

Firefox 99
x86_64
Linux
defect

Tracking

()

RESOLVED DUPLICATE of bug 1759137
Tracking Status
firefox99 --- disabled
firefox100 --- disabled

People

(Reporter: fabriciol.castillo, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: crash)

Crash Data

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:99.0) Gecko/20100101 Firefox/99.0

Steps to reproduce:

I updated my system and went from FF98 to F99 and video acceleration was working fine (with the MOZ_DISABLE_RDD_SANDBOX=1 flag). Chromium v100 also stopped hardware acceleration but mpv and vlc work fine.

With h264fy installed and enabled, open a video in youtube and check gpu usage using intel_gpu_top

Actual results:

No activity registered in video decode indicator in intel_gpu_top, higher cpu usual than expected

Expected results:

Firefox should have used vaapi for decoding h264 streams as reported by vainfo and and as mpv and vlc do (both mpv and vlc use gpu for decoding video)

vainfo: VA-API version: 1.13 (libva 2.14.0)
vainfo: Driver version: Intel i965 driver for Intel(R) Sandybridge Mobile - 2.4.1
vainfo: Supported profile and entrypoints
VAProfileMPEG2Simple : VAEntrypointVLD
VAProfileMPEG2Main : VAEntrypointVLD
VAProfileH264ConstrainedBaseline: VAEntrypointVLD
VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
VAProfileH264Main : VAEntrypointVLD
VAProfileH264Main : VAEntrypointEncSlice
VAProfileH264High : VAEntrypointVLD
VAProfileH264High : VAEntrypointEncSlice
VAProfileH264StereoHigh : VAEntrypointVLD
VAProfileVC1Simple : VAEntrypointVLD
VAProfileVC1Main : VAEntrypointVLD
VAProfileVC1Advanced : VAEntrypointVLD
VAProfileNone : VAEntrypointVideoProc

This is my sistem info:
about:support -> https://pastebin.com/m1xURW0z
Packages: extra/libva 2.13.0-2 [installed]
Video Acceleration (VA) API for Linux
extra/libva-intel-driver 2.4.1-2 [installed]
VA-API implementation for Intel G45 and HD Graphics family
extra/libva-mesa-driver 21.3.8-1 [installed]
multilib/lib32-libva-intel-driver 2.4.1-1 [installed]
VA-API implementation for Intel G45 and HD Graphics family (32-bit)
multilib/lib32-libva-mesa-driver 21.3.8-2 [installed]
VA-API implementation for gallium (32-bit)
multilib/lib32-libva-vdpau-driver 0.7.4-6 [installed]
VDPAU backend for VA API (32-bit)
community/intel-gpu-tools 1.26-1 [installed]
Tools for development and testing of the Intel DRM driver
multilib/lib32-libva-intel-driver 2.4.1-1 [installed]
VA-API implementation for Intel G45 and HD Graphics family (32-bit)
multilib/lib32-vulkan-intel 21.3.8-2 [installed]
Intel's Vulkan mesa driver (32-bit)
community/libva-utils 2.14.0-1 [installed]
Intel VA-API Media Applications and Scripts for libva
community/intel-gpu-tools 1.26-1 [installed]
Tools for development and testing of the Intel DRM driver

The Bugbug bot thinks this bug should belong to the 'Core::Audio/Video: Playback' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Audio/Video: Playback
Product: Firefox → Core

Hi, thanks for the info! Could you try starting Firefox with the following commandline?

MOZ_DISABLE_RDD_SANDBOX=1 MOZ_LOG="DmaBuf:5,PlatformDecoderModule:5" firefox

Then, on Youtube start a video that should be hardware-accelerated and then quickly pause it. If you could report back with the log, that would be helpful to diagnose. There'll be a lot of output, including VAAPI information -- for instance, on my machine I have among other info:

...
[AVHWDeviceContext @ 0x7f0163e5d4c0] VAAPI driver: Intel iHD driver for Intel(R) Gen Graphics - 22.2.1 ().            
[AVHWDeviceContext @ 0x7f0163e5d4c0] Driver not found in known nonstandard list, using standard behaviour.            
[h264 @ 0x7f0163e52500] nal_unit_type: 7(SPS), nal_ref_idc: 3                                                         
[h264 @ 0x7f0163e52500] nal_unit_type: 8(PPS), nal_ref_idc: 3                                                         
[RDD 2729526: MediaPDecoder #1]: D/PlatformDecoderModule FFMPEG: FFmpegVideoDecoder::GetAcceleratedFormats()          
[RDD 2729526: MediaPDecoder #1]: D/PlatformDecoderModule FFMPEG:   Profile H264Main:                                  
[RDD 2729526: MediaPDecoder #1]: D/PlatformDecoderModule FFMPEG:     codec h264 format nv12              3         12 
[RDD 2729526: MediaPDecoder #1]: D/PlatformDecoderModule FFMPEG:     codec h264 format nv12              3         12 
...
Flags: needinfo?(fabriciol.castillo)

Hello, thanks for the reply. I ran the command you gave me with the additional MOZ_LOG_FILE=firefox.log to have that on file cause my cli was clipping the log and it was not complete. It returned several logfiles of which only a couple had anything in them (i asume other child processes weren't making use of the decoder).

RELEVANT: I also notice that the video would play only sometimes. It seems as if it's switching resolutions for some reason and it ends up with a lower one (<1080p) by default and sometimes this switching would result in an error and youtube would display a message saying there was an payback error. Again, this didn't happen in FF98

LOGS:
firefox.log.child-5.moz_log
firefox.log.child-8.moz_log
firefox.log.child-11.moz_log
firefox.log.child-13.moz_log
firefox.log.child-14.moz_log

Flags: needinfo?(fabriciol.castillo)

I tried again and got the output form the CLI directly (it's all together now and I can already see error messages)

Thank you for the info! I saw some lines that look interesting, among others:
[Child 24794, MediaDecoderStateMachine #1] WARNING: Decoder=7f0c2b2da600 Decode error: NS_ERROR_OUT_OF_MEMORY (0x8007000e): file /build/firefox/src/firefox-99.0.1/dom/media/MediaDecoderStateMachine.cpp:3577

[Parent 24608: Main Thread]: D/PlatformDecoderModule RDD shutdown before creating content bridge

... and VAAPI being reported as disabled despite it being force enabled in your config:

[RDD 24953: Main Thread]: D/PlatformDecoderModule PDMInitializer, Init PDMs in RDD process
[RDD 24953: Main Thread]: D/PlatformDecoderModule FFMPEG: Couldn't load function av_frame_get_colorspace
[RDD 24953: Main Thread]: D/PlatformDecoderModule FFMPEG: Couldn't load function av_frame_get_color_range
[RDD 24953: Main Thread]: D/PlatformDecoderModule Agnostic decoder supports requested type
...
[RDD 24953: MediaSupervisor #1]: D/PlatformDecoderModule FFMPEG: FFmpegVideoDecoder::FFmpegVideoDecoder MIME video/avc Codec ID 27
[RDD 24953: MediaSupervisor #1]: D/PlatformDecoderModule FFMPEG: VAAPI is disabled by parent decoder module.

Martin, would you have any ideas here?

Flags: needinfo?(stransky)
Severity: -- → S4
Priority: -- → P3

Report ID: bp-167d52e5-2613-48af-8ec0-10c600220427

FFmpeg 5.0 [@ av_buffer_ref ]
This is the same as bug 1759137 (its patch is going to be backed out by bug 1762725).

Description: Mesa DRI Intel(R) HD Graphics 3000 (SNB GT2)
Driver Vendor: mesa/i965
Driver Version: 21.3.8.0

MOZ_DISABLE_RDD_SANDBOX: 1

gfx.canvas.accelerated: true

Blocks: 1759137
Crash Signature: [@ av_buffer_ref ]
Keywords: crash
OS: Unspecified → Linux
Hardware: Unspecified → x86_64
Summary: VAAPI stopped working in FF99, works in external players, not in chromium → VAAPI stopped working in FF99: FFmpeg 5.0/KDE/X11/Mesa 21 i965/Manjaro, Crash in [@ av_buffer_ref ]

(In reply to az [:az] from comment #5)

Thank you for the info! I saw some lines that look interesting, among others:
[Child 24794, MediaDecoderStateMachine #1] WARNING: Decoder=7f0c2b2da600 Decode error: NS_ERROR_OUT_OF_MEMORY (0x8007000e): file /build/firefox/src/firefox-99.0.1/dom/media/MediaDecoderStateMachine.cpp:3577

It's Bug 1761217.

The reason why RDD crashes is perhaps Bug 1762725 / Bug 1759137.

Status: UNCONFIRMED → RESOLVED
Closed: 2 years ago
Flags: needinfo?(stransky)
Resolution: --- → DUPLICATE

(fabriciol.castillo from comment #0)

about:support -> https://pastebin.com/m1xURW0z

Crash Reports for the Last 3 Days

Report ID: bp-167d52e5-2613-48af-8ec0-10c600220427 [@ av_buffer_ref ]
Submitted: 1 hour ago

Report ID: bp-aa6c9d56-ebe3-4697-be18-5d2850220427 [@ av_buffer_ref ]
Submitted: 1 hour ago

Report ID: bp-7883de56-0341-4ce7-9c47-2a0da0220427 [@ av_buffer_ref ]
Submitted: 1 hour ago

Report ID: bp-90ec9a86-92c8-4d69-977b-e895c0220427 [@ av_buffer_ref ]
Submitted: 1 hour ago

Report ID: bp-329d850b-0bdc-42ca-9f4c-d62d20220427 [@ av_buffer_ref ]
Submitted: 1 hour ago

Report ID: bp-e9c46418-a300-4631-b695-90c910220427 [@ av_buffer_ref ]
Submitted: 1 hour ago

Report ID: bp-804328a8-1c69-4b77-b870-bf3820220427 [@ av_buffer_ref ]
Submitted: 1 hour ago

Report ID: bp-144f2756-e963-435b-90bf-0a96b0220427 [@ av_buffer_ref ]
Submitted: 1 hour ago

Report ID: bp-4977d7dd-cd36-430e-95c0-011cf0220427 [@ av_buffer_ref ]
Submitted: 1 hour ago

Report ID: bp-fd0ba362-932a-4539-b2d4-af33e0220427 [@ av_buffer_ref ]
Submitted: 1 hour ago

Report ID: bp-bdda99f2-eda5-45fd-88ba-2a5340220427 [@ av_buffer_ref ]
Submitted: 1 hour ago

Report ID: bp-54eb7ee0-c6c5-4b9f-92ac-753cb0220427 [@ av_buffer_ref ]
Submitted: 1 hour ago

Report ID: bp-a82adc60-2d2b-4e22-84ce-34ef10220427 [@ av_buffer_ref ]
Submitted: 1 hour ago

Report ID: bp-37a9f384-a7de-40ef-95c5-4421d0220427 [@ av_buffer_ref ]
Submitted: 1 hour ago

Report ID: bp-5281d007-9883-4a1b-9d59-27e910220427 [@ av_buffer_ref ]
Submitted: 1 hour ago

Report ID: bp-48d5e061-aa32-44c5-a968-9acb10220427 [@ av_buffer_ref ]
Submitted: 1 hour ago

Report ID: bp-8205a944-25db-4bf4-822e-588640220427 [@ av_buffer_ref ]
Submitted: 1 hour ago

Report ID: bp-249df353-14c9-4174-8ee8-74fcc0220427 [@ av_buffer_ref ]
Submitted: 1 hour ago

Report ID: bp-c461f39d-4c6a-4c9d-8f0d-23a4b0220427 [@ av_buffer_ref ]
Submitted: 1 hour ago

Report ID: bp-a6648735-9e49-468a-adf9-5583a0220427 [@ av_buffer_ref ]
Submitted: 1 hour ago

Report ID: bp-f9beda3a-b6f3-4c49-81a0-e82df0220427 [@ av_buffer_ref ]
Submitted: 1 hour ago

Report ID: bp-1a49b93d-3845-4c3c-ab42-aa8a00220427 [@ av_buffer_ref ]
Submitted: 1 hour ago

Report ID: bp-d6992ec6-1efb-4ff4-a980-6270d0220427 [@ av_buffer_ref ]
Submitted: 1 hour ago

Report ID: bp-687544fe-a578-4a79-9850-8013c0220427 [@ av_buffer_ref ]
Submitted: 1 hour ago

Report ID: bp-5799b28b-b0b7-48bb-967b-b51e10220427 [@ av_buffer_ref ]
Submitted: 1 hour ago

Report ID: bp-9b6e3a7a-47a8-4ed5-9889-ae4370220427 [@ av_buffer_ref ]
Submitted: 1 hour ago

No longer blocks: 1759137
You need to log in before you can comment on or make changes to this bug.