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>
This commit is contained in:
Michael Meeks
2016-07-01 18:24:48 +01:00
parent 3ebfc5b955
commit ef47ce2397
5 changed files with 28 additions and 31 deletions

View File

@@ -47,20 +47,17 @@ SvxOpenCLTabPage::SvxOpenCLTabPage(vcl::Window* pParent, const SfxItemSet& rSet)
{ {
get(mpUseSwInterpreter, "useswinterpreter"); get(mpUseSwInterpreter, "useswinterpreter");
get(mpUseOpenCL, "useopencl"); get(mpUseOpenCL, "useopencl");
get(clUsed,"openclused"); get(mpOclUsed,"openclused");
get(mpOclNotUsed,"openclnotused");
mpUseSwInterpreter->Check(officecfg::Office::Common::Misc::UseSwInterpreter::get()); mpUseSwInterpreter->Check(officecfg::Office::Common::Misc::UseSwInterpreter::get());
mpUseOpenCL->Check(maConfig.mbUseOpenCL); mpUseOpenCL->Check(maConfig.mbUseOpenCL);
mpUseOpenCL->SetClickHdl(LINK(this, SvxOpenCLTabPage, EnableOpenCLHdl)); mpUseOpenCL->SetClickHdl(LINK(this, SvxOpenCLTabPage, EnableOpenCLHdl));
cl_device_id idTest=opencl::gpuEnv.mpDevID; bool bCLUsed = opencl::GPUEnv::isOpenCLEnabled();
if(!idTest) mpOclUsed->Show(bCLUsed);
{ mpOclNotUsed->Show(!bCLUsed);
clUsed->SetText("Yes");
}else{
clUsed->SetText("No");
}
} }
SvxOpenCLTabPage::~SvxOpenCLTabPage() SvxOpenCLTabPage::~SvxOpenCLTabPage()

View File

@@ -34,7 +34,8 @@ private:
VclPtr<CheckBox> mpUseSwInterpreter; VclPtr<CheckBox> mpUseSwInterpreter;
VclPtr<CheckBox> mpUseOpenCL; VclPtr<CheckBox> mpUseOpenCL;
VclPtr<FixedText> clUsed; VclPtr<FixedText> mpOclUsed;
VclPtr<FixedText> mpOclNotUsed;
DECL_STATIC_LINK_TYPED(SvxOpenCLTabPage, EnableOpenCLHdl, Button*, void); DECL_STATIC_LINK_TYPED(SvxOpenCLTabPage, EnableOpenCLHdl, Button*, void);

View File

@@ -57,26 +57,11 @@
<property name="position">1</property> <property name="position">1</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkLabel" id="label2">
<property name="visible">True</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>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child> <child>
<object class="GtkLabel" id="openclused"> <object class="GtkLabel" id="openclused">
<property name="visible">True</property> <property name="visible">False</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="label" translatable="yes">OpenCL is available for use.</property>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
@@ -85,10 +70,16 @@
</packing> </packing>
</child> </child>
<child> <child>
<placeholder/> <object class="GtkLabel" id="openclnotused">
</child> <property name="visible">False</property>
<child> <property name="can_focus">False</property>
<placeholder/> <property name="label" translatable="yes">OpenCL is not used.</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child> </child>
</object> </object>
</child> </child>

View File

@@ -35,7 +35,7 @@ struct KernelEnv
cl_program mpkProgram; cl_program mpkProgram;
}; };
struct GPUEnv struct OPENCL_DLLPUBLIC GPUEnv
{ {
//share vb in all modules in hb library //share vb in all modules in hb library
cl_platform_id mpPlatformID; cl_platform_id mpPlatformID;
@@ -48,9 +48,12 @@ struct GPUEnv
bool mnKhrFp64Flag; bool mnKhrFp64Flag;
bool mnAmdFp64Flag; bool mnAmdFp64Flag;
cl_uint mnPreferredVectorWidthFloat; cl_uint mnPreferredVectorWidthFloat;
static bool isOpenCLEnabled();
}; };
extern OPENCL_DLLPUBLIC GPUEnv gpuEnv; extern OPENCL_DLLPUBLIC GPUEnv gpuEnv;
OPENCL_DLLPUBLIC bool generatBinFromKernelSource( cl_program program, const char * clFileName ); 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 bool buildProgramFromBinary(const char* buildOption, GPUEnv* gpuEnv, const char* filename, int idx);
OPENCL_DLLPUBLIC void setKernelEnv( KernelEnv *envInfo ); OPENCL_DLLPUBLIC void setKernelEnv( KernelEnv *envInfo );

View File

@@ -865,6 +865,11 @@ const char* errorString(cl_int nError)
#undef CASE #undef CASE
} }
bool GPUEnv::isOpenCLEnabled()
{
return gpuEnv.mpDevID;
}
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */