diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2015-10-26 11:50:12 +0000 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2015-10-26 14:36:07 +0000 |
commit | f77603855f73560449c9680d343cc82d80e79aee (patch) | |
tree | d59540c5803a615853dddbb30acfad973b0eed14 /sc/source | |
parent | 644fe0abd5dd9fb468c913337ae616fe26f9e3ad (diff) |
Make OpenCL listener global, to avoid perf. cost of copying it around.
Change-Id: Ic10b70e1d56b941d263ed7632ba8a5146145cab1
Reviewed-on: https://gerrit.libreoffice.org/19600
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/core/data/formulacell.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/tool/calcconfig.cxx | 9 | ||||
-rw-r--r-- | sc/source/core/tool/formulagroup.cxx | 8 | ||||
-rw-r--r-- | sc/source/core/tool/interpr5.cxx | 2 |
4 files changed, 13 insertions, 8 deletions
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index 09a06bd579a5..07cd700e590c 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -3890,7 +3890,7 @@ bool ScFormulaCell::InterpretFormulaGroup() return false; } - if (!ScInterpreter::GetGlobalConfig().mbOpenCLEnabled.get()) + if (!ScCalcConfig::isOpenCLEnabled()) return false; // TODO : Disable invariant formula group interpretation for now in order diff --git a/sc/source/core/tool/calcconfig.cxx b/sc/source/core/tool/calcconfig.cxx index a1ac442378d0..f36309bf24ba 100644 --- a/sc/source/core/tool/calcconfig.cxx +++ b/sc/source/core/tool/calcconfig.cxx @@ -33,12 +33,17 @@ static rtl::Reference<ConfigurationListener> getMiscListener() return xListener; } +bool ScCalcConfig::isOpenCLEnabled() +{ + static comphelper::ConfigurationListenerProperty<bool> gOpenCLEnabled(getMiscListener(), OUString("UseOpenCL")); + return gOpenCLEnabled.get(); +} + ScCalcConfig::ScCalcConfig() : meStringRefAddressSyntax(formula::FormulaGrammar::CONV_UNSPECIFIED), meStringConversion(StringConversion::LOCALE), // old LibreOffice behavior mbEmptyStringAsZero(false), - mbHasStringRefSyntax(false), - mbOpenCLEnabled(getMiscListener(), "UseOpenCL") + mbHasStringRefSyntax(false) { setOpenCLConfigToDefault(); diff --git a/sc/source/core/tool/formulagroup.cxx b/sc/source/core/tool/formulagroup.cxx index 659c2318ad01..64a1b04888a6 100644 --- a/sc/source/core/tool/formulagroup.cxx +++ b/sc/source/core/tool/formulagroup.cxx @@ -477,7 +477,7 @@ FormulaGroupInterpreter *FormulaGroupInterpreter::getStatic() { #if HAVE_FEATURE_OPENCL const ScCalcConfig& rConfig = ScInterpreter::GetGlobalConfig(); - if (ScInterpreter::GetGlobalConfig().mbOpenCLEnabled.get()) + if (ScCalcConfig::isOpenCLEnabled()) switchOpenCLDevice(rConfig.maOpenCLDevice, rConfig.mbOpenCLAutoSelect); #endif static bool bAllowSoftwareInterpreter = (getenv("SC_ALLOW_BROKEN_SOFTWARE_INTERPRETER") != NULL); @@ -503,7 +503,7 @@ void FormulaGroupInterpreter::fillOpenCLInfo(std::vector<OpenCLPlatformInfo>& rP bool FormulaGroupInterpreter::switchOpenCLDevice(const OUString& rDeviceId, bool bAutoSelect, bool bForceEvaluation) { - bool bOpenCLEnabled = ScInterpreter::GetGlobalConfig().mbOpenCLEnabled.get(); + bool bOpenCLEnabled = ScCalcConfig::isOpenCLEnabled(); static bool bAllowSoftwareInterpreter = (getenv("SC_ALLOW_BROKEN_SOFTWARE_INTERPRETER") != NULL); if (!bOpenCLEnabled || (bAllowSoftwareInterpreter && rDeviceId == OPENCL_SOFTWARE_DEVICE_CONFIG_NAME)) { @@ -526,7 +526,7 @@ bool FormulaGroupInterpreter::switchOpenCLDevice(const OUString& rDeviceId, bool delete msInstance; msInstance = NULL; - if ( ScInterpreter::GetGlobalConfig().mbOpenCLEnabled.get() ) + if (ScCalcConfig::isOpenCLEnabled()) { msInstance = new sc::opencl::FormulaGroupInterpreterOpenCL(); return msInstance != NULL; @@ -539,7 +539,7 @@ void FormulaGroupInterpreter::getOpenCLDeviceInfo(sal_Int32& rDeviceId, sal_Int3 { rDeviceId = -1; rPlatformId = -1; - bool bOpenCLEnabled = ScInterpreter::GetGlobalConfig().mbOpenCLEnabled.get(); + bool bOpenCLEnabled = ScCalcConfig::isOpenCLEnabled(); if(!bOpenCLEnabled) return; diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx index eac7cd46b2ab..4548acb3ced5 100644 --- a/sc/source/core/tool/interpr5.cxx +++ b/sc/source/core/tool/interpr5.cxx @@ -912,7 +912,7 @@ void ScInterpreter::ScMatInv() SCSIZE nC, nR; pMat->GetDimensions(nC, nR); - if (ScInterpreter::GetGlobalConfig().mbOpenCLEnabled.get()) + if (ScCalcConfig::isOpenCLEnabled()) { sc::FormulaGroupInterpreter *pInterpreter = sc::FormulaGroupInterpreter::getStatic(); if (pInterpreter != NULL) |