From 397ad713cf9bc951b4882ca4b6baeb57541e318c Mon Sep 17 00:00:00 2001 From: Luboš Luňák Date: Tue, 4 Feb 2020 17:28:10 +0100 Subject: merge OpenGLZone and OpenCLZone into one generic code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- include/opencl/OpenCLZone.hxx | 42 ++++++++---------------------------------- 1 file changed, 8 insertions(+), 34 deletions(-) (limited to 'include/opencl') 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 -#include -#include - #include -// 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 +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 -- cgit