Work in progress: Move Calc-independend OpenCL configuration out of sc

Intermediate commit. More changes will follow: The device selection
logic needs to be moved, too. (And cleaned up.) Instead of the
separate formulacalculationoptions dialog we should simply have a
normal options page for those OpenCL-related settings that will remain
purely Calc-specific, like the formula opcode subsetting.

Change-Id: Id60d95e80d377cbbf5780beb473b221bce06b5e5
This commit is contained in:
Tor Lillqvist 2014-11-26 22:30:33 +02:00
parent ccfb8c7827
commit c1d09b1ad0
43 changed files with 1538 additions and 882 deletions

View file

@ -402,6 +402,7 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ooo, \
odfflatxml \
offacc \
oox \
$(call gb_Helper_optional,OPENCL,opencl) \
passwordcontainer \
pcr \
$(if $(ENABLE_NPAPI_FROM_BROWSER),pl) \

View file

@ -82,6 +82,7 @@ $(eval $(call gb_Module_add_moduledirs,libreoffice,\
officecfg \
oovbaapi \
oox \
$(call gb_Helper_optional,OPENCL,opencl) \
package \
postprocess \
$(call gb_Helper_optional,PYUNO,pyuno) \

View file

@ -157,7 +157,6 @@ export ENABLE_ONLINE_UPDATE=@ENABLE_ONLINE_UPDATE@
export ENABLE_OOENV=@ENABLE_OOENV@
export ENABLE_OPENGL=@ENABLE_OPENGL@
export ENABLE_OPENGL_CANVAS=@ENABLE_OPENGL_CANVAS@
export ENABLE_OPENCL=@ENABLE_OPENCL@
export ENABLE_PACKAGEKIT=@ENABLE_PACKAGEKIT@
export ENABLE_PCH=@ENABLE_PCH@
export ENABLE_PDFIMPORT=@ENABLE_PDFIMPORT@

View file

@ -10261,13 +10261,13 @@ dnl =================================================
dnl Check whether to build with OpenCL support.
dnl =================================================
ENABLE_OPENCL=
if test $_os != iOS -a $_os != Android; then
ENABLE_OPENCL=TRUE
BUILD_TYPE="$BUILD_TYPE CLCC"
# CLCC in BUILD_TYPE tells that we are building a bundled clcc (just the clew part), OPENCL in
# BUILD_TYPE tells that OpenCL is potentially available on the platform (optional at run-time,
# used through clew).
BUILD_TYPE="$BUILD_TYPE CLCC OPENCL"
AC_DEFINE(HAVE_FEATURE_OPENCL)
fi
AC_SUBST(ENABLE_OPENCL)
dnl ===================================================================
dnl Check whether to enable glTF support

View file

@ -44,6 +44,8 @@ $(eval $(call gb_Library_use_libraries,cui,\
$(if $(ENABLE_JAVA), \
jvmfwk) \
lng \
$(call gb_Helper_optional,OPENCL, \
opencl) \
sal \
salhelper \
sax \
@ -64,6 +66,8 @@ $(eval $(call gb_Library_use_libraries,cui,\
$(eval $(call gb_Library_use_externals,cui,\
boost_headers \
$(call gb_Helper_optional,OPENCL,\
clew) \
icuuc \
icu_headers \
))
@ -153,6 +157,8 @@ $(eval $(call gb_Library_add_exception_objects,cui,\
cui/source/options/optjsearch \
cui/source/options/optlingu \
cui/source/options/optmemory \
$(call gb_Helper_optional,OPENCL, \
cui/source/options/optopencl) \
cui/source/options/optpath \
cui/source/options/optsave \
cui/source/options/optupdt \

View file

@ -28,6 +28,7 @@ $(eval $(call gb_UIConfig_add_uifiles,cui,\
cui/uiconfig/ui/backgroundpage \
cui/uiconfig/ui/baselinksdialog \
cui/uiconfig/ui/bitmaptabpage \
cui/uiconfig/ui/blackorwhitelistentrydialog \
cui/uiconfig/ui/borderareatransparencydialog \
cui/uiconfig/ui/borderbackgrounddialog \
cui/uiconfig/ui/borderpage \
@ -131,6 +132,8 @@ $(eval $(call gb_UIConfig_add_uifiles,cui,\
cui/uiconfig/ui/optmemorypage \
cui/uiconfig/ui/optnewdictionarydialog \
cui/uiconfig/ui/optonlineupdatepage \
$(call gb_Helper_optional,OPENCL, \
cui/uiconfig/ui/optopenclpage) \
cui/uiconfig/ui/optpathspage \
cui/uiconfig/ui/optproxypage \
cui/uiconfig/ui/optsavepage \

View file

@ -436,6 +436,8 @@
#define RID_SVXSTR_PERSONA_MUSIC (RID_SVX_START + 1288)
#define RID_SVXSTR_PERSONA_NATURE (RID_SVX_START + 1289)
#define RID_SVXPAGE_OPENCL (RID_SVX_START + 254)
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View file

@ -209,7 +209,6 @@ OfaMiscTabPage::OfaMiscTabPage(vcl::Window* pParent, const SfxItemSet& rSet)
get(m_pYearValueField, "year");
get(m_pToYearFT, "toyear");
get(m_pCollectUsageInfo, "collectusageinfo");
get(m_pUseOpenCL, "useopencl");
if (m_pFileDlgCB->IsVisible() && SvtMiscOptions().IsUseSystemFileDialogReadOnly())
{
@ -302,12 +301,6 @@ bool OfaMiscTabPage::FillItemSet( SfxItemSet* rSet )
bModified = true;
}
if (m_pUseOpenCL->IsValueChangedFromSaved())
{
officecfg::Office::Common::Misc::UseOpenCL::set(m_pUseOpenCL->IsChecked(), batch);
bModified = true;
}
batch->commit();
return bModified;
@ -349,9 +342,6 @@ void OfaMiscTabPage::Reset( const SfxItemSet* rSet )
m_pCollectUsageInfo->Check(officecfg::Office::Common::Misc::CollectUsageInformation::get());
m_pCollectUsageInfo->SaveValue();
m_pUseOpenCL->Check(officecfg::Office::Common::Misc::UseOpenCL::get());
m_pUseOpenCL->SaveValue();
}

View file

@ -57,8 +57,6 @@ private:
CheckBox* m_pCollectUsageInfo;
CheckBox* m_pUseOpenCL;
DECL_LINK( TwoFigureHdl, NumericField* );
DECL_LINK( TwoFigureConfigHdl, NumericField* );
DECL_LINK(HelpCheckHdl_Impl, void *);

View file

@ -0,0 +1,283 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <vcl/fixed.hxx>
#include <vcl/svapp.hxx>
#include <vcl/window.hxx>
#include <vcl/settings.hxx>
#include <svl/zforlist.hxx>
#include <opencl/openclconfig.hxx>
#include <officecfg/Office/Common.hxx>
#include <com/sun/star/configuration/theDefaultProvider.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/ui/dialogs/FolderPicker.hpp>
#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/util/XChangesBatch.hpp>
#include <com/sun/star/setup/UpdateCheckConfig.hpp>
#include "cuires.hrc"
#include "optopencl.hxx"
SvxOpenCLTabPage::SvxOpenCLTabPage(vcl::Window* pParent, const SfxItemSet& rSet) :
SfxTabPage(pParent, "OptOpenCLPage", "cui/ui/optopenclpage.ui", &rSet),
maConfig(OpenCLConfig::get())
{
get(mpUseOpenCL, "useopencl");
get(mpBlackList, "blacklist");
get(mpBlackListEdit, "bledit");
get(mpBlackListAdd, "bladd");
get(mpBlackListDelete, "bldelete");
get(mpWhiteList, "whitelist");
get(mpWhiteListEdit, "wledit");
get(mpWhiteListAdd, "wladd");
get(mpWhiteListDelete, "wldelete");
mpBlackListEdit->SetClickHdl(LINK(this, SvxOpenCLTabPage, BlackListEditHdl));
mpBlackListAdd->SetClickHdl(LINK(this, SvxOpenCLTabPage, BlackListAddHdl));
mpBlackListDelete->SetClickHdl(LINK(this, SvxOpenCLTabPage, BlackListDeleteHdl));
mpWhiteListEdit->SetClickHdl(LINK(this, SvxOpenCLTabPage, WhiteListEditHdl));
mpWhiteListAdd->SetClickHdl(LINK(this, SvxOpenCLTabPage, WhiteListAddHdl));
mpWhiteListDelete->SetClickHdl(LINK(this, SvxOpenCLTabPage, WhiteListDeleteHdl));
mpBlackList->set_height_request(4 * mpBlackList->GetTextHeight());
mpWhiteList->set_height_request(4 * mpWhiteList->GetTextHeight());
}
SvxOpenCLTabPage::~SvxOpenCLTabPage()
{
}
SfxTabPage*
SvxOpenCLTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet )
{
return new SvxOpenCLTabPage(pParent, *rAttrSet);
}
bool SvxOpenCLTabPage::FillItemSet( SfxItemSet* )
{
bool bModified = false;
boost::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
if (mpUseOpenCL->IsValueChangedFromSaved())
maConfig.mbUseOpenCL = mpUseOpenCL->IsChecked();
if (maConfig != OpenCLConfig::get())
{
maConfig.set();
bModified = true;
}
if (bModified)
batch->commit();
return bModified;
}
namespace {
OUString format(const OpenCLConfig::ImplMatcher& rImpl)
{
return (rImpl.maOS + " " +
rImpl.maOSVersion + " " +
rImpl.maPlatformVendor + " " +
rImpl.maDevice + " " +
rImpl.maDriverVersion);
}
void fillListBox(ListBox* pListBox, const OpenCLConfig::ImplMatcherSet& rSet)
{
pListBox->SetUpdateMode(false);
pListBox->Clear();
for (auto i = rSet.cbegin(); i != rSet.cend(); ++i)
{
pListBox->InsertEntry(format(*i), LISTBOX_APPEND);
}
pListBox->SetUpdateMode(true);
}
}
void SvxOpenCLTabPage::Reset( const SfxItemSet* )
{
maConfig = OpenCLConfig::get();
mpUseOpenCL->Check(maConfig.mbUseOpenCL);
mpUseOpenCL->SaveValue();
fillListBox(mpBlackList, maConfig.maBlackList);
fillListBox(mpWhiteList, maConfig.maWhiteList);
}
void SvxOpenCLTabPage::FillUserData()
{
}
namespace {
class ListEntryDialog : public ModalDialog
{
public:
OpenCLConfig::ImplMatcher maEntry;
Edit* mpOS;
Edit* mpOSVersion;
Edit* mpPlatformVendor;
Edit* mpDevice;
Edit* mpDriverVersion;
DECL_LINK(EditModifiedHdl, Edit*);
ListEntryDialog(vcl::Window* pParent, const OpenCLConfig::ImplMatcher& rEntry, const OString& rTag);
};
ListEntryDialog::ListEntryDialog(vcl::Window* pParent, const OpenCLConfig::ImplMatcher& rEntry, const OString& rTag)
: ModalDialog(pParent, "BlackOrWhiteListEntryDialog",
"cui/ui/blackorwhitelistentrydialog.ui"),
maEntry(rEntry)
{
get(mpOS, "os");
get(mpOSVersion, "osversion");
get(mpPlatformVendor, "platformvendor");
get(mpDevice, "device");
get(mpDriverVersion, "driverversion");
mpOS->SetText(rEntry.maOS);
mpOSVersion->SetText(rEntry.maOSVersion);
mpPlatformVendor->SetText(rEntry.maPlatformVendor);
mpDevice->SetText(rEntry.maDevice);
mpDriverVersion->SetText(rEntry.maDriverVersion);
mpOS->SetModifyHdl(LINK(this, ListEntryDialog, EditModifiedHdl));
mpOSVersion->SetModifyHdl(LINK(this, ListEntryDialog, EditModifiedHdl));
mpPlatformVendor->SetModifyHdl(LINK(this, ListEntryDialog, EditModifiedHdl));
mpDevice->SetModifyHdl(LINK(this, ListEntryDialog, EditModifiedHdl));
mpDriverVersion->SetModifyHdl(LINK(this, ListEntryDialog, EditModifiedHdl));
SetText(get<FixedText>(rTag + "title")->GetText());
}
IMPL_LINK(ListEntryDialog, EditModifiedHdl, Edit*, pEdit)
{
if (pEdit == mpOS)
maEntry.maOS = pEdit->GetText();
else if (pEdit == mpOSVersion)
maEntry.maOSVersion = pEdit->GetText();
else if (pEdit == mpPlatformVendor)
maEntry.maPlatformVendor = pEdit->GetText();
else if (pEdit == mpDevice)
maEntry.maDevice = pEdit->GetText();
else if (pEdit == mpDriverVersion)
maEntry.maDriverVersion = pEdit->GetText();
return 0;
}
void openListDialog(SvxOpenCLTabPage* pTabPage, OpenCLConfig::ImplMatcher& rEntry, const OString& rTag)
{
ListEntryDialog aDlg(pTabPage, rEntry, rTag);
if (aDlg.Execute() == RET_OK)
rEntry = aDlg.maEntry;
}
const OpenCLConfig::ImplMatcher& findCurrentEntry(OpenCLConfig::ImplMatcherSet& rSet, ListBox* pListBox)
{
auto i = rSet.begin();
std::advance(i, pListBox->GetSelectEntryPos());
return *i;
}
}
long SvxOpenCLTabPage::EditHdl(ListBox* pListBox, OpenCLConfig::ImplMatcherSet& rSet, const OString& rTag)
{
if (pListBox->GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND)
return 0;
OpenCLConfig::ImplMatcher rEntry(findCurrentEntry(rSet, pListBox));
rSet.erase(rEntry);
openListDialog(this, rEntry, rTag);
rSet.insert(rEntry);
fillListBox(pListBox, rSet);
return 0;
}
long SvxOpenCLTabPage::AddHdl(ListBox* pListBox, OpenCLConfig::ImplMatcherSet& rSet, const OString& rTag)
{
OpenCLConfig::ImplMatcher rEntry;
openListDialog(this, rEntry, rTag);
if (rEntry != OpenCLConfig::ImplMatcher())
{
rSet.insert(rEntry);
fillListBox(pListBox, rSet);
}
return 0;
}
long SvxOpenCLTabPage::DeleteHdl(ListBox* pListBox, OpenCLConfig::ImplMatcherSet& rSet)
{
if (pListBox->GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND)
return 0;
OpenCLConfig::ImplMatcher rEntry(findCurrentEntry(rSet, pListBox));
rSet.erase(rEntry);
fillListBox(pListBox, rSet);
return 0;
}
IMPL_LINK_NOARG(SvxOpenCLTabPage, BlackListEditHdl)
{
return EditHdl(mpBlackList, maConfig.maBlackList, "bledit");
}
IMPL_LINK_NOARG(SvxOpenCLTabPage, BlackListAddHdl)
{
return AddHdl(mpBlackList, maConfig.maBlackList, "bladd");
}
IMPL_LINK_NOARG(SvxOpenCLTabPage, BlackListDeleteHdl)
{
return DeleteHdl(mpBlackList, maConfig.maBlackList);
}
IMPL_LINK_NOARG(SvxOpenCLTabPage, WhiteListEditHdl)
{
return EditHdl(mpWhiteList, maConfig.maWhiteList, "wledit");
}
IMPL_LINK_NOARG(SvxOpenCLTabPage, WhiteListAddHdl)
{
return AddHdl(mpWhiteList, maConfig.maWhiteList, "wladd");
}
IMPL_LINK_NOARG(SvxOpenCLTabPage, WhiteListDeleteHdl)
{
return DeleteHdl(mpWhiteList, maConfig.maWhiteList);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View file

@ -0,0 +1,71 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef INCLUDED_CUI_SOURCE_OPTIONS_OPTOPENCL_HXX
#define INCLUDED_CUI_SOURCE_OPTIONS_OPTOPENCL_HXX
#include <opencl/openclconfig.hxx>
#include <sfx2/tabdlg.hxx>
#include <svtools/simptabl.hxx>
#include <vcl/fixed.hxx>
#include <vcl/lstbox.hxx>
class SvxOpenCLTabPage : public SfxTabPage
{
private:
OpenCLConfig maConfig;
CheckBox* mpUseOpenCL;
ListBox* mpBlackList;
PushButton* mpBlackListEdit;
PushButton* mpBlackListAdd;
PushButton* mpBlackListDelete;
ListBox* mpWhiteList;
PushButton* mpWhiteListEdit;
PushButton* mpWhiteListAdd;
PushButton* mpWhiteListDelete;
DECL_LINK(BlackListEditHdl, void*);
DECL_LINK(BlackListAddHdl, void*);
DECL_LINK(BlackListDeleteHdl, void*);
DECL_LINK(WhiteListEditHdl, void*);
DECL_LINK(WhiteListAddHdl, void*);
DECL_LINK(WhiteListDeleteHdl, void*);
long EditHdl(ListBox* pListBox, OpenCLConfig::ImplMatcherSet& rSet, const OString& rTag);
long AddHdl(ListBox* pListBox, OpenCLConfig::ImplMatcherSet& rSet, const OString& rTag);
long DeleteHdl(ListBox* pListBox, OpenCLConfig::ImplMatcherSet& rSet);
public:
SvxOpenCLTabPage( vcl::Window* pParent, const SfxItemSet& rSet );
virtual ~SvxOpenCLTabPage();
static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rSet );
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
virtual void FillUserData() SAL_OVERRIDE;
};
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View file

@ -47,6 +47,7 @@
#include "optjsearch.hxx"
#include "optlingu.hxx"
#include "optmemory.hxx"
#include "optopencl.hxx"
#include "optpath.hxx"
#include "optsave.hxx"
#include "optupdt.hxx"
@ -320,6 +321,7 @@ SfxTabPage* CreateGeneralTabPage( sal_uInt16 nId, vcl::Window* pParent, const Sf
case RID_SVXPAGE_ACCESSIBILITYCONFIG: fnCreate = &SvxAccessibilityOptionsTabPage::Create; break;
case RID_SVXPAGE_OPTIONS_CTL: fnCreate = &SvxCTLOptionsPage::Create ; break;
case RID_SVXPAGE_OPTIONS_JAVA: fnCreate = &SvxJavaOptionsPage::Create ; break;
case RID_SVXPAGE_OPENCL: fnCreate = &SvxOpenCLTabPage::Create ; break;
case RID_SVXPAGE_ONLINEUPDATE: fnCreate = &SvxOnlineUpdateTabPage::Create; break;
case RID_OPTPAGE_CHART_DEFCOLORS: fnCreate = &SvxDefaultColorOptPage::Create; break;
#if HAVE_FEATURE_SCRIPTING

View file

@ -43,6 +43,7 @@ Resource RID_OFADLG_OPTIONS_TREE_PAGES
< "Advanced" ; RID_SVXPAGE_OPTIONS_JAVA ; > ;
< "Basic IDE Options" ; RID_SVXPAGE_BASICIDE_OPTIONS ; > ;
< "Online Update" ; RID_SVXPAGE_ONLINEUPDATE ; > ;
< "OpenCL" ; RID_SVXPAGE_OPENCL ; > ;
};
};
StringArray SID_LANGUAGE_OPTIONS

View file

@ -0,0 +1,281 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<interface>
<requires lib="gtk+" version="3.0"/>
<requires lib="LibreOffice" version="1.0"/>
<object class="GtkDialog" id="BlackOrWhiteListEntryDialog">
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="title" translatable="no">dummy</property>
<property name="resizable">False</property>
<property name="type_hint">dialog</property>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="dialog-action_area1">
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="ok">
<property name="label">gtk-ok</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="cancel">
<property name="label">gtk-cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="help">
<property name="label">gtk-help</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
<property name="secondary">True</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkGrid" id="grid1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="row_spacing">12</property>
<child>
<object class="GtkGrid" id="grid4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="row_spacing">6</property>
<child>
<object class="GtkLabel" id="label4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">OS:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">name</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="os">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="width_chars">12</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label5">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">OS version:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">name</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="osversion">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="width_chars">22</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label6">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">OpenCL platform vendor:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">name</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="platformvendor">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="width_chars">12</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label7">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Device:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">name</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">4</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="device">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="width_chars">22</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">5</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label8">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Driver version:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">name</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">6</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="driverversion">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="width_chars">22</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">7</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="bledittitle">
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="label" translatable="yes">Edit Black-list Entry</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="bladdtitle">
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="label" translatable="yes">Create Black-list Entry</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="wledittitle">
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="label" translatable="yes">Edit White-list Entry</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">4</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="wladdtitle">
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="label" translatable="yes">Create White-list Entry</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">5</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
<action-widgets>
<action-widget response="0">ok</action-widget>
<action-widget response="0">cancel</action-widget>
<action-widget response="0">help</action-widget>
</action-widgets>
</object>
</interface>

View file

@ -370,46 +370,5 @@
<property name="top_attach">5</property>
</packing>
</child>
<child>
<object class="GtkFrame" id="openclframe">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkAlignment" id="alignment7">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="top_padding">6</property>
<property name="left_padding">12</property>
<child>
<object class="GtkCheckButton" id="useopencl">
<property name="label" translatable="yes">Allow use of OpenCL</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="label8">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">OpenCL</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">6</property>
</packing>
</child>
</object>
</interface>

View file

@ -0,0 +1,349 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<interface>
<requires lib="gtk+" version="3.0"/>
<object class="GtkFrame" id="OptOpenCLPage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="border_width">6</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="top_padding">6</property>
<property name="left_padding">12</property>
<child>
<object class="GtkBox" id="blacklistbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
<object class="GtkCheckButton" id="useopencl">
<property name="label" translatable="yes">Allow use of OpenCL</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</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">OpenCL black-list:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">blacklist</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkGrid" id="grid1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="column_spacing">12</property>
<child>
<object class="GtkButtonBox" id="buttonbox1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<property name="layout_style">start</property>
<child>
<object class="GtkButton" id="bledit">
<property name="label" translatable="yes">_Edit...</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="bladd">
<property name="label" translatable="yes">_Add...</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="bldelete">
<property name="label" translatable="yes">_Delete...</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkGrid" id="grid2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<child>
<object class="GtkGrid" id="grid3">
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="column_spacing">6</property>
<child>
<object class="GtkLabel" id="os">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">OS</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="osversion">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">OS Version</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="vendor">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Platform vendor</property>
</object>
<packing>
<property name="left_attach">3</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="device">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Device</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="driverversion">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Driver version</property>
</object>
<packing>
<property name="left_attach">4</property>
<property name="top_attach">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkTreeView" id="blacklist">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">OpenCL white-list:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">blacklist</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkGrid" id="grid4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="column_spacing">12</property>
<child>
<object class="GtkButtonBox" id="buttonbox2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<property name="layout_style">start</property>
<child>
<object class="GtkButton" id="wledit">
<property name="label" translatable="yes">_Edit...</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="wladd">
<property name="label" translatable="yes">_Add...</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="wldelete">
<property name="label" translatable="yes">_Delete...</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkGrid" id="grid5">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<child>
<object class="GtkTreeView" id="whitelist">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">4</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">OpenCL Options</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
</child>
</object>
<object class="GtkSizeGroup" id="sizegroup1">
<widgets>
</widgets>
</object>
</interface>

View file

@ -0,0 +1,100 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef INCLUDED_OPENCL_OPENCLCONFIG_HXX
#define INCLUDED_OPENCL_OPENCLCONFIG_HXX
#include <ostream>
#include <set>
#include <opencl/opencldllapi.h>
#include <opencl/platforminfo.hxx>
#include <rtl/ustring.hxx>
#include <com/sun/star/uno/Sequence.hxx>
struct OPENCL_DLLPUBLIC OpenCLConfig
{
struct ImplMatcher
{
OUString maOS;
OUString maOSVersion;
OUString maPlatformVendor;
OUString maDevice;
OUString maDriverVersion;
ImplMatcher()
{
}
ImplMatcher(const OUString& rOS,
const OUString& rOSVersion,
const OUString& rPlatformVendor,
const OUString& rDevice,
const OUString& rDriverVersion)
: maOS(rOS),
maOSVersion(rOSVersion),
maPlatformVendor(rPlatformVendor),
maDevice(rDevice),
maDriverVersion(rDriverVersion)
{
}
bool operator==(const ImplMatcher& r) const
{
return maOS == r.maOS &&
maOSVersion == r.maOSVersion &&
maPlatformVendor == r.maPlatformVendor &&
maDevice == r.maDevice &&
maDriverVersion == r.maDriverVersion;
}
bool operator!=(const ImplMatcher& r) const
{
return !operator==(r);
}
bool operator<(const ImplMatcher& r) const
{
return (maOS < r.maOS ||
(maOS == r.maOS &&
(maOSVersion < r.maOSVersion ||
(maOSVersion == r.maOSVersion &&
(maPlatformVendor < r.maPlatformVendor ||
(maPlatformVendor == r.maPlatformVendor &&
(maDevice < r.maDevice ||
(maDevice == r.maDevice &&
(maDriverVersion < r.maDriverVersion)))))))));
}
};
bool mbUseOpenCL;
typedef std::set<ImplMatcher> ImplMatcherSet;
ImplMatcherSet maBlackList;
ImplMatcherSet maWhiteList;
OpenCLConfig();
bool operator== (const OpenCLConfig& r) const;
bool operator!= (const OpenCLConfig& r) const;
static OpenCLConfig get();
void set();
bool checkImplementation(const OpenCLPlatformInfo& rPlatform, const OpenCLDeviceInfo& rDevice) const;
};
OPENCL_DLLPUBLIC std::ostream& operator<<(std::ostream& rStream, const OpenCLConfig& rConfig);
OPENCL_DLLPUBLIC std::ostream& operator<<(std::ostream& rStream, const OpenCLConfig::ImplMatcher& rImpl);
OPENCL_DLLPUBLIC std::ostream& operator<<(std::ostream& rStream, const OpenCLConfig::ImplMatcherSet& rSet);
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View file

@ -0,0 +1,34 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef INCLUDED_OPENCL_OPENCLDLLAPI_H
#define INCLUDED_OPENCL_OPENCLDLLAPI_H
#include <sal/types.h>
#if defined(OPENCL_DLLIMPLEMENTATION)
#define OPENCL_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
#else
#define OPENCL_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
#endif
#define OPENCL_DLLPRIVATE SAL_DLLPRIVATE
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View file

@ -7,21 +7,22 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef INCLUDED_SC_INC_PLATFORMINFO_HXX
#define INCLUDED_SC_INC_PLATFORMINFO_HXX
#ifndef INCLUDED_OPENCL_PLATFORMINFO_HXX
#define INCLUDED_OPENCL_PLATFORMINFO_HXX
#include <ostream>
#include <vector>
#include <clew.h>
#include <opencl/opencldllapi.h>
#include <rtl/ustring.hxx>
#include "scdllapi.h"
// Struct that describs an actual instance of an OpenCL device
namespace sc {
struct SC_DLLPUBLIC OpenCLDeviceInfo
struct OPENCL_DLLPUBLIC OpenCLDeviceInfo
{
void* device;
cl_device_id device;
OUString maName;
OUString maVendor;
OUString maDriver;
@ -32,9 +33,11 @@ struct SC_DLLPUBLIC OpenCLDeviceInfo
OpenCLDeviceInfo();
};
struct SC_DLLPUBLIC OpenCLPlatformInfo
// Struct that describs an actual instance of an OpenCL platform implementation
struct OPENCL_DLLPUBLIC OpenCLPlatformInfo
{
void* platform;
cl_platform_id platform;
OUString maVendor;
OUString maName;
std::vector<OpenCLDeviceInfo> maDevices;
@ -42,9 +45,7 @@ struct SC_DLLPUBLIC OpenCLPlatformInfo
OpenCLPlatformInfo();
};
}
SC_DLLPUBLIC std::ostream& operator<<(std::ostream& rStream, const sc::OpenCLPlatformInfo& rPlatform);
SC_DLLPUBLIC std::ostream& operator<<(std::ostream& rStream, const sc::OpenCLDeviceInfo& rDevice);
OPENCL_DLLPUBLIC std::ostream& operator<<(std::ostream& rStream, const OpenCLPlatformInfo& rPlatform);
OPENCL_DLLPUBLIC std::ostream& operator<<(std::ostream& rStream, const OpenCLDeviceInfo& rDevice);
#endif

View file

@ -1382,20 +1382,6 @@
</info>
<value/>
</prop>
<prop oor:name="OpenCLBlackList" oor:type="oor:string-list" oor:nillable="false">
<!-- UIHints: Tools - Options Spreadsheet Formula -->
<info>
<desc>Combinations of (OS, OS version, OpenCL platform vendor, OpenCL device name, OpenCL driver version) that are known to be bad. Each entry is a string consisting of five parts separated by slashes. An empty part matches anything. In case a slash, percent or semicolon occurs inside a part, it is replaced by a percent followed by the corresponding number as two hex digits. The parts except OS can contain regular expressions. Inside these regular expressions the usual characters .*()[]\ are special and should be quoted with a backslash to be interpreted literally. OS should be just one of "Linux", "OS X" (including the space) or "Windows" (without quotes). Has higher priority than OpenCLWhiteList.</desc>
</info>
<value oor:separator=";">Windows//Intel\(R\) Corporation//9\.17\.10\.2884</value>
</prop>
<prop oor:name="OpenCLWhiteList" oor:type="oor:string-list" oor:nillable="false">
<!-- UIHints: Tools - Options Spreadsheet Formula -->
<info>
<desc>Like OpenCLBlackList, but for combinations known to be good.</desc>
</info>
<value oor:separator=";">Linux//Advanced Micro Devices, Inc\.//1445\.5 \(sse2,avx\);//Advanced Micro Devices, Inc\.//;//Intel\(R\) Corporation//;//NVIDIA Corporation//</value>
</prop>
</group>
<group oor:name="Syntax">
<info>

View file

@ -5560,6 +5560,20 @@
</info>
<value>true</value>
</prop>
<prop oor:name="OpenCLBlackList" oor:type="oor:string-list" oor:nillable="false">
<!-- UIHints: Tools - Options General OpenCL -->
<info>
<desc>Combinations of (OS, OS version, OpenCL platform vendor, OpenCL device name, OpenCL driver version) that are known to be bad. Each entry is a string consisting of five parts separated by slashes. An empty part matches anything. In case a slash, percent or semicolon occurs inside a part, it is replaced by a percent followed by the corresponding number as two hex digits. The parts except OS can contain regular expressions. Inside these regular expressions the usual characters .*()[]\ are special and should be quoted with a backslash to be interpreted literally. OS should be just one of "Linux", "OS X" (including the space) or "Windows" (without quotes). Has higher priority than OpenCLWhiteList.</desc>
</info>
<value oor:separator=";">Windows//Intel\(R\) Corporation//9\.17\.10\.2884</value>
</prop>
<prop oor:name="OpenCLWhiteList" oor:type="oor:string-list" oor:nillable="false">
<!-- UIHints: Tools - Options General OpenCL -->
<info>
<desc>Like OpenCLBlackList, but for combinations known to be good.</desc>
</info>
<value oor:separator=";">Linux//Advanced Micro Devices, Inc\.//1445\.5 \(sse2,avx\);//Advanced Micro Devices, Inc\.//;//Intel\(R\) Corporation//;//NVIDIA Corporation//</value>
</prop>
<prop oor:name="MacroRecorderMode" oor:type="xs:boolean" oor:nillable="false">
<info>
<desc>Determines if the limited, and awkward code producing

42
opencl/Library_opencl.mk Normal file
View file

@ -0,0 +1,42 @@
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
$(eval $(call gb_Library_Library,opencl))
$(eval $(call gb_Library_add_defs,opencl,\
-DOPENCL_DLLIMPLEMENTATION \
))
$(eval $(call gb_Library_use_externals,opencl,\
boost_headers \
clew \
icu_headers \
icui18n \
icuuc \
))
$(eval $(call gb_Library_use_custom_headers,opencl,\
officecfg/registry \
))
$(eval $(call gb_Library_use_sdk_api,opencl))
$(eval $(call gb_Library_use_libraries,opencl,\
configmgr \
comphelper \
cppu \
sal \
))
$(eval $(call gb_Library_add_exception_objects,opencl,\
opencl/source/openclconfig \
opencl/source/platforminfo \
))
# vim: set noet sw=4 ts=4:

14
opencl/Makefile Normal file
View file

@ -0,0 +1,14 @@
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))
include $(module_directory)/../solenv/gbuild/partial_build.mk
# vim: set noet sw=4 ts=4:

16
opencl/Module_opencl.mk Normal file
View file

@ -0,0 +1,16 @@
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
$(eval $(call gb_Module_Module,opencl))
$(eval $(call gb_Module_add_targets,opencl,\
Library_opencl \
))
# vim: set noet sw=4 ts=4:

View file

@ -0,0 +1,256 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include <boost/shared_ptr.hpp>
#include <unicode/regex.h>
#include <comphelper/configuration.hxx>
#include <officecfg/Office/Common.hxx>
#include <opencl/openclconfig.hxx>
#include <opencl/platforminfo.hxx>
#include <rtl/ustring.hxx>
#include <sal/types.h>
OpenCLConfig::OpenCLConfig() :
mbUseOpenCL(true)
{
// This entry we have had for some time (when blacklisting was
// done elsewhere in the code), so presumably there is a known
// good reason for it.
maBlackList.insert(ImplMatcher("Windows", "", "Intel\\(R\\) Corporation", "", "9\\.17\\.10\\.2884"));
// This is what I have tested on Linux and it works for our unit tests.
maWhiteList.insert(ImplMatcher("Linux", "", "Advanced Micro Devices, Inc\\.", "", "1445\\.5 \\(sse2,avx\\)"));
// For now, assume that AMD, Intel and NVIDIA drivers are good
maWhiteList.insert(ImplMatcher("", "", "Advanced Micro Devices, Inc\\.", "", ""));
maWhiteList.insert(ImplMatcher("", "", "Intel\\(R\\) Corporation", "", ""));
maWhiteList.insert(ImplMatcher("", "", "NVIDIA Corporation", "", ""));
}
bool OpenCLConfig::operator== (const OpenCLConfig& r) const
{
return (mbUseOpenCL == r.mbUseOpenCL &&
maBlackList == r.maBlackList &&
maWhiteList == r.maWhiteList &&
true);
}
bool OpenCLConfig::operator!= (const OpenCLConfig& r) const
{
return !operator== (r);
}
namespace {
css::uno::Sequence<OUString> SetOfImplMatcherToStringSequence(const OpenCLConfig::ImplMatcherSet& rSet)
{
css::uno::Sequence<OUString> result(rSet.size());
size_t n(0);
for (auto i = rSet.cbegin(); i != rSet.cend(); ++i)
{
result[n++] =
(*i).maOS.replaceAll("%", "%25").replaceAll("/", "%2F").replaceAll(";", "%3B") + "/" +
(*i).maOSVersion.replaceAll("%", "%25").replaceAll("/", "%2F").replaceAll(";", "%3B") + "/" +
(*i).maPlatformVendor.replaceAll("%", "%25").replaceAll("/", "%2F").replaceAll(";", "%3B") + "/" +
(*i).maDevice.replaceAll("%", "%25").replaceAll("/", "%2F").replaceAll(";", "%3B") + "/" +
(*i).maDriverVersion.replaceAll("%", "%25").replaceAll("/", "%2F").replaceAll(";", "%3B");
}
return result;
}
OUString getToken(const OUString& string, sal_Int32& index)
{
OUString token(string.getToken(0, '/', index));
OUString result;
sal_Int32 i(0);
sal_Int32 p;
while ((p = token.indexOf('%', i)) >= 0)
{
if (p > i)
result += token.copy(i, p - i);
if (p < token.getLength() - 2)
{
result += OUString(static_cast<sal_Unicode>(token.copy(p+1, 2).toInt32(16)));
i = p + 3;
}
else
{
i = token.getLength();
}
}
result += token.copy(i);
return result;
}
OpenCLConfig::ImplMatcherSet StringSequenceToSetOfImplMatcher(const css::uno::Sequence<OUString>& rSequence)
{
OpenCLConfig::ImplMatcherSet result;
for (auto i = rSequence.begin(); i != rSequence.end(); ++i)
{
OpenCLConfig::ImplMatcher m;
sal_Int32 index(0);
m.maOS = getToken(*i, index);
m.maOSVersion = getToken(*i, index);
m.maPlatformVendor = getToken(*i, index);
m.maDevice = getToken(*i, index);
m.maDriverVersion = getToken(*i, index);
result.insert(m);
}
return result;
}
bool match(const OUString& rPattern, const OUString& rInput)
{
if (rPattern == "")
return true;
UErrorCode nIcuError(U_ZERO_ERROR);
icu::UnicodeString sIcuPattern(reinterpret_cast<const UChar*>(rPattern.getStr()), rPattern.getLength());
icu::UnicodeString sIcuInput(reinterpret_cast<const UChar*>(rInput.getStr()), rInput.getLength());
RegexMatcher aMatcher(sIcuPattern, sIcuInput, 0, nIcuError);
if (U_SUCCESS(nIcuError) && aMatcher.matches(nIcuError) && U_SUCCESS(nIcuError))
return true;
return false;
}
bool match(const OpenCLConfig::ImplMatcher& rListEntry, const OpenCLPlatformInfo& rPlatform, const OpenCLDeviceInfo& rDevice)
{
#if defined WNT
if (rListEntry.maOS != "" && rListEntry.maOS != "Windows")
return false;
#elif defined LINUX
if (rListEntry.maOS != "" && rListEntry.maOS != "Linux")
return false;
#elif defined MACOSX
if (rListEntry.maOS != "" && rListEntry.maOS != "OS X")
return false;
#endif
// OS version check not yet implemented
if (!match(rListEntry.maPlatformVendor, rPlatform.maVendor))
return false;
if (!match(rListEntry.maDevice, rDevice.maName))
return false;
if (!match(rListEntry.maDriverVersion, rDevice.maDriver))
return false;
return true;
}
bool match(const OpenCLConfig::ImplMatcherSet& rList, const OpenCLPlatformInfo& rPlatform, const OpenCLDeviceInfo& rDevice, const char* sKindOfList)
{
for (auto i = rList.cbegin(); i != rList.end(); ++i)
{
SAL_INFO("sc.opencl", "Looking for match for platform=" << rPlatform << ", device=" << rDevice <<
" in " << sKindOfList << " entry=" << *i);
if (match(*i, rPlatform, rDevice))
{
SAL_INFO("sc.opencl", "Match!");
return true;
}
}
return false;
}
} // anonymous namespace
OpenCLConfig OpenCLConfig::get()
{
OpenCLConfig result;
result.mbUseOpenCL = officecfg::Office::Common::Misc::UseOpenCL::get();
result.maBlackList = StringSequenceToSetOfImplMatcher(officecfg::Office::Common::Misc::OpenCLBlackList::get());
result.maWhiteList = StringSequenceToSetOfImplMatcher(officecfg::Office::Common::Misc::OpenCLWhiteList::get());
return result;
}
void OpenCLConfig::set()
{
boost::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
officecfg::Office::Common::Misc::UseOpenCL::set(mbUseOpenCL, batch);
officecfg::Office::Common::Misc::OpenCLBlackList::set(SetOfImplMatcherToStringSequence(maBlackList), batch);
officecfg::Office::Common::Misc::OpenCLWhiteList::set(SetOfImplMatcherToStringSequence(maWhiteList), batch);
batch->commit();
}
bool OpenCLConfig::checkImplementation(const OpenCLPlatformInfo& rPlatform, const OpenCLDeviceInfo& rDevice) const
{
// Check blacklist of known bad OpenCL implementations
if (match(maBlackList, rPlatform, rDevice, "blacklist"))
{
SAL_INFO("opencl", "Rejecting");
return true;
}
// Check for whitelist of known good OpenCL implementations
if (match(maWhiteList, rPlatform, rDevice, "whitelist"))
{
SAL_INFO("opencl", "Approving");
return false;
}
// Fallback: reject
SAL_INFO("opencl", "Fallback: rejecting platform=" << rPlatform << ", device=" << rDevice);
return true;
}
std::ostream& operator<<(std::ostream& rStream, const OpenCLConfig& rConfig)
{
rStream << "{"
"UseOpenCL=" << (rConfig.mbUseOpenCL ? "YES" : "NO") << ","
"BlackList=" << rConfig.maBlackList << ","
"WhiteList=" << rConfig.maWhiteList <<
"}";
return rStream;
}
std::ostream& operator<<(std::ostream& rStream, const OpenCLConfig::ImplMatcher& rImpl)
{
rStream << "{"
"OS=" << rImpl.maOS << ","
"OSVersion=" << rImpl.maOSVersion << ","
"PlatformVendor=" << rImpl.maPlatformVendor << ","
"Device=" << rImpl.maDevice << ","
"DriverVersion=" << rImpl.maDriverVersion <<
"}";
return rStream;
}
std::ostream& operator<<(std::ostream& rStream, const OpenCLConfig::ImplMatcherSet& rSet)
{
rStream << "{";
for (auto i = rSet.cbegin(); i != rSet.cend(); ++i)
{
if (i != rSet.cbegin())
rStream << ",";
rStream << *i;
}
rStream << "}";
return rStream;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View file

@ -7,9 +7,9 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include "platforminfo.hxx"
#include <ostream>
namespace sc {
#include <opencl/platforminfo.hxx>
OpenCLDeviceInfo::OpenCLDeviceInfo()
: device(0)
@ -24,9 +24,7 @@ OpenCLPlatformInfo::OpenCLPlatformInfo()
{
}
}
std::ostream& operator<<(std::ostream& rStream, const sc::OpenCLPlatformInfo& rPlatform)
std::ostream& operator<<(std::ostream& rStream, const OpenCLPlatformInfo& rPlatform)
{
rStream << "{"
"Vendor=" << rPlatform.maVendor << ","
@ -35,7 +33,7 @@ std::ostream& operator<<(std::ostream& rStream, const sc::OpenCLPlatformInfo& rP
return rStream;
}
std::ostream& operator<<(std::ostream& rStream, const sc::OpenCLDeviceInfo& rDevice)
std::ostream& operator<<(std::ostream& rStream, const OpenCLDeviceInfo& rDevice)
{
rStream << "{"
"Name=" << rDevice.maName << ","

View file

@ -15,6 +15,7 @@ $(eval $(call gb_CppunitTest_add_exception_objects,sc_opencl_test, \
$(eval $(call gb_CppunitTest_use_externals,sc_opencl_test, \
boost_headers \
clew \
mdds_headers \
orcus \
orcus-parser \

View file

@ -31,7 +31,7 @@ endif
$(eval $(call gb_CppunitTest_use_externals,sc_ucalc,\
boost_headers \
$(call gb_Helper_optional,CLCC,clew) \
$(call gb_Helper_optional,OPENCL,clew) \
icu_headers \
icui18n \
icuuc \
@ -53,6 +53,8 @@ $(eval $(call gb_CppunitTest_use_libraries,sc_ucalc, \
forui \
i18nlangtag \
i18nutil \
$(call gb_Helper_optional,OPENCL, \
opencl) \
sal \
salhelper \
sax \

View file

@ -37,7 +37,7 @@ $(eval $(call gb_Library_use_sdk_api,sc))
$(eval $(call gb_Library_use_externals,sc,\
boost_headers \
$(call gb_Helper_optional,CLCC,clew) \
$(call gb_Helper_optional,OPENCL,clew) \
icu_headers \
icui18n \
icuuc \
@ -72,6 +72,8 @@ $(eval $(call gb_Library_use_libraries,sc,\
forui \
i18nlangtag \
i18nutil \
$(call gb_Helper_optional,OPENCL, \
opencl) \
sal \
salhelper \
sax \
@ -247,7 +249,6 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
sc/source/core/tool/optutil \
sc/source/core/tool/orcusxml \
sc/source/core/tool/parclass \
sc/source/core/tool/platforminfo \
sc/source/core/tool/printopt \
sc/source/core/tool/prnsave \
sc/source/core/tool/progress \
@ -660,8 +661,7 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
sc/source/ui/xmlsource/xmlsourcedlg \
))
ifneq (,$(ENABLE_OPENCL))
$(call gb_Helper_optional,OPENCL,\
$(eval $(call gb_Library_add_exception_objects,sc,\
sc/source/core/opencl/formulagroupcl \
sc/source/core/opencl/openclwrapper \
@ -675,7 +675,7 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
sc/source/core/opencl/op_array \
sc/source/core/opencl/op_logical \
sc/source/core/opencl/op_spreadsheet \
))
)))
ifeq ($(OS),LINUX)
$(eval $(call gb_Library_add_libs,sc,\
@ -683,8 +683,6 @@ $(eval $(call gb_Library_add_libs,sc,\
))
endif
endif
$(eval $(call gb_SdiTarget_SdiTarget,sc/sdi/scslots,sc/sdi/scalc))
$(eval $(call gb_SdiTarget_set_include,sc/sdi/scslots,\

View file

@ -24,6 +24,7 @@ $(eval $(call gb_Library_use_sdk_api,scui))
$(eval $(call gb_Library_use_externals,scui,\
boost_headers \
$(call gb_Helper_optional,OPENCL,clew) \
mdds_headers \
))

View file

@ -40,58 +40,6 @@ struct SC_DLLPUBLIC ScCalcConfig
STRING_CONVERSION_UNAMBIGUOUS, ///< =1+"1" gives 2, but =1+"1.000" or =1+"x" give #VALUE!
STRING_CONVERSION_LOCALE_DEPENDENT ///< =1+"1.000" may be 2 or 1001 ... =1+"x" gives #VALUE!
};
struct OpenCLImplMatcher
{
OUString maOS;
OUString maOSVersion;
OUString maPlatformVendor;
OUString maDevice;
OUString maDriverVersion;
OpenCLImplMatcher()
{
}
OpenCLImplMatcher(const OUString& rOS,
const OUString& rOSVersion,
const OUString& rPlatformVendor,
const OUString& rDevice,
const OUString& rDriverVersion)
: maOS(rOS),
maOSVersion(rOSVersion),
maPlatformVendor(rPlatformVendor),
maDevice(rDevice),
maDriverVersion(rDriverVersion)
{
}
bool operator==(const OpenCLImplMatcher& r) const
{
return maOS == r.maOS &&
maOSVersion == r.maOSVersion &&
maPlatformVendor == r.maPlatformVendor &&
maDevice == r.maDevice &&
maDriverVersion == r.maDriverVersion;
}
bool operator!=(const OpenCLImplMatcher& r) const
{
return !operator==(r);
}
bool operator<(const OpenCLImplMatcher& r) const
{
return (maOS < r.maOS ||
(maOS == r.maOS &&
(maOSVersion < r.maOSVersion ||
(maOSVersion == r.maOSVersion &&
(maPlatformVendor < r.maPlatformVendor ||
(maPlatformVendor == r.maPlatformVendor &&
(maDevice < r.maDevice ||
(maDevice == r.maDevice &&
(maDriverVersion < r.maDriverVersion)))))))));
}
};
formula::FormulaGrammar::AddressConvention meStringRefAddressSyntax;
StringConversion meStringConversion;
bool mbEmptyStringAsZero:1;
@ -105,11 +53,6 @@ struct SC_DLLPUBLIC ScCalcConfig
OpCodeSet maOpenCLSubsetOpCodes;
typedef std::set<OpenCLImplMatcher> OpenCLImplMatcherSet;
OpenCLImplMatcherSet maOpenCLBlackList;
OpenCLImplMatcherSet maOpenCLWhiteList;
ScCalcConfig();
void setOpenCLConfigToDefault();
@ -121,8 +64,6 @@ struct SC_DLLPUBLIC ScCalcConfig
bool operator!= (const ScCalcConfig& r) const;
};
SC_DLLPUBLIC std::ostream& operator<<(std::ostream& rStream, const ScCalcConfig::OpenCLImplMatcher& rImpl);
SC_DLLPUBLIC std::ostream& operator<<(std::ostream& rStream, const ScCalcConfig::OpenCLImplMatcherSet& rSet);
SC_DLLPUBLIC std::ostream& operator<<(std::ostream& rStream, const ScCalcConfig& rConfig);
SC_DLLPUBLIC OUString ScOpCodeSetToNumberString(const ScCalcConfig::OpCodeSet& rOpCodes);

View file

@ -12,10 +12,10 @@
#include "address.hxx"
#include "types.hxx"
#include "platforminfo.hxx"
#include "stlalgorithm.hxx"
#include <formula/opcode.hxx>
#include <opencl/platforminfo.hxx>
#include <svl/sharedstringpool.hxx>
#include <set>

View file

@ -10,6 +10,7 @@
#include <osl/file.hxx>
#include "scdll.hxx"
#include <opencl/platforminfo.hxx>
#include <sfx2/app.hxx>
#include <sfx2/docfilt.hxx>
#include <sfx2/docfile.hxx>
@ -30,7 +31,6 @@
#include "drwlayer.hxx"
#include "userdat.hxx"
#include "formulacell.hxx"
#include "platforminfo.hxx"
#include "formulagroup.hxx"
#include <svx/svdpage.hxx>

View file

@ -11,13 +11,12 @@
#define INCLUDED_SC_SOURCE_CORE_OPENCL_OPENCLWRAPPER_HXX
#include <config_features.h>
#include <formula/opcode.hxx>
#include <sal/detail/log.h>
#include <opencl/platforminfo.hxx>
#include <osl/file.hxx>
#include <vector>
#include <boost/shared_ptr.hpp>
#include <cassert>
#include "platforminfo.hxx"
#include <rtl/string.hxx>
@ -102,8 +101,6 @@ bool switchOpenCLDevice(const OUString* pDeviceId, bool bAutoSelect,
void getOpenCLDeviceInfo(size_t& rDeviceId, size_t& rPlatformId);
bool checkForKnownBadCompilers(const OpenCLPlatformInfo& rPlatform, const OpenCLDeviceInfo& rDevice);
}}
#endif

View file

@ -21,13 +21,16 @@
#include <iostream>
#include <sstream>
#include <vector>
#include <sal/log.hxx>
#include <comphelper/random.hxx>
#include <boost/scoped_ptr.hpp>
#include <comphelper/random.hxx>
#include <opencl/openclconfig.hxx>
#include <opencl/platforminfo.hxx>
#include <sal/log.hxx>
#include "opencl_device.hxx"
#include "openclwrapper.hxx"
#include "platforminfo.hxx"
#define INPUTSIZE 15360
#define OUTPUTSIZE 15360
@ -418,7 +421,7 @@ ds_status pickBestDevice(ds_profile* profile, int* bestDeviceIdx)
aDevice.maDriver = OUString(device.oclDriverVersion, strlen(device.oclDriverVersion), RTL_TEXTENCODING_UTF8);
// If blacklisted or not whitelisted, ignore it
if (opencl::checkForKnownBadCompilers(aPlatform, aDevice))
if (OpenCLConfig::get().checkImplementation(aPlatform, aDevice))
{
SAL_INFO("sc.opencl.device", "Device[" << d << "] " << device.oclDeviceName << " is blacklisted or not whitelisted");
pScore->fTime = DBL_MAX;

View file

@ -15,6 +15,7 @@
#include "openclwrapper.hxx"
#include <comphelper/string.hxx>
#include <opencl/openclconfig.hxx>
#include <osl/file.hxx>
#include <rtl/bootstrap.hxx>
#include <rtl/digest.h>
@ -519,65 +520,6 @@ bool OpenCLDevice::initOpenCLRunEnv( GPUEnv *gpuInfo )
namespace {
bool match(const OUString& rPattern, const OUString& rInput)
{
if (rPattern == "")
return true;
UErrorCode nIcuError(U_ZERO_ERROR);
icu::UnicodeString sIcuPattern(reinterpret_cast<const UChar*>(rPattern.getStr()), rPattern.getLength());
icu::UnicodeString sIcuInput(reinterpret_cast<const UChar*>(rInput.getStr()), rInput.getLength());
RegexMatcher aMatcher(sIcuPattern, sIcuInput, 0, nIcuError);
if (U_SUCCESS(nIcuError) && aMatcher.matches(nIcuError) && U_SUCCESS(nIcuError))
return true;
return false;
}
bool match(const ScCalcConfig::OpenCLImplMatcher& rListEntry, const OpenCLPlatformInfo& rPlatform, const OpenCLDeviceInfo& rDevice)
{
#if defined WNT
if (rListEntry.maOS != "" && rListEntry.maOS != "Windows")
return false;
#elif defined LINUX
if (rListEntry.maOS != "" && rListEntry.maOS != "Linux")
return false;
#elif defined MACOSX
if (rListEntry.maOS != "" && rListEntry.maOS != "OS X")
return false;
#endif
// OS version check not yet implemented
if (!match(rListEntry.maPlatformVendor, rPlatform.maVendor))
return false;
if (!match(rListEntry.maDevice, rDevice.maName))
return false;
if (!match(rListEntry.maDriverVersion, rDevice.maDriver))
return false;
return true;
}
bool match(const ScCalcConfig::OpenCLImplMatcherSet& rList, const OpenCLPlatformInfo& rPlatform, const OpenCLDeviceInfo& rDevice, const char* sKindOfList)
{
for (auto i = rList.cbegin(); i != rList.end(); ++i)
{
SAL_INFO("sc.opencl", "Looking for match for platform=" << rPlatform << ", device=" << rDevice <<
" in " << sKindOfList << " entry=" << *i);
if (match(*i, rPlatform, rDevice))
{
SAL_INFO("sc.opencl", "Match!");
return true;
}
}
return false;
}
// based on crashes and hanging during kernel compilation
void createDeviceInfo(cl_device_id aDeviceId, OpenCLPlatformInfo& rPlatformInfo)
{
@ -635,7 +577,7 @@ void createDeviceInfo(cl_device_id aDeviceId, OpenCLPlatformInfo& rPlatformInfo)
aDeviceInfo.mnComputeUnits = nComputeUnits;
if(!checkForKnownBadCompilers(rPlatformInfo, aDeviceInfo))
if(!OpenCLConfig::get().checkImplementation(rPlatformInfo, aDeviceInfo))
rPlatformInfo.maDevices.push_back(aDeviceInfo);
}
@ -679,27 +621,6 @@ bool createPlatformInfo(cl_platform_id nPlatformId, OpenCLPlatformInfo& rPlatfor
}
bool checkForKnownBadCompilers(const OpenCLPlatformInfo& rPlatform, const OpenCLDeviceInfo& rDevice)
{
// Check blacklist of known bad OpenCL implementations
if (match(ScInterpreter::GetGlobalConfig().maOpenCLBlackList, rPlatform, rDevice, "blacklist"))
{
SAL_INFO("sc.opencl", "Rejecting");
return true;
}
// Check for whitelist of known good OpenCL implementations
if (match(ScInterpreter::GetGlobalConfig().maOpenCLWhiteList, rPlatform, rDevice, "whitelist"))
{
SAL_INFO("sc.opencl", "Approving");
return false;
}
// Fallback: reject
SAL_INFO("sc.opencl", "Fallback: rejecting platform=" << rPlatform << ", device=" << rDevice);
return true;
}
const std::vector<OpenCLPlatformInfo>& fillOpenCLInfo()
{
static std::vector<OpenCLPlatformInfo> aPlatforms;

View file

@ -64,19 +64,6 @@ void ScCalcConfig::setOpenCLConfigToDefault()
maOpenCLSubsetOpCodes.insert(ocCount);
maOpenCLSubsetOpCodes.insert(ocNormDist);
maOpenCLSubsetOpCodes.insert(ocSumIfs);
// This entry we have had for some time (when blacklisting was
// done elsewhere in the code), so presumably there is a known
// good reason for it.
maOpenCLBlackList.insert(OpenCLImplMatcher("Windows", "", "Intel\\(R\\) Corporation", "", "9\\.17\\.10\\.2884"));
// This is what I have tested on Linux and it works for our unit tests.
maOpenCLWhiteList.insert(OpenCLImplMatcher("Linux", "", "Advanced Micro Devices, Inc\\.", "", "1445\\.5 \\(sse2,avx\\)"));
// For now, assume that AMD, Intel and NVIDIA drivers are good
maOpenCLWhiteList.insert(OpenCLImplMatcher("", "", "Advanced Micro Devices, Inc\\.", "", ""));
maOpenCLWhiteList.insert(OpenCLImplMatcher("", "", "Intel\\(R\\) Corporation", "", ""));
maOpenCLWhiteList.insert(OpenCLImplMatcher("", "", "NVIDIA Corporation", "", ""));
}
void ScCalcConfig::reset()
@ -103,8 +90,6 @@ bool ScCalcConfig::operator== (const ScCalcConfig& r) const
maOpenCLDevice == r.maOpenCLDevice &&
mnOpenCLMinimumFormulaGroupSize == r.mnOpenCLMinimumFormulaGroupSize &&
maOpenCLSubsetOpCodes == r.maOpenCLSubsetOpCodes &&
maOpenCLBlackList == r.maOpenCLBlackList &&
maOpenCLWhiteList == r.maOpenCLWhiteList &&
true;
}
@ -113,32 +98,6 @@ bool ScCalcConfig::operator!= (const ScCalcConfig& r) const
return !operator==(r);
}
std::ostream& operator<<(std::ostream& rStream, const ScCalcConfig::OpenCLImplMatcher& rImpl)
{
rStream << "{"
"OS=" << rImpl.maOS << ","
"OSVersion=" << rImpl.maOSVersion << ","
"PlatformVendor=" << rImpl.maPlatformVendor << ","
"Device=" << rImpl.maDevice << ","
"DriverVersion=" << rImpl.maDriverVersion <<
"}";
return rStream;
}
std::ostream& operator<<(std::ostream& rStream, const ScCalcConfig::OpenCLImplMatcherSet& rSet)
{
rStream << "{";
for (auto i = rSet.cbegin(); i != rSet.cend(); ++i)
{
if (i != rSet.cbegin())
rStream << ",";
rStream << *i;
}
rStream << "}";
return rStream;
}
std::ostream& operator<<(std::ostream& rStream, const ScCalcConfig& rConfig)
{
rStream << "{"
@ -150,8 +109,6 @@ std::ostream& operator<<(std::ostream& rStream, const ScCalcConfig& rConfig)
"OpenCLDevice='" << rConfig.maOpenCLDevice << "',"
"OpenCLMinimumFormulaGroupSize=" << rConfig.mnOpenCLMinimumFormulaGroupSize << ","
"OpenCLSubsetOpCodes={" << ScOpCodeSetToSymbolicString(rConfig.maOpenCLSubsetOpCodes) << "},"
"OpenCLBlackList=" << rConfig.maOpenCLBlackList << ","
"OpenCLWhiteList=" << rConfig.maOpenCLWhiteList <<
"}";
return rStream;
}

View file

@ -21,6 +21,7 @@
#include <formula/vectortoken.hxx>
#include <officecfg/Office/Common.hxx>
#include <opencl/platforminfo.hxx>
#include <rtl/bootstrap.hxx>
#include <vector>
@ -541,7 +542,7 @@ void FormulaGroupInterpreter::fillOpenCLInfo(std::vector<OpenCLPlatformInfo>& rP
#if !HAVE_FEATURE_OPENCL
(void) rPlatforms;
#else
const std::vector<sc::OpenCLPlatformInfo>& rPlatformsFromWrapper =
const std::vector<OpenCLPlatformInfo>& rPlatformsFromWrapper =
sc::opencl::fillOpenCLInfo();
rPlatforms.assign(rPlatformsFromWrapper.begin(), rPlatformsFromWrapper.end());

View file

@ -205,9 +205,7 @@ SfxPoolItem* ScTpFormulaItem::Clone( SfxItemPool * ) const
#define SCFORMULAOPT_OPENCL_SUBSET_ONLY 12
#define SCFORMULAOPT_OPENCL_MIN_SIZE 13
#define SCFORMULAOPT_OPENCL_SUBSET_OPS 14
#define SCFORMULAOPT_OPENCL_BLACKLIST 15
#define SCFORMULAOPT_OPENCL_WHITELIST 16
#define SCFORMULAOPT_COUNT 17
#define SCFORMULAOPT_COUNT 15
Sequence<OUString> ScFormulaCfg::GetPropertyNames()
{
@ -228,8 +226,6 @@ Sequence<OUString> ScFormulaCfg::GetPropertyNames()
"Calculation/OpenCLSubsetOnly", // SCFORMULAOPT_OPENCL_SUBSET_ONLY
"Calculation/OpenCLMinimumDataSize", // SCFORMULAOPT_OPENCL_MIN_SIZE
"Calculation/OpenCLSubsetOpCodes", // SCFORMULAOPT_OPENCL_SUBSET_OPS
"Calculation/OpenCLBlackList", // SCFORMULAOPT_OPENCL_BLACKLIST
"Calculation/OpenCLWhiteList", // SCFORMULAOPT_OPENCL_WHITELIST
};
Sequence<OUString> aNames(SCFORMULAOPT_COUNT);
OUString* pNames = aNames.getArray();
@ -258,8 +254,6 @@ ScFormulaCfg::PropsToIds ScFormulaCfg::GetPropNamesToId()
SCFORMULAOPT_OPENCL_SUBSET_ONLY,
SCFORMULAOPT_OPENCL_MIN_SIZE,
SCFORMULAOPT_OPENCL_SUBSET_OPS,
SCFORMULAOPT_OPENCL_BLACKLIST,
SCFORMULAOPT_OPENCL_WHITELIST,
};
OSL_ENSURE( SAL_N_ELEMENTS(aVals) == aPropNames.getLength(), "Properties and ids are out of Sync");
PropsToIds aPropIdMap;
@ -276,73 +270,6 @@ ScFormulaCfg::ScFormulaCfg() :
EnableNotification( aNames );
}
namespace {
css::uno::Sequence<OUString> SetOfOpenCLImplMatcherToStringSequence(std::set<ScCalcConfig::OpenCLImplMatcher>& rSet)
{
css::uno::Sequence<OUString> result(rSet.size());
size_t n(0);
for (auto i = rSet.cbegin(); i != rSet.cend(); ++i)
{
result[n++] =
(*i).maOS.replaceAll("%", "%25").replaceAll("/", "%2F").replaceAll(";", "%3B") + "/" +
(*i).maOSVersion.replaceAll("%", "%25").replaceAll("/", "%2F").replaceAll(";", "%3B") + "/" +
(*i).maPlatformVendor.replaceAll("%", "%25").replaceAll("/", "%2F").replaceAll(";", "%3B") + "/" +
(*i).maDevice.replaceAll("%", "%25").replaceAll("/", "%2F").replaceAll(";", "%3B") + "/" +
(*i).maDriverVersion.replaceAll("%", "%25").replaceAll("/", "%2F").replaceAll(";", "%3B");
}
return result;
}
OUString getToken(const OUString& string, sal_Int32& index)
{
OUString token(string.getToken(0, '/', index));
OUString result;
sal_Int32 i(0);
sal_Int32 p;
while ((p = token.indexOf('%', i)) >= 0)
{
if (p > i)
result += token.copy(i, p - i);
if (p < token.getLength() - 2)
{
result += OUString(static_cast<sal_Unicode>(token.copy(p+1, 2).toInt32(16)));
i = p + 3;
}
else
{
i = token.getLength();
}
}
result += token.copy(i);
return result;
}
std::set<ScCalcConfig::OpenCLImplMatcher> StringSequenceToSetOfOpenCLImplMatcher(css::uno::Sequence<OUString>& rSequence)
{
std::set<ScCalcConfig::OpenCLImplMatcher> result;
for (auto i = rSequence.begin(); i != rSequence.end(); ++i)
{
ScCalcConfig::OpenCLImplMatcher m;
sal_Int32 index(0);
m.maOS = getToken(*i, index);
m.maOSVersion = getToken(*i, index);
m.maPlatformVendor = getToken(*i, index);
m.maDevice = getToken(*i, index);
m.maDriverVersion = getToken(*i, index);
result.insert(m);
}
return result;
}
} // anonymous namespace
void ScFormulaCfg::UpdateFromProperties( const Sequence<OUString>& aNames )
{
Sequence<Any> aValues = GetProperties(aNames);
@ -574,20 +501,6 @@ void ScFormulaCfg::UpdateFromProperties( const Sequence<OUString>& aNames )
GetCalcConfig().maOpenCLSubsetOpCodes = ScStringToOpCodeSet(sVal);
}
break;
case SCFORMULAOPT_OPENCL_BLACKLIST:
{
css::uno::Sequence<OUString> sVal = SetOfOpenCLImplMatcherToStringSequence(GetCalcConfig().maOpenCLBlackList);
pValues[nProp] >>= sVal;
GetCalcConfig().maOpenCLBlackList = StringSequenceToSetOfOpenCLImplMatcher(sVal);
}
break;
case SCFORMULAOPT_OPENCL_WHITELIST:
{
css::uno::Sequence<OUString> sVal = SetOfOpenCLImplMatcherToStringSequence(GetCalcConfig().maOpenCLWhiteList);
pValues[nProp] >>= sVal;
GetCalcConfig().maOpenCLWhiteList = StringSequenceToSetOfOpenCLImplMatcher(sVal);
}
break;
}
}
}
@ -734,18 +647,6 @@ void ScFormulaCfg::Commit()
pValues[nProp] <<= sVal;
}
break;
case SCFORMULAOPT_OPENCL_BLACKLIST:
{
css::uno::Sequence<OUString> sVal = SetOfOpenCLImplMatcherToStringSequence(GetCalcConfig().maOpenCLBlackList);
pValues[nProp] <<= sVal;
}
break;
case SCFORMULAOPT_OPENCL_WHITELIST:
{
css::uno::Sequence<OUString> sVal = SetOfOpenCLImplMatcherToStringSequence(GetCalcConfig().maOpenCLWhiteList);
pValues[nProp] <<= sVal;
}
break;
}
}
if(bSetOpenCL)

View file

@ -42,8 +42,6 @@ typedef enum {
CALC_OPTION_ENABLE_OPENCL_SUBSET,
CALC_OPTION_OPENCL_MIN_SIZE,
CALC_OPTION_OPENCL_SUBSET_OPS,
CALC_OPTION_OPENCL_BLACKLIST,
CALC_OPTION_OPENCL_WHITELIST,
} CalcOptionOrder;
class OptionString : public SvLBoxString
@ -155,16 +153,6 @@ ScCalcOptionsDialog::ScCalcOptionsDialog(vcl::Window* pParent, const ScCalcConfi
get(mpBtnFalse, "false");
get(mpSpinButton, "spinbutton");
get(mpEditField, "entry");
get(mpOpenCLWhiteAndBlackListGrid, "listgrid");
get(mpOpenCLWhiteAndBlackListBox, "listbox");
get(mpOS, "os");
get(mpOSVersion, "osversion");
get(mpPlatformVendor, "platformvendor");
get(mpDevice, "opencldevice");
get(mpDriverVersion, "opencldriverversion");
get(mpListNewButton, "listbox-new");
get(mpListDeleteButton, "listbox-delete");
get(mpTestButton, "test");
get(mpOpenclInfoList, "opencl_list");
get(mpBtnAutomaticSelectionTrue, "automatic_select_true");
get(mpBtnAutomaticSelectionFalse, "automatic_select_false");
@ -174,14 +162,6 @@ ScCalcOptionsDialog::ScCalcOptionsDialog(vcl::Window* pParent, const ScCalcConfi
mpSpinButton->SetModifyHdl(LINK(this, ScCalcOptionsDialog, NumModifiedHdl));
mpEditField->SetModifyHdl(LINK(this, ScCalcOptionsDialog, EditModifiedHdl));
mpOS->SetModifyHdl(LINK(this, ScCalcOptionsDialog, EditModifiedHdl));
mpOSVersion->SetModifyHdl(LINK(this, ScCalcOptionsDialog, EditModifiedHdl));
mpPlatformVendor->SetModifyHdl(LINK(this, ScCalcOptionsDialog, EditModifiedHdl));
mpDevice->SetModifyHdl(LINK(this, ScCalcOptionsDialog, EditModifiedHdl));
mpDriverVersion->SetModifyHdl(LINK(this, ScCalcOptionsDialog, EditModifiedHdl));
mpOpenCLWhiteAndBlackListBox->set_height_request(4* mpOpenCLWhiteAndBlackListBox->GetTextHeight());
mpOpenCLWhiteAndBlackListBox->SetStyle(mpOpenCLWhiteAndBlackListBox->GetStyle() | WB_CLIPCHILDREN | WB_FORCE_MAKEVISIBLE);
mpOpenclInfoList->set_height_request(4* mpOpenclInfoList->GetTextHeight());
mpOpenclInfoList->SetStyle(mpOpenclInfoList->GetStyle() | WB_CLIPCHILDREN | WB_FORCE_MAKEVISIBLE);
@ -214,12 +194,6 @@ ScCalcOptionsDialog::ScCalcOptionsDialog(vcl::Window* pParent, const ScCalcConfi
maCaptionOpenCLSubsetOpCodes = get<vcl::Window>("opencl_subset_opcodes")->GetText();
maDescOpenCLSubsetOpCodes = get<vcl::Window>("opencl_subset_opcodes_desc")->GetText();
maCaptionOpenCLBlackList = get<vcl::Window>("opencl_blacklist")->GetText();
maDescOpenCLBlackList = get<vcl::Window>("opencl_blacklist_desc")->GetText();
maCaptionOpenCLWhiteList = get<vcl::Window>("opencl_whitelist")->GetText();
maDescOpenCLWhiteList = get<vcl::Window>("opencl_whitelist_desc")->GetText();
maSoftware = get<vcl::Window>("software")->GetText();
mpLbSettings->set_height_request(8 * mpLbSettings->GetTextHeight());
@ -230,14 +204,6 @@ ScCalcOptionsDialog::ScCalcOptionsDialog(vcl::Window* pParent, const ScCalcConfi
mpLbSettings->SetSelectHdl(aLink);
mpLbOptionEdit->SetSelectHdl(aLink);
aLink = LINK(this, ScCalcOptionsDialog, OpenCLWhiteAndBlackListSelHdl);
mpOpenCLWhiteAndBlackListBox->SetSelectHdl(aLink);
mpListNewButton->SetClickHdl(LINK(this, ScCalcOptionsDialog, ListNewClickHdl));
mpListDeleteButton->SetClickHdl(LINK(this, ScCalcOptionsDialog, ListDeleteClickHdl));
mpTestButton->SetClickHdl(LINK(this, ScCalcOptionsDialog, TestClickHdl));
aLink = LINK(this, ScCalcOptionsDialog, BtnToggleHdl);
mpBtnTrue->SetToggleHdl(aLink); // Set handler only to the 'True' button.
@ -293,10 +259,10 @@ void ScCalcOptionsDialog::fillOpenCLList()
SvTreeListEntry* pSelectedEntry = NULL;
sc::FormulaGroupInterpreter::fillOpenCLInfo(maPlatformInfo);
for(std::vector<sc::OpenCLPlatformInfo>::iterator it = maPlatformInfo.begin(),
for(std::vector<OpenCLPlatformInfo>::iterator it = maPlatformInfo.begin(),
itEnd = maPlatformInfo.end(); it != itEnd; ++it)
{
for(std::vector<sc::OpenCLDeviceInfo>::iterator
for(std::vector<OpenCLDeviceInfo>::iterator
itr = it->maDevices.begin(), itrEnd = it->maDevices.end(); itr != itrEnd; ++itr)
{
OUString aDeviceId = it->maVendor + " " + itr->maName + " " + itr->maDriver;
@ -320,32 +286,6 @@ void ScCalcOptionsDialog::fillOpenCLList()
SelectedDeviceChanged();
}
namespace {
OUString format(const ScCalcConfig::OpenCLImplMatcher& rImpl)
{
return (rImpl.maOS + " " +
rImpl.maOSVersion + " " +
rImpl.maPlatformVendor + " " +
rImpl.maDevice + " " +
rImpl.maDriverVersion);
}
void fillListBox(ListBox* pListBox, const ScCalcConfig::OpenCLImplMatcherSet& rSet)
{
pListBox->SetUpdateMode(false);
pListBox->Clear();
for (auto i = rSet.cbegin(); i != rSet.cend(); ++i)
{
pListBox->InsertEntry(format(*i), LISTBOX_APPEND);
}
pListBox->SetUpdateMode(true);
}
} // anonymous namespace
#endif
namespace {
@ -386,8 +326,6 @@ void ScCalcOptionsDialog::FillOptionsList()
pModel->Insert(createItem(maCaptionOpenCLSubsetEnabled,toString(maConfig.mbOpenCLSubsetOnly)));
pModel->Insert(createItem(maCaptionOpenCLMinimumFormulaSize,toString(maConfig.mnOpenCLMinimumFormulaGroupSize)));
pModel->Insert(createItem(maCaptionOpenCLSubsetOpCodes,ScOpCodeSetToSymbolicString(maConfig.maOpenCLSubsetOpCodes)));
pModel->Insert(createItem(maCaptionOpenCLBlackList,""));
pModel->Insert(createItem(maCaptionOpenCLWhiteList,""));
fillOpenCLList();
@ -410,7 +348,6 @@ void ScCalcOptionsDialog::SelectionChanged()
mpBtnFalse->Hide();
mpSpinButton->Hide();
mpEditField->Hide();
mpOpenCLWhiteAndBlackListGrid->Hide();
mpLbOptionEdit->Show();
mpOpenclInfoList->GetParent()->Hide();
@ -445,7 +382,6 @@ void ScCalcOptionsDialog::SelectionChanged()
mpBtnFalse->Hide();
mpSpinButton->Hide();
mpEditField->Hide();
mpOpenCLWhiteAndBlackListGrid->Hide();
mpLbOptionEdit->Show();
mpOpenclInfoList->GetParent()->Hide();
@ -482,7 +418,6 @@ void ScCalcOptionsDialog::SelectionChanged()
mpBtnFalse->Show();
mpSpinButton->Hide();
mpEditField->Hide();
mpOpenCLWhiteAndBlackListGrid->Hide();
bool bValue = false;
bool bEnable = true;
@ -546,7 +481,6 @@ void ScCalcOptionsDialog::SelectionChanged()
mpBtnFalse->Hide();
mpSpinButton->Show();
mpEditField->Hide();
mpOpenCLWhiteAndBlackListGrid->Hide();
mpOpenclInfoList->GetParent()->Hide();
mpFtAnnotation->SetText(maDescOpenCLMinimumFormulaSize);
mpSpinButton->SetValue(nValue);
@ -563,38 +497,12 @@ void ScCalcOptionsDialog::SelectionChanged()
mpBtnFalse->Hide();
mpSpinButton->Hide();
mpEditField->Show();
mpOpenCLWhiteAndBlackListGrid->Hide();
mpOpenclInfoList->GetParent()->Hide();
mpFtAnnotation->SetText(maDescOpenCLSubsetOpCodes);
mpEditField->SetText(sValue);
}
break;
// string lists
case CALC_OPTION_OPENCL_BLACKLIST:
case CALC_OPTION_OPENCL_WHITELIST:
{
mpLbOptionEdit->Hide();
mpBtnTrue->Hide();
mpBtnFalse->Hide();
mpSpinButton->Hide();
mpEditField->Hide();
mpOpenCLWhiteAndBlackListGrid->Show();
mpOpenclInfoList->GetParent()->Hide();
#if HAVE_FEATURE_OPENCL
if ( nSelectedPos == CALC_OPTION_OPENCL_WHITELIST )
{
mpFtAnnotation->SetText(maDescOpenCLWhiteList);
fillListBox(mpOpenCLWhiteAndBlackListBox, maConfig.maOpenCLWhiteList);
}
else
{
mpFtAnnotation->SetText(maDescOpenCLBlackList);
fillListBox(mpOpenCLWhiteAndBlackListBox, maConfig.maOpenCLBlackList);
}
#endif
}
break;
}
}
@ -647,8 +555,6 @@ void ScCalcOptionsDialog::ListOptionValueChanged()
case CALC_OPTION_ENABLE_OPENCL_SUBSET:
case CALC_OPTION_OPENCL_MIN_SIZE:
case CALC_OPTION_OPENCL_SUBSET_OPS:
case CALC_OPTION_OPENCL_BLACKLIST:
case CALC_OPTION_OPENCL_WHITELIST:
break;
}
}
@ -671,7 +577,7 @@ void ScCalcOptionsDialog::SelectedDeviceChanged()
if(!pEntry)
return;
sc::OpenCLDeviceInfo* pInfo = reinterpret_cast<sc::OpenCLDeviceInfo*>(pEntry->GetUserData());
OpenCLDeviceInfo* pInfo = reinterpret_cast<OpenCLDeviceInfo*>(pEntry->GetUserData());
if(pInfo)
{
mpFtFrequency->SetText(OUString::number(pInfo->mnFrequency));
@ -726,22 +632,6 @@ void ScCalcOptionsDialog::SpinButtonValueChanged()
maConfig.mnOpenCLMinimumFormulaGroupSize = nVal;
}
ScCalcConfig::OpenCLImplMatcherSet& ScCalcOptionsDialog::CurrentWhiteOrBlackList()
{
return (mpLbSettings->GetSelectEntryPos() == CALC_OPTION_OPENCL_WHITELIST ? maConfig.maOpenCLWhiteList : maConfig.maOpenCLBlackList);
}
const ScCalcConfig::OpenCLImplMatcher& ScCalcOptionsDialog::CurrentWhiteOrBlackListEntry()
{
ScCalcConfig::OpenCLImplMatcherSet& rSet(CurrentWhiteOrBlackList());
auto i = rSet.begin();
int n(mpOpenCLWhiteAndBlackListBox->GetSelectEntryPos());
std::advance(i, n);
return *i;
}
void ScCalcOptionsDialog::EditFieldValueChanged(Control *pCtrl)
{
Edit& rEdit(dynamic_cast<Edit&>(*pCtrl));
@ -754,46 +644,6 @@ void ScCalcOptionsDialog::EditFieldValueChanged(Control *pCtrl)
// the OpenCL subset list of opcodes
maConfig.maOpenCLSubsetOpCodes = ScStringToOpCodeSet(sVal);
}
else
{
// We know that this handler is otherwise currently used only
// for the OpenCL white/blacklists
const ScCalcConfig::OpenCLImplMatcher& impl(CurrentWhiteOrBlackListEntry());
ScCalcConfig::OpenCLImplMatcher newImpl(impl);
if (&rEdit == mpOS)
{
newImpl.maOS = sVal;
}
else if (&rEdit == mpOSVersion)
{
newImpl.maOSVersion = sVal;
}
else if (&rEdit == mpPlatformVendor)
{
newImpl.maPlatformVendor = sVal;
}
else if (&rEdit == mpDevice)
{
newImpl.maDevice = sVal;
}
else if (&rEdit == mpDriverVersion)
{
newImpl.maDriverVersion = sVal;
}
else
assert(false && "rEdit does not match any of the Edit fields");
ScCalcConfig::OpenCLImplMatcherSet& rSet(CurrentWhiteOrBlackList());
rSet.erase(impl);
rSet.insert(newImpl);
#if HAVE_FEATURE_OPENCL
fillListBox(mpOpenCLWhiteAndBlackListBox, rSet);
mpOpenCLWhiteAndBlackListBox->SelectEntry(format(newImpl));
#endif
}
}
OUString ScCalcOptionsDialog::toString(formula::FormulaGrammar::AddressConvention eConv) const
@ -879,54 +729,7 @@ IMPL_LINK(ScCalcOptionsDialog, EditModifiedHdl, Control*, pCtrl)
return 0;
}
IMPL_LINK(ScCalcOptionsDialog, OpenCLWhiteAndBlackListSelHdl, Control*, )
{
// We know this handler is used for the mpOpenCLWhiteAndBlackListBox
const ScCalcConfig::OpenCLImplMatcher& impl(CurrentWhiteOrBlackListEntry());
mpOS->SetText(impl.maOS);
mpOSVersion->SetText(impl.maOSVersion);
mpPlatformVendor->SetText(impl.maPlatformVendor);
mpDevice->SetText(impl.maDevice);
mpDriverVersion->SetText(impl.maDriverVersion);
return 0;
}
IMPL_LINK( ScCalcOptionsDialog, ListNewClickHdl, PushButton*, )
{
ScCalcConfig::OpenCLImplMatcher aEmpty;
ScCalcConfig::OpenCLImplMatcherSet& rSet(CurrentWhiteOrBlackList());
mpOS->SetText("");
mpOSVersion->SetText("");
mpPlatformVendor->SetText("");
mpDevice->SetText("");
mpDriverVersion->SetText("");
rSet.insert(aEmpty);
#if HAVE_FEATURE_OPENCL
fillListBox(mpOpenCLWhiteAndBlackListBox, rSet);
mpOpenCLWhiteAndBlackListBox->SelectEntry(format(aEmpty));
#endif
return 0;
}
IMPL_LINK( ScCalcOptionsDialog, ListDeleteClickHdl, PushButton*, )
{
if (mpOpenCLWhiteAndBlackListBox->GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND)
return 0;
ScCalcConfig::OpenCLImplMatcherSet& rSet(CurrentWhiteOrBlackList());
const ScCalcConfig::OpenCLImplMatcher& rImpl(CurrentWhiteOrBlackListEntry());
#if HAVE_FEATURE_OPENCL
rSet.erase(rImpl);
fillListBox(mpOpenCLWhiteAndBlackListBox, rSet);
#endif
return 0;
}
#if 0
namespace {
@ -1360,4 +1163,6 @@ IMPL_LINK( ScCalcOptionsDialog, TestClickHdl, PushButton*, )
return 0;
}
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View file

@ -25,7 +25,8 @@
#include "calcconfig.hxx"
#if HAVE_FEATURE_OPENCL
#include "platforminfo.hxx"
#include <opencl/openclconfig.hxx>
#include <opencl/platforminfo.hxx>
#endif
class ScCalcOptionsDialog : public ModalDialog
@ -40,10 +41,6 @@ public:
DECL_LINK( DeviceSelHdl, void* );
DECL_LINK( NumModifiedHdl, void * );
DECL_LINK( EditModifiedHdl, Control * );
DECL_LINK( OpenCLWhiteAndBlackListSelHdl, Control* );
DECL_LINK( ListNewClickHdl, PushButton* );
DECL_LINK( ListDeleteClickHdl, PushButton* );
DECL_LINK( TestClickHdl, PushButton* );
const ScCalcConfig& GetConfig() const { return maConfig;}
@ -66,8 +63,8 @@ private:
OUString toString(sal_Int32 nVal) const;
SvTreeListEntry *createItem(const OUString &rCaption, const OUString& sValue) const;
void setValueAt(size_t nPos, const OUString &rString);
std::set<ScCalcConfig::OpenCLImplMatcher>& CurrentWhiteOrBlackList();
const ScCalcConfig::OpenCLImplMatcher& CurrentWhiteOrBlackListEntry();
OpenCLConfig::ImplMatcherSet& CurrentWhiteOrBlackList();
const OpenCLConfig::ImplMatcher& CurrentWhiteOrBlackListEntry();
private:
SvxCheckListBox* mpLbSettings;
@ -77,16 +74,6 @@ private:
RadioButton* mpBtnFalse;
NumericField* mpSpinButton;
Edit* mpEditField;
VclGrid* mpOpenCLWhiteAndBlackListGrid;
ListBox* mpOpenCLWhiteAndBlackListBox;
Edit* mpOS;
Edit* mpOSVersion;
Edit* mpPlatformVendor;
Edit* mpDevice;
Edit* mpDriverVersion;
PushButton* mpListNewButton;
PushButton* mpListDeleteButton;
PushButton* mpTestButton;
FixedText* mpFtAnnotation;
FixedText* mpFtFrequency;
@ -128,17 +115,11 @@ private:
OUString maCaptionOpenCLSubsetOpCodes;
OUString maDescOpenCLSubsetOpCodes;
OUString maCaptionOpenCLWhiteList;
OUString maDescOpenCLWhiteList;
OUString maCaptionOpenCLBlackList;
OUString maDescOpenCLBlackList;
OUString maSoftware;
ScCalcConfig maConfig;
#if HAVE_FEATURE_OPENCL
std::vector<sc::OpenCLPlatformInfo> maPlatformInfo;
std::vector<OpenCLPlatformInfo> maPlatformInfo;
#endif
bool mbSelectedEmptyStringAsZero;

View file

@ -58,6 +58,7 @@
#include <comphelper/servicehelper.hxx>
#include <comphelper/string.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <opencl/platforminfo.hxx>
#include "docuno.hxx"
#include "cellsuno.hxx"
@ -93,7 +94,6 @@
#include "sheetevents.hxx"
#include "sc.hrc"
#include "scresid.hxx"
#include "platforminfo.hxx"
#include "interpre.hxx"
#include "formulagroup.hxx"
#include "gridwin.hxx"
@ -2369,7 +2369,7 @@ void ScModelObj::selectOpenCLDevice( sal_Int32 nPlatform, sal_Int32 nDevice )
if(nPlatform < 0 || nDevice < 0)
throw uno::RuntimeException();
std::vector<sc::OpenCLPlatformInfo> aPlatformInfo;
std::vector<OpenCLPlatformInfo> aPlatformInfo;
sc::FormulaGroupInterpreter::fillOpenCLInfo(aPlatformInfo);
if(size_t(nPlatform) >= aPlatformInfo.size())
throw uno::RuntimeException();
@ -2402,7 +2402,7 @@ sal_Int32 ScModelObj::getDeviceID()
uno::Sequence< sheet::opencl::OpenCLPlatform > ScModelObj::getOpenCLPlatforms()
throw (uno::RuntimeException, std::exception)
{
std::vector<sc::OpenCLPlatformInfo> aPlatformInfo;
std::vector<OpenCLPlatformInfo> aPlatformInfo;
sc::FormulaGroupInterpreter::fillOpenCLInfo(aPlatformInfo);
uno::Sequence<sheet::opencl::OpenCLPlatform> aRet(aPlatformInfo.size());
@ -2414,7 +2414,7 @@ uno::Sequence< sheet::opencl::OpenCLPlatform > ScModelObj::getOpenCLPlatforms()
aRet[i].Devices.realloc(aPlatformInfo[i].maDevices.size());
for(size_t j = 0; j < aPlatformInfo[i].maDevices.size(); ++j)
{
const sc::OpenCLDeviceInfo& rDevice = aPlatformInfo[i].maDevices[j];
const OpenCLDeviceInfo& rDevice = aPlatformInfo[i].maDevices[j];
aRet[i].Devices[j].Name = rDevice.maName;
aRet[i].Devices[j].Vendor = rDevice.maVendor;
aRet[i].Devices[j].Driver = rDevice.maDriver;

View file

@ -184,210 +184,6 @@
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkGrid" id="listgrid">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<child>
<object class="GtkTreeView" id="listbox:border">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="orientation">vertical</property>
<property name="vexpand">True</property>
<property name="row_spacing">6</property>
<child>
<object class="GtkLabel" id="oslabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">OS</property>
<property name="mnemonic_widget">os:border</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="os:border">
<property name="visible">True</property>
<property name="can_focus">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="osversionlabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">OS Version</property>
<property name="mnemonic_widget">osversion:border</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="osversion:border">
<property name="visible">True</property>
<property name="can_focus">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="platformvendorlabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">OpenCL Platform Vendor</property>
<property name="mnemonic_widget">platformvendor:border</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">4</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="platformvendor:border">
<property name="visible">True</property>
<property name="can_focus">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">5</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="opencldevicelabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">OpenCL Device</property>
<property name="mnemonic_widget">opencldevice:border</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">6</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="opencldevice:border">
<property name="visible">True</property>
<property name="can_focus">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">7</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="opencldriverversionlabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">OpenCL Driver Version</property>
<property name="mnemonic_widget">opencldriverversion:border</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">8</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="opencldriverversion:border">
<property name="visible">True</property>
<property name="can_focus">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">9</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkButtonBox" id="listbox-action_area1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<property name="layout_style">start</property>
<child>
<object class="GtkButton" id="listbox-new">
<property name="label" translatable="yes">_New...</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="listbox-delete">
<property name="label" translatable="yes">_Delete</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkButton" id="test">
<property name="label" translatable="yes">_Test</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">0</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">5</property>
<property name="top_attach">0</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">1</property>
@ -653,62 +449,6 @@
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="opencl_blacklist">
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="label" translatable="yes">OpenCL implementation blacklist</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">21</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="opencl_blacklist_desc">
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="label" translatable="yes">List of OpenCL implementations known to be not good enough for LibreOffice. All the fields except OS are regular expressions.</property>
<property name="wrap">True</property>
<property name="max_width_chars">56</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">22</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="opencl_whitelist">
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="label" translatable="yes">OpenCL implementation whitelist</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">23</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="opencl_whitelist_desc">
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="label" translatable="yes">List of OpenCL implementations known to be usable by LibreOffice. All the fields except OS are regular expressions.</property>
<property name="wrap">True</property>
<property name="max_width_chars">56</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">25</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkGrid" id="grid6">
<property name="can_focus">False</property>