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

Need more graphics drivers and/or newer VA-API? #699

Closed
plasticfist opened this issue Jan 8, 2024 · 16 comments
Closed

Need more graphics drivers and/or newer VA-API? #699

plasticfist opened this issue Jan 8, 2024 · 16 comments

Comments

@plasticfist
Copy link

plasticfist commented Jan 8, 2024

inside the viseron container va-api is broken. I noticed a thread about an issue here was solved by adding more drivers...
Note that maybe a clue: I notice that viseron is reporting VA-API version 1.15.0, and my working container reports VA-API version 1.17.0

The server is an N100 CPU (low power), graphics are SRIOV virtualized through proxmox into a VM running docker containers, a PCI Google Coral TPU passed in, and I think viseron is using the TPU?

host OS

$ cat /proc/version
Linux version 6.2.0-39-generic (buildd@lcy02-amd64-045) (x86_64-linux-gnu-gcc-11 (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0, GNU ld (GNU Binutils for Ubuntu) 2.38) #40~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Nov 16 10:53:04 UTC 2

SRIOV references

viseron logs at start up are

$ docker logs viseron 2>&1 |more
[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 10-adduser: executing... 
************************ UID/GID *************************
User uid:    0
User gid:    0
************************** Done **************************
[cont-init.d] 10-adduser: exited 0.
[cont-init.d] 20-gid-video-device: executing... 
[cont-init.d] 20-gid-video-device: exited 0.
[cont-init.d] 30-edgetpu-permission: executing... 
************** Setting EdgeTPU permissions ***************
Coral Vendor IDs:
"1a6e"
"18d1"
No EdgeTPU USB device was found
Matching PCI devices:
/dev/apex_0
Adding user to group pcidqlNBG7F
************************** Done **************************
[cont-init.d] 30-edgetpu-permission: exited 0.
[cont-init.d] 40-set-env-vars: executing... 
****** Checking for hardware acceleration platforms ******
OpenCL is available!
VA-API cannot be used
CUDA cannot be used
*********************** Done *****************************
[cont-init.d] 40-set-env-vars: exited 0.
[cont-init.d] 50-check-if-rpi: executing... 
********** Checking if we are running on an RPi **********
Not running on any supported RPi
*********************** Done *****************************
[cont-init.d] 50-check-if-rpi: exited 0.
[cont-init.d] 55-check-if-jetson: executing... 
****** Checking if we are running on a Jetson Board ******
Not running on any supported Jetson board
*********************** Done *****************************
[cont-init.d] 55-check-if-jetson: exited 0.
[cont-init.d] 60-ffmpeg-path: executing... 
****************** Getting FFmpeg path *******************
FFmpeg path: /home/abc/bin/ffmpeg
*********************** Done *****************************
[cont-init.d] 60-ffmpeg-path: exited 0.
[cont-init.d] 70-gstreamer-path: executing... 
***************** Getting GStreamer path *****************
GStreamer path: /usr/bin/gst-launch-1.0
*********************** Done *****************************
[cont-init.d] 70-gstreamer-path: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.

inside the viseron container, vainfo says

root@ef64c2ae0da8:/src# vainfo
error: XDG_RUNTIME_DIR not set in the environment.
error: can't connect to X server!
libva info: VA-API version 1.15.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_15
libva error: /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so init failed
libva info: va_openDriver() returns 1
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_1_6
libva error: /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so init failed
libva info: va_openDriver() returns -1
vaInitialize failed with error code -1 (unknown libva error),exit

compared this to what vainfo reports inside the frigate container, same server and settings

root@f02eb9531861:/opt/frigate# vainfo
error: XDG_RUNTIME_DIR is invalid or not set in the environment.
error: can't connect to X server!
libva info: VA-API version 1.17.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_17
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.17 (libva 2.10.0)
vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 23.1.1 ()
vainfo: Supported profile and entrypoints
      VAProfileNone                   :	VAEntrypointVideoProc
      VAProfileNone                   :	VAEntrypointStats
      VAProfileMPEG2Simple            :	VAEntrypointVLD
      VAProfileMPEG2Simple            :	VAEntrypointEncSlice
      VAProfileMPEG2Main              :	VAEntrypointVLD
      VAProfileMPEG2Main              :	VAEntrypointEncSlice
      VAProfileH264Main               :	VAEntrypointVLD
      VAProfileH264Main               :	VAEntrypointEncSlice
      VAProfileH264Main               :	VAEntrypointFEI
      VAProfileH264Main               :	VAEntrypointEncSliceLP
      VAProfileH264High               :	VAEntrypointVLD
      VAProfileH264High               :	VAEntrypointEncSlice
      VAProfileH264High               :	VAEntrypointFEI
      VAProfileH264High               :	VAEntrypointEncSliceLP
      VAProfileVC1Simple              :	VAEntrypointVLD
      VAProfileVC1Main                :	VAEntrypointVLD
      VAProfileVC1Advanced            :	VAEntrypointVLD
      VAProfileJPEGBaseline           :	VAEntrypointVLD
      VAProfileJPEGBaseline           :	VAEntrypointEncPicture
      VAProfileH264ConstrainedBaseline:	VAEntrypointVLD
      VAProfileH264ConstrainedBaseline:	VAEntrypointEncSlice
      VAProfileH264ConstrainedBaseline:	VAEntrypointFEI
      VAProfileH264ConstrainedBaseline:	VAEntrypointEncSliceLP
      VAProfileVP8Version0_3          :	VAEntrypointVLD
      VAProfileHEVCMain               :	VAEntrypointVLD
      VAProfileHEVCMain               :	VAEntrypointEncSlice
      VAProfileHEVCMain               :	VAEntrypointFEI
      VAProfileHEVCMain               :	VAEntrypointEncSliceLP
      VAProfileHEVCMain10             :	VAEntrypointVLD
      VAProfileHEVCMain10             :	VAEntrypointEncSlice
      VAProfileHEVCMain10             :	VAEntrypointEncSliceLP
      VAProfileVP9Profile0            :	VAEntrypointVLD
      VAProfileVP9Profile0            :	VAEntrypointEncSliceLP
      VAProfileVP9Profile1            :	VAEntrypointVLD
      VAProfileVP9Profile1            :	VAEntrypointEncSliceLP
      VAProfileVP9Profile2            :	VAEntrypointVLD
      VAProfileVP9Profile2            :	VAEntrypointEncSliceLP
      VAProfileVP9Profile3            :	VAEntrypointVLD
      VAProfileVP9Profile3            :	VAEntrypointEncSliceLP
      VAProfileHEVCMain12             :	VAEntrypointVLD
      VAProfileHEVCMain12             :	VAEntrypointEncSlice
      VAProfileHEVCMain422_10         :	VAEntrypointVLD
      VAProfileHEVCMain422_10         :	VAEntrypointEncSlice
      VAProfileHEVCMain422_12         :	VAEntrypointVLD
      VAProfileHEVCMain422_12         :	VAEntrypointEncSlice
      VAProfileHEVCMain444            :	VAEntrypointVLD
      VAProfileHEVCMain444            :	VAEntrypointEncSliceLP
      VAProfileHEVCMain444_10         :	VAEntrypointVLD
      VAProfileHEVCMain444_10         :	VAEntrypointEncSliceLP
      VAProfileHEVCMain444_12         :	VAEntrypointVLD
      VAProfileHEVCSccMain            :	VAEntrypointVLD
      VAProfileHEVCSccMain            :	VAEntrypointEncSliceLP
      VAProfileHEVCSccMain10          :	VAEntrypointVLD
      VAProfileHEVCSccMain10          :	VAEntrypointEncSliceLP
      VAProfileHEVCSccMain444         :	VAEntrypointVLD
      VAProfileHEVCSccMain444         :	VAEntrypointEncSliceLP
      VAProfileAV1Profile0            :	VAEntrypointVLD
      VAProfileHEVCSccMain444_10      :	VAEntrypointVLD
      VAProfileHEVCSccMain444_10      :	VAEntrypointEncSliceLP
@roflcoopter
Copy link
Owner

roflcoopter commented Jan 12, 2024

Thanks for the detailed report.
Will see if upgrading vaapi solves the issue, will let you know when its ready to test

Edit: Actually this might be harder than i thought. The drivers are installed from apt and the container runs Ubuntu 20.04
Upgrading the base image is not an option right now due to other dependencies not working in later Ubuntu versions.

Do you have a good idea of how this could be done?

@bsyomov
Copy link

bsyomov commented Jan 23, 2024

The intel driver, GmmLib, LibVA can be compiled from source in principle.

What exactly are the dependencies that prevent you from updating to ubuntu 22.04, for example?

Ubuntu 20.04 is already a fairly old distribution and similar problems will appear more and more often...
With this version of VAAPI and the iHD_drv_video driver, I am experiencing memory leaks on the Celeron J4105, and I had to switch to i965_drv_video.

@roflcoopter
Copy link
Owner

Building from source is definitely preferable!
However doing that is pretty time consuming in my experience.
Do you know how to do it or know of any good guides?

The dependency issues are mainly Python related, for instance Pycoral does not officially support Python 3.10

@bsyomov
Copy link

bsyomov commented Jan 29, 2024

You can use pyenv to get older python in modern distribution.

@bsyomov
Copy link

bsyomov commented Jan 29, 2024

You can use 3rd party repos to install python, ppa:deadsnakes/ppa at example have some versions:

  • Ubuntu 22.04 (jammy) Python3.7 - Python3.9, Python3.11 - Python3.13

@roflcoopter
Copy link
Owner

Great idea, will try that!

@luisiam
Copy link

luisiam commented Apr 8, 2024

I am experiencing the same problem. Both on N100 and i5-12600k.

@roflcoopter
Copy link
Owner

Will try to fast track some upgrades of dependencies before v3.0.0

@roflcoopter
Copy link
Owner

I have successfully updated to Ubuntu 22.04 and have a PoC for running the EdgeTPU component under python 3.9 in a spawn subprocess.

Just need to clean up the code a bit before pushing a new beta

@w-marco
Copy link
Sponsor

w-marco commented May 6, 2024

FWIW, the VA-API Issue still exists on the latest dev build for me. Also using Intel N100 with SR-IOV.

I edited the file /etc/apt/sources.list.d/intel.gpu.focal.list to be jammy instead of focal and installed intel-media-va-driver-non-free again. Now vainfo is reporting my GPU and after restarting the viseron container, VA-API is recognized!

****** Checking for hardware acceleration platforms ******
OpenCL is available!
VA-API is available!
CUDA cannot be used

@roflcoopter
Copy link
Owner

Thanks for troubleshooting! Will fix soon.
Hopefully I can release the next beta in a few days

@roflcoopter
Copy link
Owner

Hit a small snag, i upgraded OpenVINO in the process to version 2023.3 since older versions are not available for Ubuntu 22.04.
This version is causing segfaults when running object detection.

Have to revert back to an old version and do some testing before i can release the beta

@roflcoopter
Copy link
Owner

I decided to ignore the OpenVINO error for now and added a note to the docs that it is broken.
Hopefully OpenCV 4.10.0 fixes this issue when it is released.

I just pushed 3.0.0b4, builds should be done in a few minutes.

Please give it a go when you get the chance!

@w-marco
Copy link
Sponsor

w-marco commented May 8, 2024

VA-API working fine for me with 3.0.0b4 and Intel N100 using SR-IOV!

@roflcoopter
Copy link
Owner

Great to hear! Thanks for the quick response

@roflcoopter
Copy link
Owner

Closing as this is addressed in the latest beta.
Please create a new issue if you encounter any problems

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

5 participants