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
bool mbEmptyStringAsZero:1;
bool mbHasStringRefSyntax:1;
comphelper::ConfigurationListenerProperty<bool> mbOpenCLEnabled;
static bool isOpenCLEnabled();
bool mbOpenCLSubsetOnly:1;
bool mbOpenCLAutoSelect:1;
......
......@@ -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
......
......@@ -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();
......
......@@ -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;
......
......@@ -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)
......
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