Brave-browser: Enable video decoding with vaapi by default

Created on 7 Sep 2018  路  58Comments  路  Source: brave/brave-browser

Description

From reddit thread:
https://www.reddit.com/r/BATProject/comments/9dkbpi/the_rewrite_of_brave_named_brave_core_is/

"On Linux, we definitely need to get Hardware Video decoding with vaapi working. (Chromium does not enable the compile flag by default)"

Please verify this is the case that it's on with Chrome and enable with Brave if so.
Maybe a gn option that we can see what the default is.

ODesktop OLinux featurvideo prioritP4

Most helpful comment

BTW, I have news. Both Fedora and OpenSuse are now using vaapi patch in their official chromium. The patch just landed in Fedora rawhide and is expected to come in stable repositories( i.e Fedora 29, Fedora 28) as well. The patch they are using is slightly different from the official one.

All 58 comments

Hi, author of this reddit comment here!

Unfortunately, hardware acceleration (va-api at least) is not enabled in the proprietary Chrome binary neither. That's a pity because our Linux laptops see their battery quickly drained playing videos. Firefox (in Fedora) does not seem to do HW video decoding neither).

For reference, @biswasab is working on a repo "Chromium browser for Fedora Linux with video acceleration patches." here: https://gitlab.com/biswasab/chromium_vaapi_fed

I guess there are reasons why HW is not enable in Chrome/Chromium, but it seems to work ok on at least some GPUs, so if Brave could enable this at least with a whitelisted hardware it would be awesome.

Hello. Thank you for mentioning me here. I'm just a maintainer like others who are involved in maintaining a custom fork of chromium with hardware decoding acceleration. Actually, chrome browser on chromeos already supports video decoding acceleration using vaapi. 5 years ago, a guy hacked the source making it look like it is build for chromeos but it's actually building on linux and got hardware decoding acceleration working. 4 years ago, an intel developer started working on patch to enable full video decoding acceleration on intel gpus only. But the patch is not merged because it was breaking other platform builds. I waited for years in hope for the patch to get merged and after 4 years I lost my patience. So I have created my own fork and maintaining that ever since.

Main reason why google is not interested in implementing va api on Linux:
Nvidia and horrible drivers!
Just look at Nvidia. First they used their own VDPAU(Video Decoding and Presentation API for Unix), then they deserted it and adopted NVDEC. Since there is not a single api which is supported by all GPU vendors, Google, mozilla and companies/organizations which makes browser alike are not interested.
There are many bugs in libva, specially in amdgpu. We need to fix those as soon as possible. That's why I'm bringing my package to rpmfusion. People will report libva bugs and the project will grow beyond intel as standard video acceleration api on linux(my dream actually lol). I am still have no confidence on Nvidia though.

A chromium developer is reviewing the patch in the lastest comment. There is hope.
https://chromium-review.googlesource.com/c/chromium/src/+/532294

I am really hoping to see this too 馃憤

I am also really hoping to see this. It seems insane to me that in 2018, almost 2019, we still don't have hardware video acceleration in web browsers on Linux. Firefox and Chrome both have this on Windows, but Linux users are left out. Instead, we have to suffer from high CPU usage, high power consumption, and stuttering videos - or otherwise have to download video clips and play them in an external video player like VLC or MPV (which is perfectly capable of hardware acceleration).

If Brave could implement the chromium-vaapi patches to give us hardware video acceleration, that would be a big advantage.

BTW, I have news. Both Fedora and OpenSuse are now using vaapi patch in their official chromium. The patch just landed in Fedora rawhide and is expected to come in stable repositories( i.e Fedora 29, Fedora 28) as well. The patch they are using is slightly different from the official one.

Looks like things are looking fairly good now when it comes to the support of this. Ubuntu has a testing snap app with support now. Have a look here for more info...

@Jacalz Wow. I didn't expect them to use my patch. Anyways, also since version 73, the CL will be much lower and I'm going to enable VDA2(mojo) on next chromium update on Fedora. It's working really well in my testing.

I hope Brave browser will follow.
Thanks for sharing this awesome news.

Yeah, it would be wonderful if we could see somebody taking on this issue and getting it working. It would be a strong improvement for us Linux users 馃憤

@biswasab we have used your patch from here in our chromium-vaapi package. I am on Nvidia proprietary drivers and (almost) everything works great. If you use WhatsApp, can you test its web client's gif search facility? It freezes for a couple of seconds, some gifs load as black rectangles. The problem goes away I disable hw-accelerated video decoding.

@kureta Hi. Is it specific to the Nvidia drivers because I cannot reproduce it here ( running on Radeon RX 550, Fedora 29) ?

@biswasab it may be. I cannot test on any other device. Maybe someone can test it on Intel. By the way, there are no problems loading gifs at giphy or tenor. Only the search functionality in whatsapp web. Also, the most CPU consuming processes during the hang-up is Xorg. I don't know if it helps...

@kureta Sounds like a driver problem. Moreover I don't trust the vaapi-->vdpau bridge driver and that's why I have blacklisted it on all Nvidia GPUs.

I am likely not a typical user, but I use the Chromium SNAP with HW accel enabled only for that reason.. HW accel. Until Brave has it enabled, like many here are likely thinking, it simply isn't worth it.

An progress in this regard?

A note to brave developers.
If brave browser uses chromium > 73 as it's base, then please add use_vaapi=true gyp flag. This will enable mojo with vaapi when ignore gpu blacklist flag is enabled.

I'd appreciate this feature.

I'd use Brave in a heartbeat if it were to video decoding with vaapi :)

Here is the patch from chromium-vaapi in Arch Linux
https://aur.archlinux.org/cgit/aur.git/tree/chromium-vaapi.patch?h=chromium-vaapi

@wooque Thanks for sharing my patch here but we don't need that. Some GPUs are having problems so its better if we keep this feature behind a flag. I have already proposed a PR for it.

The Chromium VAAPI patches work fine on NVIDIA hardware. You simply need to install a patched vdpau-va-driver package that fixes the errors reported by chromium. It's working fine on an Oryx Pro with a GTX 1070 in Pop!_OS 19.04.

In my experience of maintaining chromium-vaapi for Arch Linux, at this point I would not recommend enabling VA-API _by default_, given the amount of issues we've seen recently with drivers and regressions in Chromium codebase (we have tried to enable VA-API by default in the official Chromium package for Arch Linux and failed miserably after seeing many many bug reports of broken video playback, so we had to revert).

But merging #4039 to allow users to enable VA-API with a --ignore-gpu-blacklist flag on case-by-case basis would truly be awesome!

@bsclifton yay for merging #4039!! 馃帀 This issue however should probably stay open, as it is requesting having VA-API enabled _by default_.

@maximbaz beat me by a few seconds! 馃槃 Re-opening for the reasons you mention 馃槃 It auto-closed because of the GitHub closing keywords

@bsclifton yay for merging #4039!! tada This issue however should probably stay open, as it is requesting having VA-API enabled _by default_.

Can we enable it now? How?

@Sparsa Just add the --ignore-gpu-blacklist or enable override software rendering list flag :)

Edit: I think it's on the latest nightly or you can install from the @maximbaz 's repository if you use arch linux.

Thanks for enable VA-API Support by flag. I enabled the "Override software rendering list"-flag in the latest nightly. But VP9 and H264 youtube-videos are no longer playing. Where is the right place to report this bug?

@karmaMonk Intel? You'll need this patch. This is the reason why I have it disabled by default.

@akarshanbiswas Yes, Intel HD Graphics 620 (Kaby Lake GT2). Will your patch be included in brave sooner or later? Thx for your work.

@KarmaMonk @maximbaz is maintaining brave browser with that patch. If you're on Arch linux you can download and install from his repository. As for as official is concerned, I am not willing to.

The bug/regression with Intel drivers can be tracked here .

@akarshanbiswas Why aren't you willing to? I'm on Fedora + Intel and can't easily make use of your work without getting official support.

ignore gpu blacklist works but webm videos are not playing anymore. for example this one: http://dl5.webmfiles.org/big-buck-bunny_trailer.webm

anyone has an idea why when disabling gpu blacklist the webm stops playing?

ignore gpu blacklist works but webm videos are not playing anymore. for example this one: http://dl5.webmfiles.org/big-buck-bunny_trailer.webm

anyone has an idea why when disabling gpu blacklist the webm stops playing?

@Spass1966 I hope you've got the answer.

@tbergeron See link

@tbergeron See link

Thanks for pointing me to that issue. Hoping I can figure this out, it used to work so well but since around Brave 1.0 it stopped working (not saying it's because of Brave; I legit don't know what's causing that issue except that when removing the --ignore-gpu-blacklist it fixes video playback but hardware decode breaks.

--ignore-gpu-blacklist doesn't work on my Ubuntu 19.10 desktop with Nvidia (using vdpau-va-driver) -- Brave doesn't use accelerated video decoding. But it works in Chromium with vaapi patches (for both I tried it in YouTube with the h264ify extension). Does Brave require something else to get this to work?

What's the status of this? chrome://media-internals on Brave 1.1.23 (Chromium 79) shows FFmpegVideoDecoder while Chrome 79 shows VpxVideoDecoder, which is hw accelerated.

about://gpu shows

ERROR:vaapi_wrapper.cc(437)] : The system version 1.1 should be greater than or equal to 1.5

Not quite sure what it refers to.

--ignore-gpu-blacklist doesn't work on my Ubuntu 19.10 desktop with Nvidia (using vdpau-va-driver) -- Brave doesn't use accelerated video decoding. But it works in Chromium with vaapi patches (for both I tried it in YouTube with the h264ify extension). Does Brave require something else to get this to work?

What "Chromium with vaapi patches" are you talking about? There is Chromium 73 in Fedora 30, which has hardware acceleration, but all newer versions and Chromium-vaapi/Chromium-freeworld are not accelerated.

Debian's Chromium builds enabled VAAPI a while ago. We're also shipping it in Pop!_OS.

@mmstick They reverted it as far as I know

@wooque We haven't seen any issues during testing in our lab, so we still have it enabled.

--ignore-gpu-blacklist doesn't work on my Ubuntu 19.10 desktop with Nvidia (using vdpau-va-driver) -- Brave doesn't use accelerated video decoding. But it works in Chromium with vaapi patches (for both I tried it in YouTube with the h264ify extension). Does Brave require something else to get this to work?

What "Chromium with vaapi patches" are you talking about? There is Chromium 73 in Fedora 30, which has hardware acceleration, but all newer versions and Chromium-vaapi/Chromium-freeworld are not accelerated.

I'm using Ubuntu with this PPA: https://launchpad.net/~saiarcot895/+archive/ubuntu/chromium-beta. The VAAPI patches are available here: https://github.com/saiarcot895/chromium-ubuntu-build/tree/master/debian/patches.

What's the status of this? chrome://media-internals on Brave 1.1.23 (Chromium 79) shows FFmpegVideoDecoder while Chrome 79 shows VpxVideoDecoder, which is hw accelerated.

about://gpu shows

ERROR:vaapi_wrapper.cc(437)] : The system version 1.1 should be greater than or equal to 1.5

Not quite sure what it refers to.

I had this issue when vaapi was using intel-media-sdk files instead of intel-media-driver, manually overriding the driver path with the LIBVA_DRIVERS_PATH environment variable fixed the issue.

What's the status of this? chrome://media-internals on Brave 1.1.23 (Chromium 79) shows FFmpegVideoDecoder while Chrome 79 shows VpxVideoDecoder, which is hw accelerated.
about://gpu shows

ERROR:vaapi_wrapper.cc(437)] : The system version 1.1 should be greater than or equal to 1.5

I'm having the same error on Ubuntu 18.04. Looking forward for a fix, thanks for the great work.

I'm having the same error on Ubuntu 18.04. Looking forward for a fix, thanks for the great work.

Try upgrading libva to atleast version 2.5

Debian's Chromium builds enabled VAAPI a while ago. We're also shipping it in Pop!_OS.

I don't see it in system76 PPA , how do you distribute chromium ?

It's in the Pop!_OS PPA

Thx , silly me :-)

I just gave this a try but apparently it's missing a patche to work with vdpau / NVIDIA GPUs.

For reference NixOS's chromium build is working fine for me with vdpau. This is their patch:
https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/networking/browsers/chromium/patches/enable-vdpau-support-for-nvidia.patch

Hey, any update on this? Is this planned to be introduced in Brave for Linux?

Hey, any update on this? Is this planned to be introduced in Brave for Linux?

Who knows, I just deleted Brave and switched to Firefox due to their ignorance and shady referral links business...

Hey, any update on this? Is this planned to be introduced in Brave for Linux?

Who knows, I just deleted Brave and switched to Firefox due to their ignorance and shady referral links business...

Lol, how is this comment contributing to the issue's resolution? Just go on with your life, you don't need to come back here and insult lots of people's genuine work just because you dislike something.

@tbergeron I see you're getting emotional as well, adding negative reactions to my comment. This is a purely technical discussion, we are not here to discuss any company's or personal politics. Especially since Mozilla is not exactly the most ethical and correct company either: [link 1] [link 2].

I asked a question about Brave's feature stack, you replied with a political answer completely unrelated to my question. Just stop.

No updates yet, sorry 鈽癸笍
cc: @rebron for visibility

Hey, any update on this? Is this planned to be introduced in Brave for Linux?

Brave browser depends on chromium blink engine. It already has video hardware disabled by default because of few issues with some drivers.

Here is a list of upstream bugs you can follow:

Please note that this PR is a WIP:

I hope this answers all the doubts.
If anyone wants to experiment, try adding --enable-accelerated-video-decode flag and test. [Do it at your own risk];
vaapi support is already included in brave browser.

I hope this answers all the doubts.

It does! For me, those issues are surely a minor drawback compared to having my CPU skyrocket to 85% usage whenever I play a video. Thank you so much!

Just a quick note for whoever might be interested: I noticed that GPU (hardware-accelerated) rasterization is disabled too, however, using the flag --enable-gpu-rasterization enables it. Out-of-process hardware-accelerated rasterization can be enabled too, with --enable-oop-rasterization. So the terminal command to start Brave fully GPU accelerated is:

brave --enable-gpu-rasterization --enable-oop-rasterization --enable-accelerated-video-decode

I personally wanted to enable rasterization too, because some websites use it to draw graphical stuff via scripts ([example]).

Alternatively, those flags can be set by visiting brave://flags, so that they are applied system-wide, without having to launch from shell or edit env variables.

Thanks again for the heads up!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nomaed picture nomaed  路  63Comments

bsclifton picture bsclifton  路  76Comments

Brave-Matt picture Brave-Matt  路  49Comments

bbondy picture bbondy  路  57Comments

LaurenWags picture LaurenWags  路  47Comments