[FFmpeg-devel] [PATCH] lavu: add calling convention for OpenCL callback.

Song, Ruiling ruiling.song at intel.com
Thu Jun 7 18:42:31 EEST 2018



> -----Original Message-----
> From: ffmpeg-devel [mailto:ffmpeg-devel-bounces at ffmpeg.org] On Behalf Of
> Mark Thompson
> Sent: Thursday, June 7, 2018 6:21 AM
> To: ffmpeg-devel at ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH] lavu: add calling convention for OpenCL
> callback.
> 
> On 06/06/18 16:31, Ruiling Song wrote:
> > This fix a build error on Windows:
> > C2440: connot convert from 'void (__cdecl *) (...)' to 'void (__stdcall *)(...)'.
> >
> > Signed-off-by: Ruiling Song <ruiling.song at intel.com>
> > ---
> >  libavutil/hwcontext_opencl.c | 7 ++++---
> >  1 file changed, 4 insertions(+), 3 deletions(-)
> >
> > diff --git a/libavutil/hwcontext_opencl.c b/libavutil/hwcontext_opencl.c
> > index 43b5c5a..e08d7bc 100644
> > --- a/libavutil/hwcontext_opencl.c
> > +++ b/libavutil/hwcontext_opencl.c
> > @@ -141,9 +141,10 @@ typedef struct OpenCLFramesContext {
> >  } OpenCLFramesContext;
> >
> >
> > -static void opencl_error_callback(const char *errinfo,
> > -                                  const void *private_info, size_t cb,
> > -                                  void *user_data)
> > +static void CL_CALLBACK opencl_error_callback(const char *errinfo,
> > +                                              const void *private_info,
> > +                                              size_t cb,
> > +                                              void *user_data)
> >  {
> >      AVHWDeviceContext *ctx = user_data;
> >      av_log(ctx, AV_LOG_ERROR, "OpenCL error: %s\n", errinfo);
> >
> 
> Yep, applied.
> 
> Is this visible in any MSVC build, or does it have to be 32-bit?  (All my testing on
> Windows has been done with MinGW-w64, where __stdcall/__cdecl have no
> effect and this goes unnoticed.)
Yes, I think this should only occur on 32bit. In fact, I am not intentionally trying to build 32bit.
I am basically follow the steps in: https://pracucci.com/compile-ffmpeg-on-windows-with-visual-studio-compiler.html
I installed VS 2017 and msys2-x86_64 (http://www.msys2.org)
Then I launch mingw64 in vs2017 command prompt through 'msys2_shell.cmd -mingw64 -use-full-path'.
I installed Intel OpenCL SDK, and modify INCLUDE and LIB to point to it.
The Intel OpenCL SDK provides both x86 and x64 OpenCL.lib.
I first use x64 version OpenCL.lib. then I configure FFmpeg like:
./configure --toolchain=msvc --enable-yasm --arch=x86_x64 --enable-asm --enable-opencl.
But the configure failed with below error log. Seems it still tries to build WIN32. I am not sure what's wrong.
I just didn't have enough time to look into this. so I switched to x86 version OpenCL.lib, then I met the bug.

cl -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS -D_WIN32_WINNT=0x0600 -nologo -c -Fo./ffconf.EeohdeiF/test.o ./ffconf.EeohdeiF/test.c
test.c
./compat/windows/mslink -nologo -LARGEADDRESSAWARE -out:./ffconf.EeohdeiF/test.exe ./ffconf.EeohdeiF/test.o OpenCL.lib
test.o : error LNK2019: unresolved external symbol _clEnqueueNDRangeKernel at 36 referenced in function _check_clEnqueueNDRangeKernel
C:\Program Files (x86)\Intel\OpenCL SDK\6.3\lib\x64\OpenCL.lib : warning LNK4272: library machine type 'x64' conflicts with target machine type 'x86'

Thanks!
Ruiling
> 
> Thanks,
> 
> - Mark
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


More information about the ffmpeg-devel mailing list