Re-enable VA-API hardware video acceleration on openSUSE Tumbleweed
Tags: tutorial, linux, productivity, opensource
Published: 2022-10-02 04:00:57

> **UPDATE:** Now you can install the VA-API enabled Mesa (for all the codecs) on openSUSE Tumbleweed by using **[PackMan](http://packman.links2linux.com/package/Mesa-drivers/)** 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](https://github.com/openSUSE/opi)** installed yet, just run `sudo zypper install opi`. Thanks **[Luis Zepeda](https://dev.to/donxepe)** for this update!

Following the drama at **[Fedora's subreddit](https://www.reddit.com/r/Fedora/comments/xpt34f/fedora_37_drops_vaapi_accelerated_hardware_video/)** 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](https://build.opensuse.org/request/show/1006922)** 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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kv04adqtmfxtb7my80ax.jpg)

Because Intel is using all the VA-API features through **[Intel Media Driver](https://github.com/intel/media-driver)** for distro's packaged apps, or **[org.freedesktop.Platform.VAAPI.Intel](https://docs.flatpak.org/en/latest/available-runtimes.html#:~:text=org.freedesktop.Platform.VAAPI.Intel)** for Flatpak apps. And Nvidia users mostly (if not all) use **[proprietary driver](https://www.nvidia.com/en-us/drivers/unix/)** 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](https://www.amd.com/en/support/linux-drivers)**, 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](https://www.phoronix.com/review/linux515-mesa213-pro)** 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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fzn6rglj7329oep9eqg4.jpg)

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](https://build.opensuse.org/)** 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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/79scanacl2uhmj50prop.png)

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

     ![Click at Branch Package](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2og0zvwxigb6h7on1skz.png)

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

     ![original project name](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fvo0i4vg164czgzppj5n.png)

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

     ![original package name](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tonxwhmvcy0iwhifqbdq.png)

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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o143do17u1ex9xezbk3a.png)

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

     ![Your Mesa driver branch](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/149xp0kwsur2aazj5bew.png)

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

     ![Mesa.spec file](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6o4lj4fb3wod5mpsr4wc.png)

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

     ![Search text for h264](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1afuyq4zxgb35zplkqze.png)

10. Remove `%if %{video_codecs}` above and `%endif` below the `Dvideo-codecs=all \` line. This is based on **[Mesa revision 1142](https://build.opensuse.org/package/show/X11:XOrg/Mesa?rev=1142)** before **[Mesa revision 1143 re-disabled the codecs](https://build.opensuse.org/package/rdiff/X11:XOrg/Mesa?linkrev=base&rev=1143)**. The result should look like this.

     ![remove codes to enable VA-API codecs again](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9aromtclqz9r1u1ktla5.png)

11. Save the file.

     ![Save the file](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kltda5e1dazbf69zezgr.png)

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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bbmo7cyi54r8zq8wogi3.png)

13. Download your Mesa build.

     ![Download your Mesa build 1](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0ag7fuu6au7wqiy5f44w.png)

     ![Download your Mesa build 2](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mj67da2luhwzne4bznki.png)

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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dwlwix3lmlbl6iv6rqi5.png)

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](https://unsplash.com/@timmossholder?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText)** on **[Unsplash](https://unsplash.com/s/photos/super-charger?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText)**

**Smoker** photo by **[Adrien King](https://unsplash.com/@adriensking?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText)** on **[Unsplash](https://unsplash.com/s/photos/smoker?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText)**

**Herbs** photo by **[Bundo Kim](https://unsplash.com/es/@bundo?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText)** on **[Unsplash](https://unsplash.com/s/photos/medicine?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText)**

**Background** photo by **[Bruno Aguirre](https://unsplash.com/@elcuervo?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText)** on **[Unsplash](https://unsplash.com/?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText)**