Kaydet (Commit) f7760385 authored tarafından Michael Meeks's avatar Michael Meeks

Make OpenCL listener global, to avoid perf. cost of copying it around.

Change-Id: Ic10b70e1d56b941d263ed7632ba8a5146145cab1
Reviewed-on: https://gerrit.libreoffice.org/19600Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMichael Meeks <michael.meeks@collabora.com>
üst 644fe0ab
...@@ -48,7 +48,7 @@ struct SC_DLLPUBLIC ScCalcConfig ...@@ -48,7 +48,7 @@ struct SC_DLLPUBLIC ScCalcConfig
bool mbEmptyStringAsZero:1; bool mbEmptyStringAsZero:1;
bool mbHasStringRefSyntax:1; bool mbHasStringRefSyntax:1;
comphelper::ConfigurationListenerProperty<bool> mbOpenCLEnabled; static bool isOpenCLEnabled();
bool mbOpenCLSubsetOnly:1; bool mbOpenCLSubsetOnly:1;
bool mbOpenCLAutoSelect:1; bool mbOpenCLAutoSelect:1;
......
...@@ -3890,7 +3890,7 @@ bool ScFormulaCell::InterpretFormulaGroup() ...@@ -3890,7 +3890,7 @@ bool ScFormulaCell::InterpretFormulaGroup()
return false; return false;
} }
if (!ScInterpreter::GetGlobalConfig().mbOpenCLEnabled.get()) if (!ScCalcConfig::isOpenCLEnabled())
return false; return false;
// TODO : Disable invariant formula group interpretation for now in order // TODO : Disable invariant formula group interpretation for now in order
......
...@@ -33,12 +33,17 @@ static rtl::Reference<ConfigurationListener> getMiscListener() ...@@ -33,12 +33,17 @@ static rtl::Reference<ConfigurationListener> getMiscListener()
return xListener; return xListener;
} }
bool ScCalcConfig::isOpenCLEnabled()
{
static comphelper::ConfigurationListenerProperty<bool> gOpenCLEnabled(getMiscListener(), OUString("UseOpenCL"));
return gOpenCLEnabled.get();
}
ScCalcConfig::ScCalcConfig() : ScCalcConfig::ScCalcConfig() :
meStringRefAddressSyntax(formula::FormulaGrammar::CONV_UNSPECIFIED), meStringRefAddressSyntax(formula::FormulaGrammar::CONV_UNSPECIFIED),
meStringConversion(StringConversion::LOCALE), // old LibreOffice behavior meStringConversion(StringConversion::LOCALE), // old LibreOffice behavior
mbEmptyStringAsZero(false), mbEmptyStringAsZero(false),
mbHasStringRefSyntax(false), mbHasStringRefSyntax(false)
mbOpenCLEnabled(getMiscListener(), "UseOpenCL")
{ {
setOpenCLConfigToDefault(); setOpenCLConfigToDefault();
......
...@@ -477,7 +477,7 @@ FormulaGroupInterpreter *FormulaGroupInterpreter::getStatic() ...@@ -477,7 +477,7 @@ FormulaGroupInterpreter *FormulaGroupInterpreter::getStatic()
{ {
#if HAVE_FEATURE_OPENCL #if HAVE_FEATURE_OPENCL
const ScCalcConfig& rConfig = ScInterpreter::GetGlobalConfig(); const ScCalcConfig& rConfig = ScInterpreter::GetGlobalConfig();
if (ScInterpreter::GetGlobalConfig().mbOpenCLEnabled.get()) if (ScCalcConfig::isOpenCLEnabled())
switchOpenCLDevice(rConfig.maOpenCLDevice, rConfig.mbOpenCLAutoSelect); switchOpenCLDevice(rConfig.maOpenCLDevice, rConfig.mbOpenCLAutoSelect);
#endif #endif
static bool bAllowSoftwareInterpreter = (getenv("SC_ALLOW_BROKEN_SOFTWARE_INTERPRETER") != NULL); static bool bAllowSoftwareInterpreter = (getenv("SC_ALLOW_BROKEN_SOFTWARE_INTERPRETER") != NULL);
...@@ -503,7 +503,7 @@ void FormulaGroupInterpreter::fillOpenCLInfo(std::vector<OpenCLPlatformInfo>& rP ...@@ -503,7 +503,7 @@ void FormulaGroupInterpreter::fillOpenCLInfo(std::vector<OpenCLPlatformInfo>& rP
bool FormulaGroupInterpreter::switchOpenCLDevice(const OUString& rDeviceId, bool bAutoSelect, bool bForceEvaluation) 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); static bool bAllowSoftwareInterpreter = (getenv("SC_ALLOW_BROKEN_SOFTWARE_INTERPRETER") != NULL);
if (!bOpenCLEnabled || (bAllowSoftwareInterpreter && rDeviceId == OPENCL_SOFTWARE_DEVICE_CONFIG_NAME)) if (!bOpenCLEnabled || (bAllowSoftwareInterpreter && rDeviceId == OPENCL_SOFTWARE_DEVICE_CONFIG_NAME))
{ {
...@@ -526,7 +526,7 @@ bool FormulaGroupInterpreter::switchOpenCLDevice(const OUString& rDeviceId, bool ...@@ -526,7 +526,7 @@ bool FormulaGroupInterpreter::switchOpenCLDevice(const OUString& rDeviceId, bool
delete msInstance; delete msInstance;
msInstance = NULL; msInstance = NULL;
if ( ScInterpreter::GetGlobalConfig().mbOpenCLEnabled.get() ) if (ScCalcConfig::isOpenCLEnabled())
{ {
msInstance = new sc::opencl::FormulaGroupInterpreterOpenCL(); msInstance = new sc::opencl::FormulaGroupInterpreterOpenCL();
return msInstance != NULL; return msInstance != NULL;
...@@ -539,7 +539,7 @@ void FormulaGroupInterpreter::getOpenCLDeviceInfo(sal_Int32& rDeviceId, sal_Int3 ...@@ -539,7 +539,7 @@ void FormulaGroupInterpreter::getOpenCLDeviceInfo(sal_Int32& rDeviceId, sal_Int3
{ {
rDeviceId = -1; rDeviceId = -1;
rPlatformId = -1; rPlatformId = -1;
bool bOpenCLEnabled = ScInterpreter::GetGlobalConfig().mbOpenCLEnabled.get(); bool bOpenCLEnabled = ScCalcConfig::isOpenCLEnabled();
if(!bOpenCLEnabled) if(!bOpenCLEnabled)
return; return;
......
...@@ -912,7 +912,7 @@ void ScInterpreter::ScMatInv() ...@@ -912,7 +912,7 @@ void ScInterpreter::ScMatInv()
SCSIZE nC, nR; SCSIZE nC, nR;
pMat->GetDimensions(nC, nR); pMat->GetDimensions(nC, nR);
if (ScInterpreter::GetGlobalConfig().mbOpenCLEnabled.get()) if (ScCalcConfig::isOpenCLEnabled())
{ {
sc::FormulaGroupInterpreter *pInterpreter = sc::FormulaGroupInterpreter::getStatic(); sc::FormulaGroupInterpreter *pInterpreter = sc::FormulaGroupInterpreter::getStatic();
if (pInterpreter != NULL) if (pInterpreter != NULL)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment