diff options
author | Tor Lillqvist <tml@collabora.com> | 2014-12-09 12:45:41 +0200 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2014-12-09 13:09:50 +0200 |
commit | 6eb155dea00a1e312fdc3339406bf168a93a25e7 (patch) | |
tree | a8ca5ee4ea35fc21a58e408ca5de34f2613f1e2a /sc | |
parent | feb92a5f3ca44a69e07eb29c23bd0d4010e2fd53 (diff) |
Don't use of the broken "Software" group interpreter
FormulaGroupInterpreterSoftware is known to be broken, says moggi. We should
not use it as a fallback to OpenCL.
Not sure whether it makes sense, but let's keep it in the code for now. Make
using it conditional on setting the environment variable
SC_ALLOW_BROKEN_SOFTWARE_INTERPRETER (to any value). Only a developer who
wants to work on it should set that.
sc::FormulaGroupInterpreter::getStatic() can now return NULL, adapt callers
accordingly.
This might fix fdo#87119, but I am not able to check, as the document from
that bug causes an unrelated assertion for me.
Change-Id: I24454f46332014cbcbf696252059b9743f3c84d6
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/data/formulacell.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/tool/formulagroup.cxx | 7 | ||||
-rw-r--r-- | sc/source/core/tool/interpr5.cxx | 12 |
3 files changed, 16 insertions, 7 deletions
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index 80842fe3d754..7cf065650209 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -3778,7 +3778,9 @@ bool ScFormulaCell::InterpretFormulaGroup() // The converted code does not have RPN tokens yet. The interpreter will // generate them. mxGroup->meCalcState = sc::GroupCalcRunning; - if (!sc::FormulaGroupInterpreter::getStatic()->interpret(*pDocument, mxGroup->mpTopCell->aPos, mxGroup, aCode)) + sc::FormulaGroupInterpreter *pInterpreter = sc::FormulaGroupInterpreter::getStatic(); + if (pInterpreter == NULL || + !pInterpreter->interpret(*pDocument, mxGroup->mpTopCell->aPos, mxGroup, aCode)) { SAL_INFO("sc.opencl", "interpreting group " << mxGroup << " (state " << (int) mxGroup->meCalcState << ") failed, disabling"); mxGroup->meCalcState = sc::GroupCalcDisabled; diff --git a/sc/source/core/tool/formulagroup.cxx b/sc/source/core/tool/formulagroup.cxx index cc4f80512376..32ee19aa770d 100644 --- a/sc/source/core/tool/formulagroup.cxx +++ b/sc/source/core/tool/formulagroup.cxx @@ -528,7 +528,9 @@ FormulaGroupInterpreter *FormulaGroupInterpreter::getStatic() if (officecfg::Office::Common::Misc::UseOpenCL::get()) switchOpenCLDevice(rConfig.maOpenCLDevice, rConfig.mbOpenCLAutoSelect, false); #endif - if ( !msInstance ) // software fallback + static bool bAllowSoftwareInterpreter = (getenv("SC_ALLOW_BROKEN_SOFTWARE_INTERPRETER") != NULL); + + if ( !msInstance && bAllowSoftwareInterpreter ) // software fallback { SAL_INFO("sc.formulagroup", "Create S/W interpreter"); msInstance = new sc::FormulaGroupInterpreterSoftware(); @@ -550,7 +552,8 @@ void FormulaGroupInterpreter::fillOpenCLInfo(std::vector<OpenCLPlatformInfo>& rP bool FormulaGroupInterpreter::switchOpenCLDevice(const OUString& rDeviceId, bool bAutoSelect, bool bForceEvaluation) { bool bOpenCLEnabled = officecfg::Office::Common::Misc::UseOpenCL::get(); - if (!bOpenCLEnabled || rDeviceId == OPENCL_SOFTWARE_DEVICE_CONFIG_NAME) + static bool bAllowSoftwareInterpreter = (getenv("SC_ALLOW_BROKEN_SOFTWARE_INTERPRETER") != NULL); + if (!bOpenCLEnabled || (bAllowSoftwareInterpreter && rDeviceId == OPENCL_SOFTWARE_DEVICE_CONFIG_NAME)) { if(msInstance) { diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx index 05936fa29696..e33484658837 100644 --- a/sc/source/core/tool/interpr5.cxx +++ b/sc/source/core/tool/interpr5.cxx @@ -911,11 +911,15 @@ void ScInterpreter::ScMatInv() if (officecfg::Office::Common::Misc::UseOpenCL::get()) { - ScMatrixRef xResMat = sc::FormulaGroupInterpreter::getStatic()->inverseMatrix(*pMat); - if (xResMat) + sc::FormulaGroupInterpreter *pInterpreter = sc::FormulaGroupInterpreter::getStatic(); + if (pInterpreter != NULL) { - PushMatrix(xResMat); - return; + ScMatrixRef xResMat = pInterpreter->inverseMatrix(*pMat); + if (xResMat) + { + PushMatrix(xResMat); + return; + } } } |