Message ID | 1527995724-23698-5-git-send-email-mypopydev@gmail.com |
---|---|
State | Accepted |
Commit | 2730a0fdf47c6ecbb6029d2b0dc47a27b377bcee |
Headers | show |
On 03/06/18 04:15, Jun Zhao wrote: > opencl_vaapi_intel_media doesn't depend on libmfx, OpenCL™ Drivers > and Runtimes for Intel® Architectureis is a standalone release, more > information can be found in the link: > https://software.intel.com/en-us/articles/opencl-drivers. > > Signed-off-by: Jun Zhao <mypopydev@gmail.com> > --- > configure | 6 ++---- > libavutil/hwcontext_opencl.c | 7 ++++++- > 2 files changed, 8 insertions(+), 5 deletions(-) > > diff --git a/configure b/configure > index ede32eb..aa17c13 100755 > --- a/configure > +++ b/configure > @@ -6326,10 +6326,8 @@ fi > > if enabled_all opencl vaapi ; then > enabled opencl_drm_beignet && enable opencl_vaapi_beignet > - if enabled libmfx ; then > - check_type "CL/cl.h CL/va_ext.h" "clCreateFromVA_APIMediaSurfaceINTEL_fn" && > - enable opencl_vaapi_intel_media > - fi > + check_type "CL/cl.h CL/va_ext.h" "clCreateFromVA_APIMediaSurfaceINTEL_fn" && > + enable opencl_vaapi_intel_media > fi > > if enabled_all opencl dxva2 ; then > diff --git a/libavutil/hwcontext_opencl.c b/libavutil/hwcontext_opencl.c > index 9ecc361..f9b5ccc 100644 > --- a/libavutil/hwcontext_opencl.c > +++ b/libavutil/hwcontext_opencl.c > @@ -46,7 +46,9 @@ > #endif > > #if HAVE_OPENCL_VAAPI_INTEL_MEDIA > +#if CONFIG_LIBMFX > #include <mfx/mfxstructures.h> > +#endif > #include <va/va.h> > #include <CL/va_ext.h> > #include "hwcontext_vaapi.h" > @@ -2248,10 +2250,13 @@ static int opencl_map_from_qsv(AVHWFramesContext *dst_fc, AVFrame *dst, > cl_int cle; > int err, p; > > +#if CONFIG_LIBMFX > if (src->format == AV_PIX_FMT_QSV) { > mfxFrameSurface1 *mfx_surface = (mfxFrameSurface1*)src->data[3]; > va_surface = *(VASurfaceID*)mfx_surface->Data.MemId; > - } else if (src->format == AV_PIX_FMT_VAAPI) { > + } else > +#endif > + if (src->format == AV_PIX_FMT_VAAPI) { > va_surface = (VASurfaceID)(uintptr_t)src->data[3]; > } else { > return AVERROR(ENOSYS); > Have you tested this in a non-MediaSDK environment? I don't think it will work, because it relies on proxying the special extension functions in the Media VAAPI driver (in particular, "DdiMedia_ExtGetSurfaceHandle") through libva. I guess the patch is in itself harmless, but I'm not sure what the use-case of such a setup would be. Thanks, - Mark
2018-06-04 2:18 GMT+08:00 Mark Thompson <sw@jkqxz.net>: > On 03/06/18 04:15, Jun Zhao wrote: >> opencl_vaapi_intel_media doesn't depend on libmfx, OpenCL™ Drivers >> and Runtimes for Intel® Architectureis is a standalone release, more >> information can be found in the link: >> https://software.intel.com/en-us/articles/opencl-drivers. >> >> Signed-off-by: Jun Zhao <mypopydev@gmail.com> >> --- >> configure | 6 ++---- >> libavutil/hwcontext_opencl.c | 7 ++++++- >> 2 files changed, 8 insertions(+), 5 deletions(-) >> >> diff --git a/configure b/configure >> index ede32eb..aa17c13 100755 >> --- a/configure >> +++ b/configure >> @@ -6326,10 +6326,8 @@ fi >> >> if enabled_all opencl vaapi ; then >> enabled opencl_drm_beignet && enable opencl_vaapi_beignet >> - if enabled libmfx ; then >> - check_type "CL/cl.h CL/va_ext.h" "clCreateFromVA_APIMediaSurfaceINTEL_fn" && >> - enable opencl_vaapi_intel_media >> - fi >> + check_type "CL/cl.h CL/va_ext.h" "clCreateFromVA_APIMediaSurfaceINTEL_fn" && >> + enable opencl_vaapi_intel_media >> fi >> >> if enabled_all opencl dxva2 ; then >> diff --git a/libavutil/hwcontext_opencl.c b/libavutil/hwcontext_opencl.c >> index 9ecc361..f9b5ccc 100644 >> --- a/libavutil/hwcontext_opencl.c >> +++ b/libavutil/hwcontext_opencl.c >> @@ -46,7 +46,9 @@ >> #endif >> >> #if HAVE_OPENCL_VAAPI_INTEL_MEDIA >> +#if CONFIG_LIBMFX >> #include <mfx/mfxstructures.h> >> +#endif >> #include <va/va.h> >> #include <CL/va_ext.h> >> #include "hwcontext_vaapi.h" >> @@ -2248,10 +2250,13 @@ static int opencl_map_from_qsv(AVHWFramesContext *dst_fc, AVFrame *dst, >> cl_int cle; >> int err, p; >> >> +#if CONFIG_LIBMFX >> if (src->format == AV_PIX_FMT_QSV) { >> mfxFrameSurface1 *mfx_surface = (mfxFrameSurface1*)src->data[3]; >> va_surface = *(VASurfaceID*)mfx_surface->Data.MemId; >> - } else if (src->format == AV_PIX_FMT_VAAPI) { >> + } else >> +#endif >> + if (src->format == AV_PIX_FMT_VAAPI) { >> va_surface = (VASurfaceID)(uintptr_t)src->data[3]; >> } else { >> return AVERROR(ENOSYS); >> > > Have you tested this in a non-MediaSDK environment? I don't think it will work, because it relies on proxying the special extension functions in the Media VAAPI driver (in particular, "DdiMedia_ExtGetSurfaceHandle") through libva. The open source iHD driver will export DdiMedia_ExtGetSurfaceHandle interface, this is the review link: https://github.com/intel/media-driver/pull/177/commits/751110c4ca2a0515ddef843cbbd38c2ffc1f2c09, so after this function enable by the iHD open source driver, I think we don't need libmfx for opencl_vaapi_intel_media. > > I guess the patch is in itself harmless, but I'm not sure what the use-case of such a setup would be. > > Thanks, > > - Mark > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
diff --git a/configure b/configure index ede32eb..aa17c13 100755 --- a/configure +++ b/configure @@ -6326,10 +6326,8 @@ fi if enabled_all opencl vaapi ; then enabled opencl_drm_beignet && enable opencl_vaapi_beignet - if enabled libmfx ; then - check_type "CL/cl.h CL/va_ext.h" "clCreateFromVA_APIMediaSurfaceINTEL_fn" && - enable opencl_vaapi_intel_media - fi + check_type "CL/cl.h CL/va_ext.h" "clCreateFromVA_APIMediaSurfaceINTEL_fn" && + enable opencl_vaapi_intel_media fi if enabled_all opencl dxva2 ; then diff --git a/libavutil/hwcontext_opencl.c b/libavutil/hwcontext_opencl.c index 9ecc361..f9b5ccc 100644 --- a/libavutil/hwcontext_opencl.c +++ b/libavutil/hwcontext_opencl.c @@ -46,7 +46,9 @@ #endif #if HAVE_OPENCL_VAAPI_INTEL_MEDIA +#if CONFIG_LIBMFX #include <mfx/mfxstructures.h> +#endif #include <va/va.h> #include <CL/va_ext.h> #include "hwcontext_vaapi.h" @@ -2248,10 +2250,13 @@ static int opencl_map_from_qsv(AVHWFramesContext *dst_fc, AVFrame *dst, cl_int cle; int err, p; +#if CONFIG_LIBMFX if (src->format == AV_PIX_FMT_QSV) { mfxFrameSurface1 *mfx_surface = (mfxFrameSurface1*)src->data[3]; va_surface = *(VASurfaceID*)mfx_surface->Data.MemId; - } else if (src->format == AV_PIX_FMT_VAAPI) { + } else +#endif + if (src->format == AV_PIX_FMT_VAAPI) { va_surface = (VASurfaceID)(uintptr_t)src->data[3]; } else { return AVERROR(ENOSYS);
opencl_vaapi_intel_media doesn't depend on libmfx, OpenCL™ Drivers and Runtimes for Intel® Architectureis is a standalone release, more information can be found in the link: https://software.intel.com/en-us/articles/opencl-drivers. Signed-off-by: Jun Zhao <mypopydev@gmail.com> --- configure | 6 ++---- libavutil/hwcontext_opencl.c | 7 ++++++- 2 files changed, 8 insertions(+), 5 deletions(-)