elFarto / nvidia-vaapi-driver

A VA-API implemention using NVIDIA's NVDEC
Other
1.22k stars 56 forks source link

Was working, formatted, no longer working. #314

Closed ddouglas87 closed 1 month ago

ddouglas87 commented 3 months ago

OpenSUSE Tumbleweed, X11 Cinnamon desktop.

First I tried zypper install nvidia-vaapi-driver. Set /etc/environment to

MOZ_DISABLE_RDD_SANDBOX=1
LIBVA_DRIVER_NAME=nvidia
NVD_BACKEND=direct

cat /etc/default/grub:

GRUB_CMDLINE_LINUX_DEFAULT="plymouth.enable=0 splash=silent security=apparmor nvidia-drm.modeset=1 nouveau.modeset=0 mitigations=auto"

Verified with:

sudo hwinfo --gfxcard | grep -A 2 'Driver Info'
  Driver Info #0:
    Driver Status: nouveau is not active
    Driver Activation Cmd: "modprobe nouveau"
  Driver Info #1:
    Driver Status: nvidia_drm is active
    Driver Activation Cmd: "modprobe nvidia_drm"
  Driver Info #2:
    Driver Status: nvidia is active
    Driver Activation Cmd: "modprobe nvidia"

FFmpeg verification:

ffmpeg -hwaccels 2>/dev/null
Hardware acceleration methods:
vdpau
cuda
vaapi
qsv
drm
vulkan

In Firefox about:config I set:

Config Setting
media.ffmpeg.vaapi.enabled true
media.rdd-ffmpeg.enabled true
gfx.x11-egl.force-enabled true
widget.dmabuf.force-enabled true

In Firefox about:support: ff_support

I'm using the plugin h264ify, which I used in the past successfully and have validated it is working. (Stats for nerds -> AVC1.)

I pull up a youtube video and while playing in watch nvidia-smi I see Type G for firefox instead of the G+C I'm supposed to be seeing.

My nvidia drivers are 550.100-25.1.

I downloaded the repo with git clone, installed the prerequisites for my system (zypper install gstreamer-plugins-bad-devel cmake-full Mesa-libEGL-devel ffnvcodec-devel libdrm-devel libva-devel), did the meson build and install instructions, verified the nvidia .so file was updated. Rebooted again. Same issue with Firefox. It shows H264 supported, and the video is H264 but it's decoding with software.

I tried changing the NVD_BACKEND type. I tried changing MOZ_DISABLE_RDD_SANDBOX. I'm not sure what settings I should mess with to get this working.

Here's the output from the test.sh file: testsh_output.txt

I had this working fine in the past, so I know it's possible on my hardware. I'm quite confused.

Oh and Firefox came with the distro:

firefox --version
Mozilla Firefox 128.0
ManuLinares commented 3 months ago

You haven't shared any logs or your system specs. I don't know what kind of help do you expect.

share a pastebin with your specs: 'inxi -Fxxxza --no-host' run firefox, open a video, close firefox: 'env MOZ_LOG="PlatformDecoderModule:5" NVD_LOG=1 firefox' and share the stdout in a pastebin

ddouglas87 commented 3 months ago

Here you go: specs.txt firefox.txt

I wasn't sure exactly what to log. Apologies. Hopefully it helps. At first glance it looks like everything should be working, but it's not.

ManuLinares commented 3 months ago

You should set this in about:config

media.ffmpeg.vaapi.enabled  true
media.av1.enabled       false
gfx.x11-egl.force-enabled   false
widget.dmabuf.force-enabled     false

Then try to run like this on a terminal:

unset LIBVA_DRIVER_NAME
MOZ_DISABLE_RDD_SANDBOX=1 NVD_BACKEND=direct MOZ_LOG="PlatformDecoderModule:5" NVD_LOG=1 firefox

Is firefox a native package or a flatpak, snap, etc? Could you provide the output of vainfo --display drm --device /dev/dri/renderD128 (assuming this is your device /dev/dri/renderD128, idk)


If the above doesn't work, try EGL backend.

gfx.x11-egl.force-enabled   true
widget.dmabuf.force-enabled     true

Then try to run like this on a terminal:

unset LIBVA_DRIVER_NAME
MOZ_DISABLE_RDD_SANDBOX=1 NVD_BACKEND=egl MOZ_LOG="PlatformDecoderModule:5" NVD_LOG=1 firefox
ddouglas87 commented 3 months ago

I figured it out. I did opi codecs to install any missing codecs. After rebooting hardware acceleration in Firefox works!

For FFmpeg hardware decoding it requires "non-free" codecs to be installed. It's possible to have FFmpeg come with your OS by default without codecs. Without codecs FFmpeg still runs, but only software decoding. Codecs are required for hardware decoding. (Or at least it's that way on my setup using OpenSUSE.) I recommend adding this note to the README.md file, as this is a necessary prerequisite.

Cheers!