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

Update hardware acceleration flag for Linux #6274

Closed

Conversation

Revival8697
Copy link

Update hardware acceleration flag for Linux

Pull Request Type

  • Bugfix
  • Feature Implementation
  • Documentation
  • Other

Description

Chromium changed the flag in v131.

Please merge this after updating Electron to v34, which is scheduled for release on January 14, 2025.

@FreeTubeBot FreeTubeBot enabled auto-merge (squash) December 4, 2024 08:00
@github-actions github-actions bot added the PR: waiting for review For PRs that are complete, tested, and ready for review label Dec 4, 2024
@PikachuEXE
Copy link
Collaborator

@PikachuEXE PikachuEXE added the OS: linux issue that occurs on linux but not on other platforms label Dec 4, 2024
@Revival8697
Copy link
Author

Revival8697 commented Dec 4, 2024

From https://chromium-review.googlesource.com/c/chromium/src/+/5893615/4/docs/gpu/vaapi.md

If you meant to implement --enable-features=AcceleratedVideoDecodeLinuxZeroCopyGL, I tried with Brave on both Intel and AMD systems, it didn't work. Feel free to test and report back.

@efb4f5ff-1298-471a-8973-3d47447115dc efb4f5ff-1298-471a-8973-3d47447115dc added PR/Issue: dependent and removed PR: waiting for review For PRs that are complete, tested, and ready for review labels Dec 4, 2024
@PikachuEXE
Copy link
Collaborator

@Revival8697
Nope, just letting other reviewers to see the diff without clicking around

@Revival8697
Copy link
Author

Revival8697 commented Dec 13, 2024

If you meant to implement --enable-features=AcceleratedVideoDecodeLinuxZeroCopyGL, I tried with Brave on both Intel and AMD systems, it didn't work. Feel free to test and report back.

It turns out this flag must be used together with AcceleratedVideoDecodeLinuxGL.
On my Intel Gen 9 GPU, I can now watch 4K videos with ~0 frame drops at 50% video usage(?) reported by intel_gpu_top, compared to 100% usage with ~10 frame drops per second.

This improvement is too significant not to implement.

One issue: FreeTube has to run as a native Wayland application for it to work. It doesn't.
This doesn't seem to do anything. Thoughts?

@absidue
Copy link
Member

absidue commented Dec 13, 2024

@Revival8697 You can try using --ozone-platform=wayland to force it to use wayland. Please note that wayland support in Chromium and Electron is still considered WIP, which is why it isn't enabled by default, so you may experience issues that you wouldn't with the X11 backend.

@Revival8697
Copy link
Author

@Revival8697 You can try using --ozone-platform=wayland to force it to use wayland. Please note that wayland support in Chromium and Electron is still considered WIP, which is why it isn't enabled by default, so you may experience issues that you wouldn't with the X11 backend.

i would consider it mature enough, i use brave in native wayland as my main browser. but if wayland auto switching isn't implemented, i won't implement ZeroCopy. the performance loss though...

@absidue
Copy link
Member

absidue commented Dec 14, 2024

Difficult to pin down exactly why it isn't working, as you deleted the relevant section of the pull request template instead of filling it in. According to the Arch Linux wiki, auto-detection is known to be broken with Weston, if you are using flatpak you need to enable the wayland socket and there is also an open PR there to enhance the launch script.

There is also a question if these flags should be in FreeTube by default at all, as they seem to be the cause of the video player crashes, because all of the Linux users that are experiencing it are able to stop it happening by passing an empty enable features flags which overwrites the defaults.

The current issue that people have mentioned experiencing with FreeTube when using wayland is not being able to resize the window, which yes is an improvement over the app crashing when you maximise the window but it does still prove that it is still work in progress.

@Revival8697
Copy link
Author

Difficult to pin down exactly why it isn't working, as you deleted the relevant section of the pull request template instead of filling it in. According to the Arch Linux wiki, auto-detection is known to be broken with Weston, if you are using flatpak you need to enable the wayland socket and there is also an open PR there to enhance the launch script.

You just pinned it down. FreeTube doesn't have access to the Wayland socket by default.

There is also a question if these flags should be in FreeTube by default at all, as they seem to be the cause of the video player crashes, because all of the Linux users that are experiencing it are able to stop it happening by passing an empty enable features flags which overwrites the defaults.

If you meant #4890, I think it is a driver issue, but seems like affected users are happy with just passing the flag.

The current issue that people have mentioned experiencing with FreeTube when using wayland is not being able to resize the window, which yes is an improvement over the app crashing when you maximise the window but it does still prove that it is still work in progress.

I will check on related issues then.

@absidue
Copy link
Member

absidue commented Dec 14, 2024

The flatpak not having access to to the wayland socket is intentional due to the problems with wayland and the fact that even Chromium themselves doesn't consider it ready which is why they still use X11 by default instead of auto-detecting wayland, please check the pull requests on the flatpak repo for the exact history.

With the video player issues I was actually talking about #5975 where the GPU process terminates itself because of fatal errors while talking to the GPU driver, which go away when removing the VA-API flag (I guess that is why just like wayland support, Chromium still has it behind a flag).

@absidue
Copy link
Member

absidue commented Dec 14, 2024

If we have to choose between a bunch of people not being able to watch videos at all by default and having to pass flags to make it possible or everyone being able to watch videos but that hardware acceleration is disabled by default and people that have a setup where it actually works can opt-in via flags, I would definitely chose the latter.

@Revival8697
Copy link
Author

If we have to choose between a bunch of people not being able to watch videos at all by default and having to pass flags to make it possible or everyone being able to watch videos but that hardware acceleration is disabled by default and people that have a setup where it actually works can opt-in via flags, I would definitely chose the latter.

That is true. I will look into the issue, but please remove this if it is deemed too buggy and breaks for too many users.

I would love to have this implemented in the GUI as a drop-down menu with "Disabled" as an option, but I have no idea how to pass the value from src/renderer/components/player-settings/player-settings.js to src/main/index.js.

I honestly don't understand why there are so many issue on certain hardware as it works fine OoTB on my hardware. And in testing, even if I force it to fail, it would just fallback to software rendering instead of breaking like that.

@absidue
Copy link
Member

absidue commented Dec 27, 2024

As the flag has to be added before the app is ready, we couldn't do it like a normal setting as those are loaded asynchronously in-parallel whereas this setting would have to be loaded synchronously and blocking to prevent the app/electron getting ready while it is happening.

What we could so is do it like the experimental disable HTTP cache setting, which creates/deletes an empty file in the user data directory and FreeTube checks if the file exists at start up. So as VA-API is so buggy I definitely think it qualifies as an experimental setting and should be disabled by default, then we could have a toggle in the experimental settings page to turn it on for people like you who mysteriously don't have the problems that everyone else has.

Or we could just remove it and then people can manually pass the flag if they are lucky enough to have drivers that it actually works with.

@absidue absidue mentioned this pull request Dec 30, 2024
1 task
auto-merge was automatically disabled December 31, 2024 00:09

Pull request was closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OS: linux issue that occurs on linux but not on other platforms
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants