Alex313031 / thorium

Chromium fork named after radioactive element No. 90. Windows and MacOS/Raspi/Android/Special builds are in different repositories, links are towards the top of the README.md.
https://thorium.rocks/
BSD 3-Clause "New" or "Revised" License
4.73k stars 147 forks source link

Allow --use-angle=vulkan when ozone platform is Wayland, fixes vaapi on amd #687

Open ms178 opened 4 months ago

ms178 commented 4 months ago

feature request

Quoting the original description by Niccolò Belli:

"vaapi on amd cards requires --use-angle=vulkan: https://wiki.archlinux.org/title/Chromium#Hardware_video_acceleration Since the gl=egl-angle,angle=vulkan GL implementation is not found in allowed implementations you cannot use it on ozone wayland. The necessary support in ozone and ANGLE are present and can be enabled with a one line patch. The angle=vulkan rendering is better on ozone wayland than it is on x11: on xwayland I have major rendering issues in websites like figma which are completely fine on ozone wayland. I can also confirm that vaapi works flawlessly on wayland. The patch is harmless because unless you tune your flags to use --use-angle=vulkan it is disabled by default anyway on both x11 and wayland. Since mesa 24.1 has just been released and it finally enables vaapi video decoding on amd cards this is a good time to merge this. Upstream issue: https://issues.chromium.org/issues/334275637"

Describe the solution you'd like, including relevant patches or source Please incorporate this one line patch: https://gitlab.archlinux.org/archlinux/packaging/packages/chromium/-/merge_requests/6

Additional Notes Description and patch taken from: https://gitlab.archlinux.org/archlinux/packaging/packages/chromium/-/merge_requests/6

gz83 commented 4 months ago

I think we need to carefully evaluate whether the relevant patch will break other parts. I will carefully review the chromium issue report you mentioned above later and may make some edits.

ms178 commented 4 months ago

There is even an AUR package that carries it forword if you want to test it: https://aur.archlinux.org/packages/google-chrome-wayland-vulkan

Robrich also tested it: https://github.com/RobRich999/Chromium_Clang/issues/26#issuecomment-2132485205

RobRich999 commented 4 months ago

Once patched VA-API should be working under Xwayland, too.

https://github.com/RobRich999/Chromium_Clang/issues/26#issuecomment-2134077918

Perhaps X11 as well, though someone else will have to verify it.

ms178 commented 4 months ago

For the record, X11 was already working fine with VAAPI before, but native Wayland didn't work at all, even hardware acceleration is completely broken there. Xwayland also works fine for me, but it has some limitations (only software GPU memory buffers) and some users reported problems with that option. There is more discussion in the upstream bug report which I've linked in the top post.

RobRich999 commented 4 months ago

I have not been keeping much track of hardware decoding as I gave up long ago on conjuring the latest CLI incantations to obtain functional VA-API support. ;)

gz83 commented 4 months ago

I have submitted a CL to Google, but I don’t know if it will be approved. Google will be more cautious than us about patches that fix hardware acceleration problems on Linux.

gz83 commented 4 months ago

https://chromium-review.googlesource.com/c/chromium/src/+/5568860

I've got the patch to land upstream

gz83 commented 4 months ago

CL caused Lacros FYI's test suite to fail and has been reverted. I am trying to discuss a solution with the engineers.

ms178 commented 3 months ago

CL caused Lacros FYI's test suite to fail and has been reverted. I am trying to discuss a solution with the engineers.

As the upstream discussion stalled, is there a chance for a quick fix? If not, carrying this patch downstream might be an option as the seen issue seems to be a non-issue for people that need to set this variable manually. At least it would provide some value for all Linux/Wayland users right away.

gz83 commented 3 months ago

The upstream issue probably won't be fixed quickly enough and looks like some deeper issue. Also, since this patch affects ChromiumOS, I don't know if it will be merged in Thorium.

@Alex313031

ninja- commented 2 months ago

it's not a deeper issue at all - Google has been researching a project of turning ChromeOS into a weird zombie mix of real "Linux" DRM/KMS/Wayland and "Android" graphic system components under "Lacros" project. The new Vulkan path had no chance of running with the "Android" graphic system, yet it was still "Linux". There really is nothing more to it, than properly IFDEFing this code path to avoid "Lacros" target so it only targets real "Linux".

I would really appreciate the patch being merged; at the moment there is no working VA-API build anywhere in the internet, except for AUR, which isn't very useful outside Arch.

gz83 commented 2 months ago

At present, the upstream blockers seem to have been deleted. I have re-landed the patch into the Chromium code base earlier, hoping that it will not cause other problems. If it causes other problems, I support reverting the patch again.

salah7670 commented 1 week ago

Chromium 129 re-added the reverted patch, and using the CachyOS v3 hardware video decode works with --use-angle=vulkan.