[FFmpeg-devel] [PATCH] configure: Do not enable both OpenCL-VAAPI interop modes simultaneously

Song, Ruiling ruiling.song at intel.com
Wed Mar 27 02:59:51 EET 2019



> -----Original Message-----
> From: ffmpeg-devel [mailto:ffmpeg-devel-bounces at ffmpeg.org] On Behalf Of
> Mark Thompson
> Sent: Wednesday, March 27, 2019 7:39 AM
> To: FFmpeg development discussions and patches <ffmpeg-devel at ffmpeg.org>
> Subject: [FFmpeg-devel] [PATCH] configure: Do not enable both OpenCL-VAAPI
> interop modes simultaneously
> 
> Beignet offers a far more flexiable and complete interface, so choose it
> by default if available.
Sorry I missed your last mail. Sure, I agree Beignet sharing is far more flexible.
The patch LGTM.

Thanks!
Ruiling
> ---
> On 23/03/2019 12:27, Mark Thompson wrote:
> > On 22/03/2019 01:40, Ruiling Song wrote:
> >> ffmpeg | branch: master | Ruiling Song <ruiling.song at intel.com> | Fri Nov 23
> 13:39:12 2018 +0800| [61cb505d18b8a335bd118d88c05b9daf40eb5f9b] |
> committer: Ruiling Song
> >>
> >> lavu/opencl: replace va_ext.h with standard name
> >>
> >> Khronos OpenCL header (https://github.com/KhronosGroup/OpenCL-Headers)
> >> uses cl_va_api_media_sharing_intel.h. And Intel's official OpenCL driver
> >> for Intel GPU (https://github.com/intel/compute-runtime) was compiled
> >> against Khronos OpenCL header. So it's better to align with Khronos.
> >>
> >> Signed-off-by: Ruiling Song <ruiling.song at intel.com>
> >>
> >>>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=61cb505d18b8a335
> bd118d88c05b9daf40eb5f9b
> >> ---
> >>
> >>  configure                    | 2 +-
> >>  libavutil/hwcontext_opencl.c | 2 +-
> >>  2 files changed, 2 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/configure b/configure
> >> index a817479559..331393f8d5 100755
> >> --- a/configure
> >> +++ b/configure
> >> @@ -6472,7 +6472,7 @@ fi
> >>
> >>  if enabled_all opencl vaapi ; then
> >>      enabled opencl_drm_beignet && enable opencl_vaapi_beignet
> >> -    check_type "CL/cl.h CL/va_ext.h"
> "clCreateFromVA_APIMediaSurfaceINTEL_fn" &&
> >> +    check_type "CL/cl.h CL/cl_va_api_media_sharing_intel.h"
> "clCreateFromVA_APIMediaSurfaceINTEL_fn" &&
> >>          enable opencl_vaapi_intel_media
> >>  fi
> >>
> >> diff --git a/libavutil/hwcontext_opencl.c b/libavutil/hwcontext_opencl.c
> >> index d3df6221c4..b116c5b708 100644
> >> --- a/libavutil/hwcontext_opencl.c
> >> +++ b/libavutil/hwcontext_opencl.c
> >> @@ -50,7 +50,7 @@
> >>  #include <mfx/mfxstructures.h>
> >>  #endif
> >>  #include <va/va.h>
> >> -#include <CL/va_ext.h>
> >> +#include <CL/cl_va_api_media_sharing_intel.h>
> >>  #include "hwcontext_vaapi.h"
> >>  #endif
> >>
> >
> > This broke the build when both are available.
> >
> > $ make
> > CC      libavutil/hwcontext_opencl.o
> > src/libavutil/hwcontext_opencl.c: In function ‘opencl_device_derive’:
> > src/libavutil/hwcontext_opencl.c:1236:5: error: duplicate case value
> >      case AV_HWDEVICE_TYPE_VAAPI:
> >      ^~~~
> > src/libavutil/hwcontext_opencl.c:1205:5: note: previously used here
> >      case AV_HWDEVICE_TYPE_VAAPI:
> >      ^~~~
> > src/libavutil/hwcontext_opencl.c: In function ‘opencl_map_to’:
> > src/libavutil/hwcontext_opencl.c:2831:5: error: duplicate case value
> >      case AV_PIX_FMT_VAAPI:
> >      ^~~~
> > src/libavutil/hwcontext_opencl.c:2825:5: note: previously used here
> >      case AV_PIX_FMT_VAAPI:
> >      ^~~~
> > src/libavutil/hwcontext_opencl.c: In function ‘opencl_frames_derive_to’:
> > src/libavutil/hwcontext_opencl.c:2873:5: error: duplicate case value
> >      case AV_HWDEVICE_TYPE_VAAPI:
> >      ^~~~
> > src/libavutil/hwcontext_opencl.c:2866:5: note: previously used here
> >      case AV_HWDEVICE_TYPE_VAAPI:
> >      ^~~~
> > make: *** [ffbuild/common.mak:60: libavutil/hwcontext_opencl.o] Error 1
> > make: Target 'all' not remade because of errors.
> >
> > $ cat config.h | grep HAVE_OPENCL
> > #define HAVE_OPENCL_D3D11 0
> > #define HAVE_OPENCL_DRM_ARM 0
> > #define HAVE_OPENCL_DRM_BEIGNET 1
> > #define HAVE_OPENCL_DXVA2 0
> > #define HAVE_OPENCL_VAAPI_BEIGNET 1
> > #define HAVE_OPENCL_VAAPI_INTEL_MEDIA 1
> >
> >
> > I think in general the Beignet mapping is more useful if present since it has far
> fewer constraints, so perhaps disable this one if Beignet is there?
> 
>  configure | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/configure b/configure
> index 331393f8d5..c94f516224 100755
> --- a/configure
> +++ b/configure
> @@ -6471,9 +6471,12 @@ if enabled_all opencl libdrm ; then
>  fi
> 
>  if enabled_all opencl vaapi ; then
> -    enabled opencl_drm_beignet && enable opencl_vaapi_beignet
> -    check_type "CL/cl.h CL/cl_va_api_media_sharing_intel.h"
> "clCreateFromVA_APIMediaSurfaceINTEL_fn" &&
> -        enable opencl_vaapi_intel_media
> +    if enabled opencl_drm_beignet ; then
> +        enable opencl_vaapi_beignet
> +    else
> +        check_type "CL/cl.h CL/cl_va_api_media_sharing_intel.h"
> "clCreateFromVA_APIMediaSurfaceINTEL_fn" &&
> +            enable opencl_vaapi_intel_media
> +    fi
>  fi
> 
>  if enabled_all opencl dxva2 ; then
> --
> 2.19.2
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".


More information about the ffmpeg-devel mailing list