Getting hardware acceleration on Linux for Intel graphics has taken a little fiddling as the defaults are geared towards maximum stability as opposed to performance, even on newer hardware where support has improved in the kernel and related packages.
I’ve been trying to document steps to take when installing Fedora for the first time on newer hardware (e.g. Intel gen11+ like my Thinkpad X1 Carbon Gen 9 with Iris Xe graphics) and wanted to get the community’s thoughts on them:
The below is a work in progress
1. Install RPMFusion repos
sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
sudo dnf install https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
2. Install multimedia packages & Intel tools
sudo dnf groupinstall multimedia
sudo dnf install intel-media-driver libva libva-utils gstreamer1-vaapi ffmpeg intel-gpu-tools mesa-dri-drivers mpv
3. Add environment variable for Libva
Add the following line to your .bashrc
(if using bash):
export LIBVA_DRIVER_NAME=iHD
4. Enable Intel GuC and HuC and Framebuffer compression
GuC and HuC are features built into newer-gen Intel graphics and apparently have power usage and performance benefits.
Add kernel parameters to load GuC and HuC (contrary to popular belief, they are not enabled by default except on Intel gen12+ platforms in the kernel) by entering the following:
sudo nano /etc/modprobe.d/i915.conf
and paste the following into it:
options i915 enable_guc=3
options i915 enable_fbc=1
Then rebuild your intramfs with the following:
sudo dracut --force
Then reboot (important)
5. Test to make sure everything is enabled and working properly
- Test VA-API support with
vainfo
and compare against this ArchWiki section - Check to make sure GuC and HuC are enabled:
sudo dmesg | grep guc
Should return something like GuC firmware i915/tgl_guc_62.0.0.bin version 62.0 submission:enabled
sudo dmesg | grep huc
Should return something like HuC firmware i915/tgl_huc_7.9.3.bin version 7.9 authenticated:yes
- Test VA-API support:
- Download a test video file
- Open a new terminal window and run
sudo intel_gpu_top
(keep this window open) - In a separate terminal window, run
mpv --hwdec=auto <video file>
- Go back to the intel_gpu_top terminal window and check to make sure the “Video” bar shows activity, this indicates that video is being accelerated properly.
6. Hardware acceleration in browsers
For the time being, both Chrome/Chromium and FIrefox have issues with hardware acceleration in the most recent versions of their browsers (Chrome/Chromium 100 and Firefox 98) with Wayland. Hopefully future versions will support VA-API again soon.
Any thoughts on the above? Looking for any suggestions regarding packages to install, any optimizations I missed, etc.
One thing that still bugs me is that the VideoEnhance
engine in intel_gpu_top still shows no activity even when playing an accelerated video. Not clear why that is but if anyone else has got that working, let me know and I can add those steps.