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.


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

Firefox 99



102 Branch
Tracking Status
firefox102 --- verified


(Reporter: shtetldik, Assigned: stransky)


(Blocks 1 open bug)



(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:

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 for vaapi support)
  • This happens both with Mesa main and Mesa 22.0.0.

Additional settings:


media.ffmpeg.vaapi.enabled = true



I can't reproduce this with vaapi using mpv. Mesa developers suggested it's a Firefox bug. (For the reference, see ).

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/
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.

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.


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
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
[Linux] Add widthAligned / heightAligned to SurfaceDescriptorDMABuf r=sotaro
[Linux] Store logical and aligned surface size for DMABufSurfaceYUV r=sotaro
[Linux] Update VideoFramePool to pass frame size along VA-API surface decriptor r=alwu
[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 ( 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.

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