PMS ignores LIBVA_DRIVER_NAME environment variable

Current versions of PMS for Linux ship with two DRI VAAPI drivers for Intel iGPUs:

  • iHD
  • i965

The default driver is iHD, unfortunately is is currently completely broken for Gemini Lake GPUs (UHG Graphics 600 / 605) which are used for example in some NUC devices or on the Asrock J5005-ITX board.

This wouldn’t be a big issue, if Plex Media Transcoder respected the LIBVA_DRIVER_NAME variable that is normally used by libva to choose which driver to use.

This was tested by injecting LIBVA_DRIVER_NAME=i965 into the PMS environment through a systemd unit override (systemctl edit plexmediaserver).

Even though cat /proc/$(pidof Plex\ Transcoder)/environ | tr '\0' '\n' showed that the LIBVA_DRIVER_NAME environment variable was set, it was ignored by Plex Transcoder and the vendored libva.

The only way to get hardware transcode working again on Gemini Lake was to rename the iHD driver through a diversion:

dpkg-divert --local --add --rename --divert /usr/lib/plexmediaserver/lib/dri/iHD_drv_video.{bak,so}

After renaming the iHD driver a lsof -p $(pidof Plex\ Transcoder) | grep dri showed that the i965 driver was used again.

The problem seems to be somewhere in Plex Transcoder since running vainfo against the vendored libs properly switches between iHD and i965 based on the LIBVA_DRIVER_NAME environment variable.

This was tested by running:

export LD_LIBRARY_PATH=/usr/lib/plexmediaserver/lib
export LIBVA_DRIVERS_PATH=/usr/lib/plexmediaserver/lib/dri
# check PMS vendored libs are used:
ldd /usr/bin/vainfo
# check default driver (uses /usr/lib/plexmediaserver/lib/dri/i965_drv_video.so)
vainfo
# check iHD driver is used (uses /usr/lib/plexmediaserver/lib/dri/iHD_drv_video.so)
LIBVA_DRIVER_NAME=iHD vainfo
# check i965 driver is used (uses /usr/lib/plexmediaserver/lib/dri/i965_drv_video.so)
LIBVA_DRIVER_NAME=i965 vainfo

For more info on the current problems with iHD on Gemini Lake check out intel/media-driver#733.

This problem was last tested on plexmediaserver 1.18.2.2058-e67a4e892 amd64 on Ubuntu 19.10 running on an Asrock J5005-ITX board with 32 GB RAM nd UHD 605 graphics with DMC FW 1.4, GuC FW 32.0 and HuC firmware 3.1 on kernel 5.3.0-23-generic x86_64.

The use of the iHD is intentional and the selection logic is handed in PMS (we first test if the hardware can be opened using the iHD, and if not, fallback to the i965. So if you delete/rename the iHD driver we will fallback and use the i965.

That said, I’ll pass this along to our transcoder team as the issues you mention with Gemini Lake might be something we can work around or special case this platform to always use the old i965 driver.

Respecting the LIBVA_DRIVER_NAME variable if set would be the easiest fix I think.

If you want to auto-detect instead the UHD Graphics 600 is PCI ID 8086:3185 and 605 is 8086:3184.

Btw. instead of hardcoding the iHD driver in Plex Transcoder you could just apply the following patch to your libva 2.5.0:

That patch wil make libva prefer iHD for Intel iGPUs, but still allow using LIBVA_DRIVER_NAME=i965 to select i965.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.