[vlc-devel] [PATCH 00/39] DirectX VA uses picture->context to output its decoded frames

Steve Lhomme robux4 at videolabs.io
Fri Jun 2 16:46:03 CEST 2017

This is how VA is supposed to work. This will also allow using the decoders
with any video output since they don't have to allocate the picture_sys_t
anymore and the GPU->CPU filter will now work properly.

A lot of patches correspond to code cleaning and refactoring. The code is
closer to the way VDPAU works.

There are also patches for CPU->GPU conversion when CPU fallback is used with
filters while decoding is done in hardware.

Part of the CommonUpdatePicture() that was in all win32 vout is now shared with
some filters in picture_helper as picture_UpdatePlanes().

DXGI_FORMAT_420_OPAQUE is not handled outside of the decoder otherwise it would
mean having a second pool to send to the vout (one for the decoder, one for the
display). It's handled by the GPU->CPU filter as the vout will fallback to a
non opaque format for that decoder.

The NVIDIA crash with more than 30 slices is fixed by using a local pool with
less slices in the decoder. It uses double the memory because we still want to
use direct rendering but we could disable direct rendering in that case and do
one more copy to save GPU memory.

Steve Lhomme (39):
  d3d11va: remove the internal filter to output YV12
  dxva2: remove the internal filter to output YV12
  d3d11va: fix the internal pool use with direct decode builds
  d3d11va: fix passing surfaces from the local pool to upstream filters
  d3d11va: use ReleasePictureSys for d3d11va internal pictures
  directx_va: let the va deal with the vlc_va_surface_t storage
  dxva: don't store the surface in the picture context
  directx_va: add a way to lock/unlock a surface
  directx_va: type the common variables for D3D11VA and DXVA2
  direct3d: fix some logs
  d3d_fmt: add a comment on who owns the picture_sys_t data
  directx_va: allow not setting device manager callbacks
  vout: win32: move the GPU to CPU picture buffer mapping in a separate
  d3d11va: don't use the external pool for NVIDIA hardware with too many
  direct3d11: detect early if DXGI_FORMAT_420_OPAQUE will be used by the
  dxa9: the texture height is given by the texture description
  d3d11_surface: no matter what the texture height is given by the
    texture description
  direct3d11: do the D3D11_OPAQUE -> NV12 conversion outside of the
  d3d11va: no need to type the intermediate recipient of QueryInterface
  direct3d11: make AllocateShaderView() more generic
  direct3d11: move AllocateShaderView() in d3d11_fmt.h
  directx_va: no need to store temporarily the number of threads
  directx_va: merge local functions only called once
  directx_va: cleaning
  directx_va: make each vlc_va_surface_t more independent
  directx_va: pass the decoder surface via the returned vlc_va_surface_t
  d3d11va: make the internal pool usable with the pixel shader
  d3d11va: do not use the vlc_va_surface_t picture anymore
  directx_va: replace the internal reference counter by an atomic value
  directx_va: rework the picture picking algorithm
  directx_va: remove the unused lock
  directx_va: let the surface deal with releasing its memory
  directx_va: stronger typing of va_surface in picture_sys_t
  dxva2: the decoder sets the surface in the picture->context, not
  d3d11va: the decoder sets the surface in the picture->context, not
  direct3d11: add a module to copy from CPU to D3D11 opaque pictures
  direct3d9: add a module to copy from CPU to D3D9 opaque pictures
  video_chroma:direct3d: only copy the visible lines to the CPU planes
  directx_va: no need to allocate dummy pictures anymore

 modules/MODULES_LIST                           |   2 +
 modules/codec/avcodec/d3d11va.c                | 677 ++++++++-----------------
 modules/codec/avcodec/directx_va.c             | 155 +++---
 modules/codec/avcodec/directx_va.h             |  36 +-
 modules/codec/avcodec/dxva2.c                  | 222 +++-----
 modules/video_chroma/Makefile.am               |  12 +-
 modules/video_chroma/d3d11_fmt.h               |  67 ++-
 modules/video_chroma/d3d11_from_cpu.c          | 274 ++++++++++
 modules/video_chroma/d3d11_surface.c           | 295 ++++++++++-
 modules/video_chroma/d3d9_fmt.h                |  12 +-
 modules/video_chroma/d3d9_from_cpu.c           | 267 ++++++++++
 modules/video_chroma/dxa9.c                    |  25 +-
 modules/video_chroma/dxgi_fmt.c                |  17 +
 modules/video_chroma/dxgi_fmt.h                |   1 +
 modules/video_output/Makefile.am               |   7 +-
 modules/video_output/win32/common.c            |  54 +-
 modules/video_output/win32/d3d11_deinterlace.c |  21 +-
 modules/video_output/win32/direct3d11.c        | 132 ++---
 modules/video_output/win32/direct3d9.c         |  14 +
 modules/video_output/win32/picture_helper.c    |  87 ++++
 modules/video_output/win32/picture_helper.h    |  37 ++
 21 files changed, 1527 insertions(+), 887 deletions(-)
 create mode 100644 modules/video_chroma/d3d11_from_cpu.c
 create mode 100644 modules/video_chroma/d3d9_from_cpu.c
 create mode 100644 modules/video_output/win32/picture_helper.c
 create mode 100644 modules/video_output/win32/picture_helper.h


More information about the vlc-devel mailing list