opencl/source/openclwrapper.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
New commits: commit c10d35e7b9135b98479b6188c2765dc661ba1e65 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> Date: Tue Oct 18 23:53:44 2016 +0200 opencl: make sure we don't initialize OpenCL when disabled If SAL_DISABLE_OPENCL is set we don't want to do any kind of OpenCL initialization. Put an extra guard in fillOpenCLInfo to prevent that. Change-Id: Icc216d4299d3a7942843117ab9b9411de8075b11 (cherry picked from commit a009a8383111593c26646951d4f290dbbe89af29) diff --git a/opencl/source/openclwrapper.cxx b/opencl/source/openclwrapper.cxx index d8d16c3..abd5407 100644 --- a/opencl/source/openclwrapper.cxx +++ b/opencl/source/openclwrapper.cxx @@ -648,7 +648,9 @@ bool createPlatformInfo(cl_platform_id nPlatformId, OpenCLPlatformInfo& rPlatfor const std::vector<OpenCLPlatformInfo>& fillOpenCLInfo() { static std::vector<OpenCLPlatformInfo> aPlatforms; - if(!aPlatforms.empty()) + + // return early if we already initialized or SAL_DISABLE_OPENCL is set + if (!aPlatforms.empty() || getenv("SAL_DISABLE_OPENCL")) return aPlatforms; int status = clewInit(OPENCL_DLL_NAME); @@ -733,7 +735,7 @@ void findDeviceInfoFromDeviceId(cl_device_id aDeviceId, size_t& rDeviceId, size_ bool switchOpenCLDevice(const OUString* pDevice, bool bAutoSelect, bool bForceEvaluation, OUString& rOutSelectedDeviceVersionIDString) { - if(fillOpenCLInfo().empty() || getenv("SAL_DISABLE_OPENCL")) + if (getenv("SAL_DISABLE_OPENCL") || fillOpenCLInfo().empty()) return false; cl_device_id pDeviceId = nullptr;
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits