[Libreoffice-commits] core.git: Branch 'feature/calc-pluggable-opencl' - sc/source

Kohei Yoshida kohei.yoshida at collabora.com
Tue Sep 17 12:59:09 PDT 2013


 sc/source/filter/inc/workbookhelper.hxx |    2 ++
 sc/source/filter/oox/formulabuffer.cxx  |    1 +
 sc/source/filter/oox/workbookhelper.cxx |   23 +++++++++++++++++++++++
 3 files changed, 26 insertions(+)

New commits:
commit deadff983b486f6a73b6630435bed72cc816158b
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Tue Sep 17 15:56:38 2013 -0400

    Pre-compile OpenCL kernels during xlsx file load as well.
    
    Change-Id: Id31190b2a9eb496f146fbbeaaf8a223d46492a99

diff --git a/sc/source/filter/inc/workbookhelper.hxx b/sc/source/filter/inc/workbookhelper.hxx
index e540ba0..9ea2353 100644
--- a/sc/source/filter/inc/workbookhelper.hxx
+++ b/sc/source/filter/inc/workbookhelper.hxx
@@ -275,6 +275,8 @@ public:
     /** Returns the codec helper that stores the encoder/decoder object. */
     BiffCodecHelper&    getCodecHelper() const;
 
+    void compileOpenCLKernels();
+
 private:
     WorkbookGlobals&    mrBookGlob;
 };
diff --git a/sc/source/filter/oox/formulabuffer.cxx b/sc/source/filter/oox/formulabuffer.cxx
index 21e383f..cc8a50a 100644
--- a/sc/source/filter/oox/formulabuffer.cxx
+++ b/sc/source/filter/oox/formulabuffer.cxx
@@ -65,6 +65,7 @@ void FormulaBuffer::finalizeImport()
         FormulaDataMap::iterator cellIt = maCellFormulas.find( nTab );
         if ( cellIt != maCellFormulas.end() )
         {
+            compileOpenCLKernels();
             applyCellFormulas( cellIt->second );
         }
 
diff --git a/sc/source/filter/oox/workbookhelper.cxx b/sc/source/filter/oox/workbookhelper.cxx
index 7a9a58f..9ae6fea 100644
--- a/sc/source/filter/oox/workbookhelper.cxx
+++ b/sc/source/filter/oox/workbookhelper.cxx
@@ -71,6 +71,8 @@
 #include "dbdata.hxx"
 #include "datauno.hxx"
 #include "globalnames.hxx"
+#include "clkernelthread.hxx"
+#include "rtl/ref.hxx"
 
 #include "formulabuffer.hxx"
 #include "vcl/mapmod.hxx"
@@ -223,6 +225,8 @@ public:
     /** Returns the codec helper that stores the encoder/decoder object. */
     inline BiffCodecHelper& getCodecHelper() { return *mxCodecHelper; }
 
+    void compileOpenCLKernels();
+
 private:
     /** Initializes some basic members and sets needed document properties. */
     void                initialize( bool bWorkbookFile );
@@ -253,6 +257,8 @@ private:
     typedef ::std::auto_ptr< PageSettingsConverter >    PageSettConvPtr;
     typedef ::std::auto_ptr< BiffCodecHelper >          BiffCodecHelperPtr;
 
+    rtl::Reference<sc::CLBuildKernelThread> mxCLKernelThread;
+
     OUString            maCellStyles;           /// Style family name for cell styles.
     OUString            maPageStyles;           /// Style family name for page styles.
     OUString            maCellStyleServ;        /// Service name for a cell style.
@@ -504,6 +510,15 @@ void WorkbookGlobals::useInternalChartDataTable( bool bInternal )
 
 // private --------------------------------------------------------------------
 
+void WorkbookGlobals::compileOpenCLKernels()
+{
+    if (mxCLKernelThread.is())
+        return;
+
+    mxCLKernelThread.set(new sc::CLBuildKernelThread);
+    mxCLKernelThread->launch();
+}
+
 void WorkbookGlobals::initialize( bool bWorkbookFile )
 {
     maCellStyles = "CellStyles";
@@ -634,6 +649,9 @@ void WorkbookGlobals::finalize()
         //ScDocShell::AfterXMLLoading() for ods
         getScDocument().SetInsertingFromOtherDoc(false);
         getScDocument().RebuildFormulaGroups();
+
+        if (mxCLKernelThread.is())
+            mxCLKernelThread->join();
     }
 }
 
@@ -949,6 +967,11 @@ BiffCodecHelper& WorkbookHelper::getCodecHelper() const
     return mrBookGlob.getCodecHelper();
 }
 
+void WorkbookHelper::compileOpenCLKernels()
+{
+    mrBookGlob.compileOpenCLKernels();
+}
+
 // ============================================================================
 
 } // namespace xls


More information about the Libreoffice-commits mailing list