Closed Bug 1760941 Opened 3 years ago Closed 1 year ago

VAAPI: Update Snap to core22 to have an intel-media-driver version that supports Iris Xe

Categories

(Firefox Build System :: Third Party Packaging, task, P3)

Firefox 98
x86_64
Linux
task

Tracking

(firefox-esr102 disabled, firefox113 disabled, firefox114 disabled, firefox115 wontfix, firefox117 fixed)

RESOLVED FIXED
Tracking Status
firefox-esr102 --- disabled
firefox113 --- disabled
firefox114 --- disabled
firefox115 --- wontfix
firefox117 --- fixed

People

(Reporter: mail, Unassigned)

References

(Blocks 1 open bug, )

Details

Attachments

(7 files)

Attached file before_clicking_play.txt (deleted) —

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

Steps to reproduce:

Hello,

Ubuntu 22.04 recently forced a transition from the Firefox deb package to the snap package. Prior to this transition, VAAPI hardware video decoding was working perfectly fine for me (after setting media.ffmpeg.vaapi.enabled to true). After switching to the snap package, it's no longer working. The video still plays, but it's silently falling back to software decoding.

The video in question is just some random 4K VP9 video on Youtube:
https://www.youtube.com/watch?v=WZFIo4yj17c

To confirm whether VAAPI is working or not, I run Firefox with the following command:
MOZ_LOG="PlatformDecoderModule:5" firefox

I'm also checking "intel_gpu_top", which reports the utilization of the video decoding hardware. With the deb package, this floats around 20% while watching the video above (and I see a bunch of VAAPI decoding messages in the console output), whereas with the snap package, it's 0.

The system is an 11th Gen Intel i7 (Iris Xe integrated graphics), running Ubuntu MATE (so, X11, not Wayland).

I have attached some files containing the console output from when I run Firefox from the command line.

The following line sticks out at me:
[vp9 @ 0x7f0cb444f800] Failed to create decode context: 2 (resource allocation failed).

Which seems to be the result of a call to vaCreateContext() failing.

Actual results:

It falls back to software decoding.

Expected results:

It should have used the hardware decoder (utilization of video hardware decoder reported by "intel_gpu_top" should be non-zero).

Attached file vainfo (deleted) —
vainfo output:

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
Severity: -- → S4
Priority: -- → P3

The log is:

[vp9 @ 0x7f0cb444f800] Considering format 0x3231564e -> nv12.
[vp9 @ 0x7f0cb444f800] Picked nv12 (0x3231564e) as best match for yuv420p.
[vp9 @ 0x7f0cb444f800] Failed to create decode context: 2 (resource allocation failed).
[vp9 @ 0x7f0cb444f800] Failed setup for format vaapi_vld: hwaccel initialisation returned error.
[vp9 @ 0x7f0cb444f800] Format vaapi_vld not usable, retrying get_format() without it.

Does decoding of any other media type work? (h264 & VP8)? Does va-api work in mpv for instance?
Also can you test latest nightly?
https://fedoraproject.org/wiki/How_to_debug_Firefox_problems?rd=Bug_info_Firefox#Testing_Mozilla_binaries

Thanks.

Flags: needinfo?(mail)
Summary: [snap] VAAPI Video Decoding Fails → [snap][Iris Xe] VAAPI Video Decoding Fails

(In reply to Martin Stránský [:stransky] (ni? me) from comment #3)

The log is:

[vp9 @ 0x7f0cb444f800] Considering format 0x3231564e -> nv12.
[vp9 @ 0x7f0cb444f800] Picked nv12 (0x3231564e) as best match for yuv420p.
[vp9 @ 0x7f0cb444f800] Failed to create decode context: 2 (resource allocation failed).
[vp9 @ 0x7f0cb444f800] Failed setup for format vaapi_vld: hwaccel initialisation returned error.
[vp9 @ 0x7f0cb444f800] Format vaapi_vld not usable, retrying get_format() without it.

Does decoding of any other media type work? (h264 & VP8)? Does va-api work in mpv for instance?
Also can you test latest nightly?
https://fedoraproject.org/wiki/How_to_debug_Firefox_problems?rd=Bug_info_Firefox#Testing_Mozilla_binaries

Thanks.

Good morning,

I just tried the nightly and that also doesn't work, but with a slightly different log:

[RDD 14407: Main Thread]: D/PlatformDecoderModule Agnostic decoder supports requested type
[RDD 14407: MediaSupervisor #1]: D/PlatformDecoderModule FFVPX: FFmpegVideoDecoder::FFmpegVideoDecoder MIME video/vp9 Codec ID 167
[RDD 14407: MediaPDecoder #1]: D/PlatformDecoderModule FFVPX: Initialising VA-API FFmpeg decoder
[RDD 14407: MediaPDecoder #1]: D/PlatformDecoderModule FFVPX: codec vp9 : Google VP9
libva info: VA-API version 1.14.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_14
readlink -errno 13

I am able to play back local VP9 video files using MPV with VAAPI successfully.

Also, the Firefox deb package from the Ubuntu 22.04 repo worked too, but they removed it and replaced it with the snap.

Does the snap version of Firefox include a separate copy of the libigdgmm12 library? There is a bug in version 22.1.1+ds1-1 that was just pushed out to Ubuntu 22.04 which breaks even MPV decoding about a week ago, so I've been holding my version back at 22.0.2+ds1-1.

Flags: needinfo?(mail)

Okay, looks like snap packaging issue then.

Blocks: snap
No longer blocks: egl-linux-vaapi

The firefox snap relies on the VA-API drivers shipped by the gnome-3-38-2004 platform snap, which according to its manifest includes libigdgmm11=20.1.1+ds1-1.

Can you run the firefox snap with LIBVA_MESSAGING_LEVEL=2 and share the output here?

Flags: needinfo?(mail)

which according to its manifest includes libigdgmm11=20.1.1+ds1-1.

Interesting. Maybe I need a newer version for Iris Xe?

Also, for what it's worth, there was recently an issue with libigdgmm11=20.1.1+ds1-1.

I actually submitted a bug report for that to Ubuntu: https://bugs.launchpad.net/ubuntu/+source/intel-gmmlib/+bug/1966362

It has since been fixed as of libigdgmm11 22.1.2+ds1-1 I think the bug was caused by some ABI breakage, which required libigdgmm and intel-media-va-driver to be rebuilt.

Anyway, here's the output requested:

[2022-04-25T18:32:50Z ERROR mp4parse] Found 2 nul bytes in "\u{0}\u{0}"
[2022-04-25T18:32:50Z ERROR mp4parse] Found 2 nul bytes in "\u{0}\u{0}"
[2022-04-25T18:32:50Z ERROR mp4parse] Found 2 nul bytes in "\u{0}\u{0}"
[2022-04-25T18:32:50Z ERROR mp4parse] Found 2 nul bytes in "\u{0}\u{0}"
libva info: VA-API version 1.7.0
libva info: Trying to open /snap/firefox/1232/gnome-platform/usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_7
libva info: va_openDriver() returns 0

I should point out that even though the driver open is returning 0, it's not actually working. It's still falling back to software decoding.

Flags: needinfo?(mail)

Sorry, the recent issue was with 22.1.1+ds1-1, not 20.1.1+ds1-1.

This is possibly a duplicate of bug 1751363.
Does disabling the RDD sandbox help? (run the firefox snap with MOZ_DISABLE_RDD_SANDBOX=1)

Flags: needinfo?(mail)

Hello,

Here's the output when running with MOZ_DISABLE_RDD_SANDBOX=1
....
[2022-04-29T17:19:56Z ERROR mp4parse] Found 2 nul bytes in "\u{0}\u{0}"
[2022-04-29T17:19:56Z ERROR mp4parse] Found 2 nul bytes in "\u{0}\u{0}"
[2022-04-29T17:19:56Z ERROR mp4parse] Found 2 nul bytes in "\u{0}\u{0}"
[2022-04-29T17:19:56Z ERROR mp4parse] Found 2 nul bytes in "\u{0}\u{0}"
libva info: VA-API version 1.7.0
libva info: Trying to open /snap/firefox/1232/gnome-platform/usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_7
libva info: va_openDriver() returns 0

Flags: needinfo?(mail)

comment 10 does not contain the info whether VAAPI is used, it's too short.

  • Please attach a log of playing a video with MOZ_DISABLE_RDD_SANDBOX=1 for ~2 seconds.
  • Or does $ sudo intel_gpu_top show any hardware decoding activity now?

Console output from running firefox snap in the foreground via: MOZ_DISABLE_RDD_SANDBOX=1 MOZ_LOG="PlatformDecoderModule:5" firefox

While playing a Youtube video that should support VAAPI playback.

Attached file disable_rdd_sandbox.txt (deleted) —

Console output from running firefox snap in the foreground via: MOZ_DISABLE_RDD_SANDBOX=1 firefox

While playing a Youtube video that should support VAAPI playback.

I've attached a couple of log files. If I just run firefox with MOZ_DISABLE_RDD_SANDBOX=1, that's all the output I get, even after several seconds. Hardware decoding is not functional at that time (confirmed via intel_gpu_top).

If I add MOZ_LOG="PlatformDecoderModule:5", then I get continuous log messages, and hardware decoding still doesn't work.

When running with MOZ_LOG="PlatformDecoderModule:5", I noticed the following interesting lines:

[vp9 @ 0x7f3c3d96b100] Failed to create decode context: 2 (resource allocation failed).
[vp9 @ 0x7f3c3d96b100] Failed setup for format vaapi_vld: hwaccel initialisation returned error.

Jed, isnt this a dupe of bug 1751363 ?

Flags: needinfo?(jld)

If it fails only with Snap, it's probably a duplicate of bug 1772142.

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

Hello,

This bug is not fixed as of 102.0 (snap). Can we re-open?

It behaves the same as before.

Here's the log snippet:

[vp9 @ 0x7ff0c7266200] Considering format 0x3231564e -> nv12.
[vp9 @ 0x7ff0c7266200] Picked nv12 (0x3231564e) as best match for yuv420p.
[vp9 @ 0x7ff0c7266200] Failed to create decode context: 2 (resource allocation failed).
[vp9 @ 0x7ff0c7266200] Failed setup for format vaapi_vld: hwaccel initialisation returned error.
[vp9 @ 0x7ff0c7266200] Format vaapi_vld not usable, retrying get_format() without it.
[RDD 23480: MediaPDecoder #1]: D/PlatformDecoderModule FFVPX: Choosing FFmpeg pixel format for VA-API video decoding.
[vp9 @ 0x7ff0c7266200] Failed to initialize decoder for 1280x720 @ 0

Status: RESOLVED → UNCONFIRMED
Resolution: DUPLICATE → ---

It should have been fixed in 103 (nightly).
sudo snap install firefox --edge

Status: UNCONFIRMED → RESOLVED
Closed: 2 years ago2 years ago
Resolution: --- → DUPLICATE
Attached file failure_version_103.txt (deleted) —

Unfortunately, this bug still exists for me in version 103. The log looks basically the same, but I've attached a new text file anyway.

For what it's worth, vaapi did work previously before the switch to snap, so I know my system isn't at least totally broken.

Status: RESOLVED → UNCONFIRMED
Resolution: DUPLICATE → ---

I confirm this bug here on Alder Lake - Intel XE laptop
Firefox 106.0.2 (64 bits) SNAP
Ffmpeg shows : "glxtest: VA-API test failed: failed to initialise VAAPI connection"

Any other application including firefox deb works perfectly with vaapi

it seems the included driver / LibVA in gnome-3-38 platform is too old for this hardware ?

Are we going back to a dependency problem ? which we tried to avoid with snap ?

(In reply to michel memeteau from comment #21)

I confirm this bug here on Alder Lake - Intel XE laptop
Firefox 106.0.2 (64 bits) SNAP
Ffmpeg shows : "glxtest: VA-API test failed: failed to initialise VAAPI connection"

Any other application including firefox deb works perfectly with vaapi

it seems the included driver / LibVA in gnome-3-38 platform is too old for this hardware ?

Are we going back to a dependency problem ? which we tried to avoid with snap ?

Can you share about:support from both deb and snap ? Knowing which versions of the driver you have in both case could be valuable as well.

Flags: needinfo?(michel.memeteau)

about:support from :

snap https://pastebin.ubuntu.com/p/pmWSBWWVhz/
deb https://pastebin.ubuntu.com/p/5yjVG2V4v3/

system vainfo :

vainfo: VA-API version: 1.14 (libva 2.12.0)
vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 22.3.1 ()

Flags: needinfo?(michel.memeteau)

(In reply to michel memeteau from comment #23)

system vainfo :

vainfo: VA-API version: 1.14 (libva 2.12.0)
vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 22.3.1 ()

Are the same versions reported by snap?

I'm not sure how to verify the version from the snap firefox shell , but as it is connect to gnome3.38 platform and I can see

/snap/gnome-3-38-2004/119/usr/lib/x86_64-linux-gnu/libva.so.2.700.0

Firefox is using libva from 20.04 which is too old to handle Intel Iris XE

Is this that simple ?

We should then migrate the base platform to the latest gnome to grab 22.04 libs ?

(In reply to michel memeteau from comment #27)

I'm not sure how to verify the version from the snap firefox shell , but as it is connect to gnome3.38 platform and I can see

/snap/gnome-3-38-2004/119/usr/lib/x86_64-linux-gnu/libva.so.2.700.0

Firefox is using libva from 20.04 which is too old to handle Intel Iris XE

Is this that simple ?

We should then migrate the base platform to the latest gnome to grab 22.04 libs ?

I think you can check with snap run --shell firefox and from there perform a vainfo call. But the above lib seems to match your theory. I guess we need to defer to Olivier on whether this is expected or not, but I'm afraid you might be right.

Flags: needinfo?(olivier)

Firefox is using libva from 20.04 which is too old to handle Intel Iris XE

That sounds plausible.
I am working on upgrading firefox's base to core22 and gnome-42-2204, which ships libva.so.2.1400.0. Would that be enough to support Intel Iris XE ?

Flags: needinfo?(olivier)

That would be great !

Yes gnome-42-2204 would work as on 22.04 firefox deb ( and others) play vaapi supported ( except av1 ) streams without problems.

Do you have Intel Iris hardware to validate this test case ? I can make a test machine available is needed here

I will open ( if not already raised) 2 other bugs :

  • ffmpeg in firefox does not use VAAPI for AV1 ( I think it needs a 5.X version )
  • We need to ship vaapi enable firefox settings as a default and propose a disable setting for users in case of problems.

Hello , you can test the candidate/core22 snap channel , which is based on Ubuntu 22.04 and thus brings a compatible version of the vaapi stack with Intel XE graphics

ASA this channel is merged into stable , this bug will be closed

I've tested with sucess with all codecs ( VP9 , H264 etc..) supported by the current 22.04 ffmpeg version and it works perfectly

To enable AV1 hardware VAAPI decoding , we need to update the ffmpeg version in the snap , tracked here https://bugzilla.mozilla.org/show_bug.cgi?id=1798512

Blocks: 1798512

Hello, I gave a try to the candidate:

sudo snap refresh firefox --channel candidate/core22

But immediately faced:

Content snap command-chain for /snap/firefox/2320/gnome-platform/command-chain/desktop-launch not found: ensure slot is connected

Video acceleration works fine, also with AV1 when running nightly directly on the machine, without snap.

Is this core22 update just awaiting feedback from users before it's merged? I'd switch to the core22 branch and try it out, but I'm already on FF 110 by now and candidate/core22 is on FF 109 so I think I'd need to make fresh profile to use this version at this point. If I can confirm my feedback will be useful or if this is updated for 110, I'll try out the core22 branch. Will this go in beta or edge first so it gets wider testing before everyone gets it?

Flags: needinfo?(michel.memeteau)

Redirecting needinfo from comment 33 to Amin.

Flags: needinfo?(michel.memeteau) → needinfo?(bandali)
Duplicate of this bug: 1807762
Status: UNCONFIRMED → NEW
Type: defect → task
Component: Audio/Video: Playback → Third Party Packaging
Ever confirmed: true
Flags: needinfo?(jmathies)
OS: Unspecified → Linux
Product: Core → Firefox Build System
Hardware: Unspecified → x86_64
Summary: [snap][Iris Xe] VAAPI Video Decoding Fails → VAAPI: Update Snap to core22 to have an intel-media-driver version that supports Iris Xe

Offtopic/Verified:
I don't have Iris Xe, but old Intel Iris Graphics 6100 (BDW GT3):
VAAPI (Xwayland+Wayland) seems to work in Nightly snap (core20) on KDE Wayland, Debian Testing.

$ sudo snap install firefox --edge
$ snap list

Name Version Rev Tracking Publisher Notes
bare 1.0 5 latest/stable canonical✓ base
core20 20230503 1891 latest/stable canonical✓ base
firefox 115.0a1 2727 latest/edge mozilla✓ -
gnome-3-38-2004 0+git.6f39565 140 latest/stable canonical✓ -
gtk-common-themes 0.1-81-g442e511 1535 latest/stable canonical✓ -
snapd 2.59.2 19122 latest/stable canonical✓ snapd

$ sudo intel_gpu_top

$ MOZ_LOG="Dmabuf:5,PlatformDecoderModule:5" MOZ_ENABLE_WAYLAND=0 DISABLE_WAYLAND=1 snap run firefox

libva info: VA-API version 1.7.0
libva info: Trying to open /snap/firefox/2727/gnome-platform/usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_7
libva info: va_openDriver() returns 0

[RDD 25223: MediaPDecoder #1]: D/PlatformDecoderModule FFMPEG: VA-API Got one frame output with pts=120000 dts=160000 duration=40000 opaque=-9223372036854775808

Offtopic:
https://github.com/ubuntu/gnome-sdk/issues/132 (libva 2.17: https://github.com/intel/libva/commit/ef1df02f3ad45ac98b1fa57c373176d7c14dcc57) is irrelevant for Firefox.
Firefox doesn't use X11 VAAPI, but DRM VAAPI (bug 1580166 comment 6). That's why VAAPI works for me with Snap's libva 1.7.0 on Xwayland.

Important for Intel (WebGL || VAAPI) on Ubuntu:
Ubuntu 22.04 LTS jammy and 22.10 kinetic are still affected by bug 1779558 (main process crash under high load/multiple videos/after 20min of AV1).
Please ship kernel 6.1.4 to them or backport the specific patch:

(Darkspirit from bug 1779558 comment 30)

[...]
(https://gitlab.freedesktop.org/drm/intel/-/issues/7570#note_1692847, https://patchwork.freedesktop.org/series/111686/).

The fix landed in Linux kernel 6.1.4:

https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2003687

Linux 6.1.4

drm/i915: improve the catch-all evict to handle lock contention

https://packages.ubuntu.com/search?keywords=linux-image-generic

Debian:

Fedora: https://packages.fedoraproject.org/pkgs/kernel/kernel/

  • fixed: Fedora Rawhide (6.4.0-0.rc2.23.fc39)
  • fixed: Fedora 38 (6.2.15-300.fc38)
  • fixed: Fedora 37 (6.2.15-200.fc37)
  • fixed: Fedora 36 (6.1.7@2023-01-18. now 6.2.15)
Status: NEW → RESOLVED
Closed: 2 years ago1 year ago
Flags: needinfo?(bandali)
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: