diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2020-12-08 10:44:52 +0100 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2020-12-09 11:46:47 +0100 |
commit | 16e93759134a05a52ef218c4a5ce0f3ea67b0221 (patch) | |
tree | cdf9b1122ace6ccd6a12a3edeeb629f70e29eb3a /vcl/source/opengl/OpenGLHelper.cxx | |
parent | 8d6c51bc9ca9663b4a9328024d2a3fcf07677ba4 (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>
Diffstat (limited to 'vcl/source/opengl/OpenGLHelper.cxx')
-rw-r--r-- | vcl/source/opengl/OpenGLHelper.cxx | 101 |
1 files changed, 10 insertions, 91 deletions
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( |