diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2015-08-25 11:44:41 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2015-08-25 17:08:46 +0000 |
commit | 74bc7cb59c1bc3f7acdb4d1492fe563ebcefee6c (patch) | |
tree | ace620d6fc0b106045e45c96dee94dfcadedb5d6 /vcl/workben | |
parent | 7bb7539c0e34283baeaacf7e4ff0b19287afadc2 (diff) |
tdf#93614 - detect hanging OpenGL drivers with a watchdog.
If an OpenGL zone takes >2s to make progress, disable OpenGL.
If an OpenGL zone takes >5s to make progress, abort the app.
Change-Id: I776c06a3f8ba460ff9842a9130c21f9ee2147eee
Reviewed-on: https://gerrit.libreoffice.org/17986
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'vcl/workben')
-rw-r--r-- | vcl/workben/vcldemo.cxx | 69 |
1 files changed, 68 insertions, 1 deletions
diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx index c58ae4e9309e..e9c22eb1ab5c 100644 --- a/vcl/workben/vcldemo.cxx +++ b/vcl/workben/vcldemo.cxx @@ -41,6 +41,7 @@ #include <basegfx/numeric/ftools.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> #include <vcldemo-debug.hxx> +#include <opengl/zone.hxx> #include <rtl/math.hxx> @@ -1457,13 +1458,23 @@ class DemoWidgets : public WorkWindow VclPtr<VclBox> mpBox; VclPtr<ToolBox> mpToolbox; VclPtr<PushButton> mpButton; + VclPtr<VclHBox> mpHBox; + VclPtr<CheckBox> mpGLCheck; + VclPtr<ComboBox> mpGLCombo; + VclPtr<PushButton> mpGLButton; + + DECL_LINK(GLTestClick, void *); public: DemoWidgets() : WorkWindow(NULL, WB_APP | WB_STDWORK), mpBox(VclPtrInstance<VclVBox>(this, false, 3)), mpToolbox(VclPtrInstance<ToolBox>(mpBox.get())), - mpButton(VclPtrInstance<PushButton>(mpBox.get())) + mpButton(VclPtrInstance<PushButton>(mpBox.get())), + mpHBox(VclPtrInstance<VclHBox>(mpBox.get(), true, 3)), + mpGLCheck(VclPtrInstance<CheckBox>(mpHBox.get())), + mpGLCombo(VclPtrInstance<ComboBox>(mpHBox.get())), + mpGLButton(VclPtrInstance<PushButton>(mpHBox.get())) { SetText("VCL widget demo"); @@ -1484,11 +1495,27 @@ public: mpButton->SetText("Click me; go on"); mpButton->Show(); + mpGLCheck->SetText("Test in OGL zone"); + mpGLCheck->Show(); + mpGLCombo->InsertEntry("sleep 1 second"); + mpGLCombo->InsertEntry("sleep 3 seconds"); + mpGLCombo->InsertEntry("sleep 7 seconds"); + mpGLCombo->SelectEntryPos(2); + mpGLCombo->Show(); + mpGLButton->SetText("Execute test"); + mpGLButton->SetClickHdl(LINK(this,DemoWidgets,GLTestClick)); + mpGLButton->Show(); + mpHBox->Show(); + Show(); } virtual ~DemoWidgets() { disposeOnce(); } virtual void dispose() SAL_OVERRIDE { + mpGLButton.disposeAndClear(); + mpGLCombo.disposeAndClear(); + mpGLCheck.disposeAndClear(); + mpHBox.disposeAndClear(); mpToolbox.disposeAndClear(); mpButton.disposeAndClear(); mpBox.disposeAndClear(); @@ -1521,6 +1548,46 @@ public: } }; +class OpenGLZoneTest { +public: + static void enter() { OpenGLZone::enter(); } + static void leave() { OpenGLZone::leave(); } +}; + +IMPL_LINK_NOARG(DemoWidgets,GLTestClick) +{ + sal_Int32 nSelected = mpGLCombo->GetSelectEntryPos(); + + TimeValue aDelay; + aDelay.Seconds = 0; + aDelay.Nanosec = 0; + switch (nSelected) + { + case 0: + aDelay.Seconds = 1; + break; + case 1: + aDelay.Seconds = 3; + break; + case 2: + aDelay.Seconds = 7; + break; + default: + break; + } + + bool bEnterLeave = mpGLCheck->IsChecked(); + if (bEnterLeave) + OpenGLZoneTest::enter(); + + osl_waitThread(&aDelay); + + if (bEnterLeave) + OpenGLZoneTest::leave(); + + return 0; +} + class DemoPopup : public FloatingWindow { public: |