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

Kohei Yoshida kohei.yoshida at collabora.com
Thu Sep 12 20:49:59 PDT 2013


 sc/source/core/opencl/openclwrapper.cxx |   48 ++------------------------------
 sc/source/core/opencl/openclwrapper.hxx |    6 ----
 2 files changed, 4 insertions(+), 50 deletions(-)

New commits:
commit 19983dfa038b0a6766cf3d5bdaade6004a45ceaf
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Thu Sep 12 23:44:53 2013 -0400

    Remove these Windows specific DLL loading in favor of clew.
    
    Change-Id: Ia2ca3c512e033e80a55eb2d33fdd34d07297f29b

diff --git a/sc/source/core/opencl/openclwrapper.cxx b/sc/source/core/opencl/openclwrapper.cxx
index 0cad340..c1791f9 100644
--- a/sc/source/core/opencl/openclwrapper.cxx
+++ b/sc/source/core/opencl/openclwrapper.cxx
@@ -20,10 +20,6 @@
 #ifdef WIN32
 #include <Windows.h>
 
-#define OPENCL_DLL_NAME "opencllo.dll"
-#define OCLERR -1
-#define OCLSUCCESS 1
-
 #define TRUE 1
 #define FALSE 0
 
@@ -43,48 +39,14 @@ namespace sc { namespace opencl {
 GPUEnv OpenclDevice::gpuEnv;
 int OpenclDevice::isInited =0;
 
-#ifdef WIN32
-
-HINSTANCE HOpenclDll = NULL;
-void * OpenclDll = NULL;
-
-int OpenclDevice::loadOpencl()
-{
-    //fprintf(stderr, " loadOpenclDllxx... \n");
-    OpenclDll = static_cast<HINSTANCE>( HOpenclDll );
-    OpenclDll = LoadLibrary( OPENCL_DLL_NAME );
-    if ( !static_cast<HINSTANCE>( OpenclDll ) )
-    {
-        fprintf(stderr, " Load opencllo.dll failed! \n");
-        FreeLibrary( static_cast<HINSTANCE>( OpenclDll ) );
-        return OCLERR;
-    }
-    fprintf(stderr, " Load opencllo.dll successfully!\n");
-    return OCLSUCCESS;
-}
-
-void OpenclDevice::freeOpenclDll()
-{
-    fprintf(stderr, " Free opencllo.dll ... \n");
-    if ( !static_cast<HINSTANCE>( OpenclDll ) )
-        FreeLibrary( static_cast<HINSTANCE>( OpenclDll ) );
-}
-#endif
-
 int OpenclDevice::initEnv()
 {
-    // TODO: Make the path configurable.
-    int status = clewInit("/opt/AMDAPP/lib/x86_64/libOpenCL.so");
+    // TODO: This part needs more platform specific handling.  On Windows,
+    // the GPU Driver itself  installs OpenCL.dll in the system folder.
+    int status = clewInit("OpenCL.dll");
     if (status < 0)
         return 1;
 
-#ifdef WIN32
-    while( 1 )
-    {
-        if( 1 == loadOpencl() )
-            break;
-    }
-#endif
     initOpenclRunEnv( 0 );
     return 1;
 }
@@ -92,9 +54,7 @@ int OpenclDevice::initEnv()
 int OpenclDevice::releaseOpenclRunEnv()
 {
     releaseOpenclEnv( &gpuEnv );
-#ifdef WIN32
-    freeOpenclDll();
-#endif
+
     return 1;
 }
 ///////////////////////////////////////////////////////
diff --git a/sc/source/core/opencl/openclwrapper.hxx b/sc/source/core/opencl/openclwrapper.hxx
index 685c281..431a771 100644
--- a/sc/source/core/opencl/openclwrapper.hxx
+++ b/sc/source/core/opencl/openclwrapper.hxx
@@ -205,12 +205,6 @@ public:
     int runKernelWrapper( cl_kernel_function function, const char * kernelName, void **usrdata );
     int getKernelEnvAndFunc( const char *kernelName, KernelEnv *env, cl_kernel_function *function );
 
-
-#ifdef WIN32
-    static int loadOpencl();
-    static void freeOpenclDll();
-#endif
-
     int getOpenclState();
     void setOpenclState( int state );
     static int addKernelConfig( int kCount, const char *kName );


More information about the Libreoffice-commits mailing list