From: Alexander Alekhin Date: Fri, 25 Sep 2020 19:22:12 +0000 (+0000) Subject: ocl: fix PlatformInfo usage X-Git-Tag: submit/tizen/20210224.033012~2^2~28^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c945ea125aed599940de31610812cb38a1d3c3ba;p=platform%2Fupstream%2Fopencv.git ocl: fix PlatformInfo usage --- diff --git a/modules/core/src/directx.cpp b/modules/core/src/directx.cpp index c651449..c9bd1a4 100644 --- a/modules/core/src/directx.cpp +++ b/modules/core/src/directx.cpp @@ -459,7 +459,7 @@ Context& initializeContextFromD3D11Device(ID3D11Device* pD3D11Device) } cl_platform_id platform = platforms[found]; - std::string platformName = PlatformInfo(platform).name(); + std::string platformName = PlatformInfo(&platform).name(); OpenCLExecutionContext clExecCtx; try @@ -579,7 +579,7 @@ Context& initializeContextFromD3D10Device(ID3D10Device* pD3D10Device) } cl_platform_id platform = platforms[found]; - std::string platformName = PlatformInfo(platform).name(); + std::string platformName = PlatformInfo(&platform).name(); OpenCLExecutionContext clExecCtx; try @@ -701,7 +701,7 @@ Context& initializeContextFromDirect3DDevice9Ex(IDirect3DDevice9Ex* pDirect3DDev } cl_platform_id platform = platforms[found]; - std::string platformName = PlatformInfo(platform).name(); + std::string platformName = PlatformInfo(&platform).name(); OpenCLExecutionContext clExecCtx; try @@ -824,7 +824,7 @@ Context& initializeContextFromDirect3DDevice9(IDirect3DDevice9* pDirect3DDevice9 } cl_platform_id platform = platforms[found]; - std::string platformName = PlatformInfo(platform).name(); + std::string platformName = PlatformInfo(&platform).name(); OpenCLExecutionContext clExecCtx; try diff --git a/modules/core/src/ocl.cpp b/modules/core/src/ocl.cpp index 8a99240..0a82424 100644 --- a/modules/core/src/ocl.cpp +++ b/modules/core/src/ocl.cpp @@ -3102,7 +3102,7 @@ void initializeContextFromHandle(Context& ctx, void* _platform, void* _context, cl_context context = (cl_context)_context; cl_device_id deviceID = (cl_device_id)_device; - std::string platformName = PlatformInfo(platformID).name(); + std::string platformName = PlatformInfo(&platformID).name(); auto clExecCtx = OpenCLExecutionContext::create(platformName, platformID, context, deviceID); CV_Assert(!clExecCtx.empty()); diff --git a/modules/core/src/opengl.cpp b/modules/core/src/opengl.cpp index a95191e..5ff3c71 100644 --- a/modules/core/src/opengl.cpp +++ b/modules/core/src/opengl.cpp @@ -1690,7 +1690,7 @@ Context& initializeContextFromGL() CV_Error(cv::Error::OpenCLInitError, "OpenCL: Can't create context for OpenGL interop"); cl_platform_id platform = platforms[found]; - std::string platformName = PlatformInfo(platform).name(); + std::string platformName = PlatformInfo(&platform).name(); OpenCLExecutionContext clExecCtx = OpenCLExecutionContext::create(platformName, platform, context, device); clReleaseDevice(device); diff --git a/modules/core/src/va_intel.cpp b/modules/core/src/va_intel.cpp index 1fd574b..c640a08 100644 --- a/modules/core/src/va_intel.cpp +++ b/modules/core/src/va_intel.cpp @@ -141,13 +141,7 @@ Context& initializeContextFromVA(VADisplay display, bool tryInterop) contextInitialized = true; cl_platform_id platform = platforms[found]; - char platformName[1024] = {0}; - size_t sz = 0; - if (clGetPlatformInfo(platform, CL_PLATFORM_NAME, sizeof(platformName) - 16, platformName, &sz) != CL_SUCCESS - || sz >= sizeof(platformName)) - { - CV_Error(cv::Error::OpenCLInitError, "OpenCL: Failed to get platform name"); - } + std::string platformName = PlatformInfo(&platform).name(); OpenCLExecutionContext clExecCtx; try