Open Bug 1210729 Opened 4 years ago Updated 27 days ago

Add VDPAU or NVDEC hardware decoding support on Linux

Categories

(Core :: Audio/Video: Playback, enhancement, P3)

43 Branch
Desktop
Linux
enhancement

Tracking

()

People

(Reporter: jya, Assigned: jya)

References

(Depends on 1 open bug, Blocks 1 open bug)

Details

This bug is to track VDPAU support (decoding only) with nvidia graphic cards.
VDPAU also works for Radeon cards with Mesa driver:

https://wiki.freedesktop.org/xorg/radeon/
> 2 Nov 2011: 6.14.3 ... vdpau/XvMC support

https://wiki.freedesktop.org/xorg/RadeonFeature/
> Video Decode (VDPAU/OpenMax/VAAPI) on UVD

But as far I know only VDPAU support was packaged in Ubuntu: https://bugs.launchpad.net/bugs/1481832

Also there is special driver called vdpau-va-driver (available for installation from repository). Using this driver it's possible to access VA-API implementations (Intel, AMD proprietary) and VDPAU implementations (nVidia proprietary, nVidia free, Radeon free) using VA-API.

Also I have to note that if VDPAU is supported by driver and vdpau-va-driver is installed it will be looks like both of VA-API and VDPAU is available, so Firefox will need to decide which one to use.

I am not expert in this field, but consider this - maybe it will be easier to support just one API that cover all available drivers?  (Directly with Intel and AMD proprietary or via vdpau-va-driver for the rest.) Also VA-API already support Wayland.
vaapi backend for VDPAU is terrible anyway; so will likely search for vdpau first and if not found search for va.
supporting vdpau gives you support for nvidia and AMD (via open source driver) and vaapi gives you support for intel and amd (proprietary drivers)
Today I spent the whole day trying to get hardware acceleration working for HTML5/Youtube/Twitch videos, in both Firefox and Chromium, only to find out that it is totally unclear for a normal user to understand how the different APIs/libs etc should work together.

First of all, is there any relevance if Firefox shows GPU support enabled? Then, as I understood, ffmpeg is now the chosen video rendering framework. Would it then not be easy to select the proper decoder flags there?

For the moment I can´t understand how the pipeline should work with either gstreamer or ffmpeg. Result is the same, it seems, no HW acceleration works, my videos are dead slow...
ffmpeg doesn't do the work required, it only provides an overlay to simplify things. That's what they call hwaccel API (well hwaccel2 now as they keep changing it). And to me that API is a big fail because the setup required is different depending on the framework you'll end up using. Some of them require field 0 of an array to be set, sometimes it's at index 3 etc.

But in any case, performing decoding through VDPAU is just one aspect of things. This will return a GPU backed VDPAU surface. You then need to display that surface which itself must be done using on the of VDPAU presentation API.

The alternative is to extract the bitmap data from that GPU surface and then display it as a software image. But the cost to read back the GPU is very high, almost removing all benefit you will get from decoding alone.

(In reply to Florian Leeber from comment #3)
> First of all, is there any relevance if Firefox shows GPU support enabled?
> Then, as I understood, ffmpeg is now the chosen video rendering framework.
> Would it then not be easy to select the proper decoder flags there?

ffmpeg doesn't render anything, it only performs the decoding part

Compositing the decoded frame is the hardest part.
Ok understood. But still decoding would already give some performance benefits. You see I am trying here to get the same performance from HTML5/WEBM inside browser as I get from mplayer/vlc/xine etc. The box in question is an Atom board with nvidia ION chipset, which was proposed to have HW decoding at the time I bought it. Which was true, but today web videos get more and more important...

Sadly it seems to come out that this old chipset is being abandoned by nvidia, and newer drivers wont enable HW acceleration in any browser. Still as I understand video acceleration should be possible (let alone 4K and such things)
(In reply to Jean-Yves Avenard [:jya] from comment #4)
> You then need to display that surface which itself must be done using on the of VDPAU
> presentation API.

VDPAU can be used with OpenGL as well e.g.,
https://github.com/mpv-player/mpv/commit/db6a4eec0a9a58a342147e526154c46f19e7c303
(for post-processing see --vf=vdpaupp and --vf=vdpaurb)
good to know.. thank you for those pointers.
Maybe it is easier to first enable vdpau in fullscreen?
Would be a good start.
(In reply to Jean-Yves Avenard [:jya] from comment #2)
> vaapi backend for VDPAU is terrible anyway; so will likely search for vdpau
> first and if not found search for va.
> supporting vdpau gives you support for nvidia and AMD (via open source
> driver) and vaapi gives you support for intel and amd (proprietary drivers)

vdpau is also important for some non-PC systems, for instance single board computers using Allwinner chipsets are supported by vdpau but no other (standard) acceleration system.
We still have NO hardware video acceleration on Linux.
Do we have any about:config key to enable beta VDPAU or something?
Mass change P2 -> P3
Priority: P2 → P3
(In reply to Erdem U. Altinyurt from comment #10)
> Do we have any about:config key to enable beta VDPAU or something?

No. There is no VDPAU support.
Chrome doesn't use VDPAU. Nor does it use VAAPI either. They only use software decoding. 

I suggest you try Firefox 51 (developer edition) and try again; as OpenGL accelerated layer are now turned on by default. 

In any case; extremely doubtful the chrome use 1/4th of the CPU than Firefox considering that they both use the same video decoders. Unless you use Flash.
Gentle reminder:

* Our guidelines ask you don't argue about priority setting on bugs. Triage leads and Mozillians working on the bug set the priority. See: https://bugzilla.mozilla.org/page.cgi?id=etiquette.html
* "Me too" or "Fix this or I'm moving to Chrome/Lynx/Gopher/Edge/Webkit" comments are off topic and just add noise.
Flags: needinfo?(mhoye)
Hi, everyone. Mike Hoye here, Mozilla's engineering community manager. 

This is your much-less-gentle reminder that Bugzilla is our professional working environment as much as it is our issue tracker, and the fact that we value and encourage community involvement in Firefox development does not give anyone the right to insult our colleagues or brigade bugs with counterproductive comments. 

Our engineers have a great deal of discretion about how to best spend their time, and a bug with a long, toxic comment thread is not something anyone looks forward to touching at all, much less move to the front of the line. 

If you want this bug fixed, keep that in mind. 

If you can't find a way to participate productively in this bug without demeaning other Mozilla community members, their responses or their work, then don't. 

If you decide to do so anyway, my next step will be deactivating your bugzilla account. 

If you've got questions about that, feel free to email me.

Have a good weekend.
Flags: needinfo?(mhoye)
That's quite enough of that.

I am restricting this bug to editbugs-privileged bugzilla users only. If you have a contribution that you feel will meaningfully advance the state of this bug, that this restriction prevents you from contributing, please feel free to let me know and I will add it.

Thank you.
Restrict Comments: true
Summary: Add VDPAU hardware decoding support on Linux → Add VDPAU or NVDEC hardware decoding support on Linux
Type: defect → enhancement
Depends on: wr-nv-linux
OS: Unspecified → Linux
Hardware: Unspecified → Desktop
You need to log in before you can comment on or make changes to this bug.