Closed Bug 1759784 Opened 6 months ago Closed 4 months ago

Video distortion with H.264 when using vaapi in Firefox on Linux - video has wrong size.

Categories

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

Firefox 99
x86_64
Linux
defect

Tracking

()

VERIFIED FIXED
102 Branch
Tracking Status
firefox102 --- verified

People

(Reporter: shtetldik, Assigned: stransky)

References

(Blocks 1 open bug)

Details

Attachments

(5 files)

Attached image distortion.png

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

Steps to reproduce:

When playing an H.264 encoded video in Firefox with vaapi enabled, there is a distortion that occurs at the bottom of the video (like a stripe of vertically repeated pixels).

I tested it on this example:

https://mirrors.dotsrc.org/blender/blender-demo/movies/BBB/bbb_sunflower_1080p_60fps_normal.mp4

See attached screenshot which demonstrates distortion on the bottom.

  • Firefox 99.0b4 (Mozilla build) on Debian testing.
  • GPU: Sapphire Pulse RX 6800 XT (so it's radeonsi_drv_video.so for vaapi support)
  • This happens both with Mesa main and Mesa 22.0.0.

Additional settings:

about:config

media.ffmpeg.vaapi.enabled = true

environment:

MOZ_DISABLE_RDD_SANDBOX=1

I can't reproduce this with vaapi using mpv. Mesa developers suggested it's a Firefox bug. (For the reference, see https://gitlab.freedesktop.org/mesa/mesa/-/issues/6151 ).

OS: Unspecified → Linux
Hardware: Unspecified → x86_64
Severity: -- → S4
Priority: -- → P3

I also have this with Firefox 98.0 on Fedora 35, and with similar about:config settings, and the necessary RDD sandbox workaround.

Part of vainfo output:

libva info: VA-API version 1.13.0
libva info: Trying to open /usr/lib64/dri/radeonsi_drv_video.so
libva info: Found init function __vaDriverInit_1_13
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.13 (libva 2.13.0)
vainfo: Driver version: Mesa Gallium driver 21.3.7 for AMD Radeon RX 580 Series (POLARIS10, DRM 3.44.0, 5.16.14-200.fc35.x86_64, LLVM 13.0.0)

Can you attach a screenshot of that issue? I have similar setup but I'm not sure if I see that or not.
Thanks.

Flags: needinfo?(shtetldik)
Flags: needinfo?(shtetldik)
Summary: Video distortion with H.264 when using vaapi in Firefox on Linux → Video distortion with H.264 when using vaapi in Firefox on Linux - video has wrong size.

It's related to Bug 1724385 - We need to set texture size correctly.

Yeah, just in case I already attached the screenshot above.

See: https://bugzilla.mozilla.org/attachment.cgi?id=9267965&action=edit

Duplicate of this bug: 1766124

We need transfer aligned surface size, VA-API add extra width/height to decoded surface to keep 16px alignment
and some GL drivers (like AMD) refuses to create EGLImage when stride and width does not match (Bug 1724385).

Assignee: nobody → stransky
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true

There may be added pixels to VA-API decoded surface to keep 16px alignment.
Store the aligned size internaly as widthAligned/heightAligned and use that to create EGLImage only.

Depends on D146084

This is similar to Bug 1750858 but for VA-API, in this patch we set cropped frame size.

Depends on D146085

This is similar to Bug 1750858 but for VA-API.

Depends on D146086

Pushed by stransky@redhat.com:
https://hg.mozilla.org/integration/autoland/rev/64aa5dcbb275
[Linux] Add widthAligned / heightAligned to SurfaceDescriptorDMABuf r=sotaro
https://hg.mozilla.org/integration/autoland/rev/f7e0860e5d7e
[Linux] Store logical and aligned surface size for DMABufSurfaceYUV r=sotaro
https://hg.mozilla.org/integration/autoland/rev/839c401d16c3
[Linux] Update VideoFramePool to pass frame size along VA-API surface decriptor r=alwu
https://hg.mozilla.org/integration/autoland/rev/3a18b123610e
[Linux] Pass frame size to VideoFramePool r=alwu
Flags: qe-verify+

Could not reproduce on Fedora 36 using FX build 98.0 (20220304153049) nor on Ubuntu 20.4 using 99.0b4(20220315185755) probably because I do not have the same GPU.
Can you please confirm issue is fixed on your side on latest Beta (https://archive.mozilla.org/pub/firefox/candidates/102.0b5-candidates/). Thank you.

Flags: needinfo?(shtetldik)

This has been fixed for a while in beta, yeah.

Flags: needinfo?(shtetldik)

Mark as verified based on comment#14.

Status: RESOLVED → VERIFIED
Flags: qe-verify+
You need to log in before you can comment on or make changes to this bug.