summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-03-07 11:13:08 -0500
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2014-03-07 16:39:11 -0600
commitf41da077c76ee8a70fbcf4fe62e0bfb1fabc1a1c (patch)
tree47d570ea44144fdad51f423a11114fe57e6f1140 /sc
parent6048ced1ec27ad64c13791274b66ccb55e4d8dc9 (diff)
Initialize OpenCL device on the main thread when pre-compiling kernels.
Else it would cause extremely hard-to-debug random crashes when interpreting formulas with OpenCL. And let's re-enable kernel pre-compilation with this fix. Change-Id: Ib104bfdc3f56a02c052c837eb4bf3ecc95d562e0 (cherry picked from commit 6e24c789572aba5b6ee95e894f6d778777b1df58) Reviewed-on: https://gerrit.libreoffice.org/8498 Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/data/formulacell.cxx2
-rw-r--r--sc/source/core/tool/clkernelthread.cxx5
2 files changed, 6 insertions, 1 deletions
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 9407fbd5dc72..aff135ab7429 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -54,7 +54,7 @@
#include <boost/scoped_ptr.hpp>
-#define ENABLE_THREADED_OPENCL_KERNEL_COMPILATION 0
+#define ENABLE_THREADED_OPENCL_KERNEL_COMPILATION 1
using namespace formula;
diff --git a/sc/source/core/tool/clkernelthread.cxx b/sc/source/core/tool/clkernelthread.cxx
index ea3c7d0c1331..6c5afc0e55ed 100644
--- a/sc/source/core/tool/clkernelthread.cxx
+++ b/sc/source/core/tool/clkernelthread.cxx
@@ -69,6 +69,11 @@ void CLBuildKernelThread::push(CLBuildKernelWorkItem item)
osl::MutexGuard guard(maQueueMutex);
maQueue.push(item);
maQueueCondition.set();
+
+ // This is only to ensure that the OpenCL parameters are initialized on
+ // the main thread before spawning a worker thread for kernel
+ // pre-compilation.
+ sc::FormulaGroupInterpreter::getStatic();
}
void CLBuildKernelThread::produce()