How to enable hardware acceleration in Chromium on Raspberry Pi OS (RPi 4)

This article describes how to enable hardware acceleration in the Chromium browser running on Raspberry Pi OS (for Raspberry Pi 4).

By enabling GPU acceleration, the CPU usage should be greatly reduced when playing supported videos (e.g. on YouTube). In my case, with Raspberry Pi 4 Model B, with hardware acceleration enabled, the main Chromium gpu and renderer processes are reduced from ~160% and ~130% to ~30% and below 23% CPU usage (according to htop) . Incidentally, this is the premise of my plan to write an article soon.

Raspberry Pi OS comes with all the functions required to run Chromium with hardware acceleration on Raspberry Pi 4, but it cannot be used immediately. For Raspberry Pi 4, there is no need to install additional software packages, enable OpenGL, etc., because these packages are already enabled. You only need to enable some Chromium browser logos; there is also a “fix” below to fix screen tearing, which occurs when playing hardware-accelerated full-screen videos.

I have tested it with Raspberry Pi 4 Model B (using Raspberry Pi OS), so I can only confirm if it works.according to This, For older Raspberry Pi models, you may need to use raspi-config to enable OpenGL with fake/full KMS (I’m not sure if older models require additional steps). Raspberry Pi 4 does not require this feature.

However, since I can only test on Raspberry Pi 4 Model B, and I don’t like to write articles about things that I cannot test myself, I only focus on Raspberry Pi 4 and the instructions in this article. .

Enable hardware acceleration in the Chromium browser running on Raspberry Pi OS (Raspberry Pi 4)

To enable hardware acceleration in the Chromium browser running on Raspberry Pi OS (Raspberry Pi 4), perform the following 3 steps (well, more like 2.5):

1. Enable hardware acceleration in the Chromium browser.

Enable the following flags in chrome://flags:

  • Overlay software rendering list: chrome://flags/#ignore-gpu-blocklist
  • Hardware accelerated video decoding chrome://flags/#enable-accelerated-video-decode
  • GPU rasterization: chrome://flags/#enable-gpu-rasterization

When finished, restart Chromium.

2. Make sure that the h264ify Chromium extension is enabled.

Comes with Chromium on Raspberry Pi OS The origin of uBlock with h264ify Extensions installed by default. Make sure that h264ify is enabled so that YouTube can use h264-encoded video that supports hardware accelerated video decoding with Raspberry Pi.

3. Optional: Solve the problem of full screen video tearing.

Raspberry Pi disables synthesizer to fix full screen tearing

Repair full screen video tearing (fix by), we need to disable the synthesizer. To do this, open a terminal on the Raspberry Pi and run the following command to run the console version of the Raspberry Pi software configuration tool:

sudo raspi-config

use Up / Down Arrow keys to navigate its menus, and Tab Choose similar buttons Finish, OK or Back.To disable the synthesizer, go to Advanced Options -> Compositor Then choose No Disable it.

When finished, select Finish And restart the system.

That’s it. Your Chromium web browser should now be hardware accelerated and be able to perform hardware accelerated video decoding.

Related: How to enable hardware-accelerated video decoding in Google Chrome, Brave, Vivaldi and Opera browsers on Debian, Ubuntu or Linux Mint

To check whether the Chromium browser uses hardware acceleration, please visit chrome://gpu In Chromium:

Raspberry Pi hardware acceleration Chromium

If hardware acceleration is enabled, all fields related to hardware acceleration should be displayed in green.

This is how it looked before the above flag was enabled (so, in the screenshot below, hardware acceleration is not enabled):

Chromium Raspberry Pi does not have hardware acceleration

To check if the hardware accelerated video decoding in Chromium is working properly, please play the YouTube video and press Ctrl + Shift + i This will open Chrome DevTools.Next, click on the 3 vertical dot menus in the upper right corner of Chrome DevTools and select More tools -> Media:

Raspberry Pi MojoVideoDecoder Chromium hardware accelerated video decoding

In the new Media Under the “DevTools” tab, click on the YouTube video on the left (in Players), and then make sure Properties The sub-tab is selected, then scroll down to Video Decoder section. Use Chromium 88+ on Raspberry Pi OS, Decoder name Value should be MojoVideoDecoder If hardware accelerated video decoding is enabled and it works normally.Until Chromium 86 (I’m not sure about version 87), the decoder was named MmalVideoDecoder When hardware accelerated video decoding is enabled and works normally.

You should also note that the CPU usage is much lower, for example, when playing a 1080p video on YouTube.

You may also need to enable Widevine in the Chromium browser running on Raspberry Pi OS, which can play Netflix, Amazon Prime, Hulu, etc.

Source

Sidebar