Jump to content

Limits of i5-3320M for streaming 1080p60 on Linux

Go to solution Solved by thorgim,

It seems like putting the ThinkPad X230 out of its docking station (which is blocking the exhaust fan) seems to help keep the temperatures 10 degrees Celsius lower and prevents the idle injection temperature control mechanism from kicking in. Therefore most of the available CPU remains for the video processing and the 1080p60 video is played back smoothly. So no reason to get a new laptop yet.

Thanks @Dutch_Master, your hint to run top as root and to check dmesg lead me to spot the idle injection. I was suspecting something like that but never found evidence. If I still run into issues, I'll make sure to leverage the plugins @redteam4ever pointed to, thanks for that as well.

Trying to enjoy the occasional Twitch stream or YouTube video in 1080p60 in Firefox or Chromium on my Ubuntu ThinkPad with an i5-3320M and 16GB of RAM, I run into the issue that all four CPU cores are at maximum load.

Is this a driver issue, am I having issues with en-/disabled hardware encoding or is this simply the limit of the CPU with its integrated GPU that I'm hitting? When I reduce to 720p60 the four cores are sitting around 80-90% load but also causing some stuttering.

sensors output is as follows, so warm but not crazy, I'd say

coretemp-isa-0000
Adapter: ISA adapter
Package id 0:  +80.0°C  (high = +87.0°C, crit = +105.0°C)
Core 0:        +80.0°C  (high = +87.0°C, crit = +105.0°C)
Core 1:        +77.0°C  (high = +87.0°C, crit = +105.0°C)

acpitz-virtual-0
Adapter: Virtual device
temp1:        +82.0°C  (crit = +103.0°C)

thinkpad-isa-0000
Adapter: ISA adapter
fan1:        5464 RPM

Let me know if I can provide additional information.

Link to comment
Share on other sites

Link to post
Share on other sites

The package manager in Ubuntu has several firmware packages that may or may not be installed on your system. Probably most in the free repo will be installed, but the non-free packages might be missing. See if you can find them, check whether or not they're installed (and install them if not) and see if it makes a difference.

 

Interesting logs are from the dmesg and top tools.

sudo top #use q to quit
sudo dmesg | tail -n 20

The last command gives you the last 20 lines from the dmesg file. Note, this doesn't work for top!

"You don't need eyes to see, you need vision"

 

(Faithless, 'Reverence' from the 1996 Reverence album)

Link to comment
Share on other sites

Link to post
Share on other sites

This is a video acceleration problem. All GPUs nowadays have a video acceleration hardware built-in. The problem with older devices is that new codecs pop up and older hardware doesn't have the support for these newer codecs. YouTube switched to VP9 which is hardware decoded only on Kaby Lake Apollo Lake iGPUs and newer. This means that the decoding will be CPU only and that's why you see stuttering and 100% load.

 

There is a browser extension that can switch YouTube videos back to h264 which is hardware accelerated on most computers, it's called h264ify. Search your browser extension store, it's available for Chrome and Firefox. You can see the used codec by right clicking the YouTube video and choosing Stats for nerds.

Edited by redteam4ever
Clarity and some mistyped characters, compatibility info correction with source

My heart belongs to AMD but that doesn't mean I furiously hate Intel or NVIDIA :)

 

MAIN RIG AMD Ryzen 7 1700 | ASRock Fatal1ty X370 Gaming-ITX/ac | MSI HD7950 OC 3GB | G.Skill Ripjaws V 2x8GB @ 2666MHz (Samsung D-Die) | ADATA SX8200 480GB NVMe SSD & Seagate Barracuda 120 1TB SSD & WD Black 500GB | Sharkoon QB One

 

LAPTOP Lenovo Yoga Slim 7 (14ARE05) - AMD Ryzen 5 4500U | AMD Vega 8 (Renoir) | 16GB RAM | SKHynix PC601 512GB (OEM) | 1080p 300nit non-touch display

Link to comment
Share on other sites

Link to post
Share on other sites

top for 1080p60 scenario

Tasks: 387 total,   5 running, 300 sleeping,   0 stopped,   3 zombie
%Cpu(s): 48,2 us, 37,2 sy,  0,0 ni, 12,4 id,  1,1 wa,  0,0 hi,  1,1 si,  0,0 st
KiB Mem : 16118044 total,   398896 free,  6787532 used,  8931616 buff/cache
KiB Swap: 16494588 total, 16429176 free,    65412 used.  7198064 avail Mem 

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND                           
22394 user1     20   0 9586992 595416 204656 R 100,6  3,7  43:39.33 Web Content                       
29278 root     -51   0       0      0      0 R  49,4  0,0  11:56.47 kidle_inj/0                       
29281 root     -51   0       0      0      0 R  49,4  0,0  11:56.38 kidle_inj/3                       
29279 root     -51   0       0      0      0 R  49,0  0,0  11:56.40 kidle_inj/1                       
29280 root     -51   0       0      0      0 S  49,0  0,0  11:56.39 kidle_inj/2                       
 3477 root      20   0  712404 194272 148592 S  21,4  1,2 759:16.29 Xorg                              
 4413 user1     20   0 1680952 340024  72512 S  15,3  2,1 601:59.59 compiz                            
 4012 root      20   0  729756  37588  14380 S  12,0  0,2  83:08.92 snapd                             
20356 user1     20   0 1155956 386004 336132 S   8,4  2,4  17:34.15 GPU Process                       
20325 user1     20   0 3689916 511956 166092 S   5,8  3,2  30:54.64 firefox                           
 4434 user1     20   0  941572  47308  40368 S   4,2  0,3 164:27.42 pulseaudio                        
20548 user1     20   0 32,661g 250992 112540 S   3,6  1,6   7:23.08 WebExtensions                     
25199 user1     20   0 3000628 276876 148388 S   2,9  1,7   3:26.11 Web Content                       
25891 user1     20   0  826372  75232  18752 S   2,9  0,5  12:12.96 plugin_host                       
29065 user1     20   0  549392  65140  42392 S   2,9  0,4   1:41.56 gnome-system-mo                   
14160 user1     20   0 1258636 233612 103772 S   1,3  1,4   2:45.16 Discord                           
27183 user1     20   0 1012432 299080 141936 S   1,3  1,9  17:52.77 signal-desktop                    
13597 user1     20   0 3021936 229604 116088 S   1,0  1,4   2:06.31 spotify                           
  678 root      20   0       0      0      0 S   0,6  0,0   2:48.62 dmcrypt_write                     
30186 root      20   0   43608   4016   3296 R   0,6  0,0   0:00.09 top                               
  663 root       0 -20       0      0      0 I   0,3  0,0   0:47.08 kworker/3:1H                      
  728 root      20   0       0      0      0 S   0,3  0,0   2:53.64 jbd2/dm-1-8                       
 3444 gnunet    20   0   30740   2728   2452 S   0,3  0,0   4:10.44 gnunet-service-                   
 4264 user1     20   0 1610088  61056  37460 S   0,3  0,4  17:37.96 unity-settings-                   
20445 user1     20   0 3251680 300524 196144 S   0,3  1,9   7:21.01 Web Content                       
25865 user1     20   0 1640980 395804  66076 S   0,3  2,5   1:08.14 sublime_text                      
27110 user1     20   0 1539184 769416 107088 S   0,3  4,8   5:45.38 signal-desktop                    
27151 user1     20   0  540256 116576  88012 S   0,3  0,7  12:44.05 signal-desktop                    
27187 user1     20   0 2718416 189728 109468 S   0,3  1,2   0:36.46 Web Content                       
27728 user1     20   0 2866572 287488 197004 S   0,3  1,8   1:26.86 Web Content                       
28142 root       0 -20       0      0      0 I   0,3  0,0   0:10.58 kworker/u17:2                     
28885 root      20   0       0      0      0 I   0,3  0,0   0:00.24 kworker/0:2                       
29087 root      20   0       0      0      0 I   0,3  0,0   0:01.90 kworker/3:2                       
29285 root       0 -20       0      0      0 I   0,3  0,0   0:02.94 kworker/u17:4                     
29358 root       0 -20       0      0      0 I   0,3  0,0   0:02.74 kworker/u17:3                     
    1 root      20   0  185984   6676   4088 S   0,0  0,0   0:20.43 systemd 

dmesg for 1080p60 scenario

[587252.575681] audit: type=1400 audit(1591359847.373:298966): apparmor="DENIED" operation="open" profile="snap.discord.discord" name="/proc/7982/cmdline" pid=14160 comm="Discord" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0
[587252.576068] audit: type=1400 audit(1591359847.373:298967): apparmor="DENIED" operation="open" profile="snap.discord.discord" name="/proc/15679/cmdline" pid=14160 comm="Discord" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0
[587252.577142] audit: type=1400 audit(1591359847.377:298968): apparmor="DENIED" operation="open" profile="snap.discord.discord" name="/proc/27861/cmdline" pid=14160 comm="Discord" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0
[587252.577415] audit: type=1400 audit(1591359847.377:298969): apparmor="DENIED" operation="open" profile="snap.discord.discord" name="/proc/30981/cmdline" pid=14160 comm="Discord" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0
[587257.573869] audit: type=1400 audit(1591359852.373:298970): apparmor="DENIED" operation="open" profile="snap.discord.discord" name="/proc/4054/cmdline" pid=14160 comm="Discord" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0
[587257.573876] audit: type=1400 audit(1591359852.373:298971): apparmor="DENIED" operation="open" profile="snap.discord.discord" name="/proc/4059/cmdline" pid=14160 comm="Discord" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0
[587257.577331] kauditd_printk_skb: 1 callbacks suppressed
[587257.577334] audit: type=1400 audit(1591359852.377:298973): apparmor="DENIED" operation="open" profile="snap.discord.discord" name="/proc/6431/cmdline" pid=14160 comm="Discord" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0
[587257.577607] audit: type=1400 audit(1591359852.377:298974): apparmor="DENIED" operation="open" profile="snap.discord.discord" name="/proc/7982/cmdline" pid=14160 comm="Discord" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0
[587257.578280] audit: type=1400 audit(1591359852.377:298975): apparmor="DENIED" operation="open" profile="snap.discord.discord" name="/proc/15679/cmdline" pid=14160 comm="Discord" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0
[587257.579610] audit: type=1400 audit(1591359852.377:298976): apparmor="DENIED" operation="open" profile="snap.discord.discord" name="/proc/27861/cmdline" pid=14160 comm="Discord" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0
[587257.580101] audit: type=1400 audit(1591359852.377:298977): apparmor="DENIED" operation="open" profile="snap.discord.discord" name="/proc/30981/cmdline" pid=14160 comm="Discord" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0
[587262.572175] audit: type=1400 audit(1591359857.369:298978): apparmor="DENIED" operation="open" profile="snap.discord.discord" name="/proc/4054/cmdline" pid=14160 comm="Discord" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0
[587262.572192] audit: type=1400 audit(1591359857.369:298979): apparmor="DENIED" operation="open" profile="snap.discord.discord" name="/proc/4059/cmdline" pid=14160 comm="Discord" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0
[587262.572609] audit: type=1400 audit(1591359857.373:298980): apparmor="DENIED" operation="open" profile="snap.discord.discord" name="/proc/4252/cmdline" pid=14160 comm="Discord" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0
[587262.574242] audit: type=1400 audit(1591359857.373:298981): apparmor="DENIED" operation="open" profile="snap.discord.discord" name="/proc/6431/cmdline" pid=14160 comm="Discord" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0
[587262.574363] audit: type=1400 audit(1591359857.373:298982): apparmor="DENIED" operation="open" profile="snap.discord.discord" name="/proc/7982/cmdline" pid=14160 comm="Discord" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0
[587288.700691] intel_powerclamp: Start idle injection to reduce power
[587292.705577] intel_powerclamp: Stop forced idle injection
[587312.726351] intel_powerclamp: Start idle injection to reduce power

 

Link to comment
Share on other sites

Link to post
Share on other sites

@redteam4ever thanks for the explanation with the codecs, that makes a lot of sense (also why my phone has no issues with 1080p60 playback 😅). The h264ify addon makes a difference but it's not enough it seems to fully prevent stutter due to reaching max load on the CPU.

 

I'm checking the non-free driver options now. Meanwhile, I'm wondering about this "kidle_inj" process and the potentially matching "Start idle injection to reduce power" in the dmesg output.

Link to comment
Share on other sites

Link to post
Share on other sites

Seems to be temperature related afterall. Let me improve the cooling situation of that closed laptop resting in a docking station (which weirdly enough is sort of blocking the fan exhaust). I'll get back to you in a bit.

Link to comment
Share on other sites

Link to post
Share on other sites

They are related. No idea where they're coming from, sorry.

(kidle_inj should be read as k-idle-inject, meaning kernel is injected with code that doesn't do anything, except taking time. There are tools to trace this, try strace, see man strace how this works)

"You don't need eyes to see, you need vision"

 

(Faithless, 'Reverence' from the 1996 Reverence album)

Link to comment
Share on other sites

Link to post
Share on other sites

It seems like putting the ThinkPad X230 out of its docking station (which is blocking the exhaust fan) seems to help keep the temperatures 10 degrees Celsius lower and prevents the idle injection temperature control mechanism from kicking in. Therefore most of the available CPU remains for the video processing and the 1080p60 video is played back smoothly. So no reason to get a new laptop yet.

Thanks @Dutch_Master, your hint to run top as root and to check dmesg lead me to spot the idle injection. I was suspecting something like that but never found evidence. If I still run into issues, I'll make sure to leverage the plugins @redteam4ever pointed to, thanks for that as well.

Link to comment
Share on other sites

Link to post
Share on other sites

26 minutes ago, thorgim said:

It seems like putting the ThinkPad X230 out of its docking station (which is blocking the exhaust fan) seems to help keep the temperatures 10 degrees Celsius lower and prevents the idle injection temperature control mechanism from kicking in. Therefore most of the available CPU remains for the video processing and the 1080p60 video is played back smoothly. So no reason to get a new laptop yet.

Thanks @Dutch_Master, your hint to run top as root and to check dmesg lead me to spot the idle injection. I was suspecting something like that but never found evidence. If I still run into issues, I'll make sure to leverage the plugins @redteam4ever pointed to, thanks for that as well.

Sorry, your first mention didn't come through, only seeing this now. I've been looking at hardware video decoding on Linux yesterday (total coincidence). The most useful resource seemed to be (as always) Arch Wiki and then I found a Debian Wiki page too.

 

For starters, I have ThinkPad Yoga 12 with Haswell i5 running Ubuntu 18.04 and Windows 10. It seems like the open and closed source Intel drivers both support hardware acceleration. Although, I haven't been able to see much improvement from h264ify on Linux either, it worked wonders on Windows - from stuttery mess and 100% CPU utilization, I can now watch 1080p60 with ~7% CPU utilization (when the video is buffered, buffering strains the CPU a lot too).

 

I believe that the small improvement on Linux comes from the fact that h264 is easier to decode on the CPU and hardware acceleration is still not working. Might be some incompatibility between the Linux drivers and kernel or something else. VP9 has better compression ratio than h264 and that's why Google started defaulting it on YouTube. Better codecs are always harder to process because the encode and decode algorithm is more advanced.

 

I haven't gone through any troubleshooting on Arch's wiki because I didn't really have a problem with it on Linux. But I think that the Arch wiki verification and troubleshooting section is worth looking into.

My heart belongs to AMD but that doesn't mean I furiously hate Intel or NVIDIA :)

 

MAIN RIG AMD Ryzen 7 1700 | ASRock Fatal1ty X370 Gaming-ITX/ac | MSI HD7950 OC 3GB | G.Skill Ripjaws V 2x8GB @ 2666MHz (Samsung D-Die) | ADATA SX8200 480GB NVMe SSD & Seagate Barracuda 120 1TB SSD & WD Black 500GB | Sharkoon QB One

 

LAPTOP Lenovo Yoga Slim 7 (14ARE05) - AMD Ryzen 5 4500U | AMD Vega 8 (Renoir) | 16GB RAM | SKHynix PC601 512GB (OEM) | 1080p 300nit non-touch display

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×