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

chromium-vaapi: init #85076

Closed
wants to merge 3 commits into from
Closed

chromium-vaapi: init #85076

wants to merge 3 commits into from

Conversation

ElXreno
Copy link
Contributor

@ElXreno ElXreno commented Apr 12, 2020

Motivation for this change

VA-API give us more speeds for video encoding and a positive effect on the battery if you working on laptop.
Rebuild chromium at least on my laptop with Celeron N3060 takes a lot of time, and not all users wants rebuild it for VA-API only.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@hyperfekt
Copy link
Contributor

hyperfekt commented Apr 12, 2020

Would be worth investigating if the VAAPI patches (with disabled by default functionality) can become part of the default chromium build due to the added load on the build farm of compiling it twice. See #82443 and others.

@ElXreno
Copy link
Contributor Author

ElXreno commented Apr 12, 2020

@hyperfekt VA-API disabled by default because this broke video playback on radeon cards.
Need to work on it.

See this commit: 233e551
Issue: #57837 (comment)

@ElXreno
Copy link
Contributor Author

ElXreno commented Apr 12, 2020

@hyperfekt how I see video acceleration disabled in config by default. I think we can just enable VA-API by default, and manually enable video acceleration in chrome://flags.

Waiting for other opinions.

@primeos primeos self-assigned this Apr 13, 2020
Copy link
Member

@primeos primeos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd also prefer to enable VA-API by default (vs. adding chroium-vaapi). I've added my current thoughts in #82443. If we try to resolve all major issues first we should hopefully be able to succeed this time.

@ElXreno
Copy link
Contributor Author

ElXreno commented Apr 13, 2020

@primeos how about this solution?
#82443 (comment)

@ElXreno

This comment has been minimized.

provide chromium-vaapi without disabled acceleration for video encoding and decoding
@ElXreno ElXreno changed the title chromium: provide chromiumVaapi with VA-API support chromium-vaapi: init Apr 13, 2020
@ElXreno
Copy link
Contributor Author

ElXreno commented Apr 13, 2020

I force-pushed @misuzu solution. Please check and give your opinion and maybe more proper solution.

@primeos
Copy link
Member

primeos commented Apr 13, 2020

I didn't test that solution yet, does it work as expected? From the source-code I'd expect that it wouldn't work as that flag is unavailable on Linux by default (see e.g. chrome://flags/).

In case it doesn't work: I'm currently trying out another solution with a small custom patch to resolve this, but the build is still running (i.e. testing probably has to wait until tomorrow).

@misuzu
Copy link
Contributor

misuzu commented Apr 13, 2020

I didn't test that solution yet, does it work as expected? From the source-code I'd expect that it wouldn't work as that flag is unavailable on Linux by default (see e.g. chrome://flags/).

I'm building this now. It seems that about_flags.cc is doing UI rendering, so command-line switch should work.

@misuzu
Copy link
Contributor

misuzu commented Apr 14, 2020

It works!

chromium

Graphics Feature Status
Canvas: Hardware accelerated
Flash: Hardware accelerated
Flash Stage3D: Hardware accelerated
Flash Stage3D Baseline profile: Hardware accelerated
Compositing: Hardware accelerated
Multiple Raster Threads: Enabled
Out-of-process Rasterization: Disabled
OpenGL: Enabled
Hardware Protected Video Decode: Unavailable
Rasterization: Software only. Hardware acceleration disabled
Skia Renderer: Enabled
Video Decode: Software only. Hardware acceleration disabled
Vulkan: Disabled
WebGL: Hardware accelerated
WebGL2: Hardware accelerated

Problems Detected
Accelerated video decode is unavailable on Linux: 137247, 1032907
Disabled Features: accelerated_video_decode
Protected video decoding with swap chain is for Windows and Intel only
Disabled Features: protected_video_decode
Clear uniforms before first program use on all platforms: 124764, 349137
Applied Workarounds: clear_uniforms_before_first_program_use
Mesa drivers in Linux handle varyings without static use incorrectly: 333885
Applied Workarounds: count_all_in_varyings_packing
Disable partial swaps on Mesa drivers (detected with GL_RENDERER): 339493
Applied Workarounds: disable_post_sub_buffers_for_onscreen_surfaces
Always rewrite vec/mat constructors to be consistent: 398694
Applied Workarounds: scalarize_vec_and_mat_constructor_args
Disable partial swaps on Mesa drivers (detected with GL_VERSION): 339493
Applied Workarounds: disable_post_sub_buffers_for_onscreen_surfaces
Disable KHR_blend_equation_advanced until cc shaders are updated: 661715
Applied Workarounds: disable(GL_KHR_blend_equation_advanced), disable(GL_KHR_blend_equation_advanced_coherent)
Some drivers can't recover after OUT_OF_MEM and context lost: 893177
Applied Workarounds: exit_on_context_lost
Avoid waiting on a egl fence before swapping buffers and rely on implicit sync on Intel GPUs: 938286
Applied Workarounds: rely_on_implicit_sync_for_swap_buffers
Disable GL_MESA_framebuffer_flip_y for desktop GL: 964010
Applied Workarounds: disable(GL_MESA_framebuffer_flip_y)
Accelerated video decode has been disabled, either via blacklist, about:flags or the command line.
Disabled Features: video_decode

chromium-vaapi

Graphics Feature Status
Canvas: Hardware accelerated
Flash: Hardware accelerated
Flash Stage3D: Hardware accelerated
Flash Stage3D Baseline profile: Hardware accelerated
Compositing: Hardware accelerated
Multiple Raster Threads: Enabled
Out-of-process Rasterization: Disabled
OpenGL: Enabled
Hardware Protected Video Decode: Unavailable
Rasterization: Software only. Hardware acceleration disabled
Skia Renderer: Enabled
Video Decode: Unavailable
Vulkan: Disabled
WebGL: Hardware accelerated
WebGL2: Hardware accelerated

Problems Detected
Accelerated video decode is unavailable on Linux: 137247, 1032907
Disabled Features: accelerated_video_decode
Protected video decoding with swap chain is for Windows and Intel only
Disabled Features: protected_video_decode
Clear uniforms before first program use on all platforms: 124764, 349137
Applied Workarounds: clear_uniforms_before_first_program_use
Mesa drivers in Linux handle varyings without static use incorrectly: 333885
Applied Workarounds: count_all_in_varyings_packing
Disable partial swaps on Mesa drivers (detected with GL_RENDERER): 339493
Applied Workarounds: disable_post_sub_buffers_for_onscreen_surfaces
Always rewrite vec/mat constructors to be consistent: 398694
Applied Workarounds: scalarize_vec_and_mat_constructor_args
Disable partial swaps on Mesa drivers (detected with GL_VERSION): 339493
Applied Workarounds: disable_post_sub_buffers_for_onscreen_surfaces
Disable KHR_blend_equation_advanced until cc shaders are updated: 661715
Applied Workarounds: disable(GL_KHR_blend_equation_advanced), disable(GL_KHR_blend_equation_advanced_coherent)
Some drivers can't recover after OUT_OF_MEM and context lost: 893177
Applied Workarounds: exit_on_context_lost
Avoid waiting on a egl fence before swapping buffers and rely on implicit sync on Intel GPUs: 938286
Applied Workarounds: rely_on_implicit_sync_for_swap_buffers
Disable GL_MESA_framebuffer_flip_y for desktop GL: 964010
Applied Workarounds: disable(GL_MESA_framebuffer_flip_y)

chromium-vaapi + --ignore-gpu-blacklist

Graphics Feature Status
Canvas: Hardware accelerated
Flash: Hardware accelerated
Flash Stage3D: Hardware accelerated
Flash Stage3D Baseline profile: Hardware accelerated
Compositing: Hardware accelerated
Multiple Raster Threads: Enabled
Out-of-process Rasterization: Disabled
OpenGL: Enabled
Hardware Protected Video Decode: Hardware accelerated
Rasterization: Software only. Hardware acceleration disabled
Skia Renderer: Enabled
Video Decode: Hardware accelerated
Vulkan: Disabled
WebGL: Hardware accelerated
WebGL2: Hardware accelerated

Problems Detected
Clear uniforms before first program use on all platforms: 124764, 349137
Applied Workarounds: clear_uniforms_before_first_program_use
Mesa drivers in Linux handle varyings without static use incorrectly: 333885
Applied Workarounds: count_all_in_varyings_packing
Disable partial swaps on Mesa drivers (detected with GL_RENDERER): 339493
Applied Workarounds: disable_post_sub_buffers_for_onscreen_surfaces
Always rewrite vec/mat constructors to be consistent: 398694
Applied Workarounds: scalarize_vec_and_mat_constructor_args
Disable partial swaps on Mesa drivers (detected with GL_VERSION): 339493
Applied Workarounds: disable_post_sub_buffers_for_onscreen_surfaces
Disable KHR_blend_equation_advanced until cc shaders are updated: 661715
Applied Workarounds: disable(GL_KHR_blend_equation_advanced), disable(GL_KHR_blend_equation_advanced_coherent)
Some drivers can't recover after OUT_OF_MEM and context lost: 893177
Applied Workarounds: exit_on_context_lost
Avoid waiting on a egl fence before swapping buffers and rely on implicit sync on Intel GPUs: 938286
Applied Workarounds: rely_on_implicit_sync_for_swap_buffers
Disable GL_MESA_framebuffer_flip_y for desktop GL: 964010
Applied Workarounds: disable(GL_MESA_framebuffer_flip_y)

This is on my Intel(R) UHD Graphics 620 (KBL GT2).
Maybe --ignore-gpu-blacklist should be default for chromium-vaapi?

Co-Authored-By: Jörg Thalheim <Mic92@users.noreply.github.com>
@primeos
Copy link
Member

primeos commented Apr 14, 2020

Sorry for the delay, my initial attempt didn't work as I hoped, but I now finished my alternative draft:
#85251.

It's based on this work but with some differences (I tried to document the reasons). Feel free to add feedback and/or ask questions. If you're ok with it I'd like to go with the approach in #85253, but that's of course open for discussion.

@ElXreno
Copy link
Contributor Author

ElXreno commented Apr 15, 2020

@primeos I think your solution is better. Now I can close this PR, right?

@primeos
Copy link
Member

primeos commented Apr 15, 2020

@ElXreno great, then you can close your PR. Thanks for your work and initiating this :)
@misuzu: Also thanks for your work, that CLI switch is quite handy :)

@ElXreno ElXreno closed this Apr 15, 2020
@ElXreno ElXreno deleted the chromium-vaapi branch April 15, 2020 10:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants