summaryrefslogtreecommitdiffstats
path: root/opencl
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2017-08-25 15:22:40 +0300
committerTor Lillqvist <tml@collabora.com>2017-08-25 15:49:34 +0300
commitaa7dc5fa1df23f1a9079305cb362aab018e94848 (patch)
tree68c4825581e939b4dd8af5c7d1fa7ef848bf4fb8 /opencl
parentloplugin:constparam in sc part6 (diff)
downloadcore-aa7dc5fa1df23f1a9079305cb362aab018e94848.tar.gz
core-aa7dc5fa1df23f1a9079305cb362aab018e94848.zip
Get rid of need to use initial :: for ::opencl to avoid clash with sc::opencl
Rename the global opencl namespace to openclwrapper. Its public API is after all declared in a file called openclwrapper.hxx. The confusion started when part of the OpenCL code was moved out from sc some years ago. Change-Id: I98ebd8498b2244804411e5de9169eb619f86070b
Diffstat (limited to 'opencl')
-rw-r--r--opencl/inc/opencl_device.hxx9
-rw-r--r--opencl/source/OpenCLZone.cxx2
-rw-r--r--opencl/source/opencl_device.cxx4
-rw-r--r--opencl/source/openclwrapper.cxx70
4 files changed, 39 insertions, 46 deletions
diff --git a/opencl/inc/opencl_device.hxx b/opencl/inc/opencl_device.hxx
index 4fc75cf443f8..b69cbabc28a5 100644
--- a/opencl/inc/opencl_device.hxx
+++ b/opencl/inc/opencl_device.hxx
@@ -10,16 +10,13 @@
#ifndef INCLUDED_OPENCL_INC_OPENCL_DEVICE_HXX
#define INCLUDED_OPENCL_INC_OPENCL_DEVICE_HXX
-#include "opencl_device_selection.h"
+#include <opencl/openclwrapper.hxx>
-namespace opencl {
+#include "opencl_device_selection.h"
ds_device const & getDeviceSelection(OUString const & pFileName, bool bForceSelection);
-struct GPUEnv;
-void releaseOpenCLEnv( GPUEnv *gpuInfo );
-
-}
+void releaseOpenCLEnv( openclwrapper::GPUEnv *gpuInfo );
#endif
diff --git a/opencl/source/OpenCLZone.cxx b/opencl/source/OpenCLZone.cxx
index 52d6ada8518a..e757cd497073 100644
--- a/opencl/source/OpenCLZone.cxx
+++ b/opencl/source/OpenCLZone.cxx
@@ -44,7 +44,7 @@ void OpenCLZone::hardDisable()
css::uno::Reference<css::util::XFlushable> xFlushable(xConfProvider, css::uno::UNO_QUERY_THROW);
xFlushable->flush();
- releaseOpenCLEnv(&opencl::gpuEnv);
+ releaseOpenCLEnv(&openclwrapper::gpuEnv);
}
}
diff --git a/opencl/source/opencl_device.cxx b/opencl/source/opencl_device.cxx
index 695c85505201..4f63e983ae3a 100644
--- a/opencl/source/opencl_device.cxx
+++ b/opencl/source/opencl_device.cxx
@@ -40,8 +40,6 @@
#define STRINGIFY(...) #__VA_ARGS__"\n"
-namespace opencl {
-
namespace {
void DS_CHECK_STATUS(cl_int status, char const * name) {
@@ -671,6 +669,4 @@ ds_device const & getDeviceSelection(
return selectedDevice;
}
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/opencl/source/openclwrapper.cxx b/opencl/source/openclwrapper.cxx
index d59630c53981..73412e9fff58 100644
--- a/opencl/source/openclwrapper.cxx
+++ b/opencl/source/openclwrapper.cxx
@@ -61,7 +61,13 @@ if( status != CL_SUCCESS ) \
using namespace std;
-namespace opencl {
+namespace {
+
+bool bIsInited = false;
+
+}
+
+namespace openclwrapper {
GPUEnv gpuEnv;
sal_uInt64 kernelFailures = 0;
@@ -69,8 +75,6 @@ sal_uInt64 kernelFailures = 0;
namespace
{
-bool bIsInited = false;
-
OString generateMD5(const void* pData, size_t length)
{
sal_uInt8 pBuffer[RTL_DIGEST_LENGTH_MD5];
@@ -320,38 +324,6 @@ bool initOpenCLAttr( OpenCLEnv * env )
return false;
}
-}
-
-void releaseOpenCLEnv( GPUEnv *gpuInfo )
-{
- OpenCLZone zone;
-
- if ( !bIsInited )
- {
- return;
- }
-
- for (_cl_command_queue* & i : gpuEnv.mpCmdQueue)
- {
- if (i)
- {
- clReleaseCommandQueue(i);
- i = nullptr;
- }
- }
- gpuEnv.mnCmdQueuePos = 0;
-
- if ( gpuEnv.mpContext )
- {
- clReleaseContext( gpuEnv.mpContext );
- gpuEnv.mpContext = nullptr;
- }
- bIsInited = false;
- gpuInfo->mnIsUserCreated = 0;
-}
-
-namespace {
-
bool buildProgram(const char* buildOption, GPUEnv* gpuInfo, int idx)
{
cl_int clStatus;
@@ -958,4 +930,32 @@ bool GPUEnv::isOpenCLEnabled()
}
+void releaseOpenCLEnv( openclwrapper::GPUEnv *gpuInfo )
+{
+ OpenCLZone zone;
+
+ if ( !bIsInited )
+ {
+ return;
+ }
+
+ for (_cl_command_queue* & i : openclwrapper::gpuEnv.mpCmdQueue)
+ {
+ if (i)
+ {
+ clReleaseCommandQueue(i);
+ i = nullptr;
+ }
+ }
+ openclwrapper::gpuEnv.mnCmdQueuePos = 0;
+
+ if ( openclwrapper::gpuEnv.mpContext )
+ {
+ clReleaseContext( openclwrapper::gpuEnv.mpContext );
+ openclwrapper::gpuEnv.mpContext = nullptr;
+ }
+ bIsInited = false;
+ gpuInfo->mnIsUserCreated = 0;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */