Chromium on Fedora finally gets VAAPI support!

Do you like playing videos in your web browser? Well, good news, the Chromium web browser available in Fedora gets a Video Acceleration API support. That makes video playback much smoother while using significantly less resources.

A little bit of history

Chromium with a VAAPI patch was already available on other distributions. But this was not the case with Fedora. I really want hardware acceleration. But my love for Fedora was holding me back. Then with sheer willpower, I joined Fedora and started maintaining a package in COPR.

I am not really a distro hopper but a DE hopper. I usually jump from Gnome to KDE and vice versa depending upon my mood. Then I started maintaining Chromium with vaapi patch on COPR. I was using the official patch which was submitted upstream for code review. I had very little hope that it will get merge. The patch is outdated and and try jobs were failing at that time.

After six months, the Chromium upstream maintainers made a statement that they are not interested to include this patch. So after that I started working on my own patch with referenced from the official patch. My patch is about using the existing flags that other operating system uses instead of creating a new flag just for experimentation.

screenshot showing chromium uses video engine

Chromium uses AMDGPU’s UVD engine while playing a video

chromium's flag screenshot

Chromium uses Existing flags on Fedora

Effects of the VAAPI patch

Chromium with this patch was extremely stable on both of my machines. They both have AMD GPU. The video playback is smooth. This improved overall power savings as well.

Comparision with/without vaapi

Credits: Tobias Wolfshappen

As you can see, chromium with the vaapi patch takes up significantly less resources in comparison to chromium without the patch and Firefox.  The CPU usage went down from 120% to 10%. The playback is smooth with no shuttering.

VA-API patch in chromium for Fedora

It was then Fedora’s former Engineering Manager @ Red Hat and Chromium maintainer, Tom Callaway, finally recognises the VAAPI patch and decides to include in Fedora’s Chromium browser. Fedora becomes the second distribution to include the VAAPI patch in their official Chromium package.

New in Fedora Using Software

32 Comments

  1. Levi

    Thanks for your work! Nice to hear that Fedora’s Chromium browser now includes the VAAPI patch.
    I am left wondering how you get Chromium to play h264 content. The Chromium package in the Fedora repo is not compiled with that codec, however in your screenshot you are clearly using it.
    Is there a way to install the codec separately to get it to work without recompiling Chromium? I really want to try it, however without content hardware decoding’s potential is largely lost.

    • There is a plugin called chromium-libs-media-freeworld. For that you have to get it from a separate third party repository called RPMFusion. In case of my build, I have compiled with all possible codecs but due to legal limitations Fedora actually doesn’t allows that.

      However if you have Intel Skylake or similar, you also get VP9 acceleration as well.
      Honestly I am also hoping to get hardware accelerated aom support in the future.

      • Levi

        Thanks for the chromium-libs-media-freeworld tip, that worked!

        I have Intel Skylake, however neither VP9 nor H264 hardware acceleration worked with Chromium(-vaapi). The flags are set the same as yours and chrome://gpu states that hardware acceleration is on, however gpu://media-internals states that FFmpegVideoDecoder is used for h264 and VpxVideoDecoder is used for vp9.

        I cannot figure out what the problem is. I guess I will stay with software decoding for the foreseeable future.

        • Are you running on Wayland session by any chance? Do you have libva intel driver installed?

          • Levi

            The libva intel driver was already installed. It was indeed the Wayland session, I can confirm that it does indeed work in X.

  2. This makes me wonder if it’s possible to do hangouts. How hard would it be to get video chat with Facebook massager on Fedora?

  3. james

    thanks, and congratulations

  4. Tristan Kobusch

    Fedora ist one of the few distros that uses Wayland by Default.
    In the past there have been many issues with vaapi and Wayland especially with chromium.
    Do you know the current state of affairs?

    • AMD plays very well under Wayland(Xwayland) since it has DRI3 support. Intel driver doesn’t actually supports that. There was a PR for enabling DRI3 but it has been closed due to inactivity.

      As for as Wayland support in Chromium is concerned, we are still too far from it.

  5. Frediano Ziglio

    There’s a typo in a title “VAPPI in Fedora”.
    Did you have to install some driver for va-api out for Fedora repository?

    • Yes I saw that and the typo has been fixed. 🙂

      For AMD, you don’t have to do anything. For Intel, unfortunately you need a driver out of Fedora repository(libva-intel-driver/intel-media-driver).

  6. Tim

    Good work. I use a ppa in Ubuntu to enable hardware decoding (https://launchpad.net/~saiarcot895/+archive/ubuntu/chromium-beta), and it’s completely stable (on a laptop with intel hardware). Plus I use it on an Intel NUC, where the advantages of hardware decoding are really clear. Works great there too. And for you, it works well on AMD. It’s very disappointing that upstream is ignoring this work.

    Fedora is a very influential distribution and this decision may trigger the Chromium devs to be more flexible. It will probably cause Ubuntu to have a look too, and Firefox may take this seriously at last. So I see lot of good things happening because of your efforts.

  7. Frankstar

    im pretty new to the scence and build chromium out of source with h264 support just a few days ago.
    Is there a way (for a newbie) to include your work ontop of the source and build it myself? i didnt found anything like that.
    I dont think the gn argument

    use_vaapi

    is all i need ?

    Thank you for your work!!!!!

  8. Does it work with AMD graphics on Wayland?

  9. Daiquiri

    What’s missing to also take advatange of hardware decoding in firefox?

  10. MaCroX95

    Is VA API driver utilized normally on wayland session through XWayland? Thanks for any replies 🙂 VA API is really crucial for my ultrabook, but under Xorg the desktop performance is horrible.

  11. G-Ray

    Thanks to the contributors. The only things missing are hw decoding on Wayland for Intel chips, and it seems there is no possibility to get widevine working with chromium ?

  12. Eitam Doodai

    Hello, thanks for the article and comments!

    I have Lenovo T460s with intel 520 gpu, fedora 28 plasma.

    I have installed chromium 71 and got the new chrome://flags stuff
    I have installed libva-intel-driver
    I have installed the chromium-libs-media-freeworld

    In chromium media-internals I still see VpxVideoDecoder and not GPU.

    Any help will be appreciated 🙂

    • Please check what video codecs/profiles are supported in “Video Acceleration Information” section in chrome://gpu

      Also Intel libva driver doesn’t work on Wayland(yet)

  13. xaras

    It support also older AMD GPU? Like HD5850/6950?
    Testing Chromium dev in PPA for Ubuntu and working fine with vaapi but now in Fedora I still see ffmpeg decoder and not a gpuvideodecoder.
    Any suggestion? Or maybe old AMD Gpu not supported?

    • It is supported. Please check if it is running on a wayland session for that you have to set an environment variable “LIBVA_DRIVER_NAME”.

  14. Not so interesting?
    I could try it in a Fedora 28, Kde, Xorg. The lower CPU usage is there, but battery is not so happy : I left playing a 720p movie in http://arte.tv for 5 minutes with chromium-vaapi and firefox.
    Result, upower tells me this energy rate :
    – 6,44W for chromium
    – 6,32W for firefox
    – 2,6W idle

    • (Looks like Fedora Magazine doesn’t like sharing imdb links in comments, but anyway.)

      In my case:
      chromium-vaapi: 11.79 W
      Firefox: 17.58 W

      Both playing the same video and same format.

  15. Ed H.

    Good article, except for one thing. You failed to explain how to install the patch.

  16. cmurf

    I tried this but still see ~200% CPU usage when playing h264 video. Skylake laptop running Fedora 29, Xorg, chromium-71.0.3578.98-1.fc29.x86_64, intel-media-driver-18.3.0-2.fc29.x86_64, libva-intel-driver-2.2.0-3.fc29.x86_64. chrom://gpu says under Graphics Feature Status, Video Decode: Hardware accelerated. But it’s still using the same amount of CPU as Firefox and Chrome.

    • Levi

      You should start a video and go to chrome://media-internals in another tab. There you can click on the video that is playing and it will either say GpuDecoder or FFmpegdecoder.

      The chrome://gpu tab only states if your browser is capable of using it, not actually if it is being used.

      Finally, make sure that you are testing in X and not in Wayland.

      • cmurf

        I see the problem. Search results for some H.264 videos in fact aren’t, and media-internal shows them as VP9, and VP9 videos use VpxVideoDecoder, and H.264 videos use GpuVideoDecoder.

        • Levi

          Then it is highly likely that your hardware does not support hardware acceleration for VP9. As mentioned in the comments above only pretty recent GPUs support VP9.

          YouTube wil almost always send VP9 content as it is their default format, however you can force YouTube to send h264 video with the add-on h264ify.

          The only downside to this I have found so far is that YouTube only keeps video up to 1080p in the h264 format. So if you have a 1080p screen or don’t mind video to be 1080p, then you can use that extension.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

The opinions expressed on this website are those of each author, not of the author's employer or of Red Hat. Fedora Magazine aspires to publish all content under a Creative Commons license but may not be able to do so in all cases. You are responsible for ensuring that you have the necessary permission to reuse any work on this site. The Fedora logo is a trademark of Red Hat, Inc. Terms and Conditions

%d bloggers like this: