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

More flexible hardware acceleration for Linux #5438

Merged
merged 1 commit into from
Jul 22, 2024

Conversation

xsmile
Copy link
Contributor

@xsmile xsmile commented Jul 21, 2024

More flexible VA-API hardware video acceleration for Linux

Pull Request Type

  • Bugfix
  • Feature Implementation
  • Documentation
  • Other

Related issue

closes #5437.

Description

Video hardware acceleration is only enabled if no other Electron feature flags are found. The OpenGL mode is used by default.

Users can now override the feature flag list passed to Electron and e.g. use Vulkan instead of OpenGL.

Testing

Testing was done with both the bundled Electron library in freetube-0.21.1-linux-portable-x64.zip and with the system package electron31 from Arch Linux.

Using the official freetube portable package

  • ./freetube - no feature flags are found, VaapiVideoDecodeLinuxGL is enabled - VA-API does not work (in my case). This is the default behavior.
  • ./freetube --enable-features=Vulkan,VulkanFromANGLE,DefaultANGLEVulkan,VaapiIgnoreDriverChecks - custom feature flags are detected and left unmodified - VA-API works

Using the system package electron31

  • electron31 --enable-features=Vulkan,VulkanFromANGLE,DefaultANGLEVulkan,VaapiIgnoreDriverChecks resources/app.asar - custom feature flags are detected and left unmodified - VA-API works

Desktop

  • OS: Arch Linux
  • OS Version: rolling
  • FreeTube version: v0.21.1 Beta
  • GPU driver: amdgpu
  • Display server: X

Video hardware acceleration is only enabled if no other Electron feature flags are found. The OpenGL mode is used by default.
@FreeTubeBot FreeTubeBot enabled auto-merge (squash) July 21, 2024 13:17
@github-actions github-actions bot added the PR: waiting for review For PRs that are complete, tested, and ready for review label Jul 21, 2024
@FreeTubeBot FreeTubeBot merged commit 8bb88a1 into FreeTubeApp:development Jul 22, 2024
5 checks passed
@github-actions github-actions bot removed the PR: waiting for review For PRs that are complete, tested, and ready for review label Jul 22, 2024
@xsmile xsmile deleted the patch-1 branch July 22, 2024 10:39
PikachuEXE added a commit to PikachuEXE/FreeTube that referenced this pull request Jul 25, 2024
* development:
  Bump version number to v0.21.2
  Update YouTube.js to 10.2.0 (FreeTubeApp#5465)
  Update icon for channels button on side nav (FreeTubeApp#5273)
  Translated using Weblate (Azerbaijani)
  Fix getRegions script and update the regions (FreeTubeApp#5450)
  More flexible hardware acceleration for Linux (FreeTubeApp#5438)
  Bump the eslint group with 3 updates (FreeTubeApp#5441)
  Bump lefthook from 1.7.2 to 1.7.5 (FreeTubeApp#5445)
  Bump the fortawesome group with 4 updates (FreeTubeApp#5442)
  Bump swiper from 11.1.4 to 11.1.5 (FreeTubeApp#5443)
  Bump electron from 31.2.0 to 31.2.1 (FreeTubeApp#5444)
  Fix scss deprecation warnings (FreeTubeApp#5429)
  Bump the stylelint group with 2 updates (FreeTubeApp#5411)
@absidue
Copy link
Member

absidue commented Aug 3, 2024

@xsmile Do you know if there is a way that we could detect which flags would be the right ones to use? Ideally we would have it working correctly out of the box, without users having to pass their own flags to get it to work.

@xsmile
Copy link
Contributor Author

xsmile commented Aug 4, 2024

@absidue I'm not sure if there is an easy and reliable way to do this.

In general the following requirements must be met:

  • VA-API library is installed
  • Electron is built with VA-API support: this should be the default

Additionally you will need to differentiate between OpenGL and Vulkan modes:

  • OpenGL doesn't require additional workarounds
  • Vulkan requires an up to date Mesa package >= 24.1 and a patch for Electron if using Wayland

The GPU vendor is relevant as well. Intel is known to be less problematic, AMD and NVIDIA might require more workarounds. As of now, acceleration on AMD GPUs seems to only work with Vulkan.

Alternatively, you could use pre-set flags for both OpenGL and Vulkan and let the user decide on the mode to be used via toggles on the Settings page. I would use the flags provided on the official Chromium page as a reference.

You can also find some user feedback on this topic at the Arch Linux forum

@xeleven11
Copy link

I use nvidia but none of the flags in previous post dont work. I have freetube v0.21.3 installed and do i have to install electron31 too?

@absidue
Copy link
Member

absidue commented Sep 1, 2024

@xeleven11 To quote Chromium's own documentation on VA-API (https://chromium.googlesource.com/chromium/src/+/master/docs/gpu/vaapi.md#vaapi-on-linux):

The NVIDIA VaAPI drivers are known to not support Chromium

@xeleven11
Copy link

@absidue i have already read your linked document but there are some people here saying hardware decoding works from nvidia driver. im not sure whether their driver actually works with freetube or got confused with software decode.

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

Successfully merging this pull request may close these issues.

[Bug]: Hardware video acceleration via VA-API does not work
6 participants