skia: turn ForceSkiaRaster into ForceSkiaGPU

so unless ForceSkiaGPU is specifically enabled by the user,
hardware accelatarion will be disabled by default.
Some discussion on the topic can be found here
https://gerrit.libreoffice.org/c/core/+/208116/comments/273234df_69198d70
and here
https://gerrit.libreoffice.org/c/core/+/208116/comments/372732df_f989e4f3

In libreoffice-26-2 branch, Vulkan has been put under experimental mode
so it doesn't touch translations,
see https://gerrit.libreoffice.org/c/core/+/208134

Change-Id: Ib7a39d269f24b5ef82752edb238944d3d453153c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208182
Tested-by: Jenkins
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
This commit is contained in:
Xisco Fauli
2026-07-28 12:54:40 +02:00
committed by Christian Lohmaier
parent ca6014ec29
commit fbb7574523
7 changed files with 38 additions and 38 deletions
+1 -1
View File
@@ -1888,7 +1888,7 @@ namespace comphelper
xRootElement->appendChild(lcl_getConfigElement(xDocument, u"/org.openoffice.Office.Common/VCL"_ustr,
u"ForceSkia"_ustr, u"false"_ustr));
xRootElement->appendChild(lcl_getConfigElement(xDocument, u"/org.openoffice.Office.Common/VCL"_ustr,
u"ForceSkiaRaster"_ustr, u"true"_ustr));
u"ForceSkiaGPU"_ustr, u"false"_ustr));
OUString aTempURL;
{
+11 -11
View File
@@ -545,8 +545,8 @@ OfaViewTabPage::OfaViewTabPage(weld::Container* pPage, weld::DialogController* p
, m_xUseAntiAliaseImg(m_xBuilder->weld_widget(u"lockuseaa"_ustr))
, m_xUseSkia(m_xBuilder->weld_check_button(u"useskia"_ustr))
, m_xUseSkiaImg(m_xBuilder->weld_widget(u"lockuseskia"_ustr))
, m_xForceSkiaRaster(m_xBuilder->weld_check_button(u"forceskiaraster"_ustr))
, m_xForceSkiaRasterImg(m_xBuilder->weld_widget(u"lockforceskiaraster"_ustr))
, m_xForceSkiaGPU(m_xBuilder->weld_check_button(u"forceskiagpu"_ustr))
, m_xForceSkiaGPUImg(m_xBuilder->weld_widget(u"lockforceskiagpu"_ustr))
, m_xSkiaStatusEnabled(m_xBuilder->weld_label(u"skiaenabled"_ustr))
, m_xSkiaStatusDisabled(m_xBuilder->weld_label(u"skiadisabled"_ustr))
, m_xSkiaLog(m_xBuilder->weld_button(u"btnSkialog"_ustr))
@@ -604,7 +604,7 @@ IMPL_LINK_NOARG(OfaViewTabPage, OnCopySkiaLog, weld::Button&, void)
void OfaViewTabPage::HideSkiaWidgets()
{
m_xUseSkia->hide();
m_xForceSkiaRaster->hide();
m_xForceSkiaGPU->hide();
m_xSkiaStatusEnabled->hide();
m_xSkiaStatusDisabled->hide();
m_xSkiaLog->hide();
@@ -642,8 +642,8 @@ void OfaViewTabPage::UpdateSkiaStatus()
m_xUseSkia->set_sensitive(!officecfg::Office::Common::VCL::UseSkia::isReadOnly());
#endif
m_xUseSkiaImg->set_visible(officecfg::Office::Common::VCL::UseSkia::isReadOnly());
m_xForceSkiaRaster->set_sensitive(m_xUseSkia->get_active() && !officecfg::Office::Common::VCL::ForceSkiaRaster::isReadOnly());
m_xForceSkiaRasterImg->set_visible(officecfg::Office::Common::VCL::ForceSkiaRaster::isReadOnly());
m_xForceSkiaGPU->set_sensitive(m_xUseSkia->get_active() && !officecfg::Office::Common::VCL::ForceSkiaGPU::isReadOnly());
m_xForceSkiaGPUImg->set_visible(officecfg::Office::Common::VCL::ForceSkiaGPU::isReadOnly());
m_xSkiaLog->set_sensitive(bEnabled);
// Technically the 'use hardware acceleration' option could be used to mean !forceSkiaRaster, but the implementation
@@ -673,7 +673,7 @@ OUString OfaViewTabPage::GetAllStrings()
}
OUString checkButton[]
= { u"useaccel"_ustr, u"useaa"_ustr, u"useskia"_ustr, u"forceskiaraster"_ustr, u"showfontpreview"_ustr, u"aafont"_ustr };
= { u"useaccel"_ustr, u"useaa"_ustr, u"useskia"_ustr, u"forceskiagpu"_ustr, u"showfontpreview"_ustr, u"aafont"_ustr };
for (const auto& check : checkButton)
{
@@ -750,10 +750,10 @@ bool OfaViewTabPage::FillItemSet( SfxItemSet* )
}
if (m_xUseSkia->get_state_changed_from_saved() ||
m_xForceSkiaRaster->get_state_changed_from_saved())
m_xForceSkiaGPU->get_state_changed_from_saved())
{
officecfg::Office::Common::VCL::UseSkia::set(m_xUseSkia->get_active(), xChanges);
officecfg::Office::Common::VCL::ForceSkiaRaster::set(m_xForceSkiaRaster->get_active(), xChanges);
officecfg::Office::Common::VCL::ForceSkiaGPU::set(m_xForceSkiaGPU->get_active(), xChanges);
bModified = true;
}
@@ -777,7 +777,7 @@ bool OfaViewTabPage::FillItemSet( SfxItemSet* )
}
if (m_xUseSkia->get_state_changed_from_saved() ||
m_xForceSkiaRaster->get_state_changed_from_saved())
m_xForceSkiaGPU->get_state_changed_from_saved())
{
SolarMutexGuard aGuard;
if( svtools::executeRestartDialog(
@@ -836,9 +836,9 @@ void OfaViewTabPage::Reset( const SfxItemSet* )
#else
m_xUseSkia->set_active(officecfg::Office::Common::VCL::UseSkia::get());
#endif
m_xForceSkiaRaster->set_active(officecfg::Office::Common::VCL::ForceSkiaRaster::get());
m_xForceSkiaGPU->set_active(officecfg::Office::Common::VCL::ForceSkiaGPU::get());
m_xUseSkia->save_state();
m_xForceSkiaRaster->save_state();
m_xForceSkiaGPU->save_state();
m_xFontAntiAliasing->save_state();
m_xAAPointLimit->save_value();
+2 -2
View File
@@ -106,8 +106,8 @@ private:
std::unique_ptr<weld::Widget> m_xUseAntiAliaseImg;
std::unique_ptr<weld::CheckButton> m_xUseSkia;
std::unique_ptr<weld::Widget> m_xUseSkiaImg;
std::unique_ptr<weld::CheckButton> m_xForceSkiaRaster;
std::unique_ptr<weld::Widget> m_xForceSkiaRasterImg;
std::unique_ptr<weld::CheckButton> m_xForceSkiaGPU;
std::unique_ptr<weld::Widget> m_xForceSkiaGPUImg;
std::unique_ptr<weld::Label> m_xSkiaStatusEnabled;
std::unique_ptr<weld::Label> m_xSkiaStatusDisabled;
+6 -6
View File
@@ -195,18 +195,18 @@
</packing>
</child>
<child>
<object class="GtkCheckButton" id="forceskiaraster">
<property name="label" translatable="yes" context="optviewpage|forceskiaraster">Force Skia software rendering</property>
<object class="GtkCheckButton" id="forceskiagpu">
<property name="label" translatable="yes" context="optviewpage|forceskiagpu">Force Skia hardware acceleration</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="tooltip-text" translatable="yes" context="optviewpage|forceskia|tooltip_text">Requires restart. Enabling this will prevent the use of graphics drivers.</property>
<property name="tooltip-text" translatable="yes" context="optviewpage|forceskia|tooltip_text">Requires restart. Enabling this will enable the use of Skia hardware acceleration.</property>
<property name="margin-start">18</property>
<property name="use-underline">True</property>
<property name="draw-indicator">True</property>
<child internal-child="accessible">
<object class="AtkObject" id="forceskiaraster-atkobject">
<property name="AtkObject::accessible-description" translatable="yes" context="optviewpage|extended_tips|forceskiaraster">Disables Skia's use of the computer graphics device. This still uses Skia software but with calls for raster framing, reduced and simplified graphics processing unit load.</property>
<object class="AtkObject" id="forceskiagpu-atkobject">
<property name="AtkObject::accessible-description" translatable="yes" context="optviewpage|extended_tips|forceskiagpu">Enables Skia's use of the computer graphics device. This still uses Skia software but with hardware acceleration enabled.</property>
</object>
</child>
</object>
@@ -297,7 +297,7 @@
</packing>
</child>
<child>
<object class="GtkImage" id="lockforceskiaraster">
<object class="GtkImage" id="lockforceskiagpu">
<property name="can-focus">False</property>
<property name="no-show-all">True</property>
<property name="halign">center</property>
@@ -273,11 +273,11 @@
</info>
<value>false</value>
</prop>
<prop oor:name="ForceSkiaRaster" oor:type="xs:boolean" oor:nillable="false">
<prop oor:name="ForceSkiaGPU" oor:type="xs:boolean" oor:nillable="false">
<info>
<desc>Specifies if Skia rendering should be used in VCL backends
supporting it. This one forces the use of Skia software rendering
instead of trying to use the graphics driver.</desc>
<desc>Specifies if Skia hardware acceleration should be used in VCL backends
supporting it. This one forces the use of Skia hardware acceleration instead of
Skia software rendering.</desc>
</info>
<value>false</value>
</prop>
@@ -5241,7 +5241,7 @@
<prop oor:name="NotebookbarColorTransparency" oor:type="xs:int" oor:nillable="false">
<!-- UIHints: Tools Options General View -->
<info>
<desc>Specifies which transparency at which module and dialog color are merged for
<desc>Specifies which transparency at which module and dialog color are merged for
the notebookbar. Use 0 for full module and 255 for full dialog.</desc>
</info>
<value>150</value>
+12 -12
View File
@@ -161,13 +161,13 @@ static std::string_view vendorAsString(uint32_t vendor)
}
// returns old value
static bool setForceSkiaRaster(bool val)
static bool setForceSkiaGPU(bool val)
{
const bool oldValue = officecfg::Office::Common::VCL::ForceSkiaRaster::get();
if (oldValue != val && !officecfg::Office::Common::VCL::ForceSkiaRaster::isReadOnly())
const bool oldValue = officecfg::Office::Common::VCL::ForceSkiaGPU::get();
if (oldValue != val && !officecfg::Office::Common::VCL::ForceSkiaGPU::isReadOnly())
{
auto batch(comphelper::ConfigurationChanges::create());
officecfg::Office::Common::VCL::ForceSkiaRaster::set(val, batch);
officecfg::Office::Common::VCL::ForceSkiaGPU::set(val, batch);
batch->commit();
// make sure the change is written to the configuration
@@ -266,15 +266,15 @@ static RenderMethod initRenderMethodToUse()
SAL_WARN("vcl.skia", "Unrecognized value of SAL_SKIA");
abort();
}
if (officecfg::Office::Common::VCL::ForceSkiaRaster::get())
return RenderRaster;
if (officecfg::Office::Common::VCL::ForceSkiaGPU::get())
{
#if defined SK_METAL
return RenderMetal;
return RenderMetal;
#elif defined SK_VULKAN
return RenderVulkan;
#else
return RenderRaster;
return RenderVulkan;
#endif
}
return RenderRaster;
}
static std::atomic<RenderMethod>& accessRenderMethodToUse()
@@ -304,7 +304,7 @@ static void checkDeviceDenylisted(bool blockDisable)
// Temporarily change config to force software rendering. If the following HW check
// crashes, this config change will stay active, and will make sure to avoid use of
// faulty HW/driver on the nest start
const bool oldForceSkiaRasterValue = setForceSkiaRaster(true);
const bool oldForceSkiaGPUValue = setForceSkiaGPU(false);
// First try if a GrDirectContext already exists.
std::unique_ptr<skwindow::WindowContext> temporaryWindowContext;
@@ -340,7 +340,7 @@ static void checkDeviceDenylisted(bool blockDisable)
}
// The check succeeded; restore the original value
setForceSkiaRaster(oldForceSkiaRasterValue);
setForceSkiaGPU(oldForceSkiaGPUValue);
#else
SAL_WARN("vcl.skia", "Vulkan support not built in");
(void)blockDisable;
+1 -1
View File
@@ -39,7 +39,7 @@ void SkiaZone::hardDisable()
// raster mode, which should be safe as it does not use drivers.
std::shared_ptr<comphelper::ConfigurationChanges> xChanges(
comphelper::ConfigurationChanges::create());
officecfg::Office::Common::VCL::ForceSkiaRaster::set(true, xChanges);
officecfg::Office::Common::VCL::ForceSkiaGPU::set(false, xChanges);
xChanges->commit();
// Force synchronous config write