목차

Linux VAAPI/VDPAU

vainfo

sudo apt install vainfo
 
vainfo
 
# 해당 기기의 가속 가능한 코덱 정보 출력
libva info: VA-API version 1.8.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_8
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.8 (libva 2.8.0)
vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 20.2.0 ()
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointVLD
      VAProfileJPEGBaseline           : VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileVP8Version0_3          : VAEntrypointVLD

Intel

# 기본으로 intel-media-va-driver 가 설치되는데 non-free 버전으로 교체
sudo apt install intel-media-va-driver-non-free libva-drm2 libva-x11-2
sudo apt install i965-va-driver-shaders libva-drm2 libva-x11-2
# Utilities
sudo apt install intel-gpu-tools
 
# intel gpu 사용상황 확인 - Video 항목의 % 가 올라가면 GPU Video Encoding 을 사용하는 것이다.
sudo intel_gpu_top

AMD Radeon

NVidia

nvidia-optimus

libva info: VA-API version 1.20.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_20
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.20 (libva 2.12.0)
vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 24.1.0 ()

nvidia-vaapi-driver

sudo apt install nvidia-vaapi-driver

MPlayer

VLC

mpv

Browser

Google Chrome 버전 / Ubuntu

mkdir -p ~/.local/share/applications
 
cp /usr/share/applications/google-chrome.desktop ~/.local/share/applications/google-chrome.desktop
# wayland
google-chrome-stable --enable-features=VaapiVideoDecodeLinuxGL --use-gl=angle --use-angle=gl --ozone-platform=wayland
 
# x11
google-chrome-stable --enable-features=VaapiVideoDecodeLinuxGL --use-gl=angle --use-angle=gl --ozone-platform=x11
--ozone-platform-wayland 옵션을 켜면 iBus 한글 입력이 안됐음. 해당 옵션을 제거해도 아무 문제없이 하드웨어 디코딩이 작동했으므로 옵션 제거.

Nvidia

sudo apt install libva-drm2 libva-x11-2
sudo dpkg -i vdpau-va-driver_0.7.4-7ubuntu1_ppa2_20.04.1_amd64.deb \
    libvdpau1_1.4-2_ubuntu20.04.1_amd64.deb
 
sudo apt-mark hold libvdpau1 # libvdpau1 이 구버전이라서 버전업 중단시킴.

Firefox

firefox - nvidia-vaapi-driver

#!/bin/sh
 
DRI_PATH=${HOME}/.var/app/org.mozilla.firefox/dri
 
echo "Clearing firefox flatpak overrides"
flatpak override --user --reset org.mozilla.firefox
 
echo "Adding firefox flatpak overrides"
flatpak override --user --env=LIBVA_DRIVER_NAME=nvidia \
                        --env=LIBVA_DRIVERS_PATH=${DRI_PATH} \
                        --env=LIBVA_MESSAGING_LEVEL=1 \
                        --env=MOZ_DISABLE_RDD_SANDBOX=1 \
                        --env=NVD_BACKEND=direct \
                        org.mozilla.firefox
 
# uncomment the following if you use keepass running on the host
# flatpak override --user --filesystem=xdg-run/app/org.keepassxc.KeePassXC org.mozilla.firefox
 
echo "Copying nvidia vaapi driver into ${DRI_PATH}"
mkdir -p ${DRI_PATH}
cp /usr/lib/x86_64-linux-gnu/dri/nvidia_drv_video.so ${DRI_PATH}/nvidia_drv_video.so
 
cat <<"EOF"
 
    Now open about:config and change `gfx.webrender.all` and `media.ffmpeg.vaapi.enabled` to true.
 
EOF
flatpak info --show-runtime org.mozilla.firefox
# 결과가 22.08 이라면
flatpak install org.freedesktop.Platform.ffmpeg-full//22.08

Browser GPU 가속여부 확인