VAAPI and multiple video cards

5,830

For the AMD GPU, you'd need to call up vainfo as shown below:

DRI_PRIME=1 LIBVA_DRIVER_NAME=radeonsi vainfo 

Now, print the output and see if anything changes.

Share:
5,830

Related videos on Youtube

rbrito
Author by

rbrito

Computer Scientist, Free Software Advocate, Wannabe Mathematician, attracted by beautiful Typography. I am, among many other things, the current author/maintainer of coursera-dl (get from PyPI: pip install coursera-dl) and a co-maintainer of edx-dl, two tools to help people download/archive videos (and other materials) from MOOCs, so that they can study at their convenience. I am also the current maintainer of the algorithms bundle for LaTeX, which includes the packages algorithm and algorithmic. It is openly developed at GitHub. By the way, my GitHub account also features many of my projects (and I am also collaborator on other repositories). I am also a proud Debian Maintainer (where I take care of circa 20 packages).

Updated on September 18, 2022

Comments

  • rbrito
    rbrito over 1 year

    I recently got a new (actually, a second-hand, but new to me) Inspiron 5548 with an Intel Core i7-5500U that also has an AMD Radeon R7 M260/M265 card.

    Everything works fine with my Ubuntu 17.04 (pre-release), but I have a "problem" that was also present since I first installed Ubuntu 16.10, namely:

    vainfo only shows me information regarding my Intel graphics card, but not regarding my other card. I believe that I have all the packages installed, and have the following vaapi drivers installed:

    $ ll /usr/lib/x86_64-linux-gnu/dri/*_drv_video.so
    -rw-r--r-- 1 root root 2113216 Nov 10 17:34 /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
    -rw-r--r-- 3 root root 4416200 Feb  6 05:47 /usr/lib/x86_64-linux-gnu/dri/nouveau_drv_video.so
    lrwxrwxrwx 1 root root      18 May 11  2016 /usr/lib/x86_64-linux-gnu/dri/nvidia_drv_video.so -> vdpau_drv_video.so
    -rw-r--r-- 3 root root 4416200 Feb  6 05:47 /usr/lib/x86_64-linux-gnu/dri/r600_drv_video.so
    -rw-r--r-- 3 root root 4416200 Feb  6 05:47 /usr/lib/x86_64-linux-gnu/dri/radeonsi_drv_video.so
    lrwxrwxrwx 1 root root      18 May 11  2016 /usr/lib/x86_64-linux-gnu/dri/s3g_drv_video.so -> vdpau_drv_video.so
    -rw-r--r-- 1 root root   97224 May 11  2016 /usr/lib/x86_64-linux-gnu/dri/vdpau_drv_video.so
    

    Here is the output of vainfo, which picks up my Intel integrated card:

    $ vainfo 
    libva info: VA-API version 0.39.4
    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_0_39
    libva info: va_openDriver() returns 0
    vainfo: VA-API version: 0.39 (libva 1.7.3)
    vainfo: Driver version: Intel i965 driver for Intel(R) Broadwell - 1.7.3
    vainfo: Supported profile and entrypoints
          VAProfileMPEG2Simple            : VAEntrypointVLD
          VAProfileMPEG2Simple            : VAEntrypointEncSlice
          VAProfileMPEG2Main              : VAEntrypointVLD
          VAProfileMPEG2Main              : VAEntrypointEncSlice
          VAProfileH264ConstrainedBaseline: VAEntrypointVLD
          VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
          VAProfileH264Main               : VAEntrypointVLD
          VAProfileH264Main               : VAEntrypointEncSlice
          VAProfileH264High               : VAEntrypointVLD
          VAProfileH264High               : VAEntrypointEncSlice
          VAProfileH264MultiviewHigh      : VAEntrypointVLD
          VAProfileH264MultiviewHigh      : VAEntrypointEncSlice
          VAProfileH264StereoHigh         : VAEntrypointVLD
          VAProfileH264StereoHigh         : VAEntrypointEncSlice
          VAProfileVC1Simple              : VAEntrypointVLD
          VAProfileVC1Main                : VAEntrypointVLD
          VAProfileVC1Advanced            : VAEntrypointVLD
          VAProfileNone                   : VAEntrypointVideoProc
          VAProfileJPEGBaseline           : VAEntrypointVLD
          VAProfileVP8Version0_3          : VAEntrypointVLD
    

    When I request the output using other drivers, this is what I get:

    $ LIBVA_DRIVER_NAME=radeonsi vainfo 
    libva info: VA-API version 0.39.4
    libva info: va_getDriverName() returns 0
    libva info: User requested driver 'radeonsi'
    libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/radeonsi_drv_video.so
    libva info: Found init function __vaDriverInit_0_39
    ilo: driver missing
    ilo: driver missing
    libva error: /usr/lib/x86_64-linux-gnu/dri/radeonsi_drv_video.so init failed
    libva info: va_openDriver() returns 2
    vaInitialize failed with error code 2 (resource allocation failed),exit
    

    Some context about the hardware and software

    The output from inxi is the following:

    # inxi -v2
    System:    Host: inspiron-5548 Kernel: 4.10.0-9-generic x86_64 (64 bit) Desktop: MATE 1.17.2
               Distro: Ubuntu Zesty Zapus (development branch)
    Machine:   Device: portable System: Dell product: Inspiron 5548 v: A07 serial: 6B7H542
               Mobo: Dell model: 0YDTG3 v: A00 serial: .6B7H542.BR1183055L0209. UEFI: Dell v: A07 date: 06/23/2016
    Battery    BAT1: charge: 37.3 Wh 100.0% condition: 37.3/38.4 Wh (97%)
    CPU:       Dual core Intel Core i7-5500U (-HT-MCP-) speed/max: 799/3000 MHz
    Graphics:  Card-1: Intel HD Graphics 5500
               Card-2: Advanced Micro Devices [AMD/ATI] Topaz XT [Radeon R7 M260/M265 / M340/M360 / M440/M445]
               Display Server: X.org 1.18.4 drivers: modesetting,ati,amdgpu (unloaded: fbdev,vesa,radeon)
               tty size: 190x49 Advanced Data: N/A for root
    Network:   Card-1: Realtek RTL8101/2/6E PCI Express Fast/Gigabit Ethernet controller driver: r8169
               Card-2: Intel Wireless 7265 driver: iwlwifi
    Drives:    HDD Total Size: 1000.2GB (16.4% used)
               ID-1: model: ST1000LM014
    Info:      Processes: 232 Uptime: 7 days Memory: 2374.9/15960.3MB Client: Shell (bash) inxi: 2.3.8
    

    Even after googling a lot, I could not find how to see the VAAPI information of the AMD side of my system and I would love to find out how to discover this (especially for transcoding things with ffmpeg).

    Extra information

    After the helpful hint by @Brainiarc7, using the variable setting DRI_PRIME=1 makes the output change considerably:

    $ DRI_PRIME=1 LIBVA_DRIVER_NAME=radeonsi vainfo
    libva info: VA-API version 0.39.4
    libva info: va_getDriverName() returns 0
    libva info: User requested driver 'radeonsi'
    libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/radeonsi_drv_video.so
    libva info: Found init function __vaDriverInit_0_39
    libva info: va_openDriver() returns 0
    vainfo: VA-API version: 0.39 (libva 1.7.3)
    vainfo: Driver version: mesa gallium vaapi
    vainfo: Supported profile and entrypoints
          VAProfileMPEG2Simple            : VAEntrypointVLD
          VAProfileMPEG2Main              : VAEntrypointVLD
          VAProfileNone                   : VAEntrypointVideoProc
    

    Is the hardware being used even though the driver is mesa gallium vaapi or is it a software decoder/placeholder? That's progress, anyway. I find it surprising that there are only a few supported profile/entrypoints (but that's perhaps the driver not exposing if, indeed, the hardware is being used).

    I will gladly provide any further information that is deemed necessary.

  • rbrito
    rbrito almost 7 years
    Thanks a lot. The output does change, but now I am not really sure if it works or not. I will update my question with the output, so that more people can see it in the future. As I stated before, I will send any information that is required.
  • Dennis Mungai
    Dennis Mungai almost 7 years
    The best way to confirm if this works for you would be to compile FFmpeg with VAAPI enabled, and then try transcoding a video with it. gstreamer-vaapi also provides such a utility.
  • rbrito
    rbrito almost 7 years
    Right, thanks. I could not (yet) use ffmpeg to transcode a video (it says that the encoding profile could not be found), but I guess that this is related to the final part of the output that I listed, where only 3 profile/entrypoints were listed (and none contained H264). I'm accepting the answer, though.