summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToma┼ż Vajngerl <tomaz.vajngerl@collabora.com>2016-09-19 18:03:47 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-09-20 10:29:46 +0000
commit33cce7003da859fa88fd770f98fefeb8717996c2 (patch)
treefad971b26c524994fc147d1ca32f45ccf2b26529
parent097f34e6411248856cfc78ffe80571aa2a876bff (diff)
tdf#102295: relax timeout timings for the GL watchdog
Some OS/GPU combinations need more relaxed watchdog timeout timings as the shader compilation takes too long to complete. Contains also the following commits: tdf#102295: The relaxed values were actually too pessimistic. tdf#102295: AMD actually has two vendor id's. Change-Id: Ifd9ff7ecfa4b004d5411d6d364dd01a389a3fcec (cherry picked from commit e5c3c69423c0f32bf4bee147936e58ba4d3be181) Reviewed-on: https://gerrit.libreoffice.org/29041 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
-rw-r--r--vcl/inc/opengl/watchdog.hxx36
-rw-r--r--vcl/inc/opengl/zone.hxx1
-rw-r--r--vcl/source/opengl/OpenGLHelper.cxx55
3 files changed, 79 insertions, 13 deletions
diff --git a/vcl/inc/opengl/watchdog.hxx b/vcl/inc/opengl/watchdog.hxx
index 0213efb7d668..ced3cf23fbd6 100644
--- a/vcl/inc/opengl/watchdog.hxx
+++ b/vcl/inc/opengl/watchdog.hxx
@@ -14,6 +14,42 @@
#include <sal/types.h>
#include <rtl/ref.hxx>
#include <salhelper/thread.hxx>
+#include <osl/mutex.hxx>
+
+struct WatchdogTimings
+{
+ osl::Mutex maMutex;
+
+ int mnMode;
+
+ /// delays to take various actions in 1/4 of a second increments.
+ std::vector<int> maDisableEntries;
+ std::vector<int> maAbortAfter;
+
+ WatchdogTimings();
+
+ void relax();
+
+ int getMode()
+ {
+ return mnMode;
+ }
+
+ void setMode(int nMode)
+ {
+ mnMode = nMode;
+ }
+
+ int getDisableEntries()
+ {
+ return maDisableEntries[mnMode];
+ }
+
+ int getAbortAfter()
+ {
+ return maAbortAfter[mnMode];
+ }
+};
class OpenGLWatchdogThread : private salhelper::Thread
{
diff --git a/vcl/inc/opengl/zone.hxx b/vcl/inc/opengl/zone.hxx
index 11f6ed00ec3c..65a7249b16b2 100644
--- a/vcl/inc/opengl/zone.hxx
+++ b/vcl/inc/opengl/zone.hxx
@@ -38,6 +38,7 @@ public:
~OpenGLZone() { gnLeaveCount++; }
static bool isInZone() { return gnEnterCount != gnLeaveCount; }
static void hardDisable();
+ static void relaxWatchdogTimings();
};
/// Create this to not only enter the zone, but set VCL context.
diff --git a/vcl/source/opengl/OpenGLHelper.cxx b/vcl/source/opengl/OpenGLHelper.cxx
index 5dff6894494d..6b58a4d0c83d 100644
--- a/vcl/source/opengl/OpenGLHelper.cxx
+++ b/vcl/source/opengl/OpenGLHelper.cxx
@@ -780,6 +780,13 @@ bool OpenGLHelper::isDeviceBlacklisted()
#elif defined( _WIN32 )
WinOpenGLDeviceInfo aInfo;
bBlacklisted = aInfo.isDeviceBlocked();
+
+ if (aInfo.GetWindowsVersion() == 0x00060001 && /* Windows 7 */
+ (aInfo.GetAdapterVendorID() == "0x1002" || aInfo.GetAdapterVendorID() == "0x1022")) /* AMD */
+ {
+ SAL_INFO("vcl.opengl", "Relaxing watchdog timings.");
+ OpenGLZone::relaxWatchdogTimings();
+ }
#else
bBlacklisted = false;
#endif
@@ -806,9 +813,27 @@ void OpenGLZone::leave() { gnLeaveCount++; }
namespace {
static volatile bool gbWatchdogFiring = false;
static oslCondition gpWatchdogExit = nullptr;
+ static WatchdogTimings gWatchdogTimings;
static rtl::Reference<OpenGLWatchdogThread> gxWatchdog;
}
+WatchdogTimings::WatchdogTimings()
+ : mnMode(0)
+ , maDisableEntries({ 6 /* 1.5s */, 20 /* 5s */ })
+ , maAbortAfter({ 20 /* 5s */, 120 /* 30s */ })
+{}
+
+void WatchdogTimings::relax()
+{
+ osl::MutexGuard g(maMutex);
+
+ maDisableEntries[0] = 60; /* 15s */
+ maDisableEntries[1] = 60; /* 15s */
+
+ maAbortAfter[0] = 240; /* 60s */
+ maAbortAfter[1] = 240; /* 60s */
+}
+
OpenGLWatchdogThread::OpenGLWatchdogThread()
: salhelper::Thread("OpenGL Watchdog")
{
@@ -816,25 +841,24 @@ OpenGLWatchdogThread::OpenGLWatchdogThread()
void OpenGLWatchdogThread::execute()
{
- // delays to take various actions in 1/4 of a second increments.
- static const int nDisableEntries[2] = { 6 /* 1.5s */, 20 /* 5s */ };
- static const int nAbortAfter[2] = { 20 /* 10s */, 120 /* 30s */ };
-
int nUnchanged = 0; // how many unchanged nEnters
- TimeValue aHalfSecond(0, 1000*1000*1000*0.25);
+ TimeValue aQuarterSecond(0, 1000*1000*1000*0.25);
bool bAbortFired = false;
do {
sal_uInt64 nLastEnters = OpenGLZone::gnEnterCount;
- osl_waitCondition(gpWatchdogExit, &aHalfSecond);
+ osl_waitCondition(gpWatchdogExit, &aQuarterSecond);
if (OpenGLZone::isInZone())
{
- int nType = 0;
+ osl::MutexGuard g(gWatchdogTimings.maMutex);
+
// The shader compiler can take a long time, first time.
if (gbInShaderCompile)
- nType = 1;
+ gWatchdogTimings.setMode(1);
+ else
+ gWatchdogTimings.setMode(0);
if (nLastEnters == OpenGLZone::gnEnterCount)
nUnchanged++;
@@ -843,12 +867,12 @@ void OpenGLWatchdogThread::execute()
SAL_INFO("vcl.opengl", "GL watchdog - unchanged " <<
nUnchanged << " enter count " <<
OpenGLZone::gnEnterCount << " type " <<
- (nType ? "in shader" : "normal gl") <<
- "breakpoints mid: " << nDisableEntries[nType] <<
- " max " << nAbortAfter[nType]);
+ (gWatchdogTimings.getMode() ? "in shader" : "normal gl") <<
+ "breakpoints mid: " << gWatchdogTimings.getDisableEntries() <<
+ " max " << gWatchdogTimings.getAbortAfter());
// Not making progress
- if (nUnchanged >= nDisableEntries[nType])
+ if (nUnchanged >= gWatchdogTimings.getDisableEntries())
{
static bool bFired = false;
if (!bFired)
@@ -869,7 +893,7 @@ void OpenGLWatchdogThread::execute()
}
// Not making even more progress
- if (nUnchanged >= nAbortAfter[nType])
+ if (nUnchanged >= gWatchdogTimings.getAbortAfter())
{
if (!bAbortFired)
{
@@ -943,6 +967,11 @@ void OpenGLZone::hardDisable()
}
}
+void OpenGLZone::relaxWatchdogTimings()
+{
+ gWatchdogTimings.relax();
+}
+
OpenGLVCLContextZone::OpenGLVCLContextZone()
{
OpenGLContext::makeVCLCurrent();