summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2020-12-08 10:44:52 +0100
committerLuboš Luňák <l.lunak@collabora.com>2020-12-09 11:46:47 +0100
commit16e93759134a05a52ef218c4a5ce0f3ea67b0221 (patch)
treecdf9b1122ace6ccd6a12a3edeeb629f70e29eb3a
parent8d6c51bc9ca9663b4a9328024d2a3fcf07677ba4 (diff)
remove isVCLOpenGLEnabled() settings, add DisableOpenGL option
The VCL OpenGL backend code has been removed, so the settings for it no longer make sense. But there's still the code for detecting if OpenGL is broken, and that one makes sense to keep. It turns out other OpenGL code (such as slideshows) doesn't even use that, so turn this into a new DisableOpenGL option, make OpenGL-related failsafe code set and use that, and OpenGL code should use OpenGLHelper::supportsOpenGL() to make sure OpenGL use is not blocked. Change-Id: Iec83f204e89bfb0b6eea13be77da8f0f4727a074 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107398 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
-rw-r--r--canvas/source/opengl/ogl_spritecanvas.cxx3
-rw-r--r--comphelper/source/misc/backupfilehelper.cxx6
-rw-r--r--include/vcl/opengl/OpenGLHelper.hxx13
-rw-r--r--include/vcl/opengl/OpenGLWrapper.hxx7
-rw-r--r--officecfg/registry/data/org/openoffice/Office/Common.xcu5
-rw-r--r--officecfg/registry/schema/org/openoffice/Office/Common.xcs13
-rw-r--r--slideshow/source/engine/opengl/TransitionerImpl.cxx2
-rw-r--r--vcl/README.vars6
-rw-r--r--vcl/source/opengl/OpenGLHelper.cxx101
9 files changed, 26 insertions, 130 deletions
diff --git a/canvas/source/opengl/ogl_spritecanvas.cxx b/canvas/source/opengl/ogl_spritecanvas.cxx
index de5caf716778..d55625b47668 100644
--- a/canvas/source/opengl/ogl_spritecanvas.cxx
+++ b/canvas/source/opengl/ogl_spritecanvas.cxx
@@ -14,6 +14,7 @@
#include <osl/mutex.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <tools/diagnose_ex.h>
+#include <vcl/opengl/OpenGLHelper.hxx>
#include "ogl_canvascustomsprite.hxx"
#include "ogl_spritecanvas.hxx"
@@ -154,6 +155,8 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
com_sun_star_comp_rendering_SpriteCanvas_OGL_get_implementation(
css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& args)
{
+ if( !OpenGLHelper::supportsOpenGL())
+ return nullptr;
auto p = new oglcanvas::SpriteCanvas(args, context);
cppu::acquire(p);
p->initialize();
diff --git a/comphelper/source/misc/backupfilehelper.cxx b/comphelper/source/misc/backupfilehelper.cxx
index d07442b8f39c..fcde7879255b 100644
--- a/comphelper/source/misc/backupfilehelper.cxx
+++ b/comphelper/source/misc/backupfilehelper.cxx
@@ -1902,12 +1902,10 @@ namespace comphelper
uno::Reference< XElement > xRootElement = xDocument->getDocumentElement();
xRootElement->appendChild(lcl_getConfigElement(xDocument, "/org.openoffice.Office.Common/VCL",
- "UseOpenGL", "false"));
- xRootElement->appendChild(lcl_getConfigElement(xDocument, "/org.openoffice.Office.Common/VCL",
- "ForceOpenGL", "false"));
+ "DisableOpenGL", "true"));
xRootElement->appendChild(lcl_getConfigElement(xDocument, "/org.openoffice.Office.Common/Misc",
"UseOpenCL", "false"));
- // Do not disable Skia entirely, just force it's CPU-based raster mode.
+ // Do not disable Skia entirely, just force its CPU-based raster mode.
xRootElement->appendChild(lcl_getConfigElement(xDocument, "/org.openoffice.Office.Common/VCL",
"ForceSkia", "false"));
xRootElement->appendChild(lcl_getConfigElement(xDocument, "/org.openoffice.Office.Common/VCL",
diff --git a/include/vcl/opengl/OpenGLHelper.hxx b/include/vcl/opengl/OpenGLHelper.hxx
index f4742d268b49..a0e2d8436564 100644
--- a/include/vcl/opengl/OpenGLHelper.hxx
+++ b/include/vcl/opengl/OpenGLHelper.hxx
@@ -21,7 +21,7 @@
/// Helper to do a SAL_INFO as well as a GL log.
#define VCL_GL_INFO(stream) \
do { \
- if (SAL_DETAIL_ENABLE_LOG_INFO && OpenGLHelper::isVCLOpenGLEnabled()) \
+ if (SAL_DETAIL_ENABLE_LOG_INFO) \
{ \
::std::ostringstream detail_stream; \
detail_stream << stream; \
@@ -32,7 +32,7 @@
/// Helper to do a SAL_WARN as well as a GL log.
#define VCL_GL_WARN(stream) \
do { \
- if (SAL_DETAIL_ENABLE_LOG_INFO && OpenGLHelper::isVCLOpenGLEnabled()) \
+ if (SAL_DETAIL_ENABLE_LOG_INFO) \
{ \
::std::ostringstream detail_stream; \
detail_stream << stream; \
@@ -105,14 +105,9 @@ public:
static bool isDeviceDenylisted();
/**
- * checks if the system supports all features that are necessary for the OpenGL VCL support
+ * checks if the system supports all features that are necessary for the OpenGL support
*/
- static bool supportsVCLOpenGL();
-
- /**
- * Returns true if VCL has OpenGL rendering enabled
- */
- static bool isVCLOpenGLEnabled();
+ static bool supportsOpenGL();
};
#ifdef SAL_LOG_WARN
diff --git a/include/vcl/opengl/OpenGLWrapper.hxx b/include/vcl/opengl/OpenGLWrapper.hxx
index 23237804e79b..3711b3fd4ba2 100644
--- a/include/vcl/opengl/OpenGLWrapper.hxx
+++ b/include/vcl/opengl/OpenGLWrapper.hxx
@@ -20,18 +20,11 @@ struct VCL_DLLPUBLIC OpenGLWrapper
{
OpenGLWrapper() = delete; // Should not be instantiated
- /**
- * Returns true if VCL has OpenGL rendering enabled
- */
#if HAVE_FEATURE_UI
- static bool isVCLOpenGLEnabled();
-
/**
* Returns the number of times OpenGL buffers have been swapped.
*/
static sal_Int64 getBufferSwapCounter();
-#else
- static bool isVCLOpenGLEnabled() { return false; }
#endif
};
diff --git a/officecfg/registry/data/org/openoffice/Office/Common.xcu b/officecfg/registry/data/org/openoffice/Office/Common.xcu
index e4c3fca51f7e..cb53de0292a5 100644
--- a/officecfg/registry/data/org/openoffice/Office/Common.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/Common.xcu
@@ -50,11 +50,6 @@
</prop>
</node>
<node oor:name="VCL">
- <prop oor:name="UseOpenGL" oor:type="xs:boolean">
- <value install:module="macosx">false</value>
- <value install:module="unx">false</value>
- <value install:module="wnt">false</value>
- </prop>
<prop oor:name="UseSkia" oor:type="xs:boolean">
<value install:module="macosx">false</value>
<value install:module="unx">false</value>
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index 02e62d950ed2..2f961f0532a2 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -850,18 +850,9 @@
<info>
<desc>Contains settings for VCL.</desc>
</info>
- <prop oor:name="UseOpenGL" oor:type="xs:boolean" oor:nillable="false">
+ <prop oor:name="DisableOpenGL" oor:type="xs:boolean" oor:nillable="false">
<info>
- <desc>Specifies if OpenGL rendering should be used in VCL backends
- supporting it.</desc>
- </info>
- <value>false</value>
- </prop>
- <prop oor:name="ForceOpenGL" oor:type="xs:boolean" oor:nillable="false">
- <info>
- <desc>Specifies if OpenGL rendering should be used in VCL backends
- supporting it. This one forces the use of OpenGL even if the
- denylist would block the OpenGL driver.</desc>
+ <desc>Specifies if all OpenGL usage should be disabled.</desc>
</info>
<value>false</value>
</prop>
diff --git a/slideshow/source/engine/opengl/TransitionerImpl.cxx b/slideshow/source/engine/opengl/TransitionerImpl.cxx
index 41a95994062e..3565e6ef104e 100644
--- a/slideshow/source/engine/opengl/TransitionerImpl.cxx
+++ b/slideshow/source/engine/opengl/TransitionerImpl.cxx
@@ -1179,6 +1179,8 @@ public:
// XTransitionFactory
virtual sal_Bool SAL_CALL hasTransition( sal_Int16 transitionType, sal_Int16 transitionSubType ) override
{
+ if( !OpenGLHelper::supportsOpenGL())
+ return false;
// A set of css::animation::TransitionSubType that don't have any meaning (in the SMIL 2.0
// standard) for MISCSHAPEWIPE have been chosen to refer to some of these "fancy" optional
// transitions. (The only subtypes of 'miscShapeWipe' defined in the standard are 'heart'
diff --git a/vcl/README.vars b/vcl/README.vars
index 68361ce78d77..4b2e326d67ef 100644
--- a/vcl/README.vars
+++ b/vcl/README.vars
@@ -19,6 +19,8 @@ VCL_DOUBLEBUFFERING_ENABLE - enable a safe subset of double buffered painting (c
VCL_DEBUG_DISABLE_PDFCOMPRESSION - disable compression in the PDF writer
+SAL_DISABLE_WATCHDOG - don't start the thread that watches for broken GL/Vulkan/OpenCL drivers
+
Gtk+
----
VCL_GTK3_PAINTDEBUG - in debug builds, if set to 1 then holding down shift+0 forces a redraw event, shift+1 repaints everything, and
@@ -33,11 +35,9 @@ EMF_PLUS_DISABLE - use EMF rendering and ignore EMF+ specifics
OpenGL
------
-SAL_FORCEGL - force enable OpenGL
+SAL_DISABLEGL - disable OpenGL use
SAL_GL_NO_SWAP - disable buffer swapping if set (should show nothing)
SAL_GL_SLEEP_ON_SWAP - sleep for half a second on each swap-buffers.
-SAL_DISABLE_WATCHDOG - don't start the thread that watches for broken GL/Vulkan/OpenCL drivers
-SAL_DISABLE_GLYPH_CACHING - don't render glyphs through OpenGL textures or Skia surfaces
Skia
----
diff --git a/vcl/source/opengl/OpenGLHelper.cxx b/vcl/source/opengl/OpenGLHelper.cxx
index fce2ac1afb11..90786adfd5ec 100644
--- a/vcl/source/opengl/OpenGLHelper.cxx
+++ b/vcl/source/opengl/OpenGLHelper.cxx
@@ -784,12 +784,16 @@ bool OpenGLHelper::isDeviceDenylisted()
return bDenylisted;
}
-bool OpenGLHelper::supportsVCLOpenGL()
+bool OpenGLHelper::supportsOpenGL()
{
- static bool bDisableGL = !!getenv("SAL_DISABLEGL");
- bool bDenylisted = isDeviceDenylisted();
-
- return !bDisableGL && !bDenylisted;
+ if( getenv("SAL_DISABLEGL") != nullptr )
+ return false;
+ if( isDeviceDenylisted())
+ return false;
+ if( officecfg::Office::Common::VCL::DisableOpenGL::get())
+ return false;
+ WatchdogThread::start();
+ return true;
}
namespace
@@ -853,7 +857,7 @@ void OpenGLZone::hardDisable()
// Disable the OpenGL support
std::shared_ptr<comphelper::ConfigurationChanges> xChanges(
comphelper::ConfigurationChanges::create());
- officecfg::Office::Common::VCL::UseOpenGL::set(false, xChanges);
+ officecfg::Office::Common::VCL::DisableOpenGL::set(true, xChanges);
xChanges->commit();
// Force synchronous config write
@@ -884,91 +888,6 @@ const CrashWatchdogTimingsValues& OpenGLZone::getCrashWatchdogTimingsValues()
return gWatchdogTimings.getWatchdogTimingsValues(eMode);
}
-static void reapGlxTest()
-{
- // Reap the glxtest child, or it'll stay around as a zombie,
- // as X11OpenGLDeviceInfo::GetData() will not get called.
- static bool bTestReaped = false;
- if(!bTestReaped)
- {
- reap_glxtest_process();
- bTestReaped = true;
- }
-}
-
-bool OpenGLHelper::isVCLOpenGLEnabled()
-{
- // Skia always takes precedence if enabled
- if( SkiaHelper::isVCLSkiaEnabled())
- {
- reapGlxTest();
- return false;
- }
-
- /**
- * The !bSet part should only be called once! Changing the results in the same
- * run will mix OpenGL and normal rendering.
- */
-
- static bool bSet = false;
- static bool bEnable = false;
- static bool bForceOpenGL = false;
-
- // No hardware rendering, so no OpenGL
- if (Application::IsBitmapRendering())
- return false;
-
- if (bSet)
- {
- return bForceOpenGL || bEnable;
- }
- /*
- * There are a number of cases that these environment variables cover:
- * * SAL_FORCEGL forces OpenGL independent of any other option
- * * SAL_DISABLEGL or a denylisted driver avoid the use of OpenGL if SAL_FORCEGL is not set
- */
-
- bSet = true;
- bForceOpenGL = !!getenv("SAL_FORCEGL") || officecfg::Office::Common::VCL::ForceOpenGL::get();
-
- bool bRet = false;
- bool bSupportsVCLOpenGL = supportsVCLOpenGL();
- // always call supportsVCLOpenGL to de-zombie the glxtest child process on X11
- if (bForceOpenGL)
- {
- bRet = true;
- }
- else if (bSupportsVCLOpenGL)
- {
- static bool bEnableGLEnv = !!getenv("SAL_ENABLEGL");
-
- bEnable = bEnableGLEnv;
-
- if (officecfg::Office::Common::VCL::UseOpenGL::get())
- bEnable = true;
-
- // Force disable in safe mode
- if (Application::IsSafeModeEnabled())
- bEnable = false;
-
- bRet = bEnable;
- }
-
- if (bRet)
- WatchdogThread::start();
- else
- reapGlxTest();
-
- CrashReporter::addKeyValue("UseOpenGL", OUString::boolean(bRet), CrashReporter::Write);
-
- return bRet;
-}
-
-bool OpenGLWrapper::isVCLOpenGLEnabled()
-{
- return OpenGLHelper::isVCLOpenGLEnabled();
-}
-
void OpenGLHelper::debugMsgStream(std::ostringstream const &pStream)
{
debugMsgPrint(