intel / libva

Libva is an implementation for VA-API (Video Acceleration API)
http://intel.github.io/libva/
Other
659 stars 302 forks source link

Weird behaviour on hyprid laptop #822

Open Dungeonseeker opened 4 months ago

Dungeonseeker commented 4 months ago

Been fighting an unrelated issue for weeks with brave & hwdec not working but as a side effect of trying to get to the bottom of that one I noticed a 'bug'? maybe? Honestly I'm not even sure it is but its worth reporting as others have had the same behaviour too.

My laptop has an Intel/NVIDIA hybrid GPU setup and with intel-media-driver installed vainfo works as expected. with intel-media-driver & libva-nvidia-driver installed vainfo uses iHD which I would expect since the intel is the primary card. The issue arises when you try to force vainfo to use the NVIDIA, in that case vainfo throws a hard crash. To use NVDEC at all on my GPU I have to swap over to dedicated GPU mode.

libva info: VA-API version 1.19.0 libva info: User environment variable requested driver 'nvidia' 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 error: /usr/lib/x86_64-linux-gnu/dri/nvidia_drv_video.so init failed libva info: va_openDriver() returns 1 vaInitialize failed with error code 1 (operation failed),exit

https://github.com/brave/brave-browser/issues/35953 ^ Bug on brave, unrelated but this user has the exact same behaviour

XinfengZhang commented 4 months ago

because you have two card, if you "force vainfo to use NVIDIA", you just set the LIBVA_DRIVER_NAME? I suppose you also need to use vainfo --device to specify the device

Dungeonseeker commented 4 months ago

because you have two card, if you "force vainfo to use NVIDIA", you just set the LIBVA_DRIVER_NAME? I suppose you also need to use vainfo --device to specify the device

libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/nvidia_drv_video.so

I did not set device however. I see from the brave thread that that is a possibility. Should it really be necessary though? Would it be possible to have libva detect this automatically? Or just detect there's more than one DRM device and if loading the driver returns a 1 try the next device instead?

XinfengZhang commented 4 months ago

I did not set device however. I see from the brave thread that that is a possibility. Should it really be necessary though? Would it be possible to have libva detect this automatically? Or just detect there's more than one DRM device and if loading the driver returns a 1 try the next device instead?

it should be a good idea, but is conflict with current design, current libva just try the related load library for a given kernel mode driver. the mapping is something like https://github.com/intel/libva/blob/master/va/drm/va_drm_utils.c#L53-L69 now, you are asking try to load all candidates for one vendor...