[vlc-devel] [PATCH 0/5] Direct3D11 deinterlacing

Steve Lhomme robux4 at gmail.com
Tue Mar 28 17:23:04 CEST 2017


On Tue, Mar 28, 2017 at 4:23 PM, Steve Lhomme <robux4 at videolabs.io> wrote:
> In Direct3D11 textures are "strongly" typed. They can only be bound on certain
> parts of the pipelines at once but not all of them. So for example it's not
> possible to have a texture to use with the decoder, in a VideoProcessor and
> to be displayed.
>
> To do GPU deinterlacing we need textures that go in/out of a VideoProcessor.
> But since the textures cannot be the same as the decoder+shader ones, we need
> to know what kind of texture we are creating. So I split the current 3 main
> pools in the core into distinct pools to the vout. This is opt-in so other
> vouts can continue to work as they used to.
>
> The first part of the patch is to differentiate the 3 pools when the core
> requests them. A new type for each of these 3 pools is introduced and passed
> to the Pool() callback. The display pool requests 3 pictures (it may be
> 2= DISPLAY_PICTURE_COUNT + 1 kept picture), the filter pool 4 pictures (3 for
> filters and 1 for SPU) and the decoder pool at least dpb_size + 1 with a
> minimum of 14 (20 -(4+1+1)).
>
> The second part allows a vout to tell if it can display pictures coming from
> the decoder pool. This may not always be the case in D3D11.
>
> The next patch adds support for typed pools in D3D11, refining the binding and
> CPU usage depending on the type of pool requested.
>
> Then the D3D11 deinterlacer which uses the decoder pool on input and filter
> pool on ouput.
>
> Fixes #12855 for D3D11, in D3D9 there is no such binding restrictions so the
> current pool can probably be used.

Actually there is no binding but the API to create a decoder surface
is different than a regular surface:
IDirectXVideoDecoderService_CreateSurface() vs
IDirect3DDevice9_CreateOffscreenPlainSurface()

For now in D3D9 we create the whole decoder pool and waste a lot of
memory because we reallocate the surfaces needed by the decoder in the
decoder.
It is not possible for the vout to create the decoder pool because it
doesn't have a decoder. But knowing the pool type and output needed it
could create empty pictures for the decoder pool rather than allocate
a lot of memory. The actual surface could be passed by the decoder
Extract() into a picture from the decoder pool (with proper reference
handling), avoiding the copy we do now. I don't know if such surfaces
can be displayed though... (proving that D3D11 > D3D9)

> Steve Lhomme (5):
>   [RFC] core: allow use different pool sources for different types
>   [RFC] core: add a way for the vout to tell if it can display decoder
>     pictures
>   direct3d11: handle separate pools for decoder/display/filters
>   d3d11_fmt: rename inputView to processorInput
>   vout: win32: add a Direct3D11 deinterlacer
>
>  include/vlc_vout_display.h                     |  14 +-
>  include/vlc_vout_wrapper.h                     |   4 +-
>  modules/codec/avcodec/d3d11va.c                |   8 +-
>  modules/codec/omxil/vout.c                     |   5 +-
>  modules/hw/mmal/vout.c                         |   3 +-
>  modules/hw/vdpau/display.c                     |   3 +-
>  modules/video_chroma/d3d11_fmt.h               |   3 +-
>  modules/video_output/Makefile.am               |   4 +
>  modules/video_output/aa.c                      |   5 +-
>  modules/video_output/android/display.c         |   5 +-
>  modules/video_output/caca.c                    |   5 +-
>  modules/video_output/caopengllayer.m           |   5 +-
>  modules/video_output/decklink.cpp              |   4 +-
>  modules/video_output/directfb.c                |   5 +-
>  modules/video_output/evas.c                    |   3 +-
>  modules/video_output/fb.c                      |   5 +-
>  modules/video_output/flaschen.c                |   5 +-
>  modules/video_output/kva.c                     |   5 +-
>  modules/video_output/macosx.m                  |   5 +-
>  modules/video_output/opengl/display.c          |   5 +-
>  modules/video_output/sdl.c                     |   5 +-
>  modules/video_output/vdummy.c                  |   6 +-
>  modules/video_output/vmem.c                    |   5 +-
>  modules/video_output/wayland/shm.c             |   3 +-
>  modules/video_output/win32/d3d11_deinterlace.c | 285 +++++++++++++++++++++++++
>  modules/video_output/win32/direct3d11.c        | 176 +++++++++------
>  modules/video_output/win32/direct3d9.c         |   5 +-
>  modules/video_output/win32/directdraw.c        |   5 +-
>  modules/video_output/win32/glwin32.c           |   5 +-
>  modules/video_output/win32/wingdi.c            |   5 +-
>  modules/video_output/xcb/x11.c                 |   5 +-
>  modules/video_output/xcb/xvideo.c              |   5 +-
>  modules/video_output/yuv.c                     |   6 +-
>  src/video_output/display.c                     |  10 +-
>  src/video_output/video_output.c                |   3 +-
>  src/video_output/vout_wrapper.c                |  89 +++++---
>  36 files changed, 569 insertions(+), 150 deletions(-)
>  create mode 100644 modules/video_output/win32/d3d11_deinterlace.c
>
> --
> 2.11.1
>


More information about the vlc-devel mailing list