brave / brave-browser

Brave browser for Android, iOS, Linux, macOS, Windows.
https://brave.com
Mozilla Public License 2.0
17.04k stars 2.22k 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.

freechelmi commented 4 years ago

Thx , silly me :-)

felschr commented 4 years ago

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

mind-overflow commented 3 years ago

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

sTiKyt commented 3 years ago

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

mind-overflow commented 3 years ago

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.

bsclifton commented 3 years ago

No updates yet, sorry ☹️ cc: @rebron for visibility

qnixsynapse commented 3 years ago

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.

mind-overflow commented 3 years ago

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!

Robanan commented 3 years ago

There is no --enable-accelerated-video-decode in brave://flags

mind-overflow commented 3 years ago

@Robanan pretty sure it was there in november. they might have changed something.

joaopauloalbq commented 3 years ago

With Chromium 91 (and any browsers based on it), the Hardware-accelerated video decode browser flag is gone. To get hardware-accelerated video playback, you'll need to add a new command line flag: --enable-features=VaapiVideoDecoder [source]

bridiver commented 2 years ago

I believe we're currently doing this incorrectly by setting use_vaapi = true instead of use_vaapi_x11 = true

# Indicates if X11 VA-API-based hardware acceleration is to be used.
  # See also the comment near the |use_vaapi| arg.
  use_vaapi_x11 =
      is_linux && ozone_platform_x11 && !is_chromecast && !is_chromeos_lacros &&
      (target_cpu == "x86" || target_cpu == "x64")
# Indicates if VA-API-based hardware acceleration is to be used. This
  # is typically the case on x86-based ChromeOS devices.
  # VA-API should also be compiled by default on x11-using linux devices
  # using x86/x64.
  use_vaapi = use_vaapi_x11 || (is_chromeos_lacros &&
                                (target_cpu == "x86" || target_cpu == "x64"))

we're also only setting it for x64 and I'm not sure why

mherrmann commented 1 year ago

@akarshanbiswas was there a reason why you only enabled vaapi for x64 and not for x86 in your PR? Do you see a reason why it should or shouldn't be enabled for arm64?

qnixsynapse commented 1 year ago

@mherrmann Hi. Thank you for asking. It's been a while. Actually vaapi is an Intel specific Video Acceleration API which is also supported by AMD and sometimes Nvidia using a Translation layer. ARM, including arm64 devices then, IIRC, used v4l2.

On top of that I didn't had a device to test then.

mherrmann commented 1 year ago

@akarshanbiswas I see. So it doesn't make much sense to enable vaapi for arm64.

Regarding x86: Could you clarify why you didn't enable vaapi for x86? Was it because it doesn't make sense for x86, or because you didn't have a device to test, or another reason?

qnixsynapse commented 1 year ago

@mherrmann In those days, the x86 build was failing when use_vaapi is set to true. So I kept it disabled.

mherrmann commented 1 year ago

@akarshanbiswas I see. Thank you!

joaopauloalbq commented 1 year ago

New flags to enable vaapi:

--ignore-gpu-blocklist
--enable-features=VaapiVideoDecoder,VaapiVideoEncoder,VaapiVideoDecodeLinuxGL,VaapiIgnoreDriverChecks