LibreOffice Module opencl (master) 1
OpenCLZone.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
9
11#include <opencl/OpenCLZone.hxx>
12#include <opencl_device.hxx>
13
14#include <memory>
15
16#include <officecfg/Office/Common.hxx>
17#include <com/sun/star/util/XFlushable.hpp>
18#include <com/sun/star/configuration/theDefaultProvider.hpp>
19
25{
26 // protect ourselves from double calling etc.
27 static bool bDisabled = false;
28 if (bDisabled)
29 return;
30
31 bDisabled = true;
32
33 std::shared_ptr<comphelper::ConfigurationChanges> xChanges(
35 officecfg::Office::Common::Misc::UseOpenCL::set(false, xChanges);
36 xChanges->commit();
37
38 // Force synchronous config write
39 auto xConfProvider
40 = css::configuration::theDefaultProvider::get(comphelper::getProcessComponentContext());
41 css::uno::Reference<css::util::XFlushable> xFlushable(xConfProvider, css::uno::UNO_QUERY_THROW);
42 xFlushable->flush();
43
45}
46
47/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static void hardDisable()
Called from a signal handler if we get a crash or hang in some CL code.
Definition: OpenCLZone.cxx:24
static std::shared_ptr< ConfigurationChanges > create()
Reference< XComponentContext > getProcessComponentContext()
void releaseOpenCLEnv(openclwrapper::GPUEnv *gpuInfo)