Why is Kubuntu using much more CPU than Windows in YouTube and other web browsing use?
The main reason you're seeing higher CPU consumption is the lack of hardware acceleration of video-related functions: mostly video decoding and possibly rendering. Intel's open source GPU drivers are of great quality and support these features, however browsers have some troubles implementing support.
The following information is to my best knowledge as of March 11 2020:
GPU acceleration
Both Firefox and Chrome/Chromium support GPU acceleration for rendering, but it is not enabled by default.
Firefox
You need to enable two things: Off-Main-Thread Compositing (OMTC) and WebRender.
I personally have the next settings in about:config
:
layers.acceleration.force-enabled = true
gfx.webrender.all = true
gfx.webrender.compositor = true
gfx.webrender.enabled = true
dom.webgpu.enabled = true
That results in everything in about:support
's Decision Log is enabled. But you might need to experiment with the settings to get a combination that works for you, because some hardware/driver combinations might experience problems.
Chrome/Chromium
GPU acceleration needs to be enabled by setting browser feature flags. chromium-flags.conf
might not work depending on your browser version, but the same flags are available through chrome://flags
.
My personal configuration has these flags:
--ignore-gpu-blacklist
--enable-gpu-rasterization
--enable-oop-rasterization
--enable-native-gpu-memory-buffers
--enable-zero-copy
--enable-accelerated-mjpeg-decode
--enable-accelerated-video
That results in all features in chrome://gpu
being green, enabled and hardware accelerated, except for Vulkan. Once again that may vary depending on you hardware, drivers and even browser version, so experiment and find the settings that work for you.
Video decoding
No browsers implement hardware video decoding by default. Good news is that is about to change.
Firefox
Next Firefox version (75) will ship GPU video decoding feature under Wayland. You'll probably have to enable it manually.
Chromium
There is a patch for Chromium that enables GPU video decoding, but it is not merged into the main branch. That means you have to install a special version from a PPA.
I'd blame the video drivers ...
On windows it is known that most video codecs shove work if possible to the graphics card away from CPU, and typically manufacturers spend much more time optimizing windows-drivers than any other.
Especially open source drivers where they would have to reveal their optimizations to any competitor. And you mention specifically video playback