硬件加速 chrome+youtube?

硬件加速 chrome+youtube?

我在观看高清(720 或 1080)视频时遇到问题Ubuntu 21.04全新安装。我的 CPU 使用率非常高(所有核心都为 50%),对于 720p 视频来说,这个数字相当高。我尝试在 vlc(硬件加速)上观看同一个视频,效果非常好。我甚至尝试了 4k 视频,效果很好,CPU 使用率 < 20%。为什么 chrome 消耗这么多 CPU?

已启用标志: 在此处输入图片描述

这是我尝试过的:sudo apt install intel-media-va-driver

使用 4k 视频 h265 时 vlc 的 CPU 使用率,vlc 在第二行,gnome 出于某种原因截取了一个巨大的屏幕截图(6MB,必须压缩): 在此处输入图片描述

chrome + youtube 的 CPU 使用率: 在此处输入图片描述 书呆子统计数据: 在此处输入图片描述

我的笔记本电脑上有一个英特尔 CPU:

lscpu
Architecture:                    x86_64
CPU op-mode(s):                  32-bit, 64-bit
Byte Order:                      Little Endian
Address sizes:                   39 bits physical, 48 bits virtual
CPU(s):                          8
On-line CPU(s) list:             0-7
Thread(s) per core:              2
Core(s) per socket:              4
Socket(s):                       1
NUMA node(s):                    1
Vendor ID:                       GenuineIntel
CPU family:                      6
Model:                           142
Model name:                      Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz
Stepping:                        11
CPU MHz:                         2000.000
CPU max MHz:                     4600.0000
CPU min MHz:                     400.0000
BogoMIPS:                        3999.93
Virtualization:                  VT-x
L1d cache:                       128 KiB
L1i cache:                       128 KiB
L2 cache:                        1 MiB
L3 cache:                        8 MiB
NUMA node0 CPU(s):               0-7
Vulnerability Itlb multihit:     KVM: Mitigation: VMX disabled
Vulnerability L1tf:              Not affected
Vulnerability Mds:               Mitigation; Clear CPU buffers; SMT vulnerable
Vulnerability Meltdown:          Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled v
                                 ia prctl and seccomp
Vulnerability Spectre v1:        Mitigation; usercopy/swapgs barriers and __user
                                  pointer sanitization
Vulnerability Spectre v2:        Mitigation; Full generic retpoline, IBPB condit
                                 ional, IBRS_FW, STIBP conditional, RSB filling
Vulnerability Srbds:             Mitigation; Microcode
Vulnerability Tsx async abort:   Not affected
Flags:                           fpu vme de pse tsc msr pae mce cx8 apic sep mtr
                                 r pge mca cmov pat pse36 clflush dts acpi mmx f
                                 xsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rd
                                 tscp lm constant_tsc art arch_perfmon pebs bts 
                                 rep_good nopl xtopology nonstop_tsc cpuid aperf
                                 mperf pni pclmulqdq dtes64 monitor ds_cpl vmx e
                                 st tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_
                                 1 sse4_2 x2apic movbe popcnt tsc_deadline_timer
                                  aes xsave avx f16c rdrand lahf_lm abm 3dnowpre
                                 fetch cpuid_fault epb invpcid_single ssbd ibrs 
                                 ibpb stibp tpr_shadow vnmi flexpriority ept vpi
                                 d ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi
                                 2 erms invpcid mpx rdseed adx smap clflushopt i
                                 ntel_pt xsaveopt xsavec xgetbv1 xsaves dtherm i
                                 da arat pln pts hwp hwp_notify hwp_act_window h
                                 wp_epp md_clear flush_l1d arch_capabilities

我已经在 Chrome 上启用了硬件加速:

Graphics Feature Status
Canvas: Hardware accelerated
Compositing: Hardware accelerated
Multiple Raster Threads: Enabled
Out-of-process Rasterization: Hardware accelerated
OpenGL: Enabled
Rasterization: Hardware accelerated
Skia Renderer: Enabled
Video Decode: Hardware accelerated
Vulkan: Enabled
WebGL: Hardware accelerated
WebGL2: Hardware accelerated
Driver Bug Workarounds
adjust_src_dst_region_for_blitframebuffer
clear_uniforms_before_first_program_use
count_all_in_varyings_packing
decode_encode_srgb_for_generatemipmap
enable_webgl_timer_query_extensions
exit_on_context_lost
msaa_is_slow
disabled_extension_GL_KHR_blend_equation_advanced
disabled_extension_GL_KHR_blend_equation_advanced_coherent
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
On Intel GPUs MSAA performance is not acceptable for GPU rasterization: 527565
Applied Workarounds: msaa_is_slow
adjust src/dst region if blitting pixels outside framebuffer on Linux Intel: 664740
Applied Workarounds: adjust_src_dst_region_for_blitframebuffer
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)
Decode and Encode before generateMipmap for srgb format textures on Linux Mesa ANGLE path: 634519
Applied Workarounds: decode_encode_srgb_for_generatemipmap
Expose WebGL's disjoint_timer_query extensions on platforms with site isolation: 808744, 870491
Applied Workarounds: enable_webgl_timer_query_extensions
Some drivers can't recover after OUT_OF_MEM and context lost: 893177
Applied Workarounds: exit_on_context_lost
ANGLE Features
allow_compressed_formats (Frontend workarounds): Enabled: true
Allow compressed formats
disable_anisotropic_filtering (Frontend workarounds): Disabled
Disable support for anisotropic filtering
disable_program_binary (Frontend features) anglebug:5007: Disabled: 
<SNIP!>
...
<SNIP!>
Device Performance Information
Log Messages
[17135:17135:1001/094454.627605:ERROR:sandbox_linux.cc(374)] : InitializeSandbox() called with multiple threads in process gpu-process.
[17135:17135:1001/094454.630728:ERROR:vulkan_device_queue.cc(217)] : Vulkan: Intel(R) UHD Graphics 620 (WHL GT2)

编辑:

好吧,这可能比我最初想象的要深奥。Ubuntu 具有省电、平衡和性能等性能设置。将其设置为性能效果很好,一切似乎都很正常。但检查调节器:

sudo apt-get install cpufrequtils

检查调节器 cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor powersave powersave powersave powersave powersave powersave powersave powersave

我将调节器设置为性能,现在它看起来运行得更好了:

sudo nano /etc/default/cpufrequtils

并设置:

GOVERNOR="performance"

然后重启服务

sudo systemctl restart cpufrequtils

编辑 2:按照 Michal Przybylowicz 的说法,解码器似乎不是硬件解码器?这是怎么回事?为什么 chome 或 ubuntu 不使用硬件解码器? 在此处输入图片描述

编辑 2.5:这是 vainfo 的输出:

vainfo
libva info: VA-API version 1.10.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_10
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.10 (libva 2.10.0)
vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 21.1.1 ()
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointEncSliceLP
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointEncSliceLP
      VAProfileJPEGBaseline           : VAEntrypointVLD
      VAProfileJPEGBaseline           : VAEntrypointEncPicture
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSliceLP
      VAProfileVP8Version0_3          : VAEntrypointVLD
      VAProfileHEVCMain               : VAEntrypointVLD
      VAProfileHEVCMain10             : VAEntrypointVLD
      VAProfileVP9Profile0            : VAEntrypointVLD
      VAProfileVP9Profile2            : VAEntrypointVLD

编辑3:尝试使用--enable-features = VaapiVideoDecoder运行它后,我得到:

google-chrome --enable-features=VaapiVideoDecoder
MESA-INTEL: warning: Performance support disabled, consider sysctl dev.i915.perf_stream_paranoid=0

[11790:11790:1003/113422.312061:ERROR:sandbox_linux.cc(374)] InitializeSandbox() called with multiple threads in process gpu-process.
[11790:11790:1003/113422.314845:ERROR:vulkan_device_queue.cc(217)] Vulkan: Intel(R) UHD Graphics 620 (WHL GT2)
Fontconfig error: Cannot load default config file: No such file: (null)
Fontconfig error: Cannot load default config file: No such file: (null)
Fontconfig error: Cannot load default config file: No such file: (null)
Fontconfig error: Cannot load default config file: No such file: (null)
Fontconfig error: Cannot load default config file: No such file: (null)

这个问题是怎么回事:

MESA-INTEL: warning: Performance support disabled, consider sysctl dev.i915.perf_stream_paranoid=0

我在加载 retroarch 时也看到了这一点,我尝试在设置后启动 chromesysctl dev.i915.perf_stream_paranoid=0但没有任何变化,仍然是 sw 解码器。

看起来其他人也遇到了同样的问题: https://www.reddit.com/r/chrome/comments/n6qywt/hardware_acceleration_fail_in_chrome_on_linux/

相关内容