CPU overload when watching videos with Firefox (Youtube)

Hello,

Just new to Linux and Manjaro. I have been testing Linux for the past week, distro hoping a lot and stopped at Manjaro.
I am using KDE. Love Manjaro for its simplicity and ease of use. Also the availability of software through AUR is a killer.

I have noticed screen tearing with a fresh install of Manjaro KDE. As you can see below I am using a Haswell-ULT integrated graphic card using the i915 driver. Not a brand new laptop I may add :smile:

lspci -nnk | grep -i vga -A3
00:02.0 VGA compatible controller [0300]: Intel Corporation Haswell-ULT Integrated Graphics Controller [8086:0a16] (rev 0b)
        DeviceName:  Onboard IGD
        Subsystem: Dell Device [1028:05cb]
        Kernel driver in use: i915

The only resolve to my screen tearing was to add a couple of lines of code in ~./drirc.

<device screen="0" driver="dri2">
	<application name="Default">
		<option name="vblank_mode" value="0"/>
	</application>
</device>

Unfortunately, a side effect (I am calling it a side effect but may be it isn’t) is cpu overload when watching videos using Firefox. I did not find a solution to this problem and was wondering if any of you guys would know anything about this CPU overload when watching videos using Firefox on Youtube. My laptop is not a powerful one and I need to be very careful as far as resources.

The same thing happened to me.
Use cpupower-gui to control the cpu frequency
https:// wiki.archlinux.org/index.php/CPU_frequency_scaling
I currently use arch linux because I couldn’t solve that problem in manjaro.

Ouch … so dri2 only ?
I was going to suggest making sure hw-accel is working … but if its that legacy I dont know if you can leverage vaapi in firefox.

Maybe more system info will be useful:
inxi --full --admin --verbosity=7 --filter --no-host
… looks like I have the same graphics controller (same revision and driver) & don’t experience this (although memory usage is another matter).

The only things I can suggest at this point is to download the videos and view in an external player, or limit the video resolution (although you’ve probably tried that already) or maybe something like uBlock Origin might help by blocking unwanted page content.

Thanks guys for your reply. Sorry as I am new to Linux and learning as I go along…

As far as the hw-accel I seem to have it covered

grep -iE 'vdpau | dri driver' /var/log/Xorg.0.log
[    12.876] (II) intel(0): [DRI2]   DRI driver: i965
[    12.876] (II) intel(0): [DRI2]   VDPAU driver: va_gl

I still get this cpu overload when watching those videos using Youtube. I checked using Smplayer and I am still getting a high cpu hit.

@MariachiLoco
I am managing the freq but the issue is still happening even the freq is lowered.

made somewhat of a difference disabling
media.ffvpx.enabled to false
I guess when you are old, you are old…

Check if you have hardware acceleration enabled,here is a mini tutorial on Firefox - ArchWiki

1 Like

I do - See post above.
I don’t think I should be looking too hard into this.
My laptop is simply old…

Just added some options and posting for visibility. Web renderer has to be activated for compositing.
gfx.webrender.all=true (use OpenGL rendering)
Also added env variable MOZ_X11_EGL=1 to Xorg.
Down to 8% cpu utilization when watching Videos with Youtube at 1080P. I can live with that :joy:

1 Like

From ~100 ? Great.
I am glad it was that simple - dont forget to check if you still need to use dri2 :wink:

From 60%
Forgot about dri2… The thing is dri2 solved my tearing issue. Will disable it and check of the tearing is still present.

PS: Definitely overwhelming the Linux space :crazy_face:

Disable dri2 and now using va_gl. This is even working better than I would have expected due to the age of my machine. I cannot ask much more than that :relaxed:

grep -iE 'vdpau | dri driver' /var/log/Xorg.0.log        
[    12.178] (II) intel(0): [DRI2]   DRI driver: i965
[    12.178] (II) intel(0): [DRI2]   VDPAU driver: va_gl

The hardware is old enough that maybe it works better.
But if you can use/configure dri3 to work properly it would be be preferred.

PS … thats not really how I would manage it either.
Besides the dri2 and disabling vblank (disabling vertical sync), which I would avoid if possible…
You probably want to use Xorg config.
Please see this link for more: Intel graphics - ArchWiki

But here are 2 examples …

  1. This is just a mirror of what you already posted, but in xorg config file:
    /etc/X11/xorg.conf.d/20-intel.conf
Section "Device"
  Identifier "Intel Graphics"
  Driver "intel"
  Option "DRI" "2"
  Option "VSync" "false"
  ## you may even want the older accel method
  #Option "AccelMethod" "uxa"
EndSection
  1. Something closer to what I would suggest generally would be something like this:
    /etc/X11/xorg.conf.d/20-intel.conf
Section "Device"
  Identifier "Intel Graphics"
  Driver "intel"
  Option "TearFree" "true"
EndSection

But for more info see the rest of the archwiki page from the link.


(EDIT)

Oh great. Well … I hope some of the above is instructive anyways. Cheers.

Thank you for your help.
I read the entire wiki regarding the tearing issue and high cpu overload. I had configure X11 the same way you have described it (Ref ArchWiki) the second time around. The first time around I had used dri2 and disabled the vblank. Both got rid of the tearing… I have now got rid of dri2.

On a side note, I am wondering if the tweaks that came after to palliate the cpu overload when watching videos are not as effective to correct the tearing ? Essentially using hw-accel through vaapi with Firefox…

I am sorry I am not sure I follow.
They are different things but can/should be used in conjunction.
Without hardware accel, but with powerful enough hardware you might still get obnoxious cpu usage - but not enough to bother your workflow, and not necessarily tearing.
On the other hand, intels ‘tear-free’ option and its gpu could be working as well as they can, but arent being properly leveraged in the browser.
In any case at the end … with older/weaker hardware you are often in a position of needing to squeeze out a few more horses, or to make sure to set that one funny config for that one funny model, etc.

Oddly enough here it seems to actually be a case of it generically working pretty well, even with the defaults (“TearFree” should be default if all other things are working) - just needed firefox to use hardware instead of translating slowly through the software.

Thanks for your explanation. The learning curve is steep on my side :pleading_face:
My first issue was the tearing. For ex, when I was scrolling a page using Firefox, I was seeing tearing of the page. I decided to investigate and digging some more, I found the Arch wiki. Changed X11 config according the the said wiki. A side effect after that change was a massive load on my CPU while watching videos using Youtube with Firefox and SMPlayer. I decided then to go the route of using vaapi. To make it short, installed driver and changed Firefox config. Out of curiosity (I am very curious…), I was wondering if the vaapi protocol could not resolve the tearing I had in the first place…From your answer, I gather the tearing and the hw-accel are two different things…
In any case and not to overwhelm me much more, everything is now working as expected and seriously a 1000 times better than when I had windows running on this old laptop… I am quite happy… :smiley:

I did this but I was confused at first how to do it.

Its:
about:config in the address bar of Firefox and search the the term.