diff options
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/core/opencl/openclwrapper.cxx | 51 | ||||
-rw-r--r-- | sc/source/core/tool/calcconfig.cxx | 12 | ||||
-rw-r--r-- | sc/source/core/tool/formulaopt.cxx | 6 | ||||
-rw-r--r-- | sc/source/ui/optdlg/calcoptionsdlg.cxx | 25 | ||||
-rw-r--r-- | sc/source/ui/optdlg/calcoptionsdlg.hxx | 3 |
5 files changed, 49 insertions, 48 deletions
diff --git a/sc/source/core/opencl/openclwrapper.cxx b/sc/source/core/opencl/openclwrapper.cxx index 87cc1c56ed5a..1e4bb7aee42b 100644 --- a/sc/source/core/opencl/openclwrapper.cxx +++ b/sc/source/core/opencl/openclwrapper.cxx @@ -9,24 +9,26 @@ #include <config_folders.h> +#include "calcconfig.hxx" +#include "interpre.hxx" +#include "opencl_device.hxx" #include "openclwrapper.hxx" #include <comphelper/string.hxx> -#include <rtl/ustring.hxx> -#include <rtl/strbuf.hxx> -#include <rtl/digest.h> +#include <osl/file.hxx> #include <rtl/bootstrap.hxx> -#include <boost/scoped_array.hpp> - +#include <rtl/digest.h> +#include <rtl/strbuf.hxx> +#include <rtl/ustring.hxx> #include <sal/config.h> -#include <osl/file.hxx> -#include "calcconfig.hxx" -#include "interpre.hxx" -#include "opencl_device.hxx" + +#include <boost/scoped_array.hpp> +#include <unicode/regex.h> #include <stdio.h> #include <stdlib.h> #include <string.h> + #include <cmath> #ifdef _WIN32 @@ -517,31 +519,44 @@ bool OpenCLDevice::initOpenCLRunEnv( GPUEnv *gpuInfo ) namespace { +bool match(const OUString& rPattern, const OUString& rInput) +{ + if (rPattern == "") + return true; + + UErrorCode nIcuError(U_ZERO_ERROR); + icu::UnicodeString sIcuPattern(reinterpret_cast<const UChar*>(rPattern.getStr()), rPattern.getLength()); + icu::UnicodeString sIcuInput(reinterpret_cast<const UChar*>(rInput.getStr()), rInput.getLength()); + RegexMatcher aMatcher(sIcuPattern, sIcuInput, 0, nIcuError); + + if (nIcuError == U_ZERO_ERROR && aMatcher.matches(nIcuError) && nIcuError == U_ZERO_ERROR) + return true; + + return false; +} + bool match(const ScCalcConfig::OpenCLImplMatcher& rListEntry, const OpenCLPlatformInfo& rPlatform, const OpenCLDeviceInfo& rDevice) { #if defined WNT - if (rListEntry.maOS != "*" && rListEntry.maOS != "Windows") + if (rListEntry.maOS != "" && rListEntry.maOS != "Windows") return false; #elif defined LINUX - if (rListEntry.maOS != "*" && rListEntry.maOS != "Linux") + if (rListEntry.maOS != "" && rListEntry.maOS != "Linux") return false; #elif defined MACOSX - if (rListEntry.maOS != "*" && rListEntry.maOS != "OS X") + if (rListEntry.maOS != "" && rListEntry.maOS != "OS X") return false; #endif // OS version check not yet implemented - if (rListEntry.maPlatformVendor != "*" && rListEntry.maPlatformVendor != rPlatform.maVendor) + if (!match(rListEntry.maPlatformVendor, rPlatform.maVendor)) return false; - if (rListEntry.maDevice != "*" && rListEntry.maDevice != rDevice.maName) + if (!match(rListEntry.maDevice, rDevice.maName)) return false; - if (rListEntry.maDriverVersionMin != "*" && - (comphelper::string::compareVersionStrings(rListEntry.maDriverVersionMin, rDevice.maDriver) > 0 || - (rListEntry.maDriverVersionMax != "" && comphelper::string::compareVersionStrings(rListEntry.maDriverVersionMax, rDevice.maDriver) < 0) || - (rListEntry.maDriverVersionMax == "" && comphelper::string::compareVersionStrings(rListEntry.maDriverVersionMin, rDevice.maDriver) < 0))) + if (!match(rListEntry.maDriverVersion, rDevice.maDriver)) return false; return true; diff --git a/sc/source/core/tool/calcconfig.cxx b/sc/source/core/tool/calcconfig.cxx index 69abb2d44564..7c9ace9bb868 100644 --- a/sc/source/core/tool/calcconfig.cxx +++ b/sc/source/core/tool/calcconfig.cxx @@ -69,15 +69,15 @@ void ScCalcConfig::setOpenCLConfigToDefault() // This entry we have had for some time (when blacklisting was // done elsewhere in the code), so presumably there is a known // good reason for it. - maOpenCLBlackList.insert(OpenCLImplMatcher("Windows", "*", "Intel(R) Corporation", "*", "9.17.10.2884", "")); + maOpenCLBlackList.insert(OpenCLImplMatcher("Windows", "", "Intel\\(R\\) Corporation", "", "9\\.17\\.10\\.2884")); // This is what I have tested on Linux and it works for our unit tests. - maOpenCLWhiteList.insert(OpenCLImplMatcher("Linux", "*", "Advanced Micro Devices, Inc.", "*", "1445.5 (sse2,avx)", "")); + maOpenCLWhiteList.insert(OpenCLImplMatcher("Linux", "", "Advanced Micro Devices, Inc\\.", "", "1445\\.5 \\(sse2,avx\\)")); // For now, assume that AMD, Intel and NVIDIA drivers are good - maOpenCLWhiteList.insert(OpenCLImplMatcher("*", "*", "Advanced Micro Devices, Inc.", "*", "*", "")); - maOpenCLWhiteList.insert(OpenCLImplMatcher("*", "*", "Intel(R) Corporation", "*", "*", "")); - maOpenCLWhiteList.insert(OpenCLImplMatcher("*", "*", "NVIDIA Corporation", "*", "*", "")); + maOpenCLWhiteList.insert(OpenCLImplMatcher("", "", "Advanced Micro Devices, Inc\\.", "", "")); + maOpenCLWhiteList.insert(OpenCLImplMatcher("", "", "Intel\\(R\\) Corporation", "", "")); + maOpenCLWhiteList.insert(OpenCLImplMatcher("", "", "NVIDIA Corporation", "", "")); } void ScCalcConfig::reset() @@ -122,7 +122,7 @@ std::ostream& operator<<(std::ostream& rStream, const ScCalcConfig::OpenCLImplMa "OSVersion=" << rImpl.maOSVersion << "," "PlatformVendor=" << rImpl.maPlatformVendor << "," "Device=" << rImpl.maDevice << "," - "DriverVersion=[" << rImpl.maDriverVersionMin << "," << rImpl.maDriverVersionMax << "]" + "DriverVersion=" << rImpl.maDriverVersion << "}"; return rStream; diff --git a/sc/source/core/tool/formulaopt.cxx b/sc/source/core/tool/formulaopt.cxx index c5ff895ca466..9f05a01ec2d5 100644 --- a/sc/source/core/tool/formulaopt.cxx +++ b/sc/source/core/tool/formulaopt.cxx @@ -293,8 +293,7 @@ css::uno::Sequence<OUString> SetOfOpenCLImplMatcherToStringSequence(std::set<ScC (*i).maOSVersion.replaceAll("%", "%25").replaceAll("/", "%2F").replaceAll(";", "%3B") + "/" + (*i).maPlatformVendor.replaceAll("%", "%25").replaceAll("/", "%2F").replaceAll(";", "%3B") + "/" + (*i).maDevice.replaceAll("%", "%25").replaceAll("/", "%2F").replaceAll(";", "%3B") + "/" + - (*i).maDriverVersionMin.replaceAll("%", "%25").replaceAll("/", "%2F").replaceAll(";", "%3B") + "/" + - (*i).maDriverVersionMax.replaceAll("%", "%25").replaceAll("/", "%2F").replaceAll(";", "%3B"); + (*i).maDriverVersion.replaceAll("%", "%25").replaceAll("/", "%2F").replaceAll(";", "%3B"); } return result; @@ -337,8 +336,7 @@ std::set<ScCalcConfig::OpenCLImplMatcher> StringSequenceToSetOfOpenCLImplMatcher m.maOSVersion = getToken(*i, index); m.maPlatformVendor = getToken(*i, index); m.maDevice = getToken(*i, index); - m.maDriverVersionMin = getToken(*i, index); - m.maDriverVersionMax = getToken(*i, index); + m.maDriverVersion = getToken(*i, index); result.insert(m); } diff --git a/sc/source/ui/optdlg/calcoptionsdlg.cxx b/sc/source/ui/optdlg/calcoptionsdlg.cxx index 046fd7f16151..acf931861ffa 100644 --- a/sc/source/ui/optdlg/calcoptionsdlg.cxx +++ b/sc/source/ui/optdlg/calcoptionsdlg.cxx @@ -160,8 +160,7 @@ ScCalcOptionsDialog::ScCalcOptionsDialog(vcl::Window* pParent, const ScCalcConfi get(mpOSVersion, "osversion"); get(mpPlatformVendor, "platformvendor"); get(mpDevice, "opencldevice"); - get(mpDriverVersionMin, "opencldriverversionmin"); - get(mpDriverVersionMax, "opencldriverversionmax"); + get(mpDriverVersion, "opencldriverversion"); get(mpListNewButton, "listbox-new"); get(mpListDeleteButton, "listbox-delete"); get(mpTestButton, "test"); @@ -178,8 +177,7 @@ ScCalcOptionsDialog::ScCalcOptionsDialog(vcl::Window* pParent, const ScCalcConfi mpOSVersion->SetModifyHdl(LINK(this, ScCalcOptionsDialog, EditModifiedHdl)); mpPlatformVendor->SetModifyHdl(LINK(this, ScCalcOptionsDialog, EditModifiedHdl)); mpDevice->SetModifyHdl(LINK(this, ScCalcOptionsDialog, EditModifiedHdl)); - mpDriverVersionMin->SetModifyHdl(LINK(this, ScCalcOptionsDialog, EditModifiedHdl)); - mpDriverVersionMax->SetModifyHdl(LINK(this, ScCalcOptionsDialog, EditModifiedHdl)); + mpDriverVersion->SetModifyHdl(LINK(this, ScCalcOptionsDialog, EditModifiedHdl)); mpOpenCLWhiteAndBlackListBox->set_height_request(4* mpOpenCLWhiteAndBlackListBox->GetTextHeight()); mpOpenCLWhiteAndBlackListBox->SetStyle(mpOpenCLWhiteAndBlackListBox->GetStyle() | WB_CLIPCHILDREN | WB_FORCE_MAKEVISIBLE); @@ -332,10 +330,7 @@ OUString format(const ScCalcConfig::OpenCLImplMatcher& rImpl) rImpl.maOSVersion + " " + rImpl.maPlatformVendor + " " + rImpl.maDevice + " " + - (rImpl.maDriverVersionMax != "" ? - OUString("[") + rImpl.maDriverVersionMin + "," + rImpl.maDriverVersionMax + "]" : - rImpl.maDriverVersionMin) - ); + rImpl.maDriverVersion); } void fillListBox(ListBox* pListBox, const ScCalcConfig::OpenCLImplMatcherSet& rSet) @@ -809,13 +804,9 @@ void ScCalcOptionsDialog::EditFieldValueChanged(Control *pCtrl) { newImpl.maDevice = sVal; } - else if (&rEdit == mpDriverVersionMin) + else if (&rEdit == mpDriverVersion) { - newImpl.maDriverVersionMin = sVal; - } - else if (&rEdit == mpDriverVersionMax) - { - newImpl.maDriverVersionMax = sVal; + newImpl.maDriverVersion = sVal; } else assert(false && "rEdit does not match any of the Edit fields"); @@ -924,8 +915,7 @@ IMPL_LINK(ScCalcOptionsDialog, OpenCLWhiteAndBlackListSelHdl, Control*, ) mpOSVersion->SetText(impl.maOSVersion); mpPlatformVendor->SetText(impl.maPlatformVendor); mpDevice->SetText(impl.maDevice); - mpDriverVersionMin->SetText(impl.maDriverVersionMin); - mpDriverVersionMax->SetText(impl.maDriverVersionMax); + mpDriverVersion->SetText(impl.maDriverVersion); return 0; } @@ -939,8 +929,7 @@ IMPL_LINK( ScCalcOptionsDialog, ListNewClickHdl, PushButton*, ) mpOSVersion->SetText(""); mpPlatformVendor->SetText(""); mpDevice->SetText(""); - mpDriverVersionMin->SetText(""); - mpDriverVersionMax->SetText(""); + mpDriverVersion->SetText(""); rSet.insert(aEmpty); #if HAVE_FEATURE_OPENCL diff --git a/sc/source/ui/optdlg/calcoptionsdlg.hxx b/sc/source/ui/optdlg/calcoptionsdlg.hxx index e1a1370daeff..705873cde91c 100644 --- a/sc/source/ui/optdlg/calcoptionsdlg.hxx +++ b/sc/source/ui/optdlg/calcoptionsdlg.hxx @@ -83,8 +83,7 @@ private: Edit* mpOSVersion; Edit* mpPlatformVendor; Edit* mpDevice; - Edit* mpDriverVersionMin; - Edit* mpDriverVersionMax; + Edit* mpDriverVersion; PushButton* mpListNewButton; PushButton* mpListDeleteButton; PushButton* mpTestButton; |