Blog

Enabling Hardware Acceleration on GNU/Linux with a Intel UHD Graphics 620 Chipset

I’ve recently spent a little bit of time struggling to enable hardware graphic acceleration on my new laptop,1 so I though I’d write up a summary here in case it could help someone.

Symptoms of dysfunctioning hardware acceleration were that applications relying on OpenGL to render their interface would appear to be completely unresponsive, the response to any user action appearing only upon forcing a “refresh” of the application’s window (e.g. by resizing it). Setting the LIBGL_ALWAYS_SOFTWARE environment variable to 1 allowed those applications to run properly (thus confirming the problem has something to do with hardware rendering), but while this is valid temporary workaround this is hardly a satisfying solution.

(Another way of demonstrating the issue is simply to run OpenGL’s demo glxgears, which would show the cogwheels not moving at all.)

The laptop is equipped, according to its spec, with what is apparently a “Intel UHD Graphics 620” chipset (a “Generation 9.5 GT2 Kaby-Lake-Refresh” chipset, for those familiar with Intel’s multiple denominations), which is handled at the kernel level by the i915 module and at X.org’s level by the intel driver.

This intel driver was apparently the cause of the problem. I’ve tried changing several of its options (AccelMethod, TearFree, DRI, and a few others listed in the intel(4) manual), to no avail. However, changing the driver completely and forcing X.org to use the modesetting driver instantly solved the issue.2

So all I had to do in the end to make OpenGL happy was to add a /etc/X11/xorg.conf.d/20-intel.conf file with the following:

Section "Device"
    Identifier "Intel Graphics"
    Driver "modesetting"
EndSection

Using modesetting was still not enough to enable video acceleration however (e.g., hardware H.265 decoding and the like). vainfo would report:

$ vainfo
libva info: VA-API version 1.5.0
...
libva info: Trying to open /usr/lib64/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_1_5
libva error: /usr/lib64/dri/i965_drv_video.so init failed
libva info: va_openDriver() returns -1

It seems that the i965-drv-video driver, as provided by intel-vaapi-driver, does not support my laptop’s graphic chip.

Installing the intel-media-driver and setting the LIBVA_DRIVER_NAME to iHD made vainfo (and VA/API-enabled video players such as VLC or MPV) happy:

$ LIBVA_DRIVER_NAME=iHD vainfo
libva info: VA-API version 1.5.0
libva info: va_getDriverName() returns -1
libva info: User requested driver 'iHD'
libva info: Trying to open /usr/lib64/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_5
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.5 (libva 2.5.0)
vainfo: Driver version: Intel iHD driver - 1.0.0
vainfo: Supported profile and entrypoints
  1. The laptop is running under Slackware64-current, but I don’t think anything in this note is specific to Slackware. It may be irrelevant on distributions running Wayland, however.
  2. A drawback of using the modesetting driver is that X.org’s xbacklight program is no longer working. This is apparently a known bug which for whatever reason appears to have never been fixed. However it is still possible to control the screen’s backlight through /sys/class/backlight/intel_backlight, so it’s good enough for me.