Skip to content

Hardware Accelerated Decoding

WangBin edited this page Nov 20, 2015 · 19 revisions

User

VA-API

Install vainfo libva-dev, libva-intel-vaapi-driver(intel gpu), xvba-va-driver(ATI), vdpau-va-driver(NVIDIA)

If vainfo works, then QtAV should work with VA-API

EGL

Since Qt5.5, you can enable EGL by setting environment var QT_XCB_GL_INTEGRATION=xcb_egl. If EGL is used, VA-API can get the best performance.

CUDA

OpenGL desktop mode supports 0-copy

Linux

nvidia-331 works. I don't know how to enable CUDA for other drivers. Tell me if you know.

Windows

Install latest nvidia driver.

DXVA

Run in OpenGL ES2 mode (ANGLE) to enable 0-copy. 0-copy in OpenGL desktop mode only supports some new intel GPUs.

Developer

Build

Code

CUDA:

QVaraiantHash cuda_opt;
cuda_opt["surfaces"] = 0; //key is property name, case sensitive
cuda_opt["copyMode"] = "ZeroCopy"; // default is "GenericCopy"
QVariantHash opt;
opt["CUDA"] = cuda_opt; //key is decoder name, case sensitive
player.setOptionsForVideoCodec(opt);

Since QtAV1.8, CUDA decoder supports ZeroCopy. Run your program with NVIDIA GPU if you have multiple GPUs.

VA-API:

QVaraiantHash va_opt;
va_opt["display"] = "X11"; //"GLX", "X11", "DRM", "EGL"
va_opt["copyMode"] = "ZeroCopy"; // "ZeroCopy", "OptimizedCopy", "GenericCopy". Default is "ZeroCopy" if possible
QVariantHash opt;
opt["VAAPI"] = va_opt; //key is decoder name, case sensitive
player.setOptionsForVideoCodec(opt);

Copy Mode

Copy mode for GPU decoders was introduced since 1.5.0. Copy mode can be ZeroCopy, LazyCopy, OptimizedCopy and GenericCopy.

  • ZeroCopy: No data read back from GPU. Directly render the decoded data on GPU. It's the most efficient way. Now it's supported by
    • CUDA
    • VA-API with libva-x11 and libva-glx. It may not work for vdpau backend.
    • VDA(OSX), VideoToolbox(OSX, iOS>=8)
    • DXVA with ANGLE. (Desktop OpenGL is not stable now)
  • LazyCopy: Used in VDA and VideoToolBox
  • OptimizedCopy: Use SSE4.1 for x86 used by DXVA and VA-API(VDA crashes), and NEON for CedarV. SSE4.1 does not work for some GPUs, e.g. NVIDIA GS8400
  • GenericCopy: Use memcpy

Status

  • D3D11
  • Copy
  • EGL (D3D11)
  • DXVA
  • Copy
  • EGL (D3D9)
  • OpenGL (WIP)
  • CUDA
  • Copy
  • EGL (WIP)
  • OpenGL
  • VA-API
  • Copy
  • EGL DRM
  • EGL DMA
  • EGL TFP
  • GLX TFP
  • VDA
  • Copy
  • OpenGL
  • VideoToolbox
  • OSX Copy+OpenL
  • iOS
  • VDPAU
  • OMX
Clone this wiki locally