Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An alternative to MOZ_DRM_DEVICE for libva "LIBVA_DRM_DEVICE" #752

Open
denji opened this issue Sep 17, 2023 · 3 comments
Open

An alternative to MOZ_DRM_DEVICE for libva "LIBVA_DRM_DEVICE" #752

denji opened this issue Sep 17, 2023 · 3 comments

Comments

@denji
Copy link

denji commented Sep 17, 2023

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

#677

@denji denji changed the title An alternative to MOZ_DRM_DEVICE for libva "LIBVA_DRM_DEVICE" An alternative to MOZ_DRM_DEVICE for libva "LIBVA_DRM_DEVICE" / "VAAPI_DEVICE" Sep 17, 2023
@denji denji changed the title An alternative to MOZ_DRM_DEVICE for libva "LIBVA_DRM_DEVICE" / "VAAPI_DEVICE" An alternative to MOZ_DRM_DEVICE for libva "LIBVA_DRM_DEVICE" Sep 17, 2023
@wem1c
Copy link

wem1c commented Dec 16, 2023

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.

@ghoste07
Copy link

ghoste07 commented May 30, 2024

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.

@geogeim
Copy link

geogeim commented Dec 18, 2024

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.

Chromium souce link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants