elFarto / nvidia-vaapi-driver

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

Fail to get NVidia driver version since V0.0.10 - working anyway up to V0.0.11 - master fails - NVidia V525.147.05 #276

Closed Jasmin68k closed 3 weeks ago

Jasmin68k commented 7 months ago

Hello!

Using the driver on Debian Sid with NVidia drivers V525.147.05, NVidia driver version is not properly detected since V0.0.10 as reported by vainfo.

Hardware decoding in Firefox works anyway, except for latest master branch, where nv-driver.c forces a dummy version of 470.123.45, when no proper NVidia driver version is returned.

Since nv-driver.c sets different parameters depending on detected driver version, it might not work optimally though.

EDIT: If I substitute the dummy driver version in nv-driver.c with 525.147.05, master branch works, too.

Let me know, if you need any further info.

master

vainfo --display drm
      3861.555803320 [11638-11638] ../src/vabackend.c:2163       __vaDriverInit_1_0 Initialising NVIDIA VA-API Driver: 31
      3861.555822223 [11638-11638] ../src/vabackend.c:2172       __vaDriverInit_1_0 Now have 0 (100 max) instances
      3861.555826865 [11638-11638] ../src/vabackend.c:2198       __vaDriverInit_1_0 Selecting Direct backend
      3861.561292937 [11638-11638] ../src/direct/nv-driver.c: 267            init_nvdriver Initing nvdriver...
      3861.561318965 [11638-11638] ../src/direct/nv-driver.c: 285            init_nvdriver NVIDIA kernel driver version: 470.123.45, major version: 470, minor version: 123
      3861.561322774 [11638-11638] ../src/direct/nv-driver.c: 292            init_nvdriver Got dev info: 100 1 0 fe
vainfo: VA-API version: 1.20 (libva 2.12.0)
vainfo: Driver version: VA-API NVDEC driver [direct backend]
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            :   VAEntrypointVLD
      VAProfileMPEG2Main              :   VAEntrypointVLD
      VAProfileVC1Simple              :   VAEntrypointVLD
      VAProfileVC1Main                :   VAEntrypointVLD
      VAProfileVC1Advanced            :   VAEntrypointVLD
      VAProfileH264Main               :   VAEntrypointVLD
      VAProfileH264High               :   VAEntrypointVLD
      VAProfileH264ConstrainedBaseline:   VAEntrypointVLD
      VAProfileHEVCMain               :   VAEntrypointVLD
      VAProfileVP9Profile0            :   VAEntrypointVLD
      VAProfileHEVCMain10             :   VAEntrypointVLD
      VAProfileHEVCMain12             :   VAEntrypointVLD
      VAProfileVP9Profile2            :   VAEntrypointVLD
      3861.609695301 [11638-11638] ../src/vabackend.c:2073              nvTerminate Terminating 0x561abc2e44d0
      3861.609723190 [11638-11638] ../src/vabackend.c:2087              nvTerminate Now have 0 (100 max) instances

0.0.11

vainfo --display drm
      1724.182846035 [9012-9012] ../src/vabackend.c:2140       __vaDriverInit_1_0 Initialising NVIDIA VA-API Driver: 31
      1724.182853024 [9012-9012] ../src/vabackend.c:2149       __vaDriverInit_1_0 Now have 0 (100 max) instances
      1724.182854389 [9012-9012] ../src/vabackend.c:2175       __vaDriverInit_1_0 Selecting Direct backend
      1724.185516520 [9012-9012] ../src/direct/nv-driver.c: 246            init_nvdriver Initing nvdriver...
      1724.185533625 [9012-9012] ../src/direct/nv-driver.c: 264            init_nvdriver NVIDIA kernel driver version: , major version: 0, minor version: 0
      1724.185535862 [9012-9012] ../src/direct/nv-driver.c: 271            init_nvdriver Got dev info: 100 1 0 fe
vainfo: VA-API version: 1.20 (libva 2.12.0)
vainfo: Driver version: VA-API NVDEC driver [direct backend]
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileHEVCMain               : VAEntrypointVLD
      VAProfileVP9Profile0            : VAEntrypointVLD
      VAProfileHEVCMain10             : VAEntrypointVLD
      VAProfileHEVCMain12             : VAEntrypointVLD
      VAProfileVP9Profile2            : VAEntrypointVLD
      1724.253564016 [9012-9012] ../src/vabackend.c:2050              nvTerminate Terminating 0x55faa863c4d0
      1724.253601577 [9012-9012] ../src/vabackend.c:2064              nvTerminate Now have 0 (100 max) instances

0.0.10

vainfo --display drm
      1788.621713788 [9366-9366] ../src/vabackend.c:2171       __vaDriverInit_1_0 Initialising NVIDIA VA-API Driver: 31
      1788.621719863 [9366-9366] ../src/vabackend.c:2180       __vaDriverInit_1_0 Now have 0 (100 max) instances
      1788.621721409 [9366-9366] ../src/vabackend.c:2206       __vaDriverInit_1_0 Selecting Direct backend
      1788.625026749 [9366-9366] ../src/direct/nv-driver.c: 223            init_nvdriver Initing nvdriver...
      1788.625034882 [9366-9366] ../src/direct/nv-driver.c: 228            init_nvdriver Got dev info: 100 1 0 fe
      1788.625053602 [9366-9366] ../src/direct/nv-driver.c: 246            init_nvdriver NVIDIA kernel driver version: , major version: 0
vainfo: VA-API version: 1.20 (libva 2.12.0)
vainfo: Driver version: VA-API NVDEC driver [direct backend]
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileHEVCMain               : VAEntrypointVLD
      VAProfileVP9Profile0            : VAEntrypointVLD
      VAProfileHEVCMain10             : VAEntrypointVLD
      VAProfileHEVCMain12             : VAEntrypointVLD
      VAProfileVP9Profile2            : VAEntrypointVLD
      1788.674947092 [9366-9366] ../src/vabackend.c:2081              nvTerminate Terminating 0x55b9089ed4d0
      1788.674973597 [9366-9366] ../src/vabackend.c:2095              nvTerminate Now have 0 (100 max) instances

0.0.9

vainfo --display drm
      1848.108299963 [9623-9623] ../src/vabackend.c:2165       __vaDriverInit_1_0 Initialising NVIDIA VA-API Driver: 31
      1848.108307034 [9623-9623] ../src/vabackend.c:2174       __vaDriverInit_1_0 Now have 0 (100 max) instances
      1848.108309093 [9623-9623] ../src/vabackend.c:2200       __vaDriverInit_1_0 Selecting Direct backend
      1848.110891810 [9623-9623] ../src/direct/nv-driver.c: 217            init_nvdriver Initing nvdriver...
      1848.110897873 [9623-9623] ../src/direct/nv-driver.c: 222            init_nvdriver Got dev info: 100 1 0 fe
      1848.110939621 [9623-9623] ../src/direct/nv-driver.c: 283            init_nvdriver NVIDIA kernel driver version: 525.147.05
vainfo: VA-API version: 1.20 (libva 2.12.0)
vainfo: Driver version: VA-API NVDEC driver [direct backend]
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileHEVCMain               : VAEntrypointVLD
      VAProfileVP9Profile0            : VAEntrypointVLD
      VAProfileHEVCMain10             : VAEntrypointVLD
      VAProfileHEVCMain12             : VAEntrypointVLD
      VAProfileVP9Profile2            : VAEntrypointVLD
      1848.159538404 [9623-9623] ../src/vabackend.c:2075              nvTerminate Terminating 0x560b66bca4d0
      1848.159563850 [9623-9623] ../src/vabackend.c:2089              nvTerminate Now have 0 (100 max) instances

0.0.8

vainfo --display drm
      1910.163405610 [9823-9823] ../src/vabackend.c:1872       __vaDriverInit_1_0 Initialising NVIDIA VA-API Driver: 0x55a4aca714d0 31
      1910.163438854 [9823-9823] ../src/vabackend.c:1894       __vaDriverInit_1_0 Now have 0 (100 max) instances
      1910.163448955 [9823-9823] ../src/vabackend.c:1919       __vaDriverInit_1_0 Selecting Direct backend
      1910.169206016 [9823-9823] ../src/direct/nv-driver.c: 190            init_nvdriver Initing nvdriver...
      1910.169216726 [9823-9823] ../src/direct/nv-driver.c: 195            init_nvdriver Got dev info: 100 1 0 fe
      1910.169285884 [9823-9823] ../src/direct/nv-driver.c: 256            init_nvdriver NVIDIA kernel driver version: 525.147.05
vainfo: VA-API version: 1.20 (libva 2.12.0)
vainfo: Driver version: VA-API NVDEC driver [direct backend]
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD
      <unknown profile>               : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileHEVCMain               : VAEntrypointVLD
      VAProfileVP9Profile0            : VAEntrypointVLD
      VAProfileHEVCMain10             : VAEntrypointVLD
      VAProfileHEVCMain12             : VAEntrypointVLD
      VAProfileVP9Profile2            : VAEntrypointVLD
      1910.215269854 [9823-9823] ../src/vabackend.c:1843              nvTerminate Terminating 0x55a4aca714d0
      1910.215295739 [9823-9823] ../src/vabackend.c:1857              nvTerminate Now have 0 (100 max) instances
thesword53 commented 7 months ago

Hardware decoding in Firefox works anyway, except for latest master branch

Maybe related to https://github.com/elFarto/nvidia-vaapi-driver/issues/271

Jasmin68k commented 7 months ago

From a quick glance at the code:

The nv_get_versions function in nv-driver.c changed somewhere between V0.0.9 and V0.0.10 and, at least on my system, the new version seems to return an empty string (see vainfo output in original post).

nv-driver.c sets different parameters based on driver version in the nv_alloc_object function (f.e. if (driverMajorVersion < 525) {...).

Up to about V0.0.10 these comparisons might not result in an optimal set of values for the 525 driver on my system due to the non-working nv_get_version function, but decoding still works.

In latest master however, the empty string is replaced with dummy version 470.123.45, resulting in the alloc_buffer function handling nvkms_params_size differently .nvkms_params_size = context->driverMajorVersion == 470 ? 0x20 : sizeof(nvkmsParams).

I assume the latter is why latest master does not work anymore on my system, and does work again, if I replace the dummy driver version with 525.147.05.

I don't claim to know exactly, how the code is working, so I might be off here.

mirh commented 7 months ago

That was added in 1d6a9d39bed38d1e2cfbe6528fafc91e1618af68 to fix #267

elFarto commented 3 weeks ago

I've added an additional work around in master for reading the version if the ioctl fails to. I'm not sure if this is still an issue for you, but if you could test it and see if it resolves the issue.

Jasmin68k commented 3 weeks ago

It's been a while, since I looked at this, since things have just been working for some time now.

It was with release V0.0.12 that I noticed, I don't need to patch in my driver version manually anymore as described above and vainfo --display drm showed me that the correct driver version was detected.

Whether that was some fix in V0.0.12, in the driver or somewhere else, I don't know.

I would love to give you more info, but vainfo --display drm does not give me verbose output anymore, just this:

vainfo --display drm
vainfo: VA-API version: 1.22 (libva 2.12.0)
vainfo: Driver version: VA-API NVDEC driver [direct backend]
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileHEVCMain               : VAEntrypointVLD
      VAProfileVP9Profile0            : VAEntrypointVLD
      VAProfileHEVCMain10             : VAEntrypointVLD
      VAProfileHEVCMain12             : VAEntrypointVLD
      VAProfileVP9Profile2            : VAEntrypointVLD

So I don't know, which driver version it actually detects or whether it uses your workaround or the fallback version.

I can tell you that V0.0.12 and master are still working, as in it shows GPU decode in nvtop.

Would you happen to know, why vainfo doesn't show all the info it used to show and how to fix this? Then I could tell you more.

I haven't ugpraded the system for a while, so tests where done with driver version 535.183.01. VA-API/libva as shown in vainfo might not be the latest either.

elFarto commented 3 weeks ago

You need NVD_LOG set to 1 for this driver to log stuff.

Jasmin68k commented 3 weeks ago

Yeah, right, of course.

I tested again with current master, V0.0.12 and V0.0.11.

With the current driver version and setup, detection and decode work in all cases and the fallback in master is not needed, but should be good to have just in case.

Since V0.0.11 works now, too, it might have been a bug in the earlier NVidia driver or something else in the at the time older Debian Sid setup.

In any case, it seems all is well now.

Thanks for getting back to the issue and adding the fallback as an additional detection measure!

master - decode works

vainfo --display drm

       682.984215616 [4126-4126] ../src/vabackend.c:2187       __vaDriverInit_1_0 Initialising NVIDIA VA-API Driver: 31
       682.984228108 [4126-4126] ../src/vabackend.c:2196       __vaDriverInit_1_0 Now have 0 (100 max) instances
       682.984232033 [4126-4126] ../src/vabackend.c:2222       __vaDriverInit_1_0 Selecting Direct backend
       682.989609814 [4126-4126] ../src/direct/nv-driver.c: 295            init_nvdriver Initing nvdriver...
       682.989626253 [4126-4126] ../src/direct/nv-driver.c: 313            init_nvdriver NVIDIA kernel driver version: 535.183.01, major version: 535, minor version: 183
       682.989628659 [4126-4126] ../src/direct/nv-driver.c: 320            init_nvdriver Got dev info: 100 1 0 fe
vainfo: VA-API version: 1.22 (libva 2.12.0)
vainfo: Driver version: VA-API NVDEC driver [direct backend]
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileHEVCMain               : VAEntrypointVLD
      VAProfileVP9Profile0            : VAEntrypointVLD
      VAProfileHEVCMain10             : VAEntrypointVLD
      VAProfileHEVCMain12             : VAEntrypointVLD
      VAProfileVP9Profile2            : VAEntrypointVLD
       683.036100847 [4126-4126] ../src/vabackend.c:2095              nvTerminate Terminating 0x55566ced94d0
       683.036126787 [4126-4126] ../src/vabackend.c:2109              nvTerminate Now have 0 (100 max) instances

V0.0.12 - decode works

vainfo --display drm
       831.182697173 [5136-5136] ../src/vabackend.c:2188       __vaDriverInit_1_0 Initialising NVIDIA VA-API Driver: 31
       831.182705524 [5136-5136] ../src/vabackend.c:2197       __vaDriverInit_1_0 Now have 0 (100 max) instances
       831.182707816 [5136-5136] ../src/vabackend.c:2223       __vaDriverInit_1_0 Selecting Direct backend
       831.187105341 [5136-5136] ../src/direct/nv-driver.c: 267            init_nvdriver Initing nvdriver...
       831.187125552 [5136-5136] ../src/direct/nv-driver.c: 285            init_nvdriver NVIDIA kernel driver version: 535.183.01, major version: 535, minor version: 183
       831.187129749 [5136-5136] ../src/direct/nv-driver.c: 292            init_nvdriver Got dev info: 100 1 0 fe
vainfo: VA-API version: 1.22 (libva 2.12.0)
vainfo: Driver version: VA-API NVDEC driver [direct backend]
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileHEVCMain               : VAEntrypointVLD
      VAProfileVP9Profile0            : VAEntrypointVLD
      VAProfileHEVCMain10             : VAEntrypointVLD
      VAProfileHEVCMain12             : VAEntrypointVLD
      VAProfileVP9Profile2            : VAEntrypointVLD
       831.231860959 [5136-5136] ../src/vabackend.c:2098              nvTerminate Terminating 0x5619c149f4d0
       831.231888231 [5136-5136] ../src/vabackend.c:2112              nvTerminate Now have 0 (100 max) instances

v0.0.11 - decode works

vainfo --display drm
       925.315489025 [6371-6371] ../src/vabackend.c:2140       __vaDriverInit_1_0 Initialising NVIDIA VA-API Driver: 31
       925.315500230 [6371-6371] ../src/vabackend.c:2149       __vaDriverInit_1_0 Now have 0 (100 max) instances
       925.315502572 [6371-6371] ../src/vabackend.c:2175       __vaDriverInit_1_0 Selecting Direct backend
       925.320917028 [6371-6371] ../src/direct/nv-driver.c: 246            init_nvdriver Initing nvdriver...
       925.320935679 [6371-6371] ../src/direct/nv-driver.c: 264            init_nvdriver NVIDIA kernel driver version: 535.183.01, major version: 535, minor version: 183
       925.320939544 [6371-6371] ../src/direct/nv-driver.c: 271            init_nvdriver Got dev info: 100 1 0 fe
vainfo: VA-API version: 1.22 (libva 2.12.0)
vainfo: Driver version: VA-API NVDEC driver [direct backend]
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileHEVCMain               : VAEntrypointVLD
      VAProfileVP9Profile0            : VAEntrypointVLD
      VAProfileHEVCMain10             : VAEntrypointVLD
      VAProfileHEVCMain12             : VAEntrypointVLD
      VAProfileVP9Profile2            : VAEntrypointVLD
       925.366457500 [6371-6371] ../src/vabackend.c:2050              nvTerminate Terminating 0x564a321f34d0
       925.366483587 [6371-6371] ../src/vabackend.c:2064              nvTerminate Now have 0 (100 max) instances