I would say OpenCL driver support is short-lived. For example, the current Intel Graphics Media Driver for VA-API provides the support way back to Intel Gen 5. On the other hand, Intel Graphics Compute Runtime for OpenCL provides the support for Intel Gen 12+. If you want OpenCL to work at all with older hardware, you will need a legacy driver.
The real issue, however, is the fact that you cannot have both intel-media-driver and intel-compute-runtime-legacy at the same time due to intel-gmmlib vs intel-gmmlib-legacy conflict. Meaning by that, you will have to choose between VA-API and OpenCL.
Fortunately, we have a container technology on Linux! We can simply have OpenCL apps inside one container, other VA-API apps can live inside another container or on the host. Therefore, you can have both VA-API and OpenCL working with legacy hardware.
There are some apps that uses OpenCL for its hardware acceleration, e.g. darktable, DaVinci Resolve. This walkthrough will make them (and you) happy 😆
👉️ Table of Contents
- Installing
distroboxandpodman - Configure
distroboxto usepodman - Create a Container
- Enable Optimized Packages
- Install
yayto Manage AUR - Install the Legacy Driver
- Zero Maintenance Your Container!
1. Installing distrobox and podman
The command will differ based on your specific package manager. Refer to your distro's docs. For example, on Arch based distros:
sudo pacman -S distrobox podman
2. Configure distrobox to use podman
echo 'container_manager="podman"' > ~/.config/distrobox/distrobox.conf
3. Create a Container
I use the official container image from CachyOS because it has x86-64-v3 and even x86-64-v4 repositories configured out of the box. Moreover, it doesn't have any issues with proprietary codecs, as all the codecs, free and proprietary ones, are available on the main Arch repositories.
The image uses the rolling-release model. Therefore, you don't have to recreate the container every time there's a new major release upgrade. You basically set it up once and can forget about it. Zero maintenance!
But most importantly, AUR is the easiest way to install the legacy OpenCL driver.
distrobox-create -i docker.io/cachyos/cachyos-v3:latest -n legacy-opencl-dbx -H ~/distrobox/legacy-opencl-dbx
You can use
docker.io/cachyos/cachyos-v4:latestinstead if your CPU supports x86-64-v4.
4. Enable Optimized Packages
Update all the packages first:
sudo pacman -Syu
Reinstall all the packages from CachyOS repos (this will replace x86-64 AKA x86-64-v1 packages with x86-64-v3 or x86-64-v4 ones):
sudo pacman -Qqn | sudo pacman -S -
5. Install yay to Manage AUR
sudo pacman -S yay
6. Install the Legacy Driver
yay -S intel-compute-runtime-legacy
⚠️ This will require a huge download, hence a fast internet connection, and a really long compile time. Fortunately, there won't be many updates for a legacy driver 😀
Lastly, install ocl-icd and clinfo
sudo pacman -S ocl-icd clinfo
7. Zero Maintenance Your Container!
We will have the container update itself daily automatically! So, we can focus more on our works, not on the system.
On the host, we create a new service file:
nano ~/.config/systemd/user/dbx-upgrade.service
Inside the service file:
[Unit]
Description=Upgrade all Distrobox containers
RequiresMountsFor=/run/user/1000/containers
StartLimitBurst=3
StartLimitIntervalSec=600
[Service]
Type=exec
ExecStart=sh -c "distrobox-upgrade --all && distrobox enter legacy-opencl-dbx -- yay -Syu --noconfirm"
Restart=on-failure
RestartSec=60
💡 Since
distrobox-upgrade --alldoesn't manageyay, we chain the command to update AUR packages withyay.
As for the timer file:
nano ~/.config/systemd/user/dbx-upgrade.timer
Inside the timer file:
[Unit]
Description=Start Distrobox containers upgrade service with some delay.
[Timer]
OnStartupSec=30
RandomizedDelaySec=15
Persistent=true
[Install]
WantedBy=timers.target
Lastly, reload and enable the timer:
systemctl --user daemon-reload && systemctl --user enable dbx-upgrade.timer
Now, you can put all the apps that requires OpenCL to work inside this container. For example, the easiest way to install DaVinci Resolve on Linux is by:
yay -S davinci-resolve
Or for DaVinci Resolve Studio (the pro version):
yay -S davinci-resolve-studio
⚠️ You don't run
yaywithsudo.
See more on AUR pages: davinci-resolve, davinci-resolve-studio.
Then, you can export it to the host, for example:
distrobox-export -b /opt/resolve/bin/resolve
The bin will be saved at ~/.local/bin/resolve on the host. You can use Launcher Studio to create the app's icon. Just make sure the StartupWMClass value in your desktop file is corresponding to the app's window class name, of which can be checked by Alt+F2, then type in lg (looking glass). This works in GNOME.
😆 At first, I want to write about how to install DaVinci Resolve on Linux, considered there are like 100 different methods on the internet. However, the only true manageable method is by AUR in a
distroboxcontainer. It works across all distros, clean, and it's only one line of command for the installation without any other mods needed.
For darktable, it's equally easy:
sudo pacman -S darktable portmidi libcanberra
Then:
distrobox-export -a darktable
I hope you all like this walkthrough. Thanks for reading 😁
Cover Photo by Aldrin Rachman Pradana on Unsplash



Top comments (0)