High Power Consumption with Firefox

Product Information:

  • Which OS (Operating System)? - endeavourOS (Arch-based)
  • Which release of your OS (Operating System / Windows 10, 11, Distribution of Linux)? - Rolling
  • Which Framework laptop (11th, 12th or 13th generation Framework laptop) are you asking for support with? - Framework 16 DIY (Ryzen 7 7840HS)
  • If this is a Linux issue, please use the Linux tag or at least put Linux in the title. - Done.
  • If there is no information pertaining to your issue or question, please let us know here: Framework | Support Framework | Fix Consumer Electronics - N/A

tl;dr - Firefox is using significant amount of CPU (6-8% with the Firefox home tab, average 3Ghz CPU clock) when open on the current virtual desktop. Powertop to report 25-35w (sometimes more) and also corroborates the high CPU usage. When moving to another virtual desktop, CPU usage drops and powertop reports 10-15w power consumption (the 15w is the upper end, it seems to drop the longer I go without Firefox on the virtual desktop; it seems to be around 10-12w usually).


I received my Framework 16 laptop recently, and was a little disappointed with the battery life. I did a fresh install of endeavourOS on this machine.

With the Balanced power profile and some light web browsing, listening to music (with wired headphones only and Bluetooth disabled), and basic system configuration activity, I am getting at best about 4-5 hours, and the machine runs pretty hot (45-50c) with the fans regularly blowing out hot air.

I read a thread where many people reported on Arch Linux that at idle, their machine was using around 10-15w of power. I installed powertop and found that my machine is using 25-35w (sometimes more) with just powertop running with Firefox in the background. This is going by the “The battery reports a discharge rate of 29.6 W” message on powertop.

I decided to test this idling at a different virtual desktop, and found that on displays without Firefox open, the reported usage drops drastically down to - surprise - 10-15w! Using a few different System Monitor tools I can see that Firefox is using significant CPU time for being idle with the Firefox homepage tab (6-8% for just this, although never much more even with more tabs and pages opened). Powertop shows many of its processes. Simply having Firefox focused for a while and then checking Plasma System Monitor shows that it is usually using about 8% of my CPU. CPU clock is all over the place with Firefox opened, peaking at about 3.2Ghz and only going down so low as about 2.4Ghz.

With all of this, I believe Firefox to be using significant CPU time, impacting the power usage of this laptop. I have not tested the machine with Firefox closed to know for sure, but if powertop can be trusted to be reporting accurately / if I am reading it correctly, then the lower CPU usage+clock speed and thus power usage in powertop being cut by a third with Firefox not in use, I am assuming that Firefox is the culprit of my power drain.

I am not interested in using Chrome or a Chromium-based browser, as I intentionally switched to Firefox some years back on my PC and previous laptop which did not have power consumption issues. I have tried Firefox and Firefox Developer Edition (the latter is my preferred), but both seem to have this problem.

Is there a way I can check if specific extensions are causing power drain, or further diagnose the issue? Or perhaps others have hit this and there is a setting I can change in about:config? Any troubleshooting advice would be appreciated!

1 Like

Recent version of firefox can show you some resource usage info with about:processes .
Check it out.

1 Like

Thanks! This has given me some direction.

I can see that it is simply the “Firefox Developer Edition” process that is using the most amount of power.

When using the profiler, I can see that it is “RefreshDriver Tick” that is using the power, it says 7.9% on this time around (although it’s been as low as 6% and as high as 10%). Inside of that, it is the “Paint” process.

This makes me think that it is the high refresh rate of the Framework display using the power. Adaptive Sync was set to “Automatic” in the Plasma Display Settings, which is the default and what it is set to on my PC. Power usage was not really affected by changing it to “Automatic”.

Changing the display refresh rate down to 60hz did reduce power consumption significantly, down to around 18w consistently with Firefox opened in a brief test. Unsure if it is just wishful thinking about.

This is still quite high though I would imagine; 18w simply with Firefox being opened, and this Framework community tab? The internal page you mentioned did show that the tab was using very little resources, it was the top “Firefox Developer Edition” process using the most resources by a longshot, and likely as a result of the refresh rate.

I checked other applications such as the Steam Client which uses XWayland and can render at 165hz (and Steam uses CEF so it has Chromium-based rendering), and while resource usage was higher, it was at most about 12w while watching game trailers and scrolling around. So it seems the high resource usage is specific to Firefox. I was able to get Steam with excessive scrolling on the store page to use a lot of CPU, over 15% with excessive and ridiculous loading of images. Under regular usage though, and on the main library page and not the Store Page, resource usage was around 2-3%, whereas Firefox with the same is 6%+

1 Like

I looked up what “Firefox Developer Edition” is. It looks like it it is ahead of the beta branch and has extra developer features. All that, possible new unrefined/buggy code and possibly extra debugging code etc enabled may be using a lot more cpu than the standard release branch versions. Perhaps try a standard release version of firefox and see if cpu/power usage is less than with the developer edition.

Sorry, I did mention in my OP that I already tried regular Firefox and it has the same behaviour. Regular Firefox is on 127.0.1 at time of writing, Firefox Developer Edition is on 128.0b6. Both are installed from the Arch repos.

CPU usage is the same across Firefox and Firefox Developer Edition, with the same usage information seen across both; The Firefox process profiler shows “RefreshDriver Tick” is using the most CPU for both.

Oops. I missed that. Sorry.
I’m no expert by any means and wanted to suggest the “about:process” page.
Hopefully others can chime in with some better help.
Good luck.

Oh, for a reference to compare, on my intel 11th gen fw13 running pop-os 22.0.4 with kernel 6.6.10 and firefox 127.0.1 with 4 web sites open and the editor window for this message open, I’m seeing cpu for firefox-bin in top -p $(pgrep -d , firefox) below 1.0% 90% of the time over a couple of minutes with a quick burst every 20 - 30 seconds up to 2.5% to 4% cpu. This is “idle” with firefox in the foreground but no keyboard or mouse activity.
Moving the mouse around over the firefox window with this forum window open kept cpu usage for firefox-bin between 30% and 39%.
Cpu usage for firefox-bin is significantly higher when about-process is open as well.
USB power supply was connected so any power profile stuff may be set to higher performance.

Good luck tracking down settings to improve power.

1 Like

Sounds like Firefox is damaging your Firefox window and thus redrawing it every frame! There may be some esoteric fix in about:config, but I’d recommend trying out some Firefox forks or Chromium forks in the meantime to see if they have the same issues!

Best of luck!

Something you might check is whether Firefox or pipewire are spinning up the dGPU and keeping it awake even if not using it.

Additionally if you have any sensor management software running it could keep dGPU awake to get to read sensors from it.

Thanks, but I don’t have a dGPU, just the standard iGPU. I should’ve mentioned this in my post, apologies.

I have tried out Ungoogled Chromium and it sadly has too many issues to be usable. Other Chromium-based browsers like Brave and Vivaldi have the same problems. And standard Chromium has the same problem as Ungoogled Chromium. Interestingly, Electron applications work fine.

As for Firefox forks, I will look around and see if there are any that fix the issue.

It sounds like your distro maintainers forgot to enable the use of hardware acceleration in firefox! You can maybe switch to a version like librewolf that often has saner default and more optimisations than firefox to see if this fixes the problem, but else you can compile firefox forcing optimisations on gentoo by forcing the use of hardware acceleration with the hwaccel flag, see this page for more details (CTRL+F for hwaccel): Firefox - Gentoo wiki. Your hardware is a little too new for firefox it seems, so firefox is defaulting back to software rendering which uses a LOT more power as it cannot detect what type of hardware you use! The good news is that it might go away on its own in a few months when drivers/support is added. Make sure the AMD driver is well installed, and your system is up to date, including kernel and all other software, use the dev version. If that fails, then, maybe you can try to compile firefox with forced hardware acceleration, or maybe there is a flag for that in about:config!

Librewolf install:

sudo pacman -Syu --needed git base-devel
git clone https://aur.archlinux.org/librewolf.git
cd librewolf
<apply patch here, modify MAKEPKG or manually do the MAKEPKG steps and in between them apply the patchs>
makepkg -si

Here is the build for firefox ESR, (doesn’t matter if the version and type don’t match that is the same software anyways): firefox-115.12.0.ebuild « firefox « www-client - repo/gentoo.git - Official Gentoo ebuild repository

CTRL+F for hwaccel and manually apply that before the MAKEPKG!

Also from the gentoo forum, don’t forget to search on arch and gentoo forums for use cases like these:

I recently found setting media.webrtc.hw.h264.enabled to true helped, though I didn’t get as far as checking the debug trace to see what was happening.

Source: Gentoo Forums :: View topic - [Solved] HW accel. works on firefox-bin, but not on firefox
Also: Cant find "disable hardware Acceleration" option in Advance settings | Firefox Support Forum | Mozilla Support

Firefox is using hardware acceleration as far as I’m aware, it’s using WebRender in about:support for compositing, and I think for software rendering it would say “WebRender (software)”. At least, if this Fedora Wiki page is to be believed :slight_smile:

Let me know if I misunderstood or if there’s another way I can check if I’m using hardware acceleration.

I may still check out Librewolf though. Thanks for pointing me in that direction!

EDIT: I can see that Firefox is listing WebRender as its compositor, however, I can see the following message in about:support a bit further down:

Perhaps hardware accelerated rendering is off!

I was able to force enable WebRendering compositor inabout:config but it does not appear to have made a significant difference after restarting and letting it run for a while.

It also seems like Fedora is patching Firefox to enable hardware acceleration. It seems Firefox has historically disabled this on AMD on Linux. There was an Arch forums thread that I cannot link to for some reason but it was insightful, although I think that was specifically around hardware accelerated media decoding rather than compositing, but it touches on Firefox blacklisting AMD + Mesa drivers which Fedora seems to be patching.

Hw accelerated video playback uses more power than sw decoding below somewhere around 1080p 30 on linux right now so it’s unfortunately likely not the magic bullet this requires here. Just turining off hw accel is also not the solution because it reverses massively above 1080p, at 4k 60 sw decoding takes over 20w while hw is in the low tens which is still a lot but a lot better but given my old intel 8th gen thinkpad does the same for 8ish it isn’t great.

I think they’re talking about HW accelerated 2D drawing, not video decode.

3 Likes

For some weeks I’ve noticed higher than usualy battery drain during the day. I later noticed this was happening when using Firefox.

using “about:processes” on some websites

Reddit front page

my cpu usage is quite high and looking at the output from the “amdgpu_top” command I see alot of GPU work. Measuring ( using Firefox “about:processes” ) the tab(s), I see that more than 50% of the time it’s the “RefreshDriver tick” and when I expand that, there’s alot of paint and layout going on even though visually everything on my screen ( Firefox area ) is idle/nothing changing.

I’ve checked ( about:support ) to see if all the hardware accelerated flags are enabled and they are ( WebRender and not WebRender software for example )

I’m seeing the same results using Arch Linux ( Linux 6.10.6 ) and Gentoo ( Linux 6.10.7 ), both using KDE Plasma 6.1.4 Wayland with 7840HS and 780M

I’m beginning to think this is bug(s) in Firefox

Looking at Firefox 129.0.2 source code (534mb~) ( I didn’t find a git repo of Firefox source code ) and did some grepping and found in source file “widget/gtk/GfxInfo.cpp” between lines 984-990 inclusive

    ////////////////////////////////////
    // FEATURE_WEBRENDER_COMPOSITOR
    APPEND_TO_DRIVER_BLOCKLIST(
        OperatingSystem::Linux, DeviceFamily::All,
        nsIGfxInfo::FEATURE_WEBRENDER_COMPOSITOR,
        nsIGfxInfo::FEATURE_BLOCKED_DEVICE, DRIVER_COMPARISON_IGNORED,
        V(0, 0, 0, 0), "FEATURE_FAILURE_WEBRENDER_COMPOSITOR_DISABLED", "");

which basically means Firefox with GTK will not use WEBRENDER_COMPOSITOR feature on Linux

and looking at source file “widget/GfxDriverInfo.h” between lines 17-35 inclusive

#define APPEND_TO_DRIVER_BLOCKLIST_EXT(                                       \
    os, screen, battery, windowProtocol, driverVendor, devices, feature,      \
    featureStatus, driverComparator, driverVersion, ruleId, suggestedVersion) \
  sDriverInfo->AppendElement(GfxDriverInfo(                                   \
      os, screen, battery,                                                    \
      (nsAString&)GfxDriverInfo::GetWindowProtocol(windowProtocol),           \
      (nsAString&)GfxDriverInfo::GetDeviceVendor(devices),                    \
      (nsAString&)GfxDriverInfo::GetDriverVendor(driverVendor),               \
      (GfxDeviceFamily*)GfxDriverInfo::GetDeviceFamily(devices), feature,     \
      featureStatus, driverComparator, driverVersion, ruleId,                 \
      suggestedVersion))

#define APPEND_TO_DRIVER_BLOCKLIST(os, devices, feature, featureStatus,     \
                                   driverComparator, driverVersion, ruleId, \
                                   suggestedVersion)                        \
  APPEND_TO_DRIVER_BLOCKLIST_EXT(                                           \
      os, ScreenSizeStatus::All, BatteryStatus::All, WindowProtocol::All,   \
      DriverVendor::All, devices, feature, featureStatus, driverComparator, \
      driverVersion, ruleId, suggestedVersion)

Doesn’t matter what combination, if your on Linux with what Firefox consider GTK, Firefox ain’t using it… fun

OFFTOPIC: I’ve also noticed high cpu usage with Firefox when it’s waiting for data to arrive or eventually website times out ( no rendering is being done )

1 Like

Using Gentoo with KDE Plasma 6.1.4 with wayland and Firefox 130

I rebuilt Firefox disabling wayland support ( for Firefox only and this will force Firefox to use Xwayland ) and the high CPU usage problem is massively reduced or gone

I’ve also noticed the bouncy, overscrolling thing in Firefox is disabled ( good, I don’t like it )

I think it’s a bug in Firefox when it’s using wayland

2 Likes