From 90b02dd4a465f312a6b9c27ff572b5a304e857de Mon Sep 17 00:00:00 2001 From: Luboš Luňák Date: Fri, 7 Feb 2020 15:36:26 +0100 Subject: in case of Skia problems force raster mode, don't disable it all MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Skia's CPU-based raster mode should be safe (at least from driver problems), so it should be enough to make the failsafe mechanism just disable Vulkan use. Also add UI option controlling forced raster rendering. Change-Id: I6be1745782816e5468e55635ae5613b6a6afded6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88206 Tested-by: Jenkins Reviewed-by: Luboš Luňák --- cui/source/options/optgdlg.cxx | 43 ++++++++++++++++++++++++++++++++++++++++-- cui/source/options/optgdlg.hxx | 2 ++ cui/uiconfig/ui/optviewpage.ui | 21 +++++++++++++++++++-- 3 files changed, 62 insertions(+), 4 deletions(-) (limited to 'cui') diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx index e10f743361c8..fb73341b9897 100644 --- a/cui/source/options/optgdlg.cxx +++ b/cui/source/options/optgdlg.cxx @@ -188,6 +188,7 @@ class SkiaCfg private: bool mbUseSkia; bool mbForceSkia; + bool mbForceSkiaRaster; bool mbModified; public: @@ -196,9 +197,11 @@ public: bool useSkia() const; bool forceSkia() const; + bool forceSkiaRaster() const; void setUseSkia(bool bSkia); void setForceSkia(bool bSkia); + void setForceSkiaRaster(bool bSkia); void reset(); }; @@ -213,6 +216,7 @@ void SkiaCfg::reset() { mbUseSkia = officecfg::Office::Common::VCL::UseSkia::get(); mbForceSkia = officecfg::Office::Common::VCL::ForceSkia::get(); + mbForceSkiaRaster = officecfg::Office::Common::VCL::ForceSkiaRaster::get(); mbModified = false; } @@ -227,6 +231,8 @@ SkiaCfg::~SkiaCfg() officecfg::Office::Common::VCL::UseSkia::set(mbUseSkia, batch); if (!officecfg::Office::Common::VCL::ForceSkia::isReadOnly()) officecfg::Office::Common::VCL::ForceSkia::set(mbForceSkia, batch); + if (!officecfg::Office::Common::VCL::ForceSkiaRaster::isReadOnly()) + officecfg::Office::Common::VCL::ForceSkiaRaster::set(mbForceSkiaRaster, batch); batch->commit(); } catch (...) @@ -245,6 +251,11 @@ bool SkiaCfg::forceSkia() const return mbForceSkia; } +bool SkiaCfg::forceSkiaRaster() const +{ + return mbForceSkiaRaster; +} + void SkiaCfg::setUseSkia(bool bSkia) { if (bSkia != mbUseSkia) @@ -263,6 +274,15 @@ void SkiaCfg::setForceSkia(bool bSkia) } } +void SkiaCfg::setForceSkiaRaster(bool bSkia) +{ + if (mbForceSkiaRaster != bSkia) + { + mbForceSkiaRaster = bSkia; + mbModified = true; + } +} + } // class OfaMiscTabPage -------------------------------------------------- @@ -759,6 +779,7 @@ OfaViewTabPage::OfaViewTabPage(weld::Container* pPage, weld::DialogController* p , m_xForceOpenGL(m_xBuilder->weld_check_button("forceopengl")) , m_xUseSkia(m_xBuilder->weld_check_button("useskia")) , m_xForceSkia(m_xBuilder->weld_check_button("forceskia")) + , m_xForceSkiaRaster(m_xBuilder->weld_check_button("forceskiaraster")) , m_xOpenGLStatusEnabled(m_xBuilder->weld_label("openglenabled")) , m_xOpenGLStatusDisabled(m_xBuilder->weld_label("opengldisabled")) , m_xSkiaStatusEnabled(m_xBuilder->weld_label("skiaenabled")) @@ -774,6 +795,7 @@ OfaViewTabPage::OfaViewTabPage(weld::Container* pPage, weld::DialogController* p m_xOpenGLStatusDisabled->hide(); m_xUseSkia->hide(); m_xForceSkia->hide(); + m_xForceSkiaRaster->hide(); m_xSkiaStatusEnabled->hide(); m_xSkiaStatusDisabled->hide(); m_xMenuIconBox->hide(); @@ -791,6 +813,7 @@ OfaViewTabPage::OfaViewTabPage(weld::Container* pPage, weld::DialogController* p m_xForceOpenGL->connect_toggled(LINK(this, OfaViewTabPage, OnForceOpenGLToggled)); m_xForceSkia->connect_toggled(LINK(this, OfaViewTabPage, OnForceSkiaToggled)); + m_xForceSkiaRaster->connect_toggled(LINK(this, OfaViewTabPage, OnForceSkiaRasterToggled)); // Set known icon themes OUString sAutoStr( m_xIconStyleLB->get_text( 0 ) ); @@ -825,6 +848,8 @@ OfaViewTabPage::OfaViewTabPage(weld::Container* pPage, weld::DialogController* p m_xUseSkia->set_sensitive(false); if (officecfg::Office::Common::VCL::ForceSkia::isReadOnly()) m_xForceSkia->set_sensitive(false); + if (officecfg::Office::Common::VCL::ForceSkiaRaster::isReadOnly()) + m_xForceSkiaRaster->set_sensitive(false); UpdateOGLStatus(); UpdateSkiaStatus(); @@ -862,6 +887,15 @@ IMPL_LINK_NOARG(OfaViewTabPage, OnForceSkiaToggled, weld::ToggleButton&, void) } } +IMPL_LINK_NOARG(OfaViewTabPage, OnForceSkiaRasterToggled, weld::ToggleButton&, void) +{ + if (m_xForceSkiaRaster->get_active()) + { + // Forcing Skia raster implies that Skia is on. + m_xUseSkia->set_active(true); + } +} + std::unique_ptr OfaViewTabPage::Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet ) { return std::make_unique(pPage, pController, *rAttrSet); @@ -1029,10 +1063,12 @@ bool OfaViewTabPage::FillItemSet( SfxItemSet* ) } if (m_xUseSkia->get_state_changed_from_saved() || - m_xForceSkia->get_state_changed_from_saved()) + m_xForceSkia->get_state_changed_from_saved() || + m_xForceSkiaRaster->get_state_changed_from_saved()) { mpSkiaConfig->setUseSkia(m_xUseSkia->get_active()); mpSkiaConfig->setForceSkia(m_xForceSkia->get_active()); + mpSkiaConfig->setForceSkiaRaster(m_xForceSkiaRaster->get_active()); bModified = true; } @@ -1074,7 +1110,8 @@ bool OfaViewTabPage::FillItemSet( SfxItemSet* ) } if (m_xUseSkia->get_state_changed_from_saved() || - m_xForceSkia->get_state_changed_from_saved()) + m_xForceSkia->get_state_changed_from_saved() || + m_xForceSkiaRaster->get_state_changed_from_saved()) { SolarMutexGuard aGuard; if( svtools::executeRestartDialog( @@ -1191,6 +1228,7 @@ void OfaViewTabPage::Reset( const SfxItemSet* ) m_xForceOpenGL->set_active(mpOpenGLConfig->forceOpenGL()); m_xUseSkia->set_active(mpSkiaConfig->useSkia()); m_xForceSkia->set_active(mpSkiaConfig->forceSkia()); + m_xForceSkiaRaster->set_active(mpSkiaConfig->forceSkiaRaster()); #if defined( UNX ) m_xFontAntiAliasing->save_state(); @@ -1202,6 +1240,7 @@ void OfaViewTabPage::Reset( const SfxItemSet* ) m_xForceOpenGL->save_state(); m_xUseSkia->save_state(); m_xForceSkia->save_state(); + m_xForceSkiaRaster->save_state(); #if defined( UNX ) OnAntialiasingToggled(*m_xFontAntiAliasing); diff --git a/cui/source/options/optgdlg.hxx b/cui/source/options/optgdlg.hxx index 491b817c25a6..04988f8e57a4 100644 --- a/cui/source/options/optgdlg.hxx +++ b/cui/source/options/optgdlg.hxx @@ -117,6 +117,7 @@ private: std::unique_ptr m_xForceOpenGL; std::unique_ptr m_xUseSkia; std::unique_ptr m_xForceSkia; + std::unique_ptr m_xForceSkiaRaster; std::unique_ptr m_xOpenGLStatusEnabled; std::unique_ptr m_xOpenGLStatusDisabled; @@ -131,6 +132,7 @@ private: #endif DECL_LINK(OnForceOpenGLToggled, weld::ToggleButton&, void); DECL_LINK(OnForceSkiaToggled, weld::ToggleButton&, void); + DECL_LINK(OnForceSkiaRasterToggled, weld::ToggleButton&, void); void UpdateOGLStatus(); void UpdateSkiaStatus(); diff --git a/cui/uiconfig/ui/optviewpage.ui b/cui/uiconfig/ui/optviewpage.ui index 23fd4c4ee63e..a54e5865f7b2 100644 --- a/cui/uiconfig/ui/optviewpage.ui +++ b/cui/uiconfig/ui/optviewpage.ui @@ -598,6 +598,23 @@ 7 + + + Force Skia software rendering + True + True + False + Requires restart. Enabling this will prevent the use of graphics drivers. + 12 + True + 0 + True + + + 0 + 8 + + False @@ -607,7 +624,7 @@ 0 - 8 + 9 @@ -619,7 +636,7 @@ 0 - 9 + 10 -- cgit v1.2.3