An alternative to MOZ_DRM_DEVICE for libva "LIBVA_DRM_DEVICE"
denji opened this issue · 4 comments
We have LIBVA_DRIVER_NAME
, and LIBVA_DRIVERS_PATH
to find libva driver libraries. But there is no replacement for MOZ_DRM_DEVICE
https://bugzilla.mozilla.org/show_bug.cgi?id=1751710 (LIBVA_DRM_DEVICE=/dev/dri/renderD129
or LIBVA_DRM_DEVICE=/dev/dri/card1
) so that we can specify the right default path to drm and not use the automatic search which may fail https://github.com/intel/libva-utils/blob/2.19.0/common/va_display_drm.c#L49-L51 with an undefined error #750.
/dev/dri/renderD128 - NVIDIA
/dev/dri/renderD129 - Intel HD Graphics (KBL)
$ env | grep LIBVA_
LIBVA_DRIVER_NAME=iHD
$ vainfo
DRM_IOCTL_VERSION, unsupported drm device by media driver: nvid
libva error: /usr/lib/dri/iHD_drv_video.so init failed
$ env | grep LIBVA_
LIBVA_DRIVER_NAME=iHD
$ env LIBVA_DRIVER_NAME=iHD vainfo --display drm --device /dev/dri/renderD128
Trying display: drm
DRM_IOCTL_VERSION, unsupported drm device by media driver: nvid
DRM_IOCTL_VERSION, unsupported drm device by media driver: nvid
libva error: /usr/lib/dri/iHD_drv_video.so init failed
vaInitialize failed with error code 18 (invalid parameter),exit
$ env | grep LIBVA_
LIBVA_DRIVER_NAME=iHD
$ env LIBVA_DRIVER_NAME=nvidia vainfo --display drm --device /dev/dri/renderD129
Trying display: drm
libva error: /usr/lib/dri/nvidia_drv_video.so init failed
vaInitialize failed with error code 1 (operation failed),exit
$ env | grep LIBVA_
LIBVA_DRIVER_NAME=iHD
$ google-chrome-stable
libva error: vaGetDriverNames() failed with unknown libva error
DRM_IOCTL_VERSION, unsupported drm device by media driver: nvid
DRM_IOCTL_VERSION, unsupported drm device by media driver: nvid
libva error: /usr/lib/dri/iHD_drv_video.so init failed
Just stumbled upon this after having issues with electron
apps trying to use my dedicated NVIDIA gpu to run VAAPI. Specifically, I've been getting one of the errors listed by @denji above:
conor ~ > chromium
DRM_IOCTL_VERSION, unsupported drm device by media driver: nvid
DRM_IOCTL_VERSION, unsupported drm device by media driver: nvid
libva error: /usr/lib/dri/iHD_drv_video.so init failed
As seen from the log, even though my VAAPI driver is set to my iGPU, chromium
is trying to run it using the dGPU. obsidian
and webcord
(and probably all electron
apps) do too.
I'm running an Arch distro on an Optimus laptop with Intel CPU and NVIDIA GPU.
I'd really like to see this too. I was hoping to use my Intel iGPU to handle hardware decode tasks since NVIDIA is still largely unsupported for that, but I can't since just about everything defaults to the first render device (the NVIDIA GPU in my case, like OP) with no way to specify another.
I also have this issue
Scenario:
/dev/dri/renderD128 - NVIDIA Corporation GM108M [GeForce 940M]
/dev/dri/renderD129 - Intel® HD Graphics 520
Nouveau does not support the first card - that for some reason is the dGPU, and chromium always selects the first card, regardless of LIBVA_DRIVER_NAME=iHD, so libva fails to initialize and i end up with software decoding.
I made a patch that accepts this env var and it works fine for me but i'm not sure if it's acceptable.. first of all it's chromium's fault that it always selects the the first card for video decoding even if it's forced to render on another card. Also vaGetDisplayDRM(int fd)
assumes that the device fd is managed from the outside so my fix was to add a field in drm_state
that tracks if the fd is owned or not.
I believe adding this feature would solve elFarto/nvidia-vaapi-driver#311