summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2016-07-01 18:24:48 +0100
committerMichael Meeks <michael.meeks@collabora.com>2016-07-01 19:02:57 +0000
commitef47ce2397d4ed453fe01d994d13a13f442ec3bb (patch)
tree8055cdc3a1fe6e60d61cbe0171f0ff0c60afd2ef
parent3ebfc5b95559a9bcb2fc0508b51fd00e8eb20260 (diff)
tdf#90336 - further cleanup of OpenCL options page.
Still problematic; since we only show OpenCL as being available if it has already been initialized and used. Change-Id: I5e82a3f778f4f2025408330b6d9da51402d01e79 Reviewed-on: https://gerrit.libreoffice.org/26866 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
-rw-r--r--cui/source/options/optopencl.cxx13
-rw-r--r--cui/source/options/optopencl.hxx3
-rw-r--r--cui/uiconfig/ui/optopenclpage.ui23
-rw-r--r--include/opencl/openclwrapper.hxx5
-rw-r--r--opencl/source/openclwrapper.cxx5
5 files changed, 23 insertions, 26 deletions
diff --git a/cui/source/options/optopencl.cxx b/cui/source/options/optopencl.cxx
index ec8f432816eb..cbe37dd6ed54 100644
--- a/cui/source/options/optopencl.cxx
+++ b/cui/source/options/optopencl.cxx
@@ -47,20 +47,17 @@ SvxOpenCLTabPage::SvxOpenCLTabPage(vcl::Window* pParent, const SfxItemSet& rSet)
{
get(mpUseSwInterpreter, "useswinterpreter");
get(mpUseOpenCL, "useopencl");
- get(clUsed,"openclused");
+ get(mpOclUsed,"openclused");
+ get(mpOclNotUsed,"openclnotused");
mpUseSwInterpreter->Check(officecfg::Office::Common::Misc::UseSwInterpreter::get());
mpUseOpenCL->Check(maConfig.mbUseOpenCL);
mpUseOpenCL->SetClickHdl(LINK(this, SvxOpenCLTabPage, EnableOpenCLHdl));
- cl_device_id idTest=opencl::gpuEnv.mpDevID;
- if(!idTest)
- {
- clUsed->SetText("Yes");
- }else{
- clUsed->SetText("No");
- }
+ bool bCLUsed = opencl::GPUEnv::isOpenCLEnabled();
+ mpOclUsed->Show(bCLUsed);
+ mpOclNotUsed->Show(!bCLUsed);
}
SvxOpenCLTabPage::~SvxOpenCLTabPage()
diff --git a/cui/source/options/optopencl.hxx b/cui/source/options/optopencl.hxx
index d6379682c310..ab628932632f 100644
--- a/cui/source/options/optopencl.hxx
+++ b/cui/source/options/optopencl.hxx
@@ -34,7 +34,8 @@ private:
VclPtr<CheckBox> mpUseSwInterpreter;
VclPtr<CheckBox> mpUseOpenCL;
- VclPtr<FixedText> clUsed;
+ VclPtr<FixedText> mpOclUsed;
+ VclPtr<FixedText> mpOclNotUsed;
DECL_STATIC_LINK_TYPED(SvxOpenCLTabPage, EnableOpenCLHdl, Button*, void);
diff --git a/cui/uiconfig/ui/optopenclpage.ui b/cui/uiconfig/ui/optopenclpage.ui
index 6b78e67a3862..86eee5774d6e 100644
--- a/cui/uiconfig/ui/optopenclpage.ui
+++ b/cui/uiconfig/ui/optopenclpage.ui
@@ -58,25 +58,22 @@
</packing>
</child>
<child>
- <object class="GtkLabel" id="label2">
- <property name="visible">True</property>
+ <object class="GtkLabel" id="openclused">
+ <property name="visible">False</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Will OpenCL be used?</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
+ <property name="label" translatable="yes">OpenCL is available for use.</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">2</property>
+ <property name="position">3</property>
</packing>
</child>
<child>
- <object class="GtkLabel" id="openclused">
- <property name="visible">True</property>
+ <object class="GtkLabel" id="openclnotused">
+ <property name="visible">False</property>
<property name="can_focus">False</property>
+ <property name="label" translatable="yes">OpenCL is not used.</property>
</object>
<packing>
<property name="expand">False</property>
@@ -84,12 +81,6 @@
<property name="position">3</property>
</packing>
</child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
</object>
</child>
</object>
diff --git a/include/opencl/openclwrapper.hxx b/include/opencl/openclwrapper.hxx
index 178c685834ae..b83c1fc2ff00 100644
--- a/include/opencl/openclwrapper.hxx
+++ b/include/opencl/openclwrapper.hxx
@@ -35,7 +35,7 @@ struct KernelEnv
cl_program mpkProgram;
};
-struct GPUEnv
+struct OPENCL_DLLPUBLIC GPUEnv
{
//share vb in all modules in hb library
cl_platform_id mpPlatformID;
@@ -48,9 +48,12 @@ struct GPUEnv
bool mnKhrFp64Flag;
bool mnAmdFp64Flag;
cl_uint mnPreferredVectorWidthFloat;
+
+ static bool isOpenCLEnabled();
};
extern OPENCL_DLLPUBLIC GPUEnv gpuEnv;
+
OPENCL_DLLPUBLIC bool generatBinFromKernelSource( cl_program program, const char * clFileName );
OPENCL_DLLPUBLIC bool buildProgramFromBinary(const char* buildOption, GPUEnv* gpuEnv, const char* filename, int idx);
OPENCL_DLLPUBLIC void setKernelEnv( KernelEnv *envInfo );
diff --git a/opencl/source/openclwrapper.cxx b/opencl/source/openclwrapper.cxx
index ace3210e9013..a54d86a70fc4 100644
--- a/opencl/source/openclwrapper.cxx
+++ b/opencl/source/openclwrapper.cxx
@@ -865,6 +865,11 @@ const char* errorString(cl_int nError)
#undef CASE
}
+bool GPUEnv::isOpenCLEnabled()
+{
+ return gpuEnv.mpDevID;
+}
+
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */