[FFmpeg-devel] [RFC 0/4] vaapi: delegate HW resources allocation to lavc

Gwenole Beauchesne gb.devel at gmail.com
Wed Aug 19 18:01:33 CEST 2015


Hi,

As indicated before, I foresee at most 2 use-cases for lavc/vaapi:
1. Allow for implicit allocation of HW resources in lavc ;
2. Allow for the user to share the pain and manage the HW resources:
   a. The old way through AVCodecContext.get_format() + maintaining a
      vaapi_context struct + multiple calls to .get_buffer2() or the
      even older .get_buffer*() family of functions ;
   b. The new way without vaapi_context, but through a unique
      interface, yet flexible: av_vaapi_set_pipeline_params(). In such
      case, the user provides VA display & context + .get_buffer2()
      hooks to satisfy his desire.

That's the goal: provide a simple enablement path of the client
application, yet still allowing for extended usages if ever needed.

To that end, I only need 2 non-intrusive and minimal additions/changes
to the core hwaccel infrastructure. One hwaccel_config dict to hold
pipeline parameters, and one fixlet to allow for fallbacks to
.get_buffer2().

On the vaapi side, there is a bit more fun to write/merge, but I would
like to prepare for even more additions. In short, I need various
casual helper functions related to vaapi, and that could be useful to
not only vaapi decoders, but also filters. For now, I stuffed the
minimal set of helpers I immediately need into libavcodec/vaapi_utils.c.

How much would you like a libavutil_vaapi/libavhwaccel_vaapi library?
This is really utility functions like av_freep() variants to
destroying VA resources (i.e. restting id to VA_INVALID_ID after
release for instance), converting a VAStatus to some FFmpeg error,
etc.

I have attached two additional patches so that to give a glimpse at
how it could look like.

Regards,
Gwenole Beauchesne (4):
  hwaccel: add infrastructure to hold accelerator config options.
  hwaccel: try get_buffer*() if hwaccel alloc_frame() yields ENOSYS.
  vaapi: add new API to configure a VA pipeline.
  vaapi: add common utilities.

 doc/APIchanges              |   6 +-
 libavcodec/Makefile         |   4 +-
 libavcodec/internal.h       |  14 ++++
 libavcodec/utils.c          |   6 +-
 libavcodec/vaapi.c          |  87 ++++++++++++++++++++--
 libavcodec/vaapi.h          |  49 +++++++++++-
 libavcodec/vaapi_internal.h |   4 +
 libavcodec/vaapi_utils.c    | 178 ++++++++++++++++++++++++++++++++++++++++++++
 libavcodec/vaapi_utils.h    |  53 +++++++++++++
 9 files changed, 386 insertions(+), 15 deletions(-)
 create mode 100644 libavcodec/vaapi_utils.c
 create mode 100644 libavcodec/vaapi_utils.h

-- 
1.9.1



More information about the ffmpeg-devel mailing list