[Libreoffice-commits] core.git: 2 commits - opencl/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Wed Dec 11 20:14:48 UTC 2019
opencl/source/opencl_device.cxx | 17 ++++++++---------
opencl/source/openclwrapper.cxx | 3 +--
2 files changed, 9 insertions(+), 11 deletions(-)
New commits:
commit ef8674a48888e2601653fd6481b6542914ffd97c
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Dec 11 16:40:06 2019 +0000
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Dec 11 21:13:51 2019 +0100
pickBestDevice return is ignored
so might as well return the BestDeviceIndex instead of passing
it by ref
Change-Id: Ic92fa3b5bfe3d319ff9fcb61b7f5404b5a624be5
Reviewed-on: https://gerrit.libreoffice.org/84971
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/opencl/source/opencl_device.cxx b/opencl/source/opencl_device.cxx
index 85a5b3ef6ec9..fe6f92a34ee6 100644
--- a/opencl/source/opencl_device.cxx
+++ b/opencl/source/opencl_device.cxx
@@ -333,11 +333,11 @@ ds_status profileDevices(std::unique_ptr<ds_profile> const & pProfile, std::uniq
}
/* Pick best device */
-ds_status pickBestDevice(std::unique_ptr<ds_profile> const & profile, int& rBestDeviceIndex)
+int pickBestDevice(std::unique_ptr<ds_profile> const & profile)
{
double bestScore = DBL_MAX;
- rBestDeviceIndex = -1;
+ int nBestDeviceIndex = -1;
for (std::vector<ds_device>::size_type d = 0; d < profile->devices.size();
d++)
@@ -390,18 +390,18 @@ ds_status pickBestDevice(std::unique_ptr<ds_profile> const & profile, int& rBest
if (fScore < bestScore)
{
bestScore = fScore;
- rBestDeviceIndex = d;
+ nBestDeviceIndex = d;
}
}
- if (rBestDeviceIndex != -1 && profile->devices[rBestDeviceIndex].eType == DeviceType::OpenCLDevice)
+ if (nBestDeviceIndex != -1 && profile->devices[nBestDeviceIndex].eType == DeviceType::OpenCLDevice)
{
- SAL_INFO("opencl.device", "Selected Device[" << rBestDeviceIndex << "]: " << profile->devices[rBestDeviceIndex].sDeviceName << "(OpenCL).");
+ SAL_INFO("opencl.device", "Selected Device[" << nBestDeviceIndex << "]: " << profile->devices[nBestDeviceIndex].sDeviceName << "(OpenCL).");
}
else
{
- SAL_INFO("opencl.device", "Selected Device[" << rBestDeviceIndex << "]: CPU (Native).");
+ SAL_INFO("opencl.device", "Selected Device[" << nBestDeviceIndex << "]: CPU (Native).");
}
- return DS_SUCCESS;
+ return nBestDeviceIndex;
}
/* Return device ID for matching device name */
@@ -566,8 +566,7 @@ ds_device const & getDeviceSelection(
}
/* Pick best device */
- int bestDeviceIdx;
- pickBestDevice(aProfile, bestDeviceIdx);
+ int bestDeviceIdx = pickBestDevice(aProfile);
/* Override if necessary */
char* overrideDeviceStr = getenv("SC_OPENCL_DEVICE_OVERRIDE");
commit c544432c049ee93536386a77da1f1d9562ea3b48
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Dec 11 14:55:22 2019 +0000
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Dec 11 21:13:39 2019 +0100
ensure cache dir is created
Change-Id: I708efa3dc4d9d145b1000d24cea4a4ff02628178
Reviewed-on: https://gerrit.libreoffice.org/84970
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/opencl/source/openclwrapper.cxx b/opencl/source/openclwrapper.cxx
index 8e2e531e5970..aea040c73036 100644
--- a/opencl/source/openclwrapper.cxx
+++ b/opencl/source/openclwrapper.cxx
@@ -776,8 +776,7 @@ bool switchOpenCLDevice(const OUString* pDevice, bool bAutoSelect, bool bForceEv
if (status < 0)
return false;
- OUString url("${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE("bootstrap") ":UserInstallation}/cache/");
- rtl::Bootstrap::expandMacros(url);
+ OUString url(OStringToOUString(getCacheFolder(), RTL_TEXTENCODING_UTF8));
OUString path;
osl::FileBase::getSystemPathFromFileURL(url,path);
ds_device aSelectedDevice = getDeviceSelection(path, bForceEvaluation);
More information about the Libreoffice-commits
mailing list