[vlc-devel] [PATCH 00/29] Direct3D11 decoding speed improvements

Steve Lhomme robux4 at videolabs.io
Thu Jan 19 11:10:35 CET 2017


This long series of patches changes the way the D3D11 vout and video
acceleration works.

With recent FFmpeg/libav changes we are no longer forced to set the full amount
of textures in an array before decoding. We can give the VideoDecoderOutputView
as the decoder requests them. So now we just use pictures from the decoder
pool of the vout, leaving more pictures in it than when we preallocated the
whole array for libavcodec. That will help with AMD hardware which has issues
when too many slices are allocated.

The pixel shader has also changed to use a Texture2DArray input(s). That way
we can provide the texture slice straight out of the decoder without any
intermediate copy. This helps on platforms where 4K 60fps decoding is not
smooth. It is not supported on Windows 10 Mobile where it fallback to Texture2D
with an intermediate copy. It also doesn't work on AMD hardware with current
hardware so an advanced option to disable the feature until they fix the issue.

Because of this change, we cannot crop the displayed texture during the copy.
So we do it by stretching the texture around the displayed area and the
viewport will do the rest of the cropping. That allows display sizes with odd
dimensions with 4:2:0 sources.

The scope of locking the DeviceContext has been reduced to avoid locking the
decoder when we don't need to.

The patchset also include some previously submited patches like the Xbox full
to studio pixel shader tweak. And also miscellaneous cleaning at the beginning
of the set.

Steve Lhomme (29):
  direct3d11: remove the deprecated USE_DXGI code
  direct3d11: the D3D11 debug should not depend on MSVC building
  direct3d11: make sure ppColorspace is always set a value
  dxgi_fmt: log RGB16 floats
  d3d11va: move variables where they really used
  direct3d11: don't keep the context locked during the swapchain
    Present() call
  direct3d11: don't keep the context locked after Prepare()
  direct3d11: TEXCOORD0 should be a float4
  dxgi_fmt: add a helper function to detect the Xbox One
  d3d11: include initguid.h before d3d11.h so we have all the class IIDs
    needed
  d3d11: use D3D11DeviceAdapter() where possible
  d3d11va: workaround for Xbox decoder limitations
  direct3d11: the magic value for the white point is 16/256
  direct3d11: make the pixel shader matrices non-const
  direct3d11: pass the whitepoint and colorspace matrices to the RGB
    pixel shader
  direct3d11: tweak the pixel shader for the Xbox
  d3d11va: use the picture from the decoder pool directly
  direct3d11: move the shader resource view in picture_sys_t
  direct3d11: pass the shader resource view to DisplayD3DPicture()
  direct3d11: keep the whole config when selecting the quad output
    format
  direct3d11: factorize the code to select the texture format
  direct3d11: use a function to find the SPU blendable texture format
  direct3d11: Use the pixel shader corresponding to the texture format
  direct3d11: factorize the pixel shader selection from the output
    format
  direct3d11: factorize the shader compilation code
  direct3d11: use a Texture2DArray in the pixel shader
  direct3d11: use a function to allocate the shader resource views
  direct3d11: create a shader resource view for each slice of the
    decoder texture
  direct3d11: rework the texture placement

 modules/codec/avcodec/d3d11va.c         | 115 +++--
 modules/video_chroma/d3d11_surface.c    |   3 +-
 modules/video_chroma/dxgi_fmt.c         |  44 +-
 modules/video_chroma/dxgi_fmt.h         |   5 +
 modules/video_output/win32/common.h     |  25 +-
 modules/video_output/win32/direct3d11.c | 815 +++++++++++++++-----------------
 6 files changed, 537 insertions(+), 470 deletions(-)

-- 
2.10.2



More information about the vlc-devel mailing list