Is this the best approach to enable vaapi?

This forum is about all development around libVLC.
microwavesafe
New Cone
New Cone
Posts: 2
Joined: 30 Oct 2014 09:35

Is this the best approach to enable vaapi?

Postby microwavesafe » 30 Oct 2014 10:01

I have now successfully enabled hardware decoding through vaapi on my system, but the route I've taken doesn't seem like the best approach.
I ended up hard coding the string "vaapi_x11" into the va.c file of modules/codec/avcodec. Anything else I tried just didn't work.

I think the problem is that the "any" default setting doesn't pick up the hardware, so in the vlc player I have to set it to VAAPI X11. But libvlc seemed to ignore this setting in ~/.config/vlcrc. It also did4 do anything with this setting in a .vlcrc file I placed next to the executable. I also tried passing --no-ignore-config to libvlc_new, but this didn't work. I then tried passing --ignore-config as well as --avcodec-hw, vaapi_x11 / --avcodec-hw=vaapi_x11 to libvlc_new, but in the debug messages it would always search for "any" and not match anything.

[00007f12a00009e8] core generic debug: looking for hw decoder module matching "any": 2 candidates
[00007f12a00009e8] core generic debug: no hw decoder modules matched

So I found where the name was being passed and hard coded it to what I wanted, in this case vaapi_x11 (taken from the settings file).

(line 57 of va.c)

Code: Select all

-- va->module = vlc_module_load(va, "hw decoder", "$avcodec-hw", true, vlc_va_Start, va, avctx, fmt); ++ va->module = vlc_module_load(va, "hw decoder", "vaapi_x11", true, vlc_va_Start, va, avctx, fmt);
Now libvlc finds the correct module

[00007fc4200009e8] core generic debug: looking for hw decoder module matching "vaapi_x11": 2 candidates
libva info: VA-API version 0.35.1
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_0_35
libva info: va_openDriver() returns 0
[00007fc4200009e8] core generic debug: using hw decoder module "vaapi_x11"
[00007fc4340b3828] avcodec decoder: Using Intel i965 driver for Intel(R) Bay Trail - 1.3.2 for hardware decoding.

Although this works and I can live with the solution, it doesn't seem very elegant. Is this the only way to pursade libvlc to take the vaapi setting?

Rémi Denis-Courmont
Developer
Developer
Posts: 15272
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: Is this the best approach to enable vaapi?

Postby Rémi Denis-Courmont » 30 Oct 2014 10:30

The "problem" is set_capability("hw decoder, 0); in vaapi.c. Put a non-zero value and it will work.

Then again, there are reasons why this is not enabled by default.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

microwavesafe
New Cone
New Cone
Posts: 2
Joined: 30 Oct 2014 09:35

Re: Is this the best approach to enable vaapi?

Postby microwavesafe » 30 Oct 2014 10:33

OK thanks for your reply.

As I am compiling for a specific target (it will only run on specific embedded platforms), I am happy with this solution.

I do wonder why, although this isn't enabled by default that there is not some way to turn it on through the interface instead of re-compiling? Is the code really unstable to use?

Rémi Denis-Courmont
Developer
Developer
Posts: 15272
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: Is this the best approach to enable vaapi?

Postby Rémi Denis-Courmont » 30 Oct 2014 12:55

The code is not sufficiently robust to enable automatically.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 19 guests