opencl/source/opencl_device.cxx | 11 ++++++++--- opencl/source/openclwrapper.cxx | 7 ++++--- 2 files changed, 12 insertions(+), 6 deletions(-)
New commits: commit 14c9f0aa3a242795de845c703ac0d47440053a56 Author: Mark Hung <mark...@gmail.com> Date: Fri May 13 19:58:18 2016 +0800 Ensure that OpenCL device id returned from getDeviceSelection() is valid. Possible fix for tdf#100104 Reviewed-on: https://gerrit.libreoffice.org/24959 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Mark Page <aptit...@btconnect.com> Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> (cherry picked from commit 40b0b9ab7703a165295b008f47df14d2ec076fb1) Change-Id: I756bb57d471db3d3ca1d9c3733d359c7c16b4e66 Reviewed-on: https://gerrit.libreoffice.org/25964 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/opencl/source/opencl_device.cxx b/opencl/source/opencl_device.cxx index 2acecdf2..85fea92 100644 --- a/opencl/source/opencl_device.cxx +++ b/opencl/source/opencl_device.cxx @@ -635,10 +635,15 @@ ds_device getDeviceSelection( } /* Final device selection */ - selectedDevice = aProfile->devices[bestDeviceIdx]; - bIsDeviceSelected = true; + if (bestDeviceIdx >=0 && static_cast< std::vector<ds_device>::size_type> ( bestDeviceIdx ) < aProfile->devices.size() ) + { + selectedDevice = aProfile->devices[bestDeviceIdx]; + bIsDeviceSelected = true; - writeDevicesLog(aProfile, sProfilePath, bestDeviceIdx); + writeDevicesLog(aProfile, sProfilePath, bestDeviceIdx); + } else { + selectedDevice.eType = DeviceType::NativeCPU; + } } return selectedDevice; } diff --git a/opencl/source/openclwrapper.cxx b/opencl/source/openclwrapper.cxx index e488f79..8d57ae4 100644 --- a/opencl/source/openclwrapper.cxx +++ b/opencl/source/openclwrapper.cxx @@ -703,9 +703,10 @@ bool switchOpenCLDevice(const OUString* pDevice, bool bAutoSelect, bool bForceEv rtl::Bootstrap::expandMacros(url); OUString path; osl::FileBase::getSystemPathFromFileURL(url,path); - ds_device pSelectedDevice = getDeviceSelection(path, bForceEvaluation); - pDeviceId = pSelectedDevice.aDeviceID; - + ds_device aSelectedDevice = getDeviceSelection(path, bForceEvaluation); + if ( aSelectedDevice.eType != DeviceType::OpenCLDevice) + return false; + pDeviceId = aSelectedDevice.aDeviceID; } if(gpuEnv.mpDevID == pDeviceId)
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits