DEV Community

Cover image for Re-enable VA-API hardware video acceleration on openSUSE Tumbleweed
Archer Allstars
Archer Allstars

Posted on • Edited on

Re-enable VA-API hardware video acceleration on openSUSE Tumbleweed

UPDATE: Now you can install the VA-API enabled Mesa (for all the codecs) on openSUSE Tumbleweed by using PackMan with sudo opi codecs. This will also pull the Mesa driver automatically (you are most likely want to install all the codecs with this command after all). If you don't have opi installed yet, just run sudo zypper install opi. Thanks Luis Zepeda for this update!

Following the drama at Fedora's subreddit regarding the fact that Fedora 37 drops VA-API accelerated hardware video decoding and encoding, which will be back ported to Fedora 36 also, openSUSE has followed Fedora's direction to disable this feature in their Mesa build. But before anything else, here are what you need to know:

  • This change only affects AMD users on Mesa open source driver. If you're using AMD's proprietary driver, Intel GPU/iGPU, or Nvidia GPU, you are not affected by this change. More on this later on.
  • Technically, this change doesn't disable all the codecs from using VA-API hardware video acceleration. It only affects H.264, H.265/HEVC, and VC-1.
  • On openSUSE, you can re-enable VA-API hardware video acceleration for all the supported codecs by deleting just 2 lines of code from the spec file.

Why Intel and Nvidia users are not affected by this issue?

Smoker

Because Intel is using all the VA-API features through Intel Media Driver for distro's packaged apps, or org.freedesktop.Platform.VAAPI.Intel for Flatpak apps. And Nvidia users mostly (if not all) use proprietary driver on Linux. Therefore, any change in Mesa is not related to Intel and Nvidia when it comes to VA-API.

AMD on the other hand uses VA-API features in Mesa directly, so it is affected by this issue. But if you're using AMD's proprietary driver, you naturally won't be affected by this change in Mesa.

Well, should you use AMD's proprietary driver instead of Mesa on Linux? I don't think you should, considering that you won't get any performance benefit at all by using the proprietary driver, and you might face a lot of hassles to get it installed/updated correctly without any issue on your system compared to Mesa in the pre-compiled kernel, I would recommend AMD users to stay on Mesa. The fact that AMD GPUs work without having to rely on the proprietary driver makes it the #1 choice for most Linux users.


Here is how to fix this issue in openSUSE Tumbleweed, step by step.

Herbs

The fix is extremely easy for openSUSE Tumbleweed. Note that openSUSE Leap doesn't have to apply this fix yet as it will take a long long time before Mesa 22.2.x arrives on Leap. Without further ado, let's begin to re-enable VA-API hardware video acceleration for all the supported codecs.

  1. Go to openSUSE Build Service website and create a new account there. If you already have an account, you can log in to use your account.

  2. Go to Your Home Project page.

    Your Home Project Page

  3. Click at Branch Package to clone and link a repository.

    Click at Branch Package

  4. In the original project name box, search for openSUSE.

    original project name

  5. In the original package name box, search for Mesa.

    original package name

  6. Make sure that you don't check stay on this revision, so you will link (auto syncing) with the upstream repo. Then click the Branch button to clone the upstream repo to your branch.

    click the Branch button

  7. Now you should have the Mesa driver at your own branch.

    Your Mesa driver branch

  8. Let's edit the Mesa.spec file.

    Mesa.spec file

  9. Search text for Dvideo-codecs in the file.

    Search text for h264

  10. Remove %if %{video_codecs} above and %endif below the Dvideo-codecs=all \ line. This is based on Mesa revision 1142 before Mesa revision 1143 re-disabled the codecs. The result should look like this.

    remove codes to enable VA-API codecs again

  11. Save the file.

    Save the file

  12. Wait for the builds. It will take some time in the cloud. You can click on the Refresh button to update the builds' status. All the builds except for Leap 15.4, which is not related to our change, will show as succeeded when the build is completed.

    When the build is completed

  13. Download your Mesa build.

    Download your Mesa build 1

    Download your Mesa build 2

  14. Install your Mesa build with YaST 1-Click Install. Follow the screen instructions, it should be very easy, hence it's called 1-Click Install 😂

    Install your Mesa build with YaST 1-Click Install

  15. Reboot your PC/laptop. After rebooted, open YaST Software Management and search for Mesa package to check whether you're actually using your Mesa build.

  16. Check available VA-API codecs with vainfo which is part of vaapi-tools package.

Note that:

  • Your build is very safe to use since it will be linked along with the upstream build.
  • If there's a breaking change, your build wouldn't success. Therefore, with this route, even though you wouldn't break the system, you'll have to maintain your build to be compatible with the main branch. Otherwise, you won't be able to update your system. I recommend using opi codecs instead.

Cover photo by Tim Mossholder on Unsplash

Smoker photo by Adrien King on Unsplash

Herbs photo by Bundo Kim on Unsplash

Background photo by Bruno Aguirre on Unsplash

Top comments (2)

Collapse
 
donxepe profile image
Luis Zepeda

Thanks for the write up!
I've been using openSUSE for a few months now, your articles had helped me deepen my knowledge of this distro and also improve my install.
I followed this guide to get back my hardware decoding and I also think it was also a good hands-on intro to the OBS, since this was my first time using it.

I also wanted to let you know that the people at the Packman repo now seem to be packaging Mesa with hardware decoding support. Just need to do the "opi codecs" command and you are good to go (probably not the most user friendly thing, but even before the mesa change, you already had to install the codecs not included by default, so they didn't really add any more steps IMO).

Looking forward to more of your excellent articles! openSUSE is severely underrated so it's harder for noobs like me to find as much info as with other more popular distros.

Collapse
 
archerallstars profile image
Archer Allstars

Agreed! openSUSE is the most underrated Linux distro. I am using it as my main working-gaming distro, love it >...<

Thanks for the info about the Mesa in Packman 🙏

I am glad you like my articles, thanks 😍