Q:

Vainfo returns "libva error: /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so init failed" in dual gpu system

I have a dual gpu system.  It has a 2nd generation Sandy Bridge iGPU and an nvidia 650ti.  The Nvidia gpu is connected to the display and is using the proprietary drivers.  I'm trying to use the iGPU for video encoding.
I have installed the va driver using
sudo apt-get install i965-va-driver

If I run vainfo it returns:
libva info: VA-API version 1.1.0
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/nvidia_drv_video.so
libva info: va_openDriver() returns -1
vaInitialize failed with error code -1 (unknown libva error),exit

But if I run LIBVA_DRIVER_NAME=i965 vainfo it returns:
libva info: VA-API version 1.1.0
libva info: va_getDriverName() returns 0
libva info: User requested driver 'i965'
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_1_1
libva error: /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so init failed
libva info: va_openDriver() returns -1
vaInitialize failed with error code -1 (unknown libva error),exit

A:

A little late, but I ran into the same problem so I thought I'd leave what worked for me. Apparently you need the VDPAU (http://http.download.nvidia.com/XFree86/vdpau/doxygen/html/index.html) wrapper.
sudo apt-get install vdpau-va-driver

After that it returns fine.
libva info: VA-API version 1.1.0
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/nvidia_drv_video.so
libva info: Found init function __vaDriverInit_1_0
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.1 (libva 2.1.0)
vainfo: Driver version: Splitted-Desktop Systems VDPAU backend for VA-API - 0.7.4

