[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - opencl/source
Mark Hung
marklh9 at gmail.com
Mon Jun 6 20:36:32 UTC 2016
opencl/source/opencl_device.cxx | 11 ++++++++---
opencl/source/openclwrapper.cxx | 2 ++
2 files changed, 10 insertions(+), 3 deletions(-)
New commits:
commit d171f3670b6726772934730024051d1534796ad5
Author: Mark Hung <marklh9 at gmail.com>
Date: Fri May 13 19:58:18 2016 +0800
Ensure that OpenCL device id returned from getDeviceSelection() is valid.
Change-Id: I756bb57d471db3d3ca1d9c3733d359c7c16b4e66
Reviewed-on: https://gerrit.libreoffice.org/24959
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Mark Page <aptitude at btconnect.com>
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
(cherry picked from commit 40b0b9ab7703a165295b008f47df14d2ec076fb1)
Reviewed-on: https://gerrit.libreoffice.org/25962
Reviewed-by: Michael Stahl <mstahl at redhat.com>
Tested-by: Michael Stahl <mstahl at redhat.com>
diff --git a/opencl/source/opencl_device.cxx b/opencl/source/opencl_device.cxx
index db143e3..9c91d70 100644
--- a/opencl/source/opencl_device.cxx
+++ b/opencl/source/opencl_device.cxx
@@ -636,10 +636,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 1655cb6..ab65091 100644
--- a/opencl/source/openclwrapper.cxx
+++ b/opencl/source/openclwrapper.cxx
@@ -703,6 +703,8 @@ bool switchOpenCLDevice(const OUString* pDevice, bool bAutoSelect, bool bForceEv
OUString path;
osl::FileBase::getSystemPathFromFileURL(url,path);
ds_device aSelectedDevice = getDeviceSelection(path, bForceEvaluation);
+ if ( aSelectedDevice.eType != DeviceType::OpenCLDevice)
+ return false;
pDeviceId = aSelectedDevice.aDeviceID;
}
More information about the Libreoffice-commits
mailing list