sc/source/core/opencl/openclwrapper.cxx |   30 ++++++++++++++----------------
 sc/source/core/opencl/openclwrapper.hxx |    5 -----
 2 files changed, 14 insertions(+), 21 deletions(-)

New commits:
commit 743b111cf62ef42ead3d8dd6a4aefbb884ce8ee4
Author: Tor Lillqvist <t...@iki.fi>
Date:   Thu Jul 4 15:30:16 2013 +0300

    Opaque binary data is opaque binary data
    
    No need to append a newline surely. At least in Apple's OpenCL doing
    that seems to invalidate a binary OpenCL blob.
    
    Change-Id: I68bb12d5071f6452afe5a47ddf510f7e8e60cf3e

diff --git a/sc/source/core/opencl/openclwrapper.cxx 
b/sc/source/core/opencl/openclwrapper.cxx
index 9b9feaa..aa3ce69 100644
--- a/sc/source/core/opencl/openclwrapper.cxx
+++ b/sc/source/core/opencl/openclwrapper.cxx
@@ -441,16 +441,13 @@ int OpenclDevice::CompileKernelFile(GPUEnv *gpuInfo, 
const char *buildOption) {
             return 0;
         }
 
-        binary = (char*) malloc(length + 2);
+        binary = (char*) malloc(length);
         if (!binary) {
             return 0;
         }
 
-        memset(binary, 0, length + 2);
+        memset(binary, 0, length);
         b_error |= fread(binary, 1, length, fd) != length;
-        if (binary[length - 1] != '\n') {
-            binary[length++] = '\n';
-        }
 
         fclose(fd);
         fd = NULL;
commit 7e00a3690edbf71d6c3e6c0670875485f65c567d
Author: Tor Lillqvist <t...@iki.fi>
Date:   Thu Jul 4 15:13:03 2013 +0300

    Use correct type for number of devices
    
    The number returned by clGetProgramInfo(..., CL_PROGRAM_NUM_DEVICES,
    ...) and clGetContextInfo(..., CL_CONTEXT_NUM_DEVICES, ...) is of type
    cl_uint, not size_t. That makes a difference for 64-bit code.
    
    Change-Id: I1b494bf604dd87930484faed64042ed211b3d705

diff --git a/sc/source/core/opencl/openclwrapper.cxx 
b/sc/source/core/opencl/openclwrapper.cxx
index f85f172..9b9feaa 100644
--- a/sc/source/core/opencl/openclwrapper.cxx
+++ b/sc/source/core/opencl/openclwrapper.cxx
@@ -220,7 +220,8 @@ int OpenclDevice::GeneratBinFromKernelSource(cl_program 
program,
         const char * clFileName) {
      unsigned int i = 0;
     cl_int status;
-    size_t *binarySizes, numDevices;
+    size_t *binarySizes;
+    cl_uint numDevices;
     cl_device_id *devices;
     char **binaries, *str = NULL;
 
@@ -403,7 +404,7 @@ int OpenclDevice::CompileKernelFile(GPUEnv *gpuInfo, const 
char *buildOption) {
     const char *source;
     size_t source_size[1];
     int b_error, binary_status, binaryExisted, idx;
-    size_t numDevices;
+    cl_uint numDevices;
     cl_device_id *devices;
     FILE *fd, *fd1;
     const char* filename = "kernel.cl";
commit 5dff961ba5fab6d451d9d993e076d190a93be495
Author: Tor Lillqvist <t...@iki.fi>
Date:   Thu Jul 4 14:59:35 2013 +0300

    Don't look for just GPUs
    
    Change-Id: Ie7dbeac17b6dc56616ae5fa16f71d568a7771d5b

diff --git a/sc/source/core/opencl/openclwrapper.cxx 
b/sc/source/core/opencl/openclwrapper.cxx
index fcb6c02..f85f172 100644
--- a/sc/source/core/opencl/openclwrapper.cxx
+++ b/sc/source/core/opencl/openclwrapper.cxx
@@ -175,7 +175,7 @@ int OpenclDevice::BinaryGenerated(const char * clFileName, 
FILE ** fhandle) {
        FILE *fd = NULL;
        cl_uint numDevices=0;
        status = clGetDeviceIDs(gpuEnv.platform, // platform
-                                                       CL_DEVICE_TYPE_GPU, // 
device_type
+                            CL_DEVICE_TYPE_ALL, // device_type
                                                        0, // num_entries
                                                        NULL, // devices
                                                        &numDevices);
@@ -651,7 +651,7 @@ int OpenclDevice::InitOpenclRunEnv(GPUEnv *gpuInfo)
                     gpuInfo->platform = platforms[i];
 
                     status = clGetDeviceIDs(gpuInfo->platform, // platform
-                                                                               
                CL_DEVICE_TYPE_GPU, // device_type
+                                                CL_DEVICE_TYPE_ALL, // 
device_type
                                                                                
                0, // num_entries
                                                                                
                NULL, // devices
                                                                                
                &numDevices);
@@ -681,12 +681,15 @@ int OpenclDevice::InitOpenclRunEnv(GPUEnv *gpuInfo)
         gpuInfo->context = clCreateContextFromType(cps, gpuInfo->dType, NULL,
                 NULL, &status);
 
+        // If no GPU, check for CPU.
         if ((gpuInfo->context == (cl_context) NULL)
                 || (status != CL_SUCCESS)) {
             gpuInfo->dType = CL_DEVICE_TYPE_CPU;
             gpuInfo->context = clCreateContextFromType(cps, gpuInfo->dType,
                     NULL, NULL, &status);
         }
+
+        // If no GPU or CPU, check for a "default" type.
         if ((gpuInfo->context == (cl_context) NULL)
                 || (status != CL_SUCCESS)) {
             gpuInfo->dType = CL_DEVICE_TYPE_DEFAULT;
commit c5922978c87e246c1bc2ae6111415ec0764d6865
Author: Tor Lillqvist <t...@iki.fi>
Date:   Thu Jul 4 13:37:35 2013 +0300

    sizeof(char) is 1 by definition
    
    Change-Id: Ibd6f74a84b49e609c8771080984832eb61949a68

diff --git a/sc/source/core/opencl/openclwrapper.cxx 
b/sc/source/core/opencl/openclwrapper.cxx
index 7a1103d..fcb6c02 100644
--- a/sc/source/core/opencl/openclwrapper.cxx
+++ b/sc/source/core/opencl/openclwrapper.cxx
@@ -150,7 +150,7 @@ int OpenclDevice::ConvertToString(const char *filename, 
char **source) {
 
         file_size = ftell(file);
         rewind(file);
-        *source = (char*) malloc(sizeof(char) * file_size + 1);
+        *source = (char*) malloc(file_size + 1);
         if (*source == (char*) NULL) {
             return 0;
         }
@@ -209,7 +209,7 @@ int OpenclDevice::WriteBinaryToFile(const char* fileName, 
const char* birary,
         return 0;
     }
 
-    fwrite(birary, sizeof(char), numBytes, output);
+    fwrite(birary, 1, numBytes, output);
     fclose(output);
 
     return 1;
@@ -252,7 +252,7 @@ int OpenclDevice::GeneratBinFromKernelSource(cl_program 
program,
 
     for (i = 0; i < numDevices; i++) {
         if (binarySizes[i] != 0) {
-            binaries[i] = (char*) malloc(sizeof(char) * binarySizes[i]);
+            binaries[i] = (char*) malloc(binarySizes[i]);
             if (binaries[i] == NULL) {
                 return 0;
             }
@@ -519,7 +519,7 @@ int OpenclDevice::CompileKernelFile(GPUEnv *gpuInfo, const 
char *buildOption) {
 
         fd1 = fopen("kernel-build.log", "w+");
         if (fd1 != NULL) {
-            fwrite(buildLog, sizeof(char), length, fd1);
+            fwrite(buildLog, 1, length, fd1);
             fclose(fd1);
         }
 
commit e79ccf01ec79849aeebeed9a024a1d1cd5d7a6e9
Author: Tor Lillqvist <t...@iki.fi>
Date:   Thu Jul 4 13:36:15 2013 +0300

    MaxTextExtent is not used
    
    Change-Id: I03ee9f65da11b4dc8a7a81d5f23f8103bd5a0534

diff --git a/sc/source/core/opencl/openclwrapper.hxx 
b/sc/source/core/opencl/openclwrapper.hxx
index 4494b50..349809b 100644
--- a/sc/source/core/opencl/openclwrapper.hxx
+++ b/sc/source/core/opencl/openclwrapper.hxx
@@ -18,8 +18,6 @@
 #include <CL/cl.h>
 #endif
 
-#define MaxTextExtent  4096
-
 #if defined(_MSC_VER)
 #ifndef strcasecmp
 #define strcasecmp strcmp
commit 3535c21bc6d90bce3b86cb60ea02e549c1cf8cc1
Author: Tor Lillqvist <t...@iki.fi>
Date:   Thu Jul 4 13:33:22 2013 +0300

    CL_MAP_WRITE_INVALIDATE_REGION is not used
    
    Change-Id: Ib7bb60c26dee4a78e19dbc84cd1f8fb61d656a72

diff --git a/sc/source/core/opencl/openclwrapper.hxx 
b/sc/source/core/opencl/openclwrapper.hxx
index a459545..4494b50 100644
--- a/sc/source/core/opencl/openclwrapper.hxx
+++ b/sc/source/core/opencl/openclwrapper.hxx
@@ -19,8 +19,6 @@
 #endif
 
 #define MaxTextExtent  4096
-//support AMD opencl
-#define CL_MAP_WRITE_INVALIDATE_REGION (1 << 2)
 
 #if defined(_MSC_VER)
 #ifndef strcasecmp
commit ba9f29d566598b5cee35984c80a06359212dff94
Author: Tor Lillqvist <t...@iki.fi>
Date:   Thu Jul 4 13:27:10 2013 +0300

    Bin leftover (?) no-op clGetCommandQueueInfo() call
    
    Change-Id: I6d22847eac3e0677c5ee67378b6772980fa17272

diff --git a/sc/source/core/opencl/openclwrapper.cxx 
b/sc/source/core/opencl/openclwrapper.cxx
index 09a9f0a..7a1103d 100644
--- a/sc/source/core/opencl/openclwrapper.cxx
+++ b/sc/source/core/opencl/openclwrapper.cxx
@@ -725,9 +725,6 @@ int OpenclDevice::InitOpenclRunEnv(GPUEnv *gpuInfo)
         }
     }
 
-    status = clGetCommandQueueInfo(gpuInfo->commandQueue,
-            CL_QUEUE_THREAD_HANDLE_AMD, 0, NULL, NULL);
-
     return 0;
 
 }
diff --git a/sc/source/core/opencl/openclwrapper.hxx 
b/sc/source/core/opencl/openclwrapper.hxx
index b9d2255..a459545 100644
--- a/sc/source/core/opencl/openclwrapper.hxx
+++ b/sc/source/core/opencl/openclwrapper.hxx
@@ -20,7 +20,6 @@
 
 #define MaxTextExtent  4096
 //support AMD opencl
-#define CL_QUEUE_THREAD_HANDLE_AMD 0x403E
 #define CL_MAP_WRITE_INVALIDATE_REGION (1 << 2)
 
 #if defined(_MSC_VER)
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to