Kaydet (Commit) 32881f01 authored tarafından Tor Lillqvist's avatar Tor Lillqvist

tdf#100965: Restart on initialisation-time OpenCL crash

Add a flag to the OpenCLZone indicating whether we are performing the
first-start OpenCL functionality verification, so that if we run into
a crash that is caught by the VCL VCLExceptionSignal_impl() handler,
we terminate the process with the EXITHELPER_NORMAL_RESTART
status after first having disabled OpenCL use. The wrapper process will
then restart soffice.bin. This is for Windows only so far.

This matches what we do if OpenGL fails early during start of
LibreOffice.

Change-Id: Ibb9bf3a86b7521bf16728de2a118ad4323be674b
Reviewed-on: https://gerrit.libreoffice.org/28086Reviewed-by: 's avatarTor Lillqvist <tml@collabora.com>
Tested-by: 's avatarTor Lillqvist <tml@collabora.com>
üst 7ffe3d74
......@@ -125,6 +125,7 @@ void Desktop::CheckOpenCLCompute(const Reference< XDesktop2 > &xDesktop)
SAL_INFO("opencl", "Initiating test of OpenCL device");
OpenCLZone aZone;
OpenCLZone::enterInitialTest();
OUString aDevice = officecfg::Office::Calc::Formula::Calculation::OpenCLDevice::get();
OUString aSelectedCLDeviceVersionID;
......
......@@ -19,6 +19,7 @@ class OPENCL_DLLPUBLIC OpenCLZone
static volatile sal_uInt64 gnEnterCount;
/// how many times have we left a new CL zone
static volatile sal_uInt64 gnLeaveCount;
static volatile bool gbInInitialTest;
public:
OpenCLZone()
......@@ -29,6 +30,8 @@ public:
~OpenCLZone()
{
gnLeaveCount++;
if (!isInZone())
gbInInitialTest = false;
}
static bool isInZone()
......@@ -36,7 +39,13 @@ public:
return gnEnterCount != gnLeaveCount;
}
static bool isInInitialTest()
{
return gbInInitialTest;
}
static void hardDisable();
static void enterInitialTest();
};
#endif // INCLUDED_OPENCL_INC_OPENCL_ZONE_HXX
......
......@@ -21,6 +21,7 @@
sal_uInt64 volatile OpenCLZone::gnEnterCount = 0;
sal_uInt64 volatile OpenCLZone::gnLeaveCount = 0;
bool volatile OpenCLZone::gbInInitialTest = false;
/**
* Called from a signal handler if we get
......@@ -47,4 +48,9 @@ void OpenCLZone::hardDisable()
}
}
void OpenCLZone::enterInitialTest()
{
gbInInitialTest = true;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -24,6 +24,8 @@
#include <osl/file.hxx>
#include <osl/signal.h>
#include <desktop/exithelper.h>
#include <tools/debug.hxx>
#include <tools/resmgr.hxx>
......@@ -123,7 +125,13 @@ oslSignalAction SAL_CALL VCLExceptionSignal_impl( void* /*pData*/, oslSignalInfo
#endif
#if HAVE_FEATURE_OPENCL
if (OpenCLZone::isInZone())
{
OpenCLZone::hardDisable();
#ifdef _WIN32
if (OpenCLZone::isInInitialTest())
TerminateProcess(GetCurrentProcess(), EXITHELPER_NORMAL_RESTART);
#endif
}
#endif
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment