[Libreoffice-commits] core.git: Branch 'private/kohei/formula-opencl-work' - 5 commits - Repository.mk RepositoryModule_host.mk sc/inc sc/Library_sc.mk sc/Library_scopencl.mk sc/Module_sc.mk sc/source sd/source
Kohei Yoshida
kohei.yoshida at collabora.com
Sun Sep 15 14:27:43 PDT 2013
Rebased ref, commits from common ancestor:
commit 0b28477226793fca61edee5156c34d4879d7f0e3
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Wed Sep 11 12:33:02 2013 -0400
Dynamically load the opencl group interpreter code at run time.
Change-Id: I0e2b393ecf068b57bfe653663be0a788caa22a36
diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx
index dada7e0..d958b1b 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -27,9 +27,6 @@
namespace sc { namespace opencl {
-// A single public entry point for a factory function:
-extern sc::FormulaGroupInterpreter *createFormulaGroupInterpreter();
-
/////time test dbg
double getTimeDiff(const TimeValue& t1, const TimeValue& t2)
{
@@ -1067,21 +1064,25 @@ bool FormulaGroupInterpreterGroundwater::interpret(ScDocument& rDoc, const ScAdd
#endif
-sc::FormulaGroupInterpreter *createFormulaGroupInterpreter()
+} // namespace opencl
+
+} // namespace sc
+
+extern "C" {
+
+SAL_DLLPUBLIC_EXPORT sc::FormulaGroupInterpreter* SAL_CALL createFormulaGroupOpenCLInterpreter()
{
if (getenv("SC_SOFTWARE"))
return NULL;
#if USE_GROUNDWATER_INTERPRETER
if (getenv("SC_GROUNDWATER"))
- return new FormulaGroupInterpreterGroundwater();
+ return new sc::opencl::FormulaGroupInterpreterGroundwater();
#endif
- return new FormulaGroupInterpreterOpenCL();
+ return new sc::opencl::FormulaGroupInterpreterOpenCL();
}
-} // namespace opencl
-
-} // namespace sc
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/tool/formulagroup.cxx b/sc/source/core/tool/formulagroup.cxx
index 98ef4a9..3b929fa 100644
--- a/sc/source/core/tool/formulagroup.cxx
+++ b/sc/source/core/tool/formulagroup.cxx
@@ -27,6 +27,12 @@
#include <cstdio>
#endif
+#ifdef DISABLE_DYNLOADING
+
+extern sc::FormulaGroupInterpreter* SAL_CALL createFormulaGroupOpenCLInterpreter();
+
+#endif
+
namespace sc {
rtl_uString* FormulaGroupContext::intern( const OUString& rStr )
@@ -128,15 +134,6 @@ void fillMatrix( ScMatrix& rMat, size_t nCol, rtl_uString** pStrs, size_t nLen )
}
-class FormulaGroupInterpreterOpenCLMissing : public FormulaGroupInterpreter
-{
-public:
- FormulaGroupInterpreterOpenCLMissing() : FormulaGroupInterpreter() {}
- virtual ~FormulaGroupInterpreterOpenCLMissing() {}
- virtual ScMatrixRef inverseMatrix(const ScMatrix&) { return ScMatrixRef(); }
- virtual bool interpret(ScDocument&, const ScAddress&, const ScFormulaCellGroupRef&, ScTokenArray&) { return false; }
-};
-
ScMatrixRef FormulaGroupInterpreterSoftware::inverseMatrix(const ScMatrix& /*rMat*/)
{
return ScMatrixRef();
@@ -278,12 +275,6 @@ bool FormulaGroupInterpreterSoftware::interpret(ScDocument& rDoc, const ScAddres
return true;
}
-// TODO: load module, hook symbol out, check it works, UI on failure etc.
-namespace opencl {
- extern sc::FormulaGroupInterpreter *createFormulaGroupInterpreter();
-}
-FormulaGroupInterpreter *FormulaGroupInterpreter::msInstance = NULL;
-
#if USE_DUMMY_INTERPRETER
class FormulaGroupInterpreterDummy : public FormulaGroupInterpreter
{
@@ -322,8 +313,28 @@ public:
return true;
}
};
+
#endif
+#ifndef DISABLE_DYNLOADING
+
+class FormulaGroupInterpreterOpenCLMissing : public FormulaGroupInterpreter
+{
+public:
+ FormulaGroupInterpreterOpenCLMissing() : FormulaGroupInterpreter() {}
+ virtual ~FormulaGroupInterpreterOpenCLMissing() {}
+ virtual ScMatrixRef inverseMatrix(const ScMatrix&) { return ScMatrixRef(); }
+ virtual bool interpret(ScDocument&, const ScAddress&, const ScFormulaCellGroupRef&, ScTokenArray&) { return false; }
+};
+
+static void SAL_CALL thisModule() {}
+
+typedef FormulaGroupInterpreter* (*LoaderFn)(void);
+
+#endif
+
+FormulaGroupInterpreter *FormulaGroupInterpreter::msInstance = NULL;
+
/// load and/or configure the correct formula group interpreter
FormulaGroupInterpreter *FormulaGroupInterpreter::getStatic()
{
@@ -351,10 +362,25 @@ FormulaGroupInterpreter *FormulaGroupInterpreter::getStatic()
if ( ScInterpreter::GetGlobalConfig().mbOpenCLEnabled )
{
#ifdef DISABLE_DYNLOADING
- msInstance = sc::opencl::createFormulaGroupInterpreter();
+ msInstance = createFormulaGroupOpenCLInterpreter();
#else
- // TODO : Dynamically load scopencl shared object, and instantiate the opencl interpreter.
- msInstance = new sc::FormulaGroupInterpreterOpenCLMissing();
+ // Dynamically load scopencl shared object, and instantiate the opencl interpreter.
+
+ OUString aLibName(SVLIBRARY("scopencl"));
+ static osl::Module aModule;
+ bool bLoaded = aModule.loadRelative(&thisModule, aLibName);
+ if (!bLoaded)
+ bLoaded = aModule.load(aLibName);
+
+ if (bLoaded)
+ {
+ oslGenericFunction fn = aModule.getFunctionSymbol("createFormulaGroupOpenCLInterpreter");
+ if (fn)
+ msInstance = reinterpret_cast<LoaderFn>(fn)();
+ }
+
+ if (!msInstance)
+ msInstance = new sc::FormulaGroupInterpreterOpenCLMissing();
#endif
}
#endif
commit 518bbf0560ed96b9f87bea4e9fb38617344c2939
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Tue Sep 10 21:09:24 2013 -0400
First step toward splitting the opencl code into own shared library.
Change-Id: I44fa3ded8d48b2972af17b78ab6c0af03e024f36
diff --git a/Repository.mk b/Repository.mk
index cff654b..4d5125b 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -155,6 +155,7 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,calc, \
scfilt \
scui \
solver \
+ $(if $(ENABLE_OPENCL),scopencl) \
$(if $(DISABLE_SCRIPTING),,vbaobj) \
$(if $(ENABLE_TELEPATHY),tubes) \
))
diff --git a/RepositoryModule_host.mk b/RepositoryModule_host.mk
index c577734..0b22952 100644
--- a/RepositoryModule_host.mk
+++ b/RepositoryModule_host.mk
@@ -246,7 +246,7 @@ endef
# the default goal is all (see Module.mk)
ifeq (,$(filter-out all,$(MAKECMDGOALS)))
$(eval $(call repositorymodule_serialize,\
- scfilt \
+ scfilt scopencl \
$(if $(filter SCRIPTING,$(BUILD_TYPE)),vbaobj) \
sc msword swui sw sd \
$(if $(filter DBCONNECTIVITY,$(BUILD_TYPE)),dbu) \
diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk
index bd1a9a3..d198737 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -54,15 +54,6 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
))
endif
-ifeq ($(ENABLE_OPENCL),TRUE)
-$(eval $(call gb_Library_use_externals,sc,opencl))
-
-$(eval $(call gb_Library_add_exception_objects,sc,\
- sc/source/core/opencl/formulagroupcl \
- sc/source/core/opencl/openclwrapper \
-))
-endif
-
$(eval $(call gb_Library_use_libraries,sc,\
avmedia \
basegfx \
diff --git a/sc/Library_scopencl.mk b/sc/Library_scopencl.mk
new file mode 100644
index 0000000..f30f9c4
--- /dev/null
+++ b/sc/Library_scopencl.mk
@@ -0,0 +1,37 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_Library_Library,scopencl))
+
+$(eval $(call gb_Library_set_include,scopencl,\
+ -I$(SRCDIR)/sc/source/core/inc \
+ -I$(SRCDIR)/sc/inc \
+ $$(INCLUDE) \
+))
+
+$(eval $(call gb_Library_set_precompiled_header,scopencl,$(SRCDIR)/sc/inc/pch/precompiled_scopencl))
+
+$(eval $(call gb_Library_use_sdk_api,scopencl))
+
+$(eval $(call gb_Library_use_libraries,scopencl,\
+ for \
+ forui \
+ sal \
+ sc \
+ $(gb_UWINAPI) \
+))
+
+$(eval $(call gb_Library_use_externals,scopencl,opencl))
+
+$(eval $(call gb_Library_add_exception_objects,scopencl,\
+ sc/source/core/opencl/formulagroupcl \
+ sc/source/core/opencl/openclwrapper \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk
index 35f1fc1..6522862 100644
--- a/sc/Module_sc.mk
+++ b/sc/Module_sc.mk
@@ -19,6 +19,12 @@ $(eval $(call gb_Module_add_targets,sc,\
UIConfig_scalc \
))
+ifeq ($(ENABLE_OPENCL),TRUE)
+$(eval $(call gb_Module_add_targets,sc,\
+ Library_scopencl \
+))
+endif
+
ifneq (,$(filter DESKTOP,$(BUILD_TYPE)))
$(eval $(call gb_Module_add_targets,sc,\
Library_scqahelper \
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 6993abb..1e720a8 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1745,7 +1745,7 @@ public:
* @param pResults array of numeric results.
* @param nLen length of numeric results.
*/
- void SetFormulaResults( const ScAddress& rTopPos, const double* pResults, size_t nLen );
+ void SC_DLLPUBLIC SetFormulaResults( const ScAddress& rTopPos, const double* pResults, size_t nLen );
private:
ScDocument(const ScDocument& r); // disabled with no definition
diff --git a/sc/source/core/opencl/openclwrapper.cxx b/sc/source/core/opencl/openclwrapper.cxx
index 75e991b..c46bdce 100644
--- a/sc/source/core/opencl/openclwrapper.cxx
+++ b/sc/source/core/opencl/openclwrapper.cxx
@@ -10,7 +10,6 @@
#include "openclwrapper.hxx"
#include "sal/config.h"
-#include "random.hxx"
#include "oclkernels.hxx"
#include <stdio.h>
diff --git a/sc/source/core/tool/formulagroup.cxx b/sc/source/core/tool/formulagroup.cxx
index 04bec4f..98ef4a9 100644
--- a/sc/source/core/tool/formulagroup.cxx
+++ b/sc/source/core/tool/formulagroup.cxx
@@ -128,6 +128,15 @@ void fillMatrix( ScMatrix& rMat, size_t nCol, rtl_uString** pStrs, size_t nLen )
}
+class FormulaGroupInterpreterOpenCLMissing : public FormulaGroupInterpreter
+{
+public:
+ FormulaGroupInterpreterOpenCLMissing() : FormulaGroupInterpreter() {}
+ virtual ~FormulaGroupInterpreterOpenCLMissing() {}
+ virtual ScMatrixRef inverseMatrix(const ScMatrix&) { return ScMatrixRef(); }
+ virtual bool interpret(ScDocument&, const ScAddress&, const ScFormulaCellGroupRef&, ScTokenArray&) { return false; }
+};
+
ScMatrixRef FormulaGroupInterpreterSoftware::inverseMatrix(const ScMatrix& /*rMat*/)
{
return ScMatrixRef();
@@ -340,7 +349,14 @@ FormulaGroupInterpreter *FormulaGroupInterpreter::getStatic()
{
#if HAVE_FEATURE_OPENCL
if ( ScInterpreter::GetGlobalConfig().mbOpenCLEnabled )
+ {
+#ifdef DISABLE_DYNLOADING
msInstance = sc::opencl::createFormulaGroupInterpreter();
+#else
+ // TODO : Dynamically load scopencl shared object, and instantiate the opencl interpreter.
+ msInstance = new sc::FormulaGroupInterpreterOpenCLMissing();
+#endif
+ }
#endif
if ( !msInstance ) // software fallback
{
commit 9e4a6760a5a2045696f86bdf26913d26699e4ac3
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Tue Sep 10 17:10:15 2013 -0400
Disable dummy and groundwater interpreters from the default build.
They are of no use in the default build.
Change-Id: Ie3b874a5c78123436736318357fa48baafd991f3
diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx
index 62d70de..dada7e0 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -18,6 +18,8 @@
#include "openclwrapper.hxx"
+#define USE_GROUNDWATER_INTERPRETER 0
+
#define SRCDATASIZE 100
#define SINGLEARRAYLEN 100
#define DOUBLEARRAYLEN 100
@@ -947,6 +949,8 @@ bool FormulaGroupInterpreterOpenCL::interpret( ScDocument& rDoc, const ScAddress
return false;
}
+#if USE_GROUNDWATER_INTERPRETER
+
/// Special case of formula compiler for groundwatering
class FormulaGroupInterpreterGroundwater : public FormulaGroupInterpreterSoftware
{
@@ -1061,13 +1065,17 @@ bool FormulaGroupInterpreterGroundwater::interpret(ScDocument& rDoc, const ScAdd
return true;
}
+#endif
+
sc::FormulaGroupInterpreter *createFormulaGroupInterpreter()
{
if (getenv("SC_SOFTWARE"))
return NULL;
+#if USE_GROUNDWATER_INTERPRETER
if (getenv("SC_GROUNDWATER"))
return new FormulaGroupInterpreterGroundwater();
+#endif
return new FormulaGroupInterpreterOpenCL();
}
diff --git a/sc/source/core/tool/formulagroup.cxx b/sc/source/core/tool/formulagroup.cxx
index d8ba564..04bec4f 100644
--- a/sc/source/core/tool/formulagroup.cxx
+++ b/sc/source/core/tool/formulagroup.cxx
@@ -21,7 +21,7 @@
#include <vector>
#include <boost/unordered_map.hpp>
-#define USE_DUMMY_INTERPRETER 1
+#define USE_DUMMY_INTERPRETER 0
#if USE_DUMMY_INTERPRETER
#include <cstdio>
commit ef1cd0c12eaddc6f1f30e73c37cf301c1fbe430d
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Tue Sep 10 17:01:15 2013 -0400
Put all opencl related code inside sc::opencl namespace.
Change-Id: Ia6c1fd88ed08022347c60af33a8620b9cf278c12
diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx
index 279ac2d..62d70de 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -7,7 +7,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#include <config_features.h>
#include "formulagroup.hxx"
#include "document.hxx"
#include "formulacell.hxx"
@@ -23,12 +22,11 @@
#define SINGLEARRAYLEN 100
#define DOUBLEARRAYLEN 100
#define SVDOUBLELEN 100
-namespace sc {
+
+namespace sc { namespace opencl {
// A single public entry point for a factory function:
-namespace opencl {
- extern sc::FormulaGroupInterpreter *createFormulaGroupInterpreter();
-}
+extern sc::FormulaGroupInterpreter *createFormulaGroupInterpreter();
/////time test dbg
double getTimeDiff(const TimeValue& t1, const TimeValue& t2)
@@ -1063,17 +1061,15 @@ bool FormulaGroupInterpreterGroundwater::interpret(ScDocument& rDoc, const ScAdd
return true;
}
-namespace opencl {
-
sc::FormulaGroupInterpreter *createFormulaGroupInterpreter()
{
if (getenv("SC_SOFTWARE"))
return NULL;
if (getenv("SC_GROUNDWATER"))
- return new sc::FormulaGroupInterpreterGroundwater();
+ return new FormulaGroupInterpreterGroundwater();
- return new sc::FormulaGroupInterpreterOpenCL();
+ return new FormulaGroupInterpreterOpenCL();
}
} // namespace opencl
diff --git a/sc/source/core/opencl/oclkernels.hxx b/sc/source/core/opencl/oclkernels.hxx
index 53917b3..3e0af5b 100644
--- a/sc/source/core/opencl/oclkernels.hxx
+++ b/sc/source/core/opencl/oclkernels.hxx
@@ -12,6 +12,9 @@
#ifndef USE_EXTERNAL_KERNEL
#define KERNEL( ... )# __VA_ARGS__
+
+namespace sc { namespace opencl {
+
// Double precision is a default of spreadsheets
// cl_khr_fp64: Khronos extension
// cl_amd_fp64: AMD extension
@@ -380,6 +383,8 @@ __kernel void oclSub( fp_t ltData, __global fp_t *rtData, __global fp_t *outData
}
);
+}}
+
#endif // USE_EXTERNAL_KERNEL
#endif //_OCL_KERNEL_H_
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/opencl/openclwrapper.cxx b/sc/source/core/opencl/openclwrapper.cxx
index 6db498b..75e991b 100644
--- a/sc/source/core/opencl/openclwrapper.cxx
+++ b/sc/source/core/opencl/openclwrapper.cxx
@@ -7,24 +7,19 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <cmath>
+#include "openclwrapper.hxx"
+
#include "sal/config.h"
#include "random.hxx"
-#include "openclwrapper.hxx"
#include "oclkernels.hxx"
-#ifdef SAL_WIN32
-#include <Windows.h>
-#endif
-//#define USE_MAP_BUFFER
-using namespace std;
-GPUEnv OpenclDevice::gpuEnv;
-int OpenclDevice::isInited =0;
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <cmath>
-#ifdef SAL_WIN32
+#ifdef WIN32
+#include <Windows.h>
#define OPENCL_DLL_NAME "opencllo.dll"
#define OCLERR -1
@@ -40,6 +35,16 @@ int OpenclDevice::isInited =0;
#define OCL_CHECK(value1,value2,str) \
if(value1!=value2) \
fprintf(stderr,"[OCL_ERROR] %s\n",str);
+#endif
+
+using namespace std;
+
+namespace sc { namespace opencl {
+
+GPUEnv OpenclDevice::gpuEnv;
+int OpenclDevice::isInited =0;
+
+#ifdef WIN32
HINSTANCE HOpenclDll = NULL;
void * OpenclDll = NULL;
@@ -69,7 +74,7 @@ void OpenclDevice::freeOpenclDll()
int OpenclDevice::initEnv()
{
-#ifdef SAL_WIN32
+#ifdef WIN32
while( 1 )
{
if( 1 == loadOpencl() )
@@ -83,14 +88,14 @@ int OpenclDevice::initEnv()
int OpenclDevice::releaseOpenclRunEnv()
{
releaseOpenclEnv( &gpuEnv );
-#ifdef SAL_WIN32
+#ifdef WIN32
freeOpenclDll();
#endif
return 1;
}
///////////////////////////////////////////////////////
///////////////////////////////////////////////////////
-inline int OpenclDevice::addKernelConfig( int kCount, const char *kName )
+int OpenclDevice::addKernelConfig( int kCount, const char *kName )
{
if ( kCount < 1 )
fprintf(stderr,"Error: ( KCount < 1 )" SAL_DETAIL_WHERE "addKernelConfig\n" );
@@ -2660,4 +2665,6 @@ int OclCalc::oclHostMatrixInverse32Bits( const char* aKernelName, float *fpOclMa
return 0;
}
+}}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/opencl/openclwrapper.hxx b/sc/source/core/opencl/openclwrapper.hxx
index cf3b4f1..d1e8925 100644
--- a/sc/source/core/opencl/openclwrapper.hxx
+++ b/sc/source/core/opencl/openclwrapper.hxx
@@ -39,6 +39,32 @@
#define CL_QUEUE_THREAD_HANDLE_AMD 0x403E
#define CL_MAP_WRITE_INVALIDATE_REGION (1 << 2)
+#define CHECK_OPENCL(status,name) \
+if( status != CL_SUCCESS ) \
+{ \
+ printf ("OpenCL error code is %d at " SAL_DETAIL_WHERE " when %s .\n", status, name); \
+ return 0; \
+}
+
+#define CHECK_OPENCL_VOID(status,name) \
+if( status != CL_SUCCESS ) \
+{ \
+ printf ("OpenCL error code is %d at " SAL_DETAIL_WHERE " when %s .\n", status, name); \
+}
+
+#define CHECK_OPENCL_RELEASE(status,name) \
+if ( name != NULL ) \
+ clReleaseMemObject( name ); \
+if( status != CL_SUCCESS ) \
+{ \
+ printf ("OpenCL error code is %d at " SAL_DETAIL_WHERE " when clReleaseMemObject( %s ).\n", status, #name); \
+}
+
+#define MAX_KERNEL_STRING_LEN 64
+#define MAX_CLFILE_NUM 50
+#define MAX_CLKERNEL_NUM 200
+#define MAX_KERNEL_NAME_LEN 64
+
#if defined(_MSC_VER)
#ifndef strcasecmp
#define strcasecmp strcmp
@@ -48,8 +74,6 @@
#include <cstdio>
#include <vector>
-typedef unsigned int uint;
-
typedef struct _KernelEnv
{
cl_context mpkContext;
@@ -59,52 +83,25 @@ typedef struct _KernelEnv
char mckKernelName[150];
} KernelEnv;
-typedef struct _OpenCLEnv
-{
- cl_platform_id mpOclPlatformID;
- cl_context mpOclContext;
- cl_device_id mpOclDevsID;
- cl_command_queue mpOclCmdQueue;
-} OpenCLEnv;
-
-#if defined __cplusplus
extern "C" {
-#endif
-//user defined, this is function wrapper which is used to set the input parameters,
-//luanch kernel and copy data from GPU to CPU or CPU to GPU.
+// user defined, this is function wrapper which is used to set the input
+// parameters, launch kernel and copy data from GPU to CPU or CPU to GPU.
typedef int ( *cl_kernel_function )( void **userdata, KernelEnv *kenv );
-#if defined __cplusplus
-
-}
-#endif
-
-#define CHECK_OPENCL(status,name) \
-if( status != CL_SUCCESS ) \
-{ \
- printf ("OpenCL error code is %d at " SAL_DETAIL_WHERE " when %s .\n", status, name); \
- return 0; \
}
-#define CHECK_OPENCL_VOID(status,name) \
-if( status != CL_SUCCESS ) \
-{ \
- printf ("OpenCL error code is %d at " SAL_DETAIL_WHERE " when %s .\n", status, name); \
-}
+namespace sc { namespace opencl {
-#define CHECK_OPENCL_RELEASE(status,name) \
-if ( name != NULL ) \
- clReleaseMemObject( name ); \
-if( status != CL_SUCCESS ) \
-{ \
- printf ("OpenCL error code is %d at " SAL_DETAIL_WHERE " when clReleaseMemObject( %s ).\n", status, #name); \
-}
+typedef unsigned int uint;
-#define MAX_KERNEL_STRING_LEN 64
-#define MAX_CLFILE_NUM 50
-#define MAX_CLKERNEL_NUM 200
-#define MAX_KERNEL_NAME_LEN 64
+typedef struct _OpenCLEnv
+{
+ cl_platform_id mpOclPlatformID;
+ cl_context mpOclContext;
+ cl_device_id mpOclDevsID;
+ cl_command_queue mpOclCmdQueue;
+} OpenCLEnv;
typedef struct _GPUEnv
{
@@ -214,14 +211,12 @@ public:
#ifdef WIN32
static int loadOpencl();
- static int openclInite();
static void freeOpenclDll();
#endif
int getOpenclState();
void setOpenclState( int state );
- inline static int addKernelConfig( int kCount, const char *kName );
-
+ static int addKernelConfig( int kCount, const char *kName );
};
class OclCalc: public OpenclDevice,OpenclCalcBase
@@ -293,5 +288,8 @@ public:
friend class agency;
};
+}}
+
#endif
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/tool/formulagroup.cxx b/sc/source/core/tool/formulagroup.cxx
index 1dbe5bd..d8ba564 100644
--- a/sc/source/core/tool/formulagroup.cxx
+++ b/sc/source/core/tool/formulagroup.cxx
@@ -7,7 +7,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#include <config_features.h>
#include "formulagroup.hxx"
#include "document.hxx"
#include "formulacell.hxx"
@@ -17,6 +16,7 @@
#include "scmatrix.hxx"
#include "formula/vectortoken.hxx"
+#include "config_features.h"
#include <vector>
#include <boost/unordered_map.hpp>
commit 2bc6a5d74ede6c00ee6ccfbaa17e791a64ffff19
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Tue Sep 10 14:36:13 2013 -0400
We can use plain char array for these, only to avoid C++11 construct.
Hopefully this will keep our tinderboxes happy.
Change-Id: I3f7d398407fea2da858a1567c264f4c9bc35ff7b
diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx
index bd806ee..6e21aef 100644
--- a/sd/source/core/sdpage.cxx
+++ b/sd/source/core/sdpage.cxx
@@ -850,16 +850,23 @@ void SdPage::CreateTitleAndLayout(sal_Bool bInit, sal_Bool bCreate )
}
}
-static const std::vector<rtl::OUString> PageKindVector = {"PK_STANDARD","PK_NOTES" , "PK_HANDOUT"};
-static const std::vector<rtl::OUString> PresObjKindVector = {"PRESOBJ_NONE", "PRESOBJ_TITLE", "PRESOBJ_OUTLINE",
- "PRESOBJ_TEXT" ,"PRESOBJ_GRAPHIC" , "PRESOBJ_OBJECT",
- "PRESOBJ_CHART", "PRESOBJ_ORGCHART", "PRESOBJ_TABLE",
- "PRESOBJ_IMAGE", "PRESOBJ_PAGE", "PRESOBJ_HANDOUT",
- "PRESOBJ_NOTES","PRESOBJ_HEADER", "PRESOBJ_FOOTER",
- "PRESOBJ_DATETIME", "PRESOBJ_SLIDENUMBER", "PRESOBJ_CALC",
- "PRESOBJ_MEDIA", "PRESOBJ_MAX" };
-
-void getPresObjProp( SdPage rPage, const rtl::OUString& sObjKind, const rtl::OUString& sPageKind, double presObjPropValue[])
+namespace {
+
+const char* PageKindVector[] = {
+ "PK_STANDARD","PK_NOTES" , "PK_HANDOUT"
+};
+
+const char* PresObjKindVector[] = {
+ "PRESOBJ_NONE", "PRESOBJ_TITLE", "PRESOBJ_OUTLINE",
+ "PRESOBJ_TEXT" ,"PRESOBJ_GRAPHIC" , "PRESOBJ_OBJECT",
+ "PRESOBJ_CHART", "PRESOBJ_ORGCHART", "PRESOBJ_TABLE",
+ "PRESOBJ_IMAGE", "PRESOBJ_PAGE", "PRESOBJ_HANDOUT",
+ "PRESOBJ_NOTES","PRESOBJ_HEADER", "PRESOBJ_FOOTER",
+ "PRESOBJ_DATETIME", "PRESOBJ_SLIDENUMBER", "PRESOBJ_CALC",
+ "PRESOBJ_MEDIA", "PRESOBJ_MAX"
+};
+
+void getPresObjProp( SdPage rPage, const char* sObjKind, const char* sPageKind, double presObjPropValue[] )
{
bool bNoObjectFound = true; //used to break from outer loop
@@ -873,7 +880,7 @@ void getPresObjProp( SdPage rPage, const rtl::OUString& sObjKind, const rtl::OUS
Reference<XNode> objectattr = objectattrlist->getNamedItem("type");
rtl::OUString sObjType = objectattr->getNodeValue();
- if(sObjType == sObjKind)
+ if (sObjType.equalsAscii(sObjKind))
{
Reference<XNodeList> objectChildren = objectNode->getChildNodes();
const int objSize = objectChildren->getLength();
@@ -890,7 +897,7 @@ void getPresObjProp( SdPage rPage, const rtl::OUString& sObjKind, const rtl::OUS
Reference<XNode> ObjPageKind = ObjAttributes->getNamedItem("pagekind");
rtl::OUString sObjPageKind = ObjPageKind->getNodeValue();
- if(sObjPageKind == sPageKind)
+ if (sObjPageKind.equalsAscii(sPageKind))
{
Reference<XNode> ObjSizeHeight = ObjAttributes->getNamedItem("relative-height");
rtl::OUString sValue = ObjSizeHeight->getNodeValue();
@@ -920,6 +927,8 @@ void getPresObjProp( SdPage rPage, const rtl::OUString& sObjKind, const rtl::OUS
}
}
+}
+
SdrObject* SdPage::CreateDefaultPresObj(PresObjKind eObjKind, bool bInsert)
{
double propvalue[] = {0,0,0,0};
@@ -941,8 +950,8 @@ SdrObject* SdPage::CreateDefaultPresObj(PresObjKind eObjKind, bool bInsert)
}
else if( (eObjKind == PRESOBJ_FOOTER) || (eObjKind == PRESOBJ_DATETIME) || (eObjKind == PRESOBJ_SLIDENUMBER) || (eObjKind == PRESOBJ_HEADER ) )
{
- rtl::OUString sObjKind = PresObjKindVector[eObjKind];
- rtl::OUString sPageKind = PageKindVector[mePageKind];
+ const char* sObjKind = PresObjKindVector[eObjKind];
+ const char* sPageKind = PageKindVector[mePageKind];
// create footer objects for standard master page
if( mePageKind == PK_STANDARD )
{
@@ -1026,7 +1035,7 @@ Rectangle SdPage::GetTitleRect() const
Size aTitleSize ( GetSize() );
aTitleSize.Width() -= GetLftBorder() + GetRgtBorder();
aTitleSize.Height() -= GetUppBorder() + GetLwrBorder();
- rtl::OUString sPageKind = PageKindVector[mePageKind];
+ const char* sPageKind = PageKindVector[mePageKind];
if (mePageKind == PK_STANDARD)
{
@@ -1107,7 +1116,7 @@ Rectangle SdPage::GetLayoutRect() const
Size aLayoutSize ( GetSize() );
aLayoutSize.Width() -= GetLftBorder() + GetRgtBorder();
aLayoutSize.Height() -= GetUppBorder() + GetLwrBorder();
- rtl::OUString sPageKind = PageKindVector[mePageKind];
+ const char* sPageKind = PageKindVector[mePageKind];
if (mePageKind == PK_STANDARD)
{
More information about the Libreoffice-commits
mailing list