High cpu usage when playing video in firefox

Im just play youtube video in 1080p and my cpu usage is around 50 - 70& it that normal?
image

What’s your cpu and gpu?

inxi -Fxxxza

You probably don’t have hardware acceleration activated. Please provide us with your hardware information.

With AMD GPUs you can enable hardware acceleration according to the Arch Wiki.

I personally have a user.js file, that enables hardware accerlation in my current Firefox profile. Create a file user.js and copy it to your current used Firefox profile folder in ~/.mozilla/firefox/. Usually your current profile has the string release inside it. This should be the content of the user.jsfile:

user_pref(“gfx.webrender.all”, true);
user_pref(“media.ffmpeg.vaapi.enabled”, true);
user_pref(“media.ffvpx.enabled”, false);
user_pref(“media.rdd-vpx.enabled”, false);
user_pref(“media.navigator.mediadatadecoder_vpx_enabled”, true);

Those lines are the options that need to be set, according to the arch wiki.

Also, if you use X11, you need to set the environment variable like this:

MOZ_X11_EGL=1

For Wayland like this:

MOZ_ENABLE_WAYLAND=1

All of this assumes you have an AMD GPU with VA-API support, according to the wiki, and you also need to install the libva-mesa-driver package. Maybe this might help some others, too.

For Nvidia GPUs, which only support VD-PAU outside of the open source Nouveau driver, there seems to be a translation layer. But I don’t have any experience with that, so if you have an Nvidia GPU, we just need to see if that works. For Intel’s integrated graphics, the mentioned user.js will work, but you need a different VA-API driver package (see the wiki).

If you have questions and problems along the way, just ask them!

CPU:
Info: Dual Core model: Intel Core i3-6006U bits: 64 type: MT MCP
arch: Skylake family: 6 model-id: 4E (78) stepping: 3 microcode: EA cache:
L2: 3 MiB
flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
bogomips: 15999
Speed: 736 MHz min/max: 400/2000 MHz Core speeds (MHz): 1: 736 2: 749
3: 733 4: 739
Vulnerabilities: Type: itlb_multihit status: KVM: VMX disabled
Type: l1tf
mitigation: PTE Inversion; VMX: conditional cache flushes, SMT vulnerable
Type: mds mitigation: Clear CPU buffers; SMT vulnerable
Type: meltdown mitigation: PTI
Type: spec_store_bypass
mitigation: Speculative Store Bypass disabled via prctl and seccomp
Type: spectre_v1
mitigation: usercopy/swapgs barriers and __user pointer sanitization
Type: spectre_v2 mitigation: Full generic retpoline, IBPB: conditional,
IBRS_FW, STIBP: conditional, RSB filling
Type: srbds mitigation: Microcode
Type: tsx_async_abort status: Not affected
Graphics:
Device-1: Intel Skylake GT2 [HD Graphics 520] vendor: ASUSTeK driver: i915
v: kernel bus-ID: 00:02.0 chip-ID: 8086:1916 class-ID: 0300
Device-2: NVIDIA GM108M [GeForce 920MX] driver: N/A
alternate: nouveau, nvidia_drm, nvidia bus-ID: 01:00.0 chip-ID: 10de:134f
class-ID: 0302
Device-3: Chicony USB2.0 VGA UVC WebCam type: USB driver: uvcvideo
bus-ID: 1-6:4 chip-ID: 04f2:b52b class-ID: 0e02 serial:
Display: x11 server: X.org 1.21.1.1 compositor: kwin_x11 driver:
loaded: intel unloaded: fbdev,modesetting,vesa
resolution: <missing: xdpyinfo>
Message: Unable to show advanced data. Required tool glxinfo missing.

I use nvidia, what first step i should do?install the driver?

sorry i ask basic question, i very confused

You are using a notebook with an Nvidia GPU and a Intel CPU, right?

I’m not so sure how it works in that case. Maybe you could try to install the intel driver intel-media-driver and see if the hardware acceleration will work through your Intel’s CPU. So install the packages intel-media-driver and libva-utils. After that run vainfo inside a terminal and post the output inside this thread.

Do you have a setup so you can switch between the Nvidia and the Intel GPU?

@Kresimir

Device-2: NVIDIA GM108M [GeForce 920MX] driver: N/A
alternate: nouveau, nvidia_drm, nvidia bus-ID: 01:00.0 chip-ID: 10de:134f

Does that mean there is no Nvidia driver installed and it uses the Nouveau driver by default? Or is the Nvidia GPU not active at all?

@I0F, I haven’t the foggiest idea. I never used a system with two graphics cards, and it’s been a few months since I’ve used an Nvidya card, so I don’t remember what inxi said about the driver.

Oh, I can’t tell you how glad I am I don’t have to deal with this Nvidya :ox: :poop: any more.

I have a similar system (but no NVIDIA graphics):

$ inxi -CGxxxz
CPU:
  Info: Dual Core model: Intel Core i3-6006U bits: 64
  type: MCP arch: Skylake rev: 3 cache: L2: 3 MiB
  flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3
  vmx
  bogomips: 8003
  Speed: 776 MHz min/max: 400/2000 MHz Core speeds (MHz):
  1: 776 2: 762
Graphics:
  Device-1: Intel Skylake GT2 [HD Graphics 520] vendor: Dell
  driver: i915 v: kernel bus-ID: 00:02.0 chip-ID: 8086:1916
  class-ID: 0300
  Device-2: Realtek Integrated_Webcam_HD type: USB
  driver: uvcvideo bus-ID: 1-5:2 chip-ID: 0bda:5769
  class-ID: 0e02 serial: <filter>
  Display: wayland server: X.org 1.21.1.1
  compositor: kwin_wayland driver: loaded: intel
  unloaded: fbdev,modesetting,vesa
  resolution: <missing: xdpyinfo>
  Message: Unable to show advanced data. Required tool
  glxinfo missing.
$ 

I too get around CPU usage of about 50% for the video you showed. The higher the video quality used, the higher the CPU usage especially for low-spec machines. So I feel there’s nothing abnormal.

I usually use a lower video quality, turn off live chat, and use uBlock origin.

Well, it’s normal because you don’t use hardware acceleration. The downside of doing software acceleration, is, that you don’t have your CPU available for other tasks. So if you watch a video and do something that needs CPU computing power, it will lead to stuttering of your video and the task you want to do on the side will take longer.

Also it will lessen the power consumption, afaik.

Your setup also seems like you could do hardware acceleration with the mentioned arch wiki link as a base.

Video hardware acceleration aside (which should be the main culprit): In my experience Youtube chat has a notable impact on slower machines too. Just hiding it helps somewhat.

hey its work for me! But i want to using the nvidia gpu, why my driver can’t installed i already run this command

nvidia-installer-dkms -b

but the inxi -CGxxxz output

Device-2: NVIDIA GM108M [GeForce 920MX] driver: N/A bus-ID: 01:00.0

how i can install the driver correctly?

hey its work for me!

Good to hear.

The problematic thing with Nvidia GPUs inside a notebook, is, that you need to setup your system the right way, so it uses the right GPU. Or to be more precise, you need to be able to switch between what is used.

There are some threads in the wiki you should read first. My guess is, this thread would probably apply to you, but I personally have no experience with that. Also there are some thread on this forum with that topic. If you can’t get a foothold with this, you should create a new thread about that issue.

Thx a lot! For helping me

1 Like

You normally only need to install Nvidia. After that you can install Optimus if you want to use Intel only, hybrid or Nvidia.

The way it works is that without any Nvidia driver your computer will only use the Intel graphics. If you try to connect an external monitor it commonly does not work, until you install Nvidia driver, then it will activate that GPU.

If you want to activate Nvidia on the laptop screen, you use Optimus to switch the card, which will log you out and back in.

If you have enough with that nonsense, as alternative you could switch off the Intel altogether and only run on discrete Nvidia GPU. You can normally do this in the bios setting under display. But need to blacklist Intel at boot in grub so it uses only Nvidia. Beware more battery drain and you can run into driver problems on update, making potentially boot to black screen. The easiest is to go back to bios, tenable hybrid and go troubleshoot driver. Alternatively you could try and fix things from cli.

1 Like

Not sure about this option, just make sure you do not install bumblebee…

if you want to use that script it should be

sudo nvidia-installer-dkms

Reboot…

https://discovery.endeavouros.com/nvidia/nvidia-installer/2021/03/

Then install optimus-manager via yay on AUR.

I’ve tried sudo nvidia-installer-dkms but i got black screen this my thread and i solved by reinstall using nvidia-installer-dkms -b I think i installed correctly and i just realize my nvidia driver not installed yet

Ok. I would remove that first.

Then you could try

sudo pacman -S nvidia-dkms

Reboot and see if no black screen and Nvidia driver installed by posting inxi output. I also ran into trouble with the nvidia-installer script this week. Perhaps @joekamprad can have a look, could be something to do with recently updated Nvidia driver.

Strangely, just installing nvidia-dkms and nvidia-settings worked for me. Then you should be able to use Nvidia on external monitor. Or additionally install Optimus as mentioned above.

(In case the screen goes black, worst case tty and remove nvidia-dkms and reboot via nouveau driver to further troubleshoot.)

Hey that’s work!
thank you for helping me, I just need to install optimus.

inxi -CGxxxz              
CPU:       Info: Dual Core model: Intel Core i3-6006U bits: 64 type: MT MCP arch: Skylake rev: 3 cache: L2: 3 MiB
           flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 15999
           Speed: 500 MHz min/max: 400/2000 MHz Core speeds (MHz): 1: 500 2: 500 3: 501 4: 500
Graphics:  Device-1: Intel Skylake GT2 [HD Graphics 520] vendor: ASUSTeK driver: i915 v: kernel bus-ID: 00:02.0
           chip-ID: 8086:1916 class-ID: 0300
           Device-2: NVIDIA GM108M [GeForce 920MX] vendor: ASUSTeK driver: nvidia v: 495.44 bus-ID: 01:00.0 chip-ID: 10de:134f
           class-ID: 0302
           Device-3: Chicony USB2.0 VGA UVC WebCam type: USB driver: uvcvideo bus-ID: 1-6:4 chip-ID: 04f2:b52b class-ID: 0e02
           serial: <filter>
           Display: x11 server: X.org 1.21.1.1 compositor: kwin_x11 driver: loaded: intel,modesetting unloaded: fbdev,vesa
           resolution: <missing: xdpyinfo>
           OpenGL: renderer: Mesa Intel HD Graphics 520 (SKL GT2) v: 4.6 Mesa 21.2.4 direct render: Yes

1 Like

Can you clarify? Did you just install Optimus, or deinstalled also your bumblebee install and reinstalled nvidia-dkms?

Note you shouldn’t run bumblebee and Optimus head to head that will create some conflicts.

Would be good to either mark a post or write down steps and mark your post as solved so that it appears on top of your thread for future users that may run into similar issues with same hardware…

Edits: sorry, saw that you solved multiple problems, the thread title is solved. Perhaps split next time into different topics.