Closed Bug 1720363 Opened 3 months ago Closed 2 months ago

VA-API not working for VP9 HW decoding on Fedora

Categories

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

Firefox 89
defect

Tracking

()

RESOLVED INVALID

People

(Reporter: vpvainio, Unassigned)

Details

Attachments

(4 files)

User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36

Steps to reproduce:

I can't get VP9 harware decoding to work in Youtube. I have a Thinkpad with Intel UHD Graphics 620 and I'm using Fedora 34. In https://mastransky.wordpress.com/2021/01/10/firefox-were-finally-getting-hw-acceleration-on-linux/ Martin Stransky asked me to file a bug report here.

Actual results:

I will attach a more detailed log to this bug report. When I run
MOZ_ENABLE_WAYLAND=1 MOZ_LOG="PlatformDecoderModule:5" firefox -P 2>&1 | grep -E -i 'vaapi|va-api'
and then force Youtube to use VP9 with the enchanced-h264ify addon, this is what I get:

[RDD 6906: Main Thread]: D/PlatformDecoderModule VA-API FFmpeg is disabled by platform
[RDD 6906: MediaSupervisor #1]: D/PlatformDecoderModule DMABuf/VA-API is disabled.

However, if I force Youtube to use H264, HW decoding works. This is a snippet of the log:
[Child 6678: MediaPDecoder #5]: D/PlatformDecoderModule Initialising VA-API FFmpeg decoder
libva info: VA-API version 1.11.0
[AVHWDeviceContext @ 0x7f1249a81180] VAAPI driver: Intel iHD driver for Intel(R) Gen Graphics - 21.1.3 ().
[Child 6678: MediaPDecoder #5]: D/PlatformDecoderModule VA-API FFmpeg init successful
[Child 6678: MediaPDecoder #5]: D/PlatformDecoderModule Choosing FFmpeg pixel format for VA-API video decoding.
[Child 6678: MediaPDecoder #5]: D/PlatformDecoderModule Requesting pixel format VAAPI_VLD
[h264 @ 0x7f1242385800] Format vaapi_vld chosen by get_format().
[h264 @ 0x7f1242385800] Format vaapi_vld requires hwaccel initialisation.
[h264 @ 0x7f1242385800] Reinit context to 864x480, pix_fmt: vaapi_vld
[Child 6678: MediaPDecoder #6]: D/PlatformDecoderModule DMABUF/VA-API Got one frame output with pts=0dts=0 duration=40000 opaque=-9223372036854775808
[Child 6678: MediaPDecoder #6]: D/PlatformDecoderModule DMABufSurfaceWrapper: VAAPI locking dmabuf surface UID = 1
[Child 6678: MediaPDecoder #5]: D/PlatformDecoderModule DMABufSurfaceWrapper: VAAPI releasing dmabuf surface UID = 1

I'm using firefox-89.0.2-2.fc34.x86_64 and intel-media-driver-21.1.3-1.fc34.x86_64. I have tested libva-intel-driver as well, with the same results.

Expected results:

It would be nice if VP9 HW decoding worked.

Youtube showed me an ad I could not skip. The log has also a bit of playing the actual video in it, which is why it's so long.

Attached file My vainfo output

I had to set media.ffmpeg.vaapi.enabled to true to get h264 HW decoding to work. Other than that, the tests are done in a new profile with Fedora's defaults.

I took a better look at the VP9 log myself. To me my situation seems similar to https://bugzilla.mozilla.org/show_bug.cgi?id=1698778

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

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

You need to disable build-in ffvpx decoder, set 'media.ffvpx.enabled' to false at about:config.
This is covered by Bug 1683808

Still does not work, I've attached the log.

(In reply to Vincent Chernin from comment #8)

Is this guide helpful: https://wiki.archlinux.org/title/Firefox#Hardware_video_acceleration

Thank you. I got it working. I needed:
media.ffmpeg.vaapi.enabled to true
media.ffvpx.enabled to false
media.rdd-vpx.enabled to false

I did not have to change security.sandbox.content.level, which is good, because I would rather live without HW VP9 decoding than disable a sandboxing feature. In my (very) old Firefox profile that option is 4 now.

If there's no actual bug here, but informed default configuration choices, you can close this report.

Thanks for the help! Closing it.

Status: UNCONFIRMED → RESOLVED
Closed: 2 months ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.