How we got hardware acceleration of graphics to work in Ubuntu 18.04.2 with an Intel Core i7-9700K Coffee Lake processor

Intel Core I7.pngWe recently set up a new system using an Intel Core i7-9700K Coffee Lake processor, and discovered that the Intel® UHD Graphics 630 is not yet supported in Ubuntu, at least not in the 18.04 Long Term Support release. Therefore hardware acceleration of video did not work in Kodi or any other program. We first realized this when none of the VAAPI settings were shown in Kodi’s settings (they are normally found in Settings Player Settings Videos Processing).  Then we installed the vainfo program (using sudo apt install vainfo), and when we ran it we got this output:

libva info: VA-API version 1.1.0
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_1_1
libva error: /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so init failed
libva info: va_openDriver() returns -1
vaInitialize failed with error code -1 (unknown libva error),exit

Obviously this is not what you want to see, so we knew we had a problem.  Much additional research led us to the conclusion that the Intel Core i7-9700K processor is so new that it’s not yet supported in Ubuntu 18.04.

After searching many pages and sites, the answer appeared in a post by user yasij in the Kodi forum, although it seems he thought you’d need to start with Ubuntu 18.10 or 19.04 (the latter should have support for this processor built in, but it’s not a Long Term Support release).

What we found was that support for this processor could be added to Ubuntu 18.04.2 – note the point version here, you need at least the 4.18 Linux kernel in that version for this to work. Check your kernel version using uname -a if you aren’t sure.

The method is rather simple, actually. First you run this command to add the necessary repository:

sudo add-apt-repository ppa:mamarley/updates

Then you need to edit the file etc/apt/sources.list.d/mamarley-ubuntu-updates-bionic.list

nano etc/apt/sources.list.d/mamarley-ubuntu-updates-bionic.list
(Or use your preferred text editor).

Look for the line:
deb http://ppa.launchpad.net/mamarley/updates/ubuntu bionic main

and change bionic to cosmic:

deb http://ppa.launchpad.net/mamarley/updates/ubuntu cosmic main

Exit nano (Ctrl-X) and save your changes. Then run:
sudo apt update
sudo apt install i965-va-driver va-driver-all
sudo apt install libasound2 libasound2-plugins

The last two packages were needed to get sound to work in Kodi. We use ALSA audio, so if you use PulseAudio you may not need those, or you may need to upgrade different packages. Additional dependencies may be installed when you install or upgrade these packages.

Then either delete etc/apt/sources.list.d/mamarley-ubuntu-updates-bionic.list or comment out that repository (add # to the start of the line, like this):
# deb http://ppa.launchpad.net/mamarley/updates/ubuntu cosmic main

Then run:
sudo apt update
again so that no additional packages from that repository are inadvertently added.

Reboot the system.

Now when you run vainfo the output should look something like this (with no errors):

libva info: VA-API version 1.4.0
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_1_3
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.4 (libva 2.1.0)
vainfo: Driver version: Intel i965 driver for Intel(R) Coffee Lake - 2.3.0
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            :	VAEntrypointVLD
      VAProfileMPEG2Simple            :	VAEntrypointEncSlice
      VAProfileMPEG2Main              :	VAEntrypointVLD
      VAProfileMPEG2Main              :	VAEntrypointEncSlice
      VAProfileH264ConstrainedBaseline:	VAEntrypointVLD
      VAProfileH264ConstrainedBaseline:	VAEntrypointEncSlice
      VAProfileH264ConstrainedBaseline:	VAEntrypointEncSliceLP
      VAProfileH264Main               :	VAEntrypointVLD
      VAProfileH264Main               :	VAEntrypointEncSlice
      VAProfileH264Main               :	VAEntrypointEncSliceLP
      VAProfileH264High               :	VAEntrypointVLD
      VAProfileH264High               :	VAEntrypointEncSlice
      VAProfileH264High               :	VAEntrypointEncSliceLP
      VAProfileH264MultiviewHigh      :	VAEntrypointVLD
      VAProfileH264MultiviewHigh      :	VAEntrypointEncSlice
      VAProfileH264StereoHigh         :	VAEntrypointVLD
      VAProfileH264StereoHigh         :	VAEntrypointEncSlice
      VAProfileVC1Simple              :	VAEntrypointVLD
      VAProfileVC1Main                :	VAEntrypointVLD
      VAProfileVC1Advanced            :	VAEntrypointVLD
      VAProfileNone                   :	VAEntrypointVideoProc
      VAProfileJPEGBaseline           :	VAEntrypointVLD
      VAProfileJPEGBaseline           :	VAEntrypointEncPicture
      VAProfileVP8Version0_3          :	VAEntrypointVLD
      VAProfileVP8Version0_3          :	VAEntrypointEncSlice
      VAProfileHEVCMain               :	VAEntrypointVLD
      VAProfileHEVCMain               :	VAEntrypointEncSlice
      VAProfileHEVCMain10             :	VAEntrypointVLD
      VAProfileHEVCMain10             :	VAEntrypointEncSlice
      VAProfileVP9Profile0            :	VAEntrypointVLD
      VAProfileVP9Profile0            :	VAEntrypointEncSlice
      VAProfileVP9Profile2            :	VAEntrypointVLD

Note that if you run vainfo in a ssh session, you will probably see one error message right at the beginning of the output:

error: can't connect to X server!

This is to be expected in a ssh session, but that error should not appear if you run vainfo from a terminal window on the desktop.

That should be all you need to do — at least it was all we needed to do to get support for this processor into Ubuntu 18.04.2. We hope it works for you, too!  Note that you are mixing packages intended for different versions of Ubuntu, so there’s always a chance that doing this might cause some unintended breakage somewhere, but so far we haven’t encountered any problems.

3 thoughts on “How we got hardware acceleration of graphics to work in Ubuntu 18.04.2 with an Intel Core i7-9700K Coffee Lake processor

  1. rn3aoh

    Unfortunately, the aforementioned PPA no longer contains even the packages for Cosmic, making your workaround invalid. You’re going to have to treasure that installation at least until the next LTS comes out.

    Back to googling for another build…

    Like

    1. Launchpad seems to be having some issues. If it doesn’t work the first time you try, try again later.

      Alternately, rather than cosmic you could try using the disco or eoan or focal repos, although the further away you get from bionic the more likely we think it might be that you’d run into issues. At this moment all of those appear to be online but when we checked a few minutes ago they were not, so just keep trying and hopefully you’ll get lucky. If all else fails there might be a pre-release version of fossa (the next LTS version) available soon, and you could always try that if you are daring enough.

      Like

      1. rn3aoh

        I actually found a reliable solution that does not involve getting lucky or creating a mess of mismatched versions. In my case, the CPU I needed support of, Core m3-8100Y, is actually supported by libva 2.1, being a Kaby Lake, it just isn’t recognized by its PCI ID.

        The optimal solution is therefore to rebuild the package with a one line change: https://github.com/intel/intel-vaapi-driver/commit/6125c2c94a304ffc90c0f15a27925c9ff9ad9c32

        Instructions on how to do that can be found in http://packaging.ubuntu.com/html/fixing-a-bug.html

        Finding out that this was the actual problem took most of a day, though.

        Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.