summaryrefslogtreecommitdiffstats
path: root/include/opencl
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2020-02-04 17:28:10 +0100
committerLuboš Luňák <l.lunak@collabora.com>2020-02-07 09:11:32 +0100
commit397ad713cf9bc951b4882ca4b6baeb57541e318c (patch)
tree2096facd2ea8432972d6354f960c528fa0f48a6a /include/opencl
parentremove use of macro DeclPrimitive2DIDBlock in everywhere (diff)
downloadcore-397ad713cf9bc951b4882ca4b6baeb57541e318c.tar.gz
core-397ad713cf9bc951b4882ca4b6baeb57541e318c.zip
merge OpenGLZone and OpenCLZone into one generic code
To be used also by Skia code to detect problems with Vulkan drivers. The watchdog does not handle OpenCL because neither did the original code, but also because OpenCLZone::hardDisable() called from it would deadlock on SolarMutex for some reason. Change-Id: I483d8cb0b11a4e1e65c564f4e4c29ab68843ff71 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88008 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'include/opencl')
-rw-r--r--include/opencl/OpenCLZone.hxx42
1 files changed, 8 insertions, 34 deletions
diff --git a/include/opencl/OpenCLZone.hxx b/include/opencl/OpenCLZone.hxx
index 50d0f81c3191..1bbf3a46161c 100644
--- a/include/opencl/OpenCLZone.hxx
+++ b/include/opencl/OpenCLZone.hxx
@@ -12,45 +12,19 @@
#include <sal/config.h>
-#include <cassert>
-#include <csignal>
-
#include <opencl/opencldllapi.h>
-// FIXME: post back-port, templatize me and share with OpenGLZone.
-class OPENCL_DLLPUBLIC OpenCLZone
-{
- /// how many times have we entered a CL zone and not yet left it
- static volatile std::sig_atomic_t gnEnterCount;
- static volatile bool gbInInitialTest;
+#include <comphelper/crashzone.hxx>
+class OPENCL_DLLPUBLIC OpenCLZone : public CrashZone< OpenCLZone >
+{
public:
- OpenCLZone()
- {
- gnEnterCount = gnEnterCount + 1; //TODO: overflow
- }
-
- ~OpenCLZone()
- {
- // coverity[assert_side_effect]
- assert(gnEnterCount > 0);
- gnEnterCount = gnEnterCount - 1;
- if (!isInZone())
- gbInInitialTest = false;
- }
-
- static bool isInZone()
- {
- return gnEnterCount > 0;
- }
-
- static bool isInInitialTest()
- {
- return gbInInitialTest;
- }
-
static void hardDisable();
- static void enterInitialTest();
+};
+
+// Used during initial testing of OpenCL.
+class OPENCL_DLLPUBLIC OpenCLInitialZone : public CrashZone< OpenCLInitialZone >
+{
};
#endif // INCLUDED_OPENCL_INC_OPENCL_ZONE_HXX