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

Cannot make it run on OrangePi PC (sun8i-h3) #20

Open
marsohod4you opened this issue May 8, 2019 · 4 comments
Open

Cannot make it run on OrangePi PC (sun8i-h3) #20

marsohod4you opened this issue May 8, 2019 · 4 comments

Comments

@marsohod4you
Copy link

I have installed armbian server (console) on my device OrangePI PC (this is allwinner H3 device).
Did "apt install x-window-system" so I can start "xinit &" and my hdmi display shows me xterm.
Then I cloned bootlin/linux-cedrus tags/release-2019.03 and built new kernel and installed it.
Then got https://github.com/intel/libva and built branch v2.4-branch, installed.
Against this libva I got and built this bootlin/libva-v4l2-request (also tags/release-2019.03)
Also I built v4l2-request-test
In armbianEnv.txt added line extraargs="cma=256M"

So v4l2-request-test runs properly and I see on full-screen fragment of bunny movie cycled. That is ok.
My my cedrus devices are:

nick@orangepipc:/opt/libva-v4l2-request/src$ ls /dev/media0 -l
crw-rw-rw- 1 root video 252, 0 May 8 16:05 /dev/media0
nick@orangepipc:/opt/libva-v4l2-request/src$ ls /dev/video0 -l
crw-rw-rw- 1 root video 81, 0 May 8 16:05 /dev/video0

Because v4l2-request-test works properly I expect that I did all right and further should be no problems, but not.

Then I want to run vlc and/or gstreamer.
1st trouble was that VLC even did not want to use HW acceleration. I spent whole day until understood that VLC by default uses multi-threading for ffmpeg and this DISABLES any possibility for HW accel. I need to manually modify VLC config file like ~/.config/vlc/vlcrc and whereever found option thread number set to 1 instead of 0 (auto mean multi-threading)
Then at least VLC begins tries to use HW accel. Would be good to add this tip into docs.

Well. VLC in my case does not work accelerated.
It crashes with log:
vlc -v ./bunny.mp4
VLC media player 3.0.6 Vetinari (revision 3.0.6-0-g5803e85f73)
libEGL warning: DRI2: failed to authenticate
[swscaler @ 0xac5b5260] No accelerated colorspace conversion found from yuv420p to bgra.
[swscaler @ 0xac5b5260] No accelerated colorspace conversion found from yuv420p to bgra.
libva info: VA-API version 1.4.1
libva info: va_getDriverName() returns -1
libva info: User requested driver 'v4l2_request'
libva info: Trying to open /usr/lib/dri/v4l2_request_drv_video.so
libva info: Found init function __vaDriverInit_1_4
libva info: va_openDriver() returns 0
[swscaler @ 0xa8f04530] No accelerated colorspace conversion found from yuv420p to bgra.
Segmentation fault

So sad.
Next I am trying to use gstreamer.
I have installed gstreamer1.0-vaapi package and configured it with

export LIBVA_DRIVERS_PATH=/usr/lib/dri
export LIBVA_DRIVER_NAME=v4l2_request
export DISPLAY=:0
export GST_VAAPI_ALL_DRIVERS=1

recent line seem important because otherwise VAAPI plugins are blacklisted in gstreamer.
gst-inspect gives hope:

gst-inspect-1.0 vaapi
Plugin Details:
Name vaapi
Description VA-API based elements
Filename /usr/lib/arm-linux-gnueabihf/gstreamer-1.0/libgstvaapi.so
Version 1.10.4
License LGPL
Source module gstreamer-vaapi
Source release date 2017-02-23
Binary package gstreamer-vaapi
Origin URL http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer

vaapimpeg2dec: VA-API MPEG2 decoder
vaapih264dec: VA-API H264 decoder
vaapih265dec: VA-API H265 decoder
vaapisink: VA-API sink

4 features:
+-- 4 elements

So I see decoding elements present.
I am trying to run any gstreamer pipeline like this:
gst-launch-1.0 filesrc location=[FILENAME] ! qtdemux ! vaapih264dec ! fakesink

My tries are failed here with log:

gst-launch-1.0 filesrc location=/opt/videos/bunny.mp4 ! qtdemux ! vaapih264dec ! fakesink
libva info: VA-API version 1.4.1
libva info: va_getDriverName() returns -1
libva info: User requested driver 'v4l2_request'
libva info: Trying to open /usr/lib/dri/v4l2_request_drv_video.so
libva info: Found init function __vaDriverInit_1_4
libva info: va_openDriver() returns 0
Setting pipeline to PAUSED ...
libva info: VA-API version 1.4.1
libva info: va_getDriverName() returns -1
libva info: User requested driver 'v4l2_request'
libva info: Trying to open /usr/lib/dri/v4l2_request_drv_video.so
libva info: Found init function __vaDriverInit_1_4
libva info: va_openDriver() returns 0
Pipeline is PREROLLING ...
Got context from element 'vaapidecode_h264-0': gst.vaapi.Display=context, gst.vaapi.Display=(GstVaapiDisplay)NULL;
v4l2-request: Unable to set format for type 1: Device or resource busy
v4l2-request: Unable to set format for type 1: Device or resource busy
v4l2-request: Unable to set format for type 1: Device or resource busy
v4l2-request: Unable to set format for type 1: Device or resource busy
v4l2-request: Unable to set format for type 1: Device or resource busy
v4l2-request: Unable to set format for type 1: Device or resource busy
v4l2-request: Unable to set format for type 1: Device or resource busy
v4l2-request: Unable to set format for type 1: Device or resource busy
v4l2-request: Unable to set format for type 1: Device or resource busy
v4l2-request: Unable to set format for type 1: Device or resource busy
v4l2-request: Unable to set format for type 1: Device or resource busy
ERROR: from element /GstPipeline:pipeline0/GstVaapiDecode_h264:vaapidecode_h264-0: Decoding error
Additional debug info:
../../../gst/vaapi/gstvaapidecode.c(689): gst_vaapidecode_handle_frame (): /GstPipeline:pipeline0/GstVaapiDecode_h264:vaapidecode_h264-0:
Decode error -1
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
Freeing pipeline ...

After so debug I see that error happens in function surface.c RequestCreateSurfaces2(..) which calls v4l2_set_format(..) with parameter capture_type=1

What ever this can be?

Can You please give me some ideas? What is wrong with VLC? And for me would be even more important gstreamer, is it ever chance to make it run?

@paulkocialkowski
Copy link
Contributor

Hi,

I spent whole day until understood that VLC by default uses multi-threading for ffmpeg and this DISABLES any possibility for HW accel.

This is unheard of so far. Do you have anything to back this statement besides what you are describing? If not, can you indicate how to reproduce the issue in details?

Segmentation fault

Well, are you sure this is caused by our libva and not by your setup somehow? We need more information anyway.

Next I am trying to use gstreamer.

We don't support GStreamer at this point, but I think Nicolas has it working (with buffer copies) with patches from his pull request, that I'll pick up very soon.

What ever this can be? Can You please give me some ideas? What is wrong with VLC?

Things are working fine on my side, so I will need more information if you want to see the issue resolved. For instance, reproducing the segfault in gdb and sharing traces, etc.

@marsohod4you
Copy link
Author

I found this thread: https://forum.videolan.org/viewtopic.php?t=134770
They discuss issue similar I had, they write (if I understood correctly) that VLC can be compiled to use libav or ffmpeg and if it uses ffmpeg then multithreading in ffmpeg disables VLC hw acceleration.
I have installed vlc with "apt install vlc" - that is all - I have no idea how it was built or which libraries it uses.
I followed their advice to disable multithreading and then it starts to call your driver.
Well, to be honest i am not interested on VLC at all.. so I stopped my research here.
Besides that libva-dump works perfectly.

Anyway I need gstreamer plugin and I dig in this direction, without success yet.
Is it possible somehow to get gstreamer patches or whatever? Copying frames is ok for me.

@marsohod4you
Copy link
Author

What is exact version of libva library neccessary to work this driver?
What is proper or recommended source of libva library?
On armbian "apt install" gives me libva version 0.39 but probably this is too old?

@Dreyk007
Copy link

@paulkocialkowski same question as above: which version of libva (https://github.com/intel/libva) neccessary for libva-v4l2-request now? Thank you.

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

3 participants