使用带有视频加速 (VA) 的 nvidia 驱动程序时出现“失败请求的 X 错误:BadRequest”

使用带有视频加速 (VA) 的 nvidia 驱动程序时出现“失败请求的 X 错误:BadRequest”

我想简单地展示一个使用 gstreamer-1.0 的测试源。当我使用(我猜)非加速输出时,gst-launch-1.0 videotestsrc ! xvimagesink一切都正常,但当我尝试播放它时,gst-launch-1.0 videotestsrc ! autovideosink我收到以下错误:

Setting pipeline to PAUSED ...
libva info: VA-API version 0.35.0
X Error of failed request:  BadRequest (invalid request code or no such operation)
  Major opcode of failed request:  153 (DRI2)
  Minor opcode of failed request:  1 (DRI2Connect)
  Serial number of failed request:  15
  Current serial number in output stream:  15

我已安装NVIDIA-Linux-x86_64-367.44.run如下Ubuntu 14.04.5

  1. 删除旧驱动程序:sudo apt-get remove --purge nvidia*
  2. 通过运行脚本将旧驱动程序列入黑名单(它会要求你这样做,然后退出)
  3. 重启
  4. 停止服务:service lightdm stop && service x11-common stop
  5. 安装驱动程序:./NVIDIA-Linux-x86_64-367.44.run --no-x-check
  6. 已安装 VA 相关内容https://wiki.ubuntuusers.de/Video-Dekodierung_beschleunigen/sudo apt-get install libvdpau1 vdpauinfo vdpau-va-driver vainfo
  7. 重启

以下是一些有用的输出,但仍会产生错误:

$ lspci -nnk | grep -i VGA -A2 
05:00.0 VGA compatible controller [0300]: NVIDIA Corporation GK106 [GeForce GTX 660] [10de:11c0] (rev a1)
        Subsystem: Gigabyte Technology Co., Ltd Device [1458:354e]
        Kernel driver in use: nvidia

$ vainfo
libva info: VA-API version 0.35.0
X Error of failed request:  BadRequest (invalid request code or no such operation)
  Major opcode of failed request:  153 (DRI2)
  Minor opcode of failed request:  1 (DRI2Connect)
  Serial number of failed request:  11
  Current serial number in output stream:  11

$ glxinfo 
name of display: localhost:10.0
X Error of failed request:  GLXBadContext
  Major opcode of failed request:  154 (GLX)
  Minor opcode of failed request:  6 (X_GLXIsDirect)
  Serial number of failed request:  20
  Current serial number in output stream:  20

$ uname -a
Linux alpia 4.4.0-38-generic #57~14.04.1-Ubuntu SMP Tue Sep 6 17:20:43 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

$ cat /var/log/Xorg.0.log | grep driver
[   127.579] (WW) Hotplugging is on, devices using drivers 'kbd', 'mouse' or 'vmmouse' will be disabled.
[   127.579]    X.Org XInput driver : 22.1
[   127.786] (II) Loading /usr/lib/xorg/modules/drivers/nvidia_drv.so
[   128.733] (II) NVIDIA(0): [DRI2]   VDPAU driver: nvidia
[   128.815]    ABI class: X.Org XInput driver, version 22.1
[   128.815] (II) Using input driver 'evdev' for 'Power Button'
[   128.830] (II) Using input driver 'evdev' for 'Power Button'
[   128.831] (II) No input driver specified, ignoring this device.
[   128.831] (II) No input driver specified, ignoring this device.
[   128.831] (II) No input driver specified, ignoring this device.
[   128.831] (II) No input driver specified, ignoring this device.
[   128.832] (II) No input driver specified, ignoring this device.
[   128.832] (II) No input driver specified, ignoring this device.
[   128.832] (II) No input driver specified, ignoring this device.
[   128.832] (II) No input driver specified, ignoring this device.
[   128.832] (II) No input driver specified, ignoring this device.
[   128.832] (II) No input driver specified, ignoring this device.
[   128.833] (II) No input driver specified, ignoring this device.
[   128.833] (II) No input driver specified, ignoring this device.
[   128.833] (II) Using input driver 'evdev' for 'DELL Dell USB Entry Keyboard'
[   128.833] (II) Using input driver 'evdev' for 'USB Optical Mouse'
[   128.834] (II) No input driver specified, ignoring this device.

有人能提供提示吗?我知道按照说明操作后这台电脑曾经能用,但现在好像出了点问题。

答案1

通过将所有内容恢复为原始 Ubuntu 来修复它,但视频加速仍然不起作用:

  1. 删除前任司机:sudo ./NVIDIA-Linux-x86_64-xxx.xx.run --uninstall
  2. 卸载与 nvidia 相关(通过 搜索相关软件包dpkg -l):nvidia、cuda、primus、vdpau-va-driver、vainfo、libvdpau1、vdpauinfo
  3. 删除 nouveau 驱动程序的所有黑名单内容:删除/etc/modprobe.d
  4. 通过以下方式恢复 xconfig:sudo X -configure && sudo cp xorg.conf.new /etc/X11/xorg.conf
  5. 重新安装mesa-vdpau-drivers-lts-<your release>
  6. 重要的:删除 gstreamer vaapi,以便它在使用类似autoconvertautovideosink的插件时不会尝试使用加速:sudo apt-get remove gstreamer1.0-vaapi gstreamer1.0-vaapi-doc libgstreamer-vaapi1.0-0:amd64 libgstreamer-vaapi1.0-dev

现在,测试程序glxinfo再次glxgears按预期运行。

无论如何:失败的尝试:我仍然不知道为什么即使使用官方 ppa,VA 东西也无法与原始驱动程序一起工作:

sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt-get update
sudo apt-get install --install-suggests nvidia-340

glxinfoglxgears正常工作,但vainfo仍然vdpauinfo输出错误。我设法vdpauinfo通过使用驱动程序和导出来输出错误以外的内容mesa(如果变量指向专有驱动程序,它将不起作用):

export VDPAU_DRIVER_PATH=/usr/lib/x86_64-linux-gnu/vdpau/
export VDPAU_DRIVER=va_gl

但这只是显示驱动程序,对吧。所以我需要告诉 VA API,它必须vdpau像这样使用(?):

export LIBVA_DRIVERS_PATH=/usr/lib/x86_64-linux-gnu/dri/
export LIBVA_DRIVER_NAME=vdpau

但在那种情况下,vainfo无论我选择哪个驱动程序名称,都只会回复错误。

如果有人知道如何使其工作,请帮忙。 但目前,gstreamer 可以再次运行(但 CPU 负载较高)。

以下是一些链接:

VDPAU Library Layout: http://http.download.nvidia.com/XFree86/vdpau/doxygen/html/group__api__winsys__x11.html
NVIDIA driver archive: http://www.nvidia.com/object/unix.html
Hardware video acceleration (Arch): https://wiki.archlinux.org/index.php/Hardware_video_acceleration
NVIDIA xorg config: http://us.download.nvidia.com/XFree86/Linux-x86/331.20/README/editxconfig.html

相关内容