Closed Bug 1658772 Opened 4 years ago Closed 2 years ago

Mesa/Nouveau: Distorted video when VAAPI / X11 enabled

Categories

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

Firefox 81
x86_64
Linux
defect

Tracking

()

RESOLVED DUPLICATE of bug 1724385
Tracking Status
firefox81 --- disabled

People

(Reporter: ilgaz, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: correctness)

Attachments

(3 files)

Attached image youtubeglitch.png

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

Steps to reproduce:

Install latest nightly
Enable ffmpeg-vaapi and webrender
Launch Firefox with EGL enabled
Play some video on Youtube

Actual results:

Video is distorted (mostly green) and if you keep playing it, it will hang the OS.

Expected results:

Play video with hardware acceleration

Console output has lines like:
[Child 2859: MediaPDecoder #2]: D/PlatformDecoderModule DMABUF/VA-API Got one frame output with pts=3128122dts=3128122 duration=41711 opaque=-9223372036854775808

and graphics info
 >>> inxi -xG                                                             [22]
Graphics:
  Device-1: NVIDIA C79 [GeForce 9400] vendor: Apple driver: nouveau 
  v: kernel bus ID: 02:00.0 
  Display: x11 server: X.org 1.20.8 driver: nouveau unloaded: modesetting 
  resolution: <xdpyinfo missing> 
  OpenGL: renderer: NVAC v: 3.3 Mesa 20.1.3 direct render: Yes

Bugbug thinks this bug should belong to this component, but please revert this change in case of error.

Component: Untriaged → Graphics
Product: Firefox → Core

It can look somewhat similar if one has two GPUs, but uses the wrong one to decode (bug 1622132 comment 0), but in this case only one GPU is present.

https://en.wikipedia.org/wiki/Nvidia_PureVideo#Table_of_GPUs_containing_a_PureVideo_SIP_block
https://www.techpowerup.com/gpu-specs/nvidia-c79.g412

VP3

https://nouveau.freedesktop.org/wiki/VideoAcceleration/

H264 DONE
H.264 videos of movie trailers often end up rendering with some artifacts. Never seen in an actual movie though.

There is a first/open MR from Nvidia, don't know if related at all: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3724

Severity: -- → S4
Status: UNCONFIRMED → NEW
Component: Graphics → Audio/Video: Playback
Ever confirmed: true
Keywords: correctness
OS: Unspecified → Linux
Priority: -- → P5
Hardware: Unspecified → x86_64
Summary: Distorted video when VAAPI / X11 enabled → Nouveau: Distorted video when VAAPI / X11 enabled
Summary: Nouveau: Distorted video when VAAPI / X11 enabled → Mesa/Nouveau: Distorted video when VAAPI / X11 enabled

There is one crash report mentioning DMABUF:

Report ID: bp-675b859f-b15e-4482-922d-2df070200812 [@ gbm_bo_create ]
Submitted: 7 hours ago

(In reply to Jan Andre Ikenmeyer [:darkspirit] from comment #4)

There is one crash report mentioning DMABUF:

Report ID: bp-675b859f-b15e-4482-922d-2df070200812 [@ gbm_bo_create ]
Submitted: 7 hours ago

It must be mine. Unfortunate thing is, the device is at my home and I have to remotely access it from work place. It is "frozen" again so I can't test anything further. I tested "mplayer" to make sure video acceleration works without crashing the OS, it indeed works.

(In reply to Jan Andre Ikenmeyer [:darkspirit] from comment #4)

There is one crash report mentioning DMABUF:

Report ID: bp-675b859f-b15e-4482-922d-2df070200812 [@ gbm_bo_create ]
Submitted: 7 hours ago

This crash means va-api is not used but SW decode to dmabuf surfaces is running. Perhaps the actual codec is not supported by the HW decoder.

I assume I can't test this: My GTX 1060 (NV136) is "PureVideo HD VP8". Nouveau seems to support up to VP5.

(In reply to ilgaz from comment #0)

  1. Does this h264 video look likewise broken for you?
  2. Can you try to get a log of it? For example:
    $ pip3 install --upgrade mozregression
    $ MOZ_X11_EGL=1 MOZ_LOG="PlatformDecoderModule:5" ~/.local/bin/mozregression --launch 20200812034418 --pref gfx.webrender.all:true media.ffmpeg.vaapi.enabled:true media.ffvpx.enabled:false -a https://bug1619882.bmoattachments.org/attachment.cgi?id=9149605 -P stdout > nouveau.txt
Attached file nouveau.txt
OpenGL: renderer: NVAC v: 3.3 Mesa 20.1.3 direct render: Yes 

(In reply to Jan Andre Ikenmeyer [:darkspirit] from comment #7)
> I assume I can't test this: My GTX 1060 (NV136) is "PureVideo HD VP8". Nouveau seems to support up to VP5.
> 
> (In reply to ilgaz from comment #0)
> 1. Does [this h264 video](https://bug1619882.bmoattachments.org/attachment.cgi?id=9149605) look likewise broken for you?
Unfortunately yes

> 2. Can you try to get a log of it? For example:
> $ pip3 install --upgrade mozregression
> $ MOZ_X11_EGL=1 MOZ_LOG="PlatformDecoderModule:5" ~/.local/bin/mozregression --launch 20200812034418 --pref gfx.webrender.all:true media.ffmpeg.vaapi.enabled:true media.ffvpx.enabled:false -a https://bug1619882.bmoattachments.org/attachment.cgi?id=9149605 -P stdout > nouveau.txt

output of vaainfo (it supports h2649
vainfo
vainfo: VA-API version: 1.8 (libva 2.7.1)
vainfo: Driver version: Mesa Gallium driver 20.1.3 for NVAC
vainfo: Supported profile and entrypoints
VAProfileMPEG2Simple : VAEntrypointVLD
VAProfileMPEG2Main : VAEntrypointVLD
VAProfileVC1Simple : VAEntrypointVLD
VAProfileVC1Main : VAEntrypointVLD
VAProfileVC1Advanced : VAEntrypointVLD
VAProfileH264ConstrainedBaseline: VAEntrypointVLD
VAProfileH264Main : VAEntrypointVLD
VAProfileH264High : VAEntrypointVLD
VAProfileNone : VAEntrypointVideoProc

The decode goes through VA-API correctly, I'm not sure why import fails. I'd need to check that on nvidia card then.

I think everyone can handle some glitch&CPU load but the real issue is, if you let video play for a while it freezes the entire OS. Even control+alt+f keys doesn't work. A chip or nouveau bug? In 10-12 hours I can leave video playing and let the text file fill with data until OS freezes so you can understand what is happening. I thought it was impossible for usermode apps to freeze OS.

(In reply to Martin Stránský [:stransky] from comment #10)

I'd need to check that on nvidia card then.

This one from April 2020 might be good to test:
https://www.phoronix.com/scan.php?page=news_item&px=Nouveau-K2020-Low-End-Card
~50-60€
https://www.heise.de/preisvergleich/asus-geforce-gt-710-90yv0e60-m0na00-a2286065.html?hloc=at&hloc=de

Chip GK208 "Kepler 2.0"

https://www.techpowerup.com/gpu-specs/nvidia-gk208.g572

PureVideo HD VP5

That's also the so far maximum supported VP version for VAAPI: https://nouveau.freedesktop.org/wiki/VideoAcceleration/

Is it possible that firefox-vaapi/x11 triggers the same issue (freezing) mentioned here on a nvidia 9400?

G92 chips appear to hang when decoding H.264 videos. See this bug for more info. https://bugs.freedesktop.org/show_bug.cgi?id=82835

BTW, I wouldn't buy a nvidia card just to test this issue. I can arrange root access to Mac Mini if you wish.

Testing VLC gave me error this time. Not sure it is related but pasting anyway:
VLC media player 3.0.11 Vetinari (revision 3.0.11-0-gdc0c5ced72)
[000055a5bbe7c670] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
[00007f3d20006c00] glconv_vaapi_x11 gl error: vaDeriveImage: operation failed
[00007f3d18e4f780] main video output error: video output creation failed
[00007f3d18c122b0] main decoder error: failed to create video output
[00007f3d18c122b0] avcodec decoder: Using G3DVL VDPAU Driver Shared Library version 1.0 for hardware decoding
[mpeg4 @ 0x7f3d18e2ef00] Failed setup for format vdpau: hwaccel initialisation returned error.
[00007f3d18c122b0] avcodec decoder error: existing hardware acceleration cannot be reused
[00007f3d4cc11bb0] glconv_vaapi_x11 gl error: vaDeriveImage: operation failed
[00007f3d4cc17aa0] glconv_vaapi_x11 gl error: vaDeriveImage: operation failed
[00007f3d18e7fbf0] main video output error: video output creation failed
[00007f3d18c122b0] main decoder error: failed to create video output
[mpeg4 @ 0x7f3d18e2ef00] get_buffer() failed
[mpeg4 @ 0x7f3d18e2ef00] thread_get_buffer() failed
[mpeg4 @ 0x7f3d18e2ef00] get_buffer() failed (-12 (nil))

Using VLC I tested playing the testing video(In reply to Jan Andre Ikenmeyer [:darkspirit] from comment #7)

I assume I can't test this: My GTX 1060 (NV136) is "PureVideo HD VP8". Nouveau seems to support up to VP5.

(In reply to ilgaz from comment #0)

  1. Does this h264 video look likewise broken for you?

I also tested playing this video on VLC. it didn't have any visible issues but it seems vaapi fails.

[ilgaz@ilgaz-macmini31 firefox]$ mv attachment.cgi?id=9149605 test.mp4
[ilgaz@ilgaz-macmini31 firefox]$ vlc test.mp4
VLC media player 3.0.11 Vetinari (revision 3.0.11-0-gdc0c5ced72)
[0000564eb65c1670] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
[00007f34dc006c00] glconv_vaapi_x11 gl error: vaDeriveImage: operation failed
[00007f3510000d20] main video output error: video output creation failed
[0000564eb72e6a20] main decoder error: failed to create video output
[0000564eb72e6a20] avcodec decoder: Using G3DVL VDPAU Driver Shared Library version 1.0 for hardware decoding

(In reply to Jan Andre Ikenmeyer [:darkspirit] from comment #16)

https://nouveau.freedesktop.org/wiki/VideoAcceleration/ > Firmware:
Do you have https://aur.archlinux.org/packages/nouveau-fw installed?

Yes, double checked.

(In reply to ilgaz from comment #15)

[ilgaz@ilgaz-macmini31 firefox]$ mv attachment.cgi?id=9149605 test.mp4
[ilgaz@ilgaz-macmini31 firefox]$ vlc test.mp4
VLC media player 3.0.11 Vetinari (revision 3.0.11-0-gdc0c5ced72)
[0000564eb65c1670] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
[00007f34dc006c00] glconv_vaapi_x11 gl error: vaDeriveImage: operation failed
[00007f3510000d20] main video output error: video output creation failed
[0000564eb72e6a20] main decoder error: failed to create video output
[0000564eb72e6a20] avcodec decoder: Using G3DVL VDPAU Driver Shared Library version 1.0 for hardware decoding

Looks like dmabuf surface export fails here on the driver/mesa side.

We can't fix the failure but we should switch SW decode (Bug 1724385).

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

Attachment

General

Creator:
Created:
Updated:
Size: