sc/inc/calcconfig.hxx | 2 +- sc/source/core/data/formulacell.cxx | 2 +- sc/source/core/tool/calcconfig.cxx | 9 +++++++-- sc/source/core/tool/formulagroup.cxx | 8 ++++---- sc/source/core/tool/interpr5.cxx | 2 +- 5 files changed, 14 insertions(+), 9 deletions(-)
New commits: commit f77603855f73560449c9680d343cc82d80e79aee Author: Michael Meeks <michael.me...@collabora.com> Date: Mon Oct 26 11:50:12 2015 +0000 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 <c...@libreoffice.org> Reviewed-by: Michael Meeks <michael.me...@collabora.com> diff --git a/sc/inc/calcconfig.hxx b/sc/inc/calcconfig.hxx index 158bc1a..4091bda 100644 --- a/sc/inc/calcconfig.hxx +++ b/sc/inc/calcconfig.hxx @@ -48,7 +48,7 @@ struct SC_DLLPUBLIC ScCalcConfig bool mbEmptyStringAsZero:1; bool mbHasStringRefSyntax:1; - comphelper::ConfigurationListenerProperty<bool> mbOpenCLEnabled; + static bool isOpenCLEnabled(); bool mbOpenCLSubsetOnly:1; bool mbOpenCLAutoSelect:1; diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index 09a06bd..07cd700 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 a1ac442..f36309b 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 659c231..64a1b04 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 eac7cd4..4548acb 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) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits