Plex hardware encoding with Intel Arc A380

I recently grabbed an Intel Arc A380 GPU for $99. This was on a whim after learning from the forums that this card actually excels at transcoding, and popular among Plex enthusiasts. Decided to try it out.

The setting up of card and it showing up in Plex under Transcoding requires some driver installation, and configuration.

Here’s what I did on Ubuntu.

Step 1 – Install Intel Drivers

Client Intel Package Repository Configuration

# Install the Intel graphics GPG public key
wget -qO - https://repositories.intel.com/gpu/intel-graphics.key | \
  sudo gpg --yes --dearmor --output /usr/share/keyrings/intel-graphics.gpg

# Configure the repositories.intel.com package repository
echo "deb [arch=amd64,i386 signed-by=/usr/share/keyrings/intel-graphics.gpg] https://repositories.intel.com/gpu/ubuntu jammy client" | \
  sudo tee /etc/apt/sources.list.d/intel-gpu-jammy.list

# Update the package repository meta-data
sudo apt update

Install Compute, Media, and Display runtimes

sudo apt install -y \
  intel-opencl-icd \
  intel-level-zero-gpu \
  level-zero \
  intel-media-va-driver-non-free \
  libmfx1 libmfxgen1 libvpl2 \
  libegl-mesa0 \
  libegl1-mesa \
  libegl1-mesa-dev \
  libgbm1 \
  libgl1-mesa-dev \
  libgl1-mesa-dri \
  libglapi-mesa \
  libgles2-mesa-dev \
  libglx-mesa0 \
  libigdgmm12 \
  libxatracker2 \
  mesa-va-drivers \
  mesa-vdpau-drivers \
  mesa-vulkan-drivers \
  va-driver-all \
  vainfo \
  hwinfo \
  clinfo
sudo dpkg --add-architecture i386

sudo apt update

sudo apt install -y \ 
  udev \
  mesa-va-drivers:i386 \
  mesa-common-dev:i386 \
  mesa-vulkan-drivers:i386 \
  libd3dadapter9-mesa-dev:i386 \
  libegl1-mesa:i386 \
  libegl1-mesa-dev:i386 \
  libgbm-dev:i386 \
  libgl1-mesa-glx:i386 \
  libgl1-mesa-dev:i386 \
  libgles2-mesa:i386 \
  libgles2-mesa-dev:i386 \
  libosmesa6:i386 \
  libosmesa6-dev:i386 \
  libwayland-egl1-mesa:i386 \
  libxatracker2:i386 \
  libxatracker-dev:i386 \
  mesa-vdpau-drivers:i386 \
  libva-x11-2:i386

Install Development Packages

sudo apt install -y \
  libigc-dev \
  intel-igc-cm \
  libigdfcl-dev \
  libigfxcmrt-dev \
  level-zero-dev

Reboot your computer.

Step 2 – Install Linux Kernel 6.2+

For hardware encoding to work, you will need the latest 6.2+ Kernel.

First check, what version of Kernel you’ve by executing uname -a. If already 6.2+, then skip.

Download 6.2 Kernel Deb files

cd /tmp/
wget -c https://kernel.ubuntu.com/~kernel-ppa/mainline/v6.2/amd64/linux-headers-6.2.0-060200-generic_6.2.0-060200.202302191831_amd64.deb

wget -c https://kernel.ubuntu.com/~kernel-ppa/mainline/v6.2/amd64/linux-headers-6.2.0-060200_6.2.0-060200.202302191831_all.deb

wget -c https://kernel.ubuntu.com/~kernel-ppa/mainline/v6.2/amd64/linux-image-unsigned-6.2.0-060200-generic_6.2.0-060200.202302191831_amd64.deb

wget -c https://kernel.ubuntu.com/~kernel-ppa/mainline/v6.2/amd64/linux-modules-6.2.0-060200-generic_6.2.0-060200.202302191831_amd64.deb

sudo dpkg -i *.deb

Reboot your computer, and once back, verify the latest Kernel is in use uname -a.

Step 3 – Check if GUC and HUC are running

sudo cat /sys/kernel/debug/dri/0/gt/uc/guc_info
GuC firmware: i915/dg2_guc_70.bin
	status: RUNNING
	version: found 70.5.1
	uCode: 369088 bytes
	RSA: 384 bytes
GuC status 0x8003f0ec:
	Bootrom status = 0x76
	uKernel status = 0xf0
	MIA Core status = 0x3
Scratch registers:
	 0: 	0x0
	 1: 	0xa03d7
	 2: 	0x2c800
	 3: 	0x4
	 4: 	0x40
	 5: 	0x380
	 6: 	0x56a50005
	 7: 	0x0
	 8: 	0x0
	 9: 	0x0
	10: 	0x0
	11: 	0x0
	12: 	0x0
	13: 	0x0
	14: 	0x0
	15: 	0x0

GuC logging stats:
	Relay full count: 0
	DEBUG:	flush count          0, overflow count          0
	CRASH:	flush count          0, overflow count          0
	CAPTURE:	flush count          0, overflow count          0
CT enabled
H2G Space: 2172
Head: 480
Tail: 480
G2H Space: 12284
Head: 95
Tail: 95
GuC Number Outstanding Submission G2H: 0
GuC tasklet count: 0
Requests in GuC submit tasklet:

Global scheduling policies:
  DPC promote time   = 500000
  Max num work items = 15
  Flags              = 0
sudo cat /sys/kernel/debug/dri/0/gt/uc/huc_info
HuC firmware: i915/dg2_huc_gsc.bin
	status: RUNNING
	version: found 7.10.3
	uCode: 0 bytes
	RSA: 0 bytes
HuC status: 0x00164001

You should see a valid output as shown below. If not, you will need to install firmware from here.

Check if the device is available at /dev/dri

ll /dev/dri
total 0
drwxr-xr-x   3 root root        100 Jan  7 17:49 .
drwxr-xr-x  20 root root       4.3K Jan  7 17:49 ..
drwxr-xr-x   2 root root         80 Jan  7 17:49 by-path
crw-rw----+  1 root video  226,   0 Jan  7 17:49 card0
crw-rw----+  1 root render 226, 128 Jan  7 17:49 renderD128

You should see an output similar to above. /dev/dri/renderD128 is the device name, which you will need to share with Plex (via docker).

Step 4 – Update docker compose file to allow this device

Simple change, add the following.

devices:
  - /dev/dri/renderD128:/dev/dri/renderD128

Reboot one last time.

Step 5 – Configure Plex

Device should show up. Select, and save.

Now that it is configured and available for Plex, I will be seeing how good it is for transcoding.

Hopefully, this guide was useful.

Credits:

Leave a Reply

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