Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VP9 video playback is broken when hw video accel is enabled #8679

Closed
luminoso opened this issue Mar 13, 2020 · 18 comments
Closed

VP9 video playback is broken when hw video accel is enabled #8679

luminoso opened this issue Mar 13, 2020 · 18 comments

Comments

@luminoso
Copy link

luminoso commented Mar 13, 2020

Description

In a Linux system (Fedora 31) with VAAPI and hardware video acceleration enabled ( #ignore-gpu-blacklist ), if a webpage has a video encoded in VP9 format, the video playback is stuck. Hardware-accelerated video playback works normally for h624-encoded videos.
This means that either you play all videos in software-mode or only play h264-encoded videos when hardware acceleration is available.

  • Hardware accelerated video playback works for h264
  • If hardware acceleration is available, then VP9 video playback doesn't work
  • Software playback works for all videos
  • Hardware acceleration works for both VP9 and h264 when running chromium-vaapi in the same test scenario

In chromium, despite having #ignore-gpu-blacklist and accelerated video playback, it doesn't affect VP9. So, chromium is not affected

This leads that the underling Chromium that Brave is using is missing some library/feature/compilation flag.

Steps to Reproduce

  1. Install latest Fedora release
  2. Fully update your system
  3. Install vaapi packages:
    sudo dnf install libva libva-utils intel-media-driver libva-intel-driver
  4. Install Brave nightly
  5. Enable #ignore-gpu-blacklist flag
  6. Try to open an youtube (or any other video) that is encoded in VP9 (e.g.: this one )

Actual result:

Video playback is stuck.

brave://media-internals/

render_id: 9
player_id: 41
origin_url: https://www.youtube.com/
kFrameUrl: https://www.youtube.com/watch?v=MZEUGR3Q21I
kFrameTitle: YouTube
url: blob:https://www.youtube.com/500eda88-a298-41e4-a3d6-874d47deecfd
info: Selected MojoVideoDecoder for video decoding, config: codec: vp9, profile: vp9 profile0, alpha_mode: is_opaque, coded size: [640,360], visible rect: [0,0,640,360], natural size: [640,360], has extra data: false, encryption scheme: Unencrypted, rotation: 0°, flipped: 0, color space: {primaries:BT709, transfer:BT709, matrix:BT709, range:LIMITED}
pipeline_state: kPlaying
kVideoTracks: [object Object]
kAudioTracks: [object Object]
kIsAudioDecryptingDemuxerStream: false
kAudioDecoderName: FFmpegAudioDecoder
kIsPlatformAudioDecoder: false
event: PLAY
kIsVideoDecryptingDemuxerStream: false
kVideoDecoderName: MojoVideoDecoder
kIsPlatformVideoDecoder: true
audio_buffering_state: BUFFERING_HAVE_ENOUGH
duration: 169.821

Expected result:

Videos playing normally with hardware acceleration enabled

Reproduces how often:

Every time

Brave version (brave://version info)

Brave 1.4.96 Chromium: 80.0.3987.132 (Official Build) (64-bit)
Revision fcea73228632975e052eb90fcf6cd1752d3b42b4-refs/branch-heads/3987@{#974}
OS Linux
JavaScript V8 8.0.426.26
Flash (Disabled)
User Agent Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36
Command Line /opt/brave.com/brave/brave --enable-dom-distiller --disable-domain-reliability --no-pings --extension-content-verification=enforce_strict --extensions-install-verification=enforce --sync-url=https://no-thanks.invalid --enable-features=PasswordImport,WebUIDarkMode,SimplifyHttpsIndicator --disable-features=AutofillServerCommunication,AllowPopupsDuringPageUnload,NotificationTriggers,AudioServiceOutOfProcess,SmsReceiver,LookalikeUrlNavigationSuggestionsUI,WebXR,VideoPlaybackQuality,WebXrGamepadModule --flag-switches-begin --ignore-gpu-blacklist --flag-switches-end --disable-webrtc-apm-in-audio-service --disable-sync
Executable Path /opt/brave.com/brave/brave
Profile Path /home/gjc/.config/BraveSoftware/Brave-Browser/Default

Version/Channel Information:

  • Can you reproduce this issue with the current release? Yes
  • Can you reproduce this issue with the beta channel? Yes
  • Can you reproduce this issue with the dev channel? Don't know
  • Can you reproduce this issue with the nightly channel? YEs

Other Additional Information:

  • Does the issue resolve itself when disabling Brave Shields? No
  • Does the issue resolve itself when disabling Brave Rewards? No
  • Is the issue reproducible on the latest version of Chrome? No

Miscellaneous Information:

Related bugs: #1024 and #7706

Some chromium-vaapi articles in the Fedora/Linux world:

vainfo:

libva info: VA-API version 1.6.0
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib64/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_1_6
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.6 (libva 2.6.0.pre1)
vainfo: Driver version: Intel iHD driver - 1.0.0
vainfo: Supported profile and entrypoints
      VAProfileNone                   : VAEntrypointVideoProc
      VAProfileNone                   : VAEntrypointStats
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Simple            : VAEntrypointEncSlice
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointEncSlice
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointEncSlice
      VAProfileH264Main               : VAEntrypointFEI
      VAProfileH264Main               : VAEntrypointEncSliceLP
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointEncSlice
      VAProfileH264High               : VAEntrypointFEI
      VAProfileH264High               : VAEntrypointEncSliceLP
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD
      VAProfileJPEGBaseline           : VAEntrypointVLD
      VAProfileJPEGBaseline           : VAEntrypointEncPicture
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
      VAProfileH264ConstrainedBaseline: VAEntrypointFEI
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSliceLP
      VAProfileVP8Version0_3          : VAEntrypointVLD
      VAProfileVP8Version0_3          : VAEntrypointEncSlice
      VAProfileHEVCMain               : VAEntrypointVLD
      VAProfileHEVCMain               : VAEntrypointEncSlice
      VAProfileHEVCMain               : VAEntrypointFEI
      VAProfileHEVCMain10             : VAEntrypointVLD
      VAProfileHEVCMain10             : VAEntrypointEncSlice
      VAProfileVP9Profile0            : VAEntrypointVLD
      VAProfileVP9Profile2            : VAEntrypointVLD
@Nuc1eoN
Copy link

Nuc1eoN commented Mar 26, 2020

This is funny because for me it is exactly the other way around.

With HW acceleration enabled I can watch VP9 videos, but h264 video content is severely broken #7706

It is true that Chromium with enabled HW accel has no issues, so it is Brave specific.

@luminoso
Copy link
Author

@Nuc1eoN can you share some system details? Which GPU do you have? what does vainfo return?

@Nuc1eoN
Copy link

Nuc1eoN commented Mar 26, 2020

vainfo: VA-API version: 1.6 (libva 2.6.0)
vainfo: Driver version: Mesa Gallium driver 19.3.4 for AMD Radeon (TM) RX 470 Graphics (POLARIS10, DRM 3.36.0, 5.5.11-arch1-1, LLVM 9.0.1)
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointEncSlice
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointEncSlice
      VAProfileHEVCMain               : VAEntrypointVLD
      VAProfileHEVCMain               : VAEntrypointEncSlice
      VAProfileHEVCMain10             : VAEntrypointVLD
      VAProfileJPEGBaseline           : VAEntrypointVLD
      VAProfileNone                   : VAEntrypointVideoProc

I do not have the new chromium-vaapi package installed though (ArchLinux) if you are referring to that. Do I need it?

However Brave clearly misbehaves only when HW accel is active in settings, so I guess it makes use of some functionality 🤔

@luminoso
Copy link
Author

I do not have the new chromium-vaapi package installed though (ArchLinux) if you are referring to that. Do I need it?

No. Chromium with vaapi enabled has different names according to the distro. Since I'm using Fedora the package name is chromium-freeworld provided by rpmfusion.

In Archlinux is available as chromium-vaapi from AUR (as described in chromium archlinux wiki page here)

Any of the packages should provide a solid base to update Brave patching/enabling of VAAPI for Linux users.

@sant0s12
Copy link

I'm having the same issue described here, couldn't test chromium-vaapi myself because the binaries are not available in the AUR anymore and I don't really want to download all the necessary dependencies to build it.

Any changes so far? Did you get working?

@luminoso
Copy link
Author

luminoso commented Apr 13, 2020

No progress on my side. Going to re-test once 1.7.x is out

@qnixsynapse
Copy link
Contributor

qnixsynapse commented Apr 21, 2020

Someone need to add this patch to brave. It will fix the Intel VP9 issue. Honestly there are many issues with chromium atm. (egl backend is busted in the current build and issue with Mesa).

@Nuc1eoN Your issue is with mesa rgb10 configs. You need to disable it. Add export allow_rgb10_configs=false in your environment and relaunch.

@luminoso
Copy link
Author

luminoso commented Apr 21, 2020

Humm according to their tree they need 3 patches?

  • chromium-81-vaapi-r738595.patch
  • chromium-enable-vaapi.patch
  • chromium-fix-vaapi-on-intel.patch

About stability: I have zero issues with chromium-freeworld and it is a lot better on cpu/laptop battery than Brave is. hum

@qnixsynapse
Copy link
Contributor

chromium-enable-vaapi.patch

This is not required.

@rebron rebron added the support addition/edits to articles on support website label May 1, 2020
@afiestas
Copy link

Hey, is there any kind of process we can follow to accelerate the revision of this issue?

This patch chromium-fix-vaapi-on-intel.patch seems to be being applied virtually everywhere (Ubuntu, Fedora, Arch) and the lack of acceleration is a bit of a PITA.

Thanks!

@qnixsynapse
Copy link
Contributor

@ni-ka
Copy link

ni-ka commented Jul 9, 2020

I use an extension to force x264 in youtube (https://chrome.google.com/webstore/detail/h264ify/aleakchihdccplidncghkekgioiakgal) as a workaround and it works great (lower cpu usage).

Would this also enable VP9 hardware acceleration in WebRTC (google meet?) since that would be a huge advantage...

@ni-ka
Copy link

ni-ka commented Jul 10, 2020

On arch linux https://aur.archlinux.org/packages/chromium-vaapi/ (last updated: 2020-07-07) gives me vp9 acceleration, while the latest chromium packages don't (only x264 acceleration).

@afiestas
Copy link

Everything seems to work great now (it has been for a while)
brave.txt

Version 1.20.47 Chromium: 88.0.4315.7 (Official Build) nightly (64-bit)

@Nuc1eoN
Copy link

Nuc1eoN commented Dec 26, 2020

For me it's the other way round. It was fixed for a while but the latest few releases caused a regression, namely many youtube videos are simply "white" with hw acceleration enabled.

@afiestas
Copy link

For me it's the other way round. It was fixed for a while but the latest few releases caused a regression, namely many youtube video are simply "white" with hw acceleration enabled.

Perhaps you are hitting this ?
#13284

@Nuc1eoN
Copy link

Nuc1eoN commented Dec 26, 2020

For me it's the other way round. It was fixed for a while but the latest few releases caused a regression, namely many youtube video are simply "white" with hw acceleration enabled.

Perhaps you are hitting this ?
#13284

Thank you, that seems exactly like my issue!

@luminoso
Copy link
Author

Yes I confirm that this looks solved. I didn't noticed because I've been using enhanced-h264ify since then.

Just tested VP9 playing with MojoVideoDecoder without issues

Closing the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants