brave / brave-browser

Brave browser for Android, iOS, Linux, macOS, Windows.
https://brave.com
Mozilla Public License 2.0
17k stars 2.21k forks source link

Enable video decoding with vaapi by default #1024

Open bbondy opened 5 years ago

bbondy commented 5 years ago

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.

G-Ray commented 5 years ago

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

G-Ray commented 5 years ago

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.

qnixsynapse commented 5 years ago

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.

G-Ray commented 5 years ago

https://bugs.chromium.org/p/chromium/issues/detail?id=463440#c65

qnixsynapse commented 5 years ago

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

Jacalz commented 5 years ago

I am really hoping to see this too 👍

JaneSmith commented 5 years ago

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.

qnixsynapse commented 5 years ago

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.

Jacalz commented 5 years ago

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

qnixsynapse commented 5 years ago

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

Jacalz commented 5 years ago

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 👍

kureta commented 5 years ago

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

qnixsynapse commented 5 years ago

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

kureta commented 5 years ago

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

qnixsynapse commented 5 years ago

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

skewty commented 5 years ago

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.

Sparsa commented 5 years ago

An progress in this regard?

qnixsynapse commented 5 years ago

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.

kkkrackpot commented 5 years ago

I'd appreciate this feature.

Nonononoki commented 5 years ago

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

wooque commented 5 years ago

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

qnixsynapse commented 5 years ago

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

mmstick commented 5 years ago

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.

maximbaz commented 5 years ago

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!

maximbaz commented 4 years ago

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

bsclifton commented 4 years ago

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

Sparsa commented 4 years ago

@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?

qnixsynapse commented 4 years ago

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

KarmaMonk commented 4 years ago

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?

qnixsynapse commented 4 years ago

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

KarmaMonk commented 4 years ago

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

qnixsynapse commented 4 years ago

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

sTiKyt commented 4 years ago

https://unix.stackexchange.com/questions/401027/gpu-at-busid-0x4-doesnt-have-a-supported-video-decoder

ghost commented 4 years ago

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

tbergeron commented 4 years ago

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?

qnixsynapse commented 4 years ago

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.

qnixsynapse commented 4 years ago

@tbergeron See link

tbergeron commented 4 years ago

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

logix2 commented 4 years ago

--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?

cromega commented 4 years ago

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.

ghost commented 4 years ago

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

mmstick commented 4 years ago

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

wooque commented 4 years ago

@mmstick They reverted it as far as I know

mmstick commented 4 years ago

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

logix2 commented 4 years ago

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

amelia808 commented 4 years ago

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.

dompie commented 4 years ago

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.

qnixsynapse commented 4 years ago

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

freechelmi commented 4 years ago

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 ?

mmstick commented 4 years ago

It's in the Pop!_OS PPA