[Libav-user] VAAPI constraints - Failed to query surface attributes: 4 (invalid VAConfigID)

Anton Sviridenko anton at corp.bluecherry.net
Tue Feb 7 20:54:59 EET 2017


Hi

I'm trying to use VAAPI accelerated decoding and this piece of code:

====
{
    int err;
    const char *device;

    Q_ASSERT(m_instance == 0);

#if defined(Q_WS_X11)
    QProcessEnvironment env;
    QByteArray x11display;

    env = QProcessEnvironment::systemEnvironment();

    if (env.contains(QLatin1String("DISPLAY")))
    {
        x11display = env.value(QLatin1String("DISPLAY")).toAscii();
        qDebug() << "VAAPI - using X11 display " << x11display;
        device = x11display.constData();
    }
    else
#endif
        device = "/dev/dri/renderD128";

    qDebug() << "trying to create VAAPI device context \"" << device << "\"";

    err = av_hwdevice_ctx_create(&m_hw_device_ctx, AV_HWDEVICE_TYPE_VAAPI,
                                 device, NULL, 0);
    if (err < 0)
    {
        qDebug() << "Failed to create VAAPI device context";
        m_available = false;
        return;
    }

    m_available = true;
    m_instance = this;

    {
        AVVAAPIHWConfig *hwconfig = NULL;
        AVHWFramesConstraints *constraints = NULL;

        hwconfig = (AVVAAPIHWConfig
*)av_hwdevice_hwconfig_alloc(m_hw_device_ctx);
        constraints =
av_hwdevice_get_hwframe_constraints(m_hw_device_ctx, hwconfig);

        if (!constraints)
        {
            qDebug() << "Failed to query VAAPI constraints";
            av_freep(&hwconfig);
            return;
        }

        qDebug() << "VAAPI frame constraints: \n"
                 << "min_width " << constraints->min_width
                 << "min_height " << constraints->min_height
                 << "max_width " << constraints->max_width
                 << "max_height " << constraints->max_height;

        av_freep(&hwconfig);
        av_hwframe_constraints_free(&constraints);
    }
====

fails with error:

====
VAAPI - using X11 display  ":1"
trying to create VAAPI device context " :1 "
libva info: VA-API version 0.39.4
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib64/va/drivers/i965_drv_video.so
libva info: Found init function __vaDriverInit_0_39
libva info: va_openDriver() returns 0
[AVHWDeviceContext @ 0x4f8c2a0] Failed to query surface attributes: 4
(invalid VAConfigID).
Failed to query VAAPI constraints
====

I use git master version of FFMpeg (latest commit -
e87a4a85c11e348be8682acf39573fd2c5e22193)

===
ffmpeg -version
ffmpeg version N-83433-ge87a4a8 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 4.9.4 (Gentoo 4.9.4 p1.0, pie-0.6.4)
configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64
--docdir=/usr/share/doc/ffmpeg-9999/html --mandir=/usr/share/man
--enable-shared --cc=x86_64-pc-linux-gnu-gcc
--cxx=x86_64-pc-linux-gnu-g++ --ar=x86_64-pc-linux-gnu-ar
--optflags='-O2 -march=native -pipe' --disable-static
--enable-avfilter --enable-avresample --disable-stripping
--disable-indev=v4l2 --disable-outdev=v4l2 --disable-indev=oss
--disable-indev=jack --disable-outdev=oss --enable-bzlib
--disable-runtime-cpudetect --disable-debug --disable-gcrypt
--disable-gnutls --disable-gmp --enable-gpl --enable-hardcoded-tables
--enable-iconv --disable-lzma --enable-network --disable-openssl
--enable-postproc --disable-libsmbclient --enable-ffplay --enable-sdl2
--enable-vaapi --disable-vdpau --enable-xlib --enable-libxcb
--enable-libxcb-shm --enable-libxcb-xfixes --enable-zlib
--disable-libcdio --disable-libiec61883 --disable-libdc1394
--disable-libcaca --disable-openal --enable-opengl --disable-libv4l2
--disable-libpulse --disable-libopencore-amrwb
--disable-libopencore-amrnb --disable-libfdk-aac --disable-libopenjpeg
--disable-libbluray --disable-libcelt --disable-libgme
--disable-libgsm --disable-mmal --disable-libmodplug --disable-libopus
--disable-libilbc --disable-librtmp --disable-libssh
--disable-libschroedinger --disable-libspeex --enable-libvorbis
--disable-libvpx --disable-libzvbi --disable-libbs2b
--disable-chromaprint --disable-libflite --disable-frei0r
--disable-libfribidi --enable-fontconfig --disable-ladspa
--disable-libass --enable-libfreetype --disable-librubberband
--disable-netcdf --disable-libzimg --disable-libsoxr --enable-pthreads
--disable-libvo-amrwbenc --enable-libmp3lame --disable-libkvazaar
--disable-nvenc --disable-libopenh264 --disable-libsnappy
--disable-libtheora --disable-libtwolame --disable-libwavpack
--disable-libwebp --enable-libx264 --disable-libx265 --enable-libxvid
--disable-amd3dnow --disable-amd3dnowext --disable-fma3 --disable-fma4
--disable-xop --cpu=host --disable-doc --disable-htmlpages
--enable-manpages
libavutil      55. 46.100 / 55. 46.100
libavcodec     57. 75.100 / 57. 75.100
libavformat    57. 66.101 / 57. 66.101
libavdevice    57.  2.100 / 57.  2.100
libavfilter     6. 73.100 /  6. 73.100
libavresample   3.  2.  0 /  3.  2.  0
libswscale      4.  3.101 /  4.  3.101
libswresample   2.  4.100 /  2.  4.100
libpostproc    54.  2.100 / 54.  2.100
===

and vainfo shows this output:

====
vainfo
libva info: VA-API version 0.39.4
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib64/va/drivers/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) Haswell Desktop - 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

====

I am able to decode some of the streams, but this error confuses me.
Is something wrong with my code or it is a bug in ffmpeg code?


More information about the Libav-user mailing list