In case something is wrong in vaapi_device_create() you usually just get EINVAL, but not the real cause. This patch allows to return the cause as set in errno. EINVAL is used for kernel driver name mismatch. ENODEV in case vaGetDisplayDRM() fails. Also changed: Try X11 interface in case vaGetDisplayDRM() fails. Try to open any of the possible 8 devices.