7

I am having an issue watching hd (720 or 1080) videos on Ubuntu 21.04 fresh install. I get really high cpu usage (50% on all cores) which is pretty high for a 720p vid. I tried watching the same video on vlc (hw acceleration) and it works perfectly fine. I even tried a 4k video and it works fine cpu usage < 20%. Why is chrome consuming so much cpu?

flags enabled: enter image description here

Here is what I have tried: sudo apt install intel-media-va-driver

CPU usage on vlc with 4k video h265, vlc is on second line, gnome for some reason takes a HUGE screenshot (6MB, had to compress): enter image description here

CPU usage chrome + youtube: enter image description here Stats for nerds: enter image description here

On my laptop I have an intel 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

I have enabled hw acceleration on 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)

EDIT:

Okay, this may be something more deep than I originally thought. Ubuntu has performance settings powersave, balanced, and performance. Setting it to performance works great and everything seems normal. But checking the governer:

sudo apt-get install cpufrequtils

Check the governer cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor powersave powersave powersave powersave powersave powersave powersave powersave

I set the governer to performance and now it looks to be working much better:

sudo nano /etc/default/cpufrequtils

and setting:

GOVERNOR="performance"

Then restarting the service

sudo systemctl restart cpufrequtils

EDIT 2: Following along with what Michal Przybylowicz said, it looks like the decoder is not a hardware decoder? What is going on here? Why isnt chome or ubuntu using the hardware decoder? enter image description here

EDIT 2.5: Here is the output of 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

Edit 3: after trying to run it with --enable-features=VaapiVideoDecoder I got:

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)

and whats up with this issue:

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

I also saw this when loading retroarch, I tried launching chrome after setting sysctl dev.i915.perf_stream_paranoid=0 and it made no change, still sw decoder.

It looks like others have been having the same issue: https://www.reddit.com/r/chrome/comments/n6qywt/hardware_acceleration_fail_in_chrome_on_linux/

Kevin
  • 265
  • 3
  • 12
  • Could you check if firefox also consumes that much CPU? – Archisman Panigrahi Oct 01 '21 at 14:16
  • 1
    @ArchismanPanigrahi firefox is exactly the same 40+% cpu – Kevin Oct 01 '21 at 14:19
  • Are you sure h265 is used by youtube? Last time I checked, there were VC1, VP9 and AVC. Now your screenshots lack youtube's "stats for nerds", or links, so I can only guess it pays a VC1 video, which needs newer hardware. – mikewhatever Oct 01 '21 at 14:27
  • I never said h265 was used by yt, but rather h265 is being used by vlc (the video is encoded in h265). How can I check if it plays a vc1 (or any other codec?) – Kevin Oct 01 '21 at 14:36
  • @mikewhatever I added a screenshot with stats for nerds – Kevin Oct 01 '21 at 14:43
  • Well, it says AVC1, aka h264, which is supported by your hardware. – mikewhatever Oct 01 '21 at 14:50
  • @mikewhatever exactly, why could the browser be consuming so much cpu. Any ideas? – Kevin Oct 01 '21 at 14:57
  • Not sure. I am not a big fan of Chrome, so let's see what others have to say. – mikewhatever Oct 01 '21 at 16:30
  • To verify if Hardware Video Acceleration actually works open Dev Tools -> (three dots) -> More Tools -> Media. Now open Media tab click on video that is currently being played and check "Decoder Name" should be "VDAVideoDecoder" and "Hardware decoder" should be "true". – Michal Przybylowicz Oct 03 '21 at 14:43
  • @MichalPrzybylowicz I dont see this menu? Where is dev tools? On chome to get to developer tools you need to click on 3 dots first. – Kevin Oct 03 '21 at 14:50
  • Click F12 or use right mouse click and "inspect". This will open a panel called developer tools. – Michal Przybylowicz Oct 03 '21 at 14:55
  • 1
    @MichalPrzybylowicz I have updated the question. Looks like you had a good hunch, decoder is not hw – Kevin Oct 03 '21 at 15:00
  • @Kevin Can You also update Your question with the output of `vainfo` command. – Michal Przybylowicz Oct 03 '21 at 15:03
  • @Kevin Run the browser from command line with this parameter and see if that changes anything `--enable-features=VaapiVideoDecoder`. – Michal Przybylowicz Oct 03 '21 at 15:11
  • @MichalPrzybylowicz just tried it, gave similar error when I tried retroarch. – Kevin Oct 03 '21 at 15:42
  • @Kevin Read through this [article](https://www.linuxuprising.com/2021/01/how-to-enable-hardware-accelerated.html) and see if something is missing on Your installation. – Michal Przybylowicz Oct 03 '21 at 18:20
  • @MichalPrzybylowicz Looks like its still broken? I tried the site and nothing worked. Found this: https://www.reddit.com/r/chrome/comments/n6qywt/hardware_acceleration_fail_in_chrome_on_linux/ others having same issue – Kevin Oct 04 '21 at 21:50

0 Answers0