vcl/source/opengl/OpenGLContext.cxx |  188 +++++++++++++++++-------------------
 1 file changed, 91 insertions(+), 97 deletions(-)

New commits:
commit 9d0e0ab8bd030b6560e97b245df4c0e94fb3ee7f
Author: Jan Holesovsky <ke...@collabora.com>
Date:   Mon May 30 17:57:10 2016 +0200

    Switch deterministic scheduling on.
    
    Change-Id: Ie735d6456086933eb84a6088782ee55f1c1ef185

diff --git a/vcl/source/app/scheduler.cxx b/vcl/source/app/scheduler.cxx
index efb65ca..3f7e0bf6 100644
--- a/vcl/source/app/scheduler.cxx
+++ b/vcl/source/app/scheduler.cxx
@@ -174,7 +174,7 @@ bool Scheduler::ProcessTaskScheduling( bool bTimerOnly )
         return false;
 }
 
-static bool g_bDeterministicMode = false;
+static bool g_bDeterministicMode = true;
 
 void Scheduler::SetDeterministicMode(bool bDeterministic)
 {
commit a6eced6fd6c866a3e94862e2665efe1282eb86ee
Author: Jan Holesovsky <ke...@collabora.com>
Date:   Mon May 30 17:36:37 2016 +0200

    tdf#100092: Implement deterministic scheduling.
    
    With this, two subsequent runs of LibreOffice trigger about the same amount 
of
    events.
    
    Change-Id: I92566ef4eee20e7d604cfd48f01c4df30c77e653

diff --git a/include/vcl/scheduler.hxx b/include/vcl/scheduler.hxx
index 95303ee..ee83c1e 100644
--- a/include/vcl/scheduler.hxx
+++ b/include/vcl/scheduler.hxx
@@ -53,6 +53,7 @@ protected:
     // These should be constexpr static, when supported.
     static const sal_uInt64 ImmediateTimeoutMs = 1;
     static const sal_uInt64 MaximumTimeoutMs = 1000 * 60; // 1 minute
+    static const sal_uInt64 InfiniteTimeoutMs = 1000 * 60 * 60 * 24; // 1 day
 
     static void ImplStartTimer(sal_uInt64 nMS, bool bForce = false);
 
@@ -90,7 +91,7 @@ public:
     Scheduler&      operator=( const Scheduler& rScheduler );
     static void ImplDeInitScheduler();
 
-    // Process one pending Timer with highhest priority
+    /// Process one pending Timer with highhest priority
     static void CallbackTaskScheduling( bool ignore );
     /// Calculate minimum timeout - and return its value.
     static sal_uInt64 CalculateMinimumTimeout( bool &bHasActiveIdles );
@@ -98,6 +99,12 @@ public:
     static bool       ProcessTaskScheduling( bool bTimerOnly );
     /// Process all events until we are idle
     static void       ProcessEventsToIdle();
+
+    /// Control the deterministic mode.  In this mode, two subsequent runs of
+    /// LibreOffice fire about the same amount idles.
+    static void SetDeterministicMode(bool bDeterministic);
+    /// Return the current state of deterministic mode.
+    static bool GetDeterministicMode();
 };
 
 #endif // INCLUDED_VCL_SCHEDULER_HXX
diff --git a/vcl/source/app/idle.cxx b/vcl/source/app/idle.cxx
index 123f37a..587e05f 100644
--- a/vcl/source/app/idle.cxx
+++ b/vcl/source/app/idle.cxx
@@ -44,7 +44,23 @@ Idle::Idle( const Idle& rIdle ) : Scheduler(rIdle)
 void Idle::Start()
 {
     Scheduler::Start();
-    Scheduler::ImplStartTimer(Scheduler::ImmediateTimeoutMs);
+
+    sal_uInt64 nPeriod = Scheduler::ImmediateTimeoutMs;
+    if (Scheduler::GetDeterministicMode())
+    {
+        switch (mePriority)
+        {
+            case SchedulerPriority::LOW:
+            case SchedulerPriority::LOWER:
+            case SchedulerPriority::LOWEST:
+                nPeriod = Scheduler::InfiniteTimeoutMs;
+                break;
+            default:
+                break;
+        }
+    }
+
+    Scheduler::ImplStartTimer(nPeriod);
 }
 
 bool Idle::ReadyForSchedule( bool bTimerOnly, sal_uInt64 /* nTimeNow */ ) const
@@ -67,6 +83,15 @@ sal_uInt64 Idle::UpdateMinPeriod( sal_uInt64 nMinPeriod, 
sal_uInt64 /* nTime */
     case SchedulerPriority::REPAINT:
         nMinPeriod = ImmediateTimeoutMs; // don't wait.
         break;
+    case SchedulerPriority::LOW:
+    case SchedulerPriority::LOWER:
+    case SchedulerPriority::LOWEST:
+        if (Scheduler::GetDeterministicMode())
+        {
+            nMinPeriod = Scheduler::InfiniteTimeoutMs;
+            break;
+        }
+        // fall-through intended
     default:
         // FIXME: tdf#92036 workaround, I should be 1 too - wait 5ms
         if (nMinPeriod > 5) // only shrink the min. period if nothing is 
quicker.
diff --git a/vcl/source/app/scheduler.cxx b/vcl/source/app/scheduler.cxx
index 879ca42..efb65ca 100644
--- a/vcl/source/app/scheduler.cxx
+++ b/vcl/source/app/scheduler.cxx
@@ -174,6 +174,18 @@ bool Scheduler::ProcessTaskScheduling( bool bTimerOnly )
         return false;
 }
 
+static bool g_bDeterministicMode = false;
+
+void Scheduler::SetDeterministicMode(bool bDeterministic)
+{
+    g_bDeterministicMode = bDeterministic;
+}
+
+bool Scheduler::GetDeterministicMode()
+{
+    return g_bDeterministicMode;
+}
+
 sal_uInt64 Scheduler::CalculateMinimumTimeout( bool &bHasActiveIdles )
 {
     // process all pending Tasks
commit 610b501ebb0f4608baedd4363b26dfd401d9f757
Author: Tor Lillqvist <t...@collabora.com>
Date:   Mon May 30 21:40:45 2016 +0300

    On Windows, compile OpenGL shaders in advance and disable on failure
    
    (Move wrongly placed code snippet -
    fix for 45683b62a696302da5fa9a6f26adad561125b338)
    
        This is a combination of multiple commits:
    
        Don't claim to be reading a file before trying to open it
    
        Avoid redundancy: The same information was logged in readProgramBinary()
    
        Use VCL_GL_INFO here
    
        Failing to open a cached shader binary is a no reason for a
        SAL_WARN. It is normal that they don't exist when first trying, that
        is the very nature of a 'cache'.
    
        Move exithelper.h to include
    
        We will want to use EXITHELPER_CRASH_WITH_RESTART in vcl, too.
    
        If the shader compilation or loading of an already compiled shader
        fails, disable OpenGL in the registry and exit with the
        EXITHELPER_CRASH_WITH_RESTART status. The wrapper process will thus
        run soffice.bin once more, and this time OpenGL will not be used.
    
    Change-Id: Icee67f0e86effd5636861c3bdcf52685eaf01b99

diff --git a/vcl/source/opengl/OpenGLContext.cxx 
b/vcl/source/opengl/OpenGLContext.cxx
index 1e59d37..da2553e 100644
--- a/vcl/source/opengl/OpenGLContext.cxx
+++ b/vcl/source/opengl/OpenGLContext.cxx
@@ -714,101 +714,6 @@ bool GLWindow::HasGLXExtension( const char* name ) const
     return checkExtension( reinterpret_cast<const GLubyte*>(name), 
reinterpret_cast<const GLubyte*>(GLXExtensions) );
 }
 
-#ifdef WNT
-
-namespace
-{
-
-bool tryShaders(const OUString& rVertexShader, const OUString& 
rFragmentShader, const OUString& rGeometryShader = "")
-{
-    GLint nId;
-
-    // Somewhat mysteriously, the OpenGLHelper::LoadShaders() API saves a 
compiled binary of the
-    // shader only if you give it the digest of the shaders. We have API to 
calculate the digest
-    // only of the combination of vertex and fragment (but not geometry) 
shader. So if we have a
-    // geometry shader, we should not save the binary.
-    if (rGeometryShader.isEmpty())
-        nId = OpenGLHelper::LoadShaders(rVertexShader, rFragmentShader, 
rGeometryShader, "", OpenGLHelper::GetDigest( rVertexShader, rFragmentShader, 
""));
-    else
-        nId = OpenGLHelper::LoadShaders(rVertexShader, rFragmentShader, 
rGeometryShader);
-    if (!nId)
-        return false;
-    glDeleteProgram(nId);
-    return glGetError() == GL_NO_ERROR;
-}
-
-bool compiledShaderBinariesWork()
-{
-    static bool bBeenHere = false;
-    static bool bResult;
-
-    if (bBeenHere)
-        return bResult;
-
-    bBeenHere = true;
-
-    bResult =
-        (
-#if 0 // Only look at shaders used by vcl for now
-         // canvas
-         tryShaders("dummyVertexShader", 
"linearMultiColorGradientFragmentShader") &&
-         tryShaders("dummyVertexShader", 
"linearTwoColorGradientFragmentShader") &&
-         tryShaders("dummyVertexShader", 
"radialMultiColorGradientFragmentShader") &&
-         tryShaders("dummyVertexShader", 
"radialTwoColorGradientFragmentShader") &&
-         tryShaders("dummyVertexShader", 
"rectangularMultiColorGradientFragmentShader") &&
-         tryShaders("dummyVertexShader", 
"rectangularTwoColorGradientFragmentShader") &&
-         // chart2
-         (GLEW_VERSION_3_3 ?
-          (tryShaders("shape3DVertexShader", "shape3DFragmentShader") &&
-           tryShaders("shape3DVertexShaderBatchScroll", 
"shape3DFragmentShaderBatchScroll") &&
-           tryShaders("shape3DVertexShaderBatch", 
"shape3DFragmentShaderBatch") &&
-           tryShaders("textVertexShaderBatch", "textFragmentShaderBatch")) :
-          (tryShaders("shape3DVertexShaderV300", 
"shape3DFragmentShaderV300"))) &&
-         tryShaders("textVertexShader", "textFragmentShader") &&
-         tryShaders("screenTextVertexShader", "screenTextFragmentShader") &&
-         tryShaders("commonVertexShader", "commonFragmentShader") &&
-         tryShaders("pickingVertexShader", "pickingFragmentShader") &&
-         tryShaders("backgroundVertexShader", "backgroundFragmentShader") &&
-         tryShaders("symbolVertexShader", "symbolFragmentShader") &&
-         tryShaders("symbolVertexShader", "symbolFragmentShader") &&
-         // slideshow
-         tryShaders("reflectionVertexShader", "reflectionFragmentShader") &&
-         tryShaders("basicVertexShader", "basicFragmentShader") &&
-         tryShaders("vortexVertexShader", "vortexFragmentShader", 
"vortexGeometryShader") &&
-         tryShaders("basicVertexShader", "rippleFragmentShader") &&
-         tryShaders("glitterVertexShader", "glitterFragmentShader") &&
-         tryShaders("honeycombVertexShader", "honeycombFragmentShader", 
"honeycombGeometryShader") &&
-#endif
-         // vcl
-         tryShaders("combinedVertexShader", "combinedFragmentShader") &&
-         tryShaders("dumbVertexShader", "invert50FragmentShader") &&
-         tryShaders("combinedTextureVertexShader", 
"combinedTextureFragmentShader") &&
-         tryShaders("textureVertexShader", "areaScaleFragmentShader") &&
-         tryShaders("transformedTextureVertexShader", 
"maskedTextureFragmentShader") &&
-         tryShaders("transformedTextureVertexShader", 
"areaScaleFastFragmentShader") &&
-         tryShaders("transformedTextureVertexShader", 
"areaScaleFragmentShader") &&
-         tryShaders("transformedTextureVertexShader", "textureFragmentShader") 
&&
-         tryShaders("combinedTextureVertexShader", 
"combinedTextureFragmentShader") &&
-         tryShaders("textureVertexShader", "linearGradientFragmentShader") &&
-         tryShaders("textureVertexShader", "radialGradientFragmentShader") &&
-         tryShaders("textureVertexShader", "textureFragmentShader") &&
-         tryShaders("textureVertexShader", "convolutionFragmentShader") &&
-         tryShaders("textureVertexShader", "areaScaleFastFragmentShader") &&
-         tryShaders("textureVertexShader", "areaScaleFragmentShader"));
-
-    if (!bResult)
-    {
-        OpenGLZone::hardDisable();
-        TerminateProcess(GetCurrentProcess(), EXITHELPER_CRASH_WITH_RESTART);
-    }
-
-    return bResult;
-}
-
-} // unnamed namespace
-
-#endif // WNT
-
 bool OpenGLContext::ImplInit()
 {
     if (!m_aGLWin.dpy)
@@ -935,6 +840,97 @@ bool OpenGLContext::ImplInit()
 
 #elif defined( _WIN32 )
 
+namespace
+{
+
+bool tryShaders(const OUString& rVertexShader, const OUString& 
rFragmentShader, const OUString& rGeometryShader = "")
+{
+    GLint nId;
+
+    // Somewhat mysteriously, the OpenGLHelper::LoadShaders() API saves a 
compiled binary of the
+    // shader only if you give it the digest of the shaders. We have API to 
calculate the digest
+    // only of the combination of vertex and fragment (but not geometry) 
shader. So if we have a
+    // geometry shader, we should not save the binary.
+    if (rGeometryShader.isEmpty())
+        nId = OpenGLHelper::LoadShaders(rVertexShader, rFragmentShader, 
rGeometryShader, "", OpenGLHelper::GetDigest( rVertexShader, rFragmentShader, 
""));
+    else
+        nId = OpenGLHelper::LoadShaders(rVertexShader, rFragmentShader, 
rGeometryShader);
+    if (!nId)
+        return false;
+    glDeleteProgram(nId);
+    return glGetError() == GL_NO_ERROR;
+}
+
+bool compiledShaderBinariesWork()
+{
+    static bool bBeenHere = false;
+    static bool bResult;
+
+    if (bBeenHere)
+        return bResult;
+
+    bBeenHere = true;
+
+    bResult =
+        (
+#if 0 // Only look at shaders used by vcl for now
+         // canvas
+         tryShaders("dummyVertexShader", 
"linearMultiColorGradientFragmentShader") &&
+         tryShaders("dummyVertexShader", 
"linearTwoColorGradientFragmentShader") &&
+         tryShaders("dummyVertexShader", 
"radialMultiColorGradientFragmentShader") &&
+         tryShaders("dummyVertexShader", 
"radialTwoColorGradientFragmentShader") &&
+         tryShaders("dummyVertexShader", 
"rectangularMultiColorGradientFragmentShader") &&
+         tryShaders("dummyVertexShader", 
"rectangularTwoColorGradientFragmentShader") &&
+         // chart2
+         (GLEW_VERSION_3_3 ?
+          (tryShaders("shape3DVertexShader", "shape3DFragmentShader") &&
+           tryShaders("shape3DVertexShaderBatchScroll", 
"shape3DFragmentShaderBatchScroll") &&
+           tryShaders("shape3DVertexShaderBatch", 
"shape3DFragmentShaderBatch") &&
+           tryShaders("textVertexShaderBatch", "textFragmentShaderBatch")) :
+          (tryShaders("shape3DVertexShaderV300", 
"shape3DFragmentShaderV300"))) &&
+         tryShaders("textVertexShader", "textFragmentShader") &&
+         tryShaders("screenTextVertexShader", "screenTextFragmentShader") &&
+         tryShaders("commonVertexShader", "commonFragmentShader") &&
+         tryShaders("pickingVertexShader", "pickingFragmentShader") &&
+         tryShaders("backgroundVertexShader", "backgroundFragmentShader") &&
+         tryShaders("symbolVertexShader", "symbolFragmentShader") &&
+         tryShaders("symbolVertexShader", "symbolFragmentShader") &&
+         // slideshow
+         tryShaders("reflectionVertexShader", "reflectionFragmentShader") &&
+         tryShaders("basicVertexShader", "basicFragmentShader") &&
+         tryShaders("vortexVertexShader", "vortexFragmentShader", 
"vortexGeometryShader") &&
+         tryShaders("basicVertexShader", "rippleFragmentShader") &&
+         tryShaders("glitterVertexShader", "glitterFragmentShader") &&
+         tryShaders("honeycombVertexShader", "honeycombFragmentShader", 
"honeycombGeometryShader") &&
+#endif
+         // vcl
+         tryShaders("combinedVertexShader", "combinedFragmentShader") &&
+         tryShaders("dumbVertexShader", "invert50FragmentShader") &&
+         tryShaders("combinedTextureVertexShader", 
"combinedTextureFragmentShader") &&
+         tryShaders("textureVertexShader", "areaScaleFragmentShader") &&
+         tryShaders("transformedTextureVertexShader", 
"maskedTextureFragmentShader") &&
+         tryShaders("transformedTextureVertexShader", 
"areaScaleFastFragmentShader") &&
+         tryShaders("transformedTextureVertexShader", 
"areaScaleFragmentShader") &&
+         tryShaders("transformedTextureVertexShader", "textureFragmentShader") 
&&
+         tryShaders("combinedTextureVertexShader", 
"combinedTextureFragmentShader") &&
+         tryShaders("textureVertexShader", "linearGradientFragmentShader") &&
+         tryShaders("textureVertexShader", "radialGradientFragmentShader") &&
+         tryShaders("textureVertexShader", "textureFragmentShader") &&
+         tryShaders("textureVertexShader", "convolutionFragmentShader") &&
+         tryShaders("textureVertexShader", "areaScaleFastFragmentShader") &&
+         tryShaders("textureVertexShader", "areaScaleFragmentShader"));
+
+    if (!bResult)
+    {
+        OpenGLZone::hardDisable();
+        TerminateProcess(GetCurrentProcess(), EXITHELPER_CRASH_WITH_RESTART);
+    }
+
+    return bResult;
+}
+
+} // unnamed namespace
+
 bool OpenGLContext::init(HDC hDC, HWND hWnd)
 {
     if (mbInitialized)
@@ -1060,14 +1056,12 @@ bool OpenGLContext::ImplInit()
         return false;
     }
 
-#ifdef WNT
     if (!compiledShaderBinariesWork())
     {
         wglMakeCurrent(NULL, NULL);
         wglDeleteContext(hTempRC);
         return false;
     }
-#endif
 
     wglMakeCurrent(NULL, NULL);
     wglDeleteContext(hTempRC);
commit 0d3c25f049164235969e15ef292a80f0ba7682e9
Author: László Németh <laszlo.nem...@collabora.com>
Date:   Mon May 30 21:05:00 2016 +0200

    Revert "tdf#100092: Implement deterministic scheduling."
    
    This reverts commit 293dd3660bb7a9154ce602ee644f9605c5313961.

diff --git a/include/vcl/scheduler.hxx b/include/vcl/scheduler.hxx
index ee83c1e..95303ee 100644
--- a/include/vcl/scheduler.hxx
+++ b/include/vcl/scheduler.hxx
@@ -53,7 +53,6 @@ protected:
     // These should be constexpr static, when supported.
     static const sal_uInt64 ImmediateTimeoutMs = 1;
     static const sal_uInt64 MaximumTimeoutMs = 1000 * 60; // 1 minute
-    static const sal_uInt64 InfiniteTimeoutMs = 1000 * 60 * 60 * 24; // 1 day
 
     static void ImplStartTimer(sal_uInt64 nMS, bool bForce = false);
 
@@ -91,7 +90,7 @@ public:
     Scheduler&      operator=( const Scheduler& rScheduler );
     static void ImplDeInitScheduler();
 
-    /// Process one pending Timer with highhest priority
+    // Process one pending Timer with highhest priority
     static void CallbackTaskScheduling( bool ignore );
     /// Calculate minimum timeout - and return its value.
     static sal_uInt64 CalculateMinimumTimeout( bool &bHasActiveIdles );
@@ -99,12 +98,6 @@ public:
     static bool       ProcessTaskScheduling( bool bTimerOnly );
     /// Process all events until we are idle
     static void       ProcessEventsToIdle();
-
-    /// Control the deterministic mode.  In this mode, two subsequent runs of
-    /// LibreOffice fire about the same amount idles.
-    static void SetDeterministicMode(bool bDeterministic);
-    /// Return the current state of deterministic mode.
-    static bool GetDeterministicMode();
 };
 
 #endif // INCLUDED_VCL_SCHEDULER_HXX
diff --git a/vcl/source/app/idle.cxx b/vcl/source/app/idle.cxx
index 587e05f..123f37a 100644
--- a/vcl/source/app/idle.cxx
+++ b/vcl/source/app/idle.cxx
@@ -44,23 +44,7 @@ Idle::Idle( const Idle& rIdle ) : Scheduler(rIdle)
 void Idle::Start()
 {
     Scheduler::Start();
-
-    sal_uInt64 nPeriod = Scheduler::ImmediateTimeoutMs;
-    if (Scheduler::GetDeterministicMode())
-    {
-        switch (mePriority)
-        {
-            case SchedulerPriority::LOW:
-            case SchedulerPriority::LOWER:
-            case SchedulerPriority::LOWEST:
-                nPeriod = Scheduler::InfiniteTimeoutMs;
-                break;
-            default:
-                break;
-        }
-    }
-
-    Scheduler::ImplStartTimer(nPeriod);
+    Scheduler::ImplStartTimer(Scheduler::ImmediateTimeoutMs);
 }
 
 bool Idle::ReadyForSchedule( bool bTimerOnly, sal_uInt64 /* nTimeNow */ ) const
@@ -83,15 +67,6 @@ sal_uInt64 Idle::UpdateMinPeriod( sal_uInt64 nMinPeriod, 
sal_uInt64 /* nTime */
     case SchedulerPriority::REPAINT:
         nMinPeriod = ImmediateTimeoutMs; // don't wait.
         break;
-    case SchedulerPriority::LOW:
-    case SchedulerPriority::LOWER:
-    case SchedulerPriority::LOWEST:
-        if (Scheduler::GetDeterministicMode())
-        {
-            nMinPeriod = Scheduler::InfiniteTimeoutMs;
-            break;
-        }
-        // fall-through intended
     default:
         // FIXME: tdf#92036 workaround, I should be 1 too - wait 5ms
         if (nMinPeriod > 5) // only shrink the min. period if nothing is 
quicker.
diff --git a/vcl/source/app/scheduler.cxx b/vcl/source/app/scheduler.cxx
index efb65ca..879ca42 100644
--- a/vcl/source/app/scheduler.cxx
+++ b/vcl/source/app/scheduler.cxx
@@ -174,18 +174,6 @@ bool Scheduler::ProcessTaskScheduling( bool bTimerOnly )
         return false;
 }
 
-static bool g_bDeterministicMode = false;
-
-void Scheduler::SetDeterministicMode(bool bDeterministic)
-{
-    g_bDeterministicMode = bDeterministic;
-}
-
-bool Scheduler::GetDeterministicMode()
-{
-    return g_bDeterministicMode;
-}
-
 sal_uInt64 Scheduler::CalculateMinimumTimeout( bool &bHasActiveIdles )
 {
     // process all pending Tasks
commit 291045c0950e26a6f33124c4d93978c1e5ff1f26
Author: László Németh <laszlo.nem...@collabora.com>
Date:   Mon May 30 21:03:22 2016 +0200

    Revert "Switch deterministic scheduling on."
    
    This reverts commit 7780f96c345c61fff767696a599b2ecd963209d7.

diff --git a/vcl/source/app/scheduler.cxx b/vcl/source/app/scheduler.cxx
index 3f7e0bf6..efb65ca 100644
--- a/vcl/source/app/scheduler.cxx
+++ b/vcl/source/app/scheduler.cxx
@@ -174,7 +174,7 @@ bool Scheduler::ProcessTaskScheduling( bool bTimerOnly )
         return false;
 }
 
-static bool g_bDeterministicMode = true;
+static bool g_bDeterministicMode = false;
 
 void Scheduler::SetDeterministicMode(bool bDeterministic)
 {
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to