ctm: disable fade animation by default on nvidia

Fixes #8891, the nvidia driver dies when we spam CTM too much.
This commit is contained in:
Vaxry 2024-12-30 11:57:55 +01:00
parent cb211d83f6
commit 8c14c2a5f4
4 changed files with 34 additions and 0 deletions

View file

@ -1289,6 +1289,24 @@ inline static const std::vector<SConfigOptionDescription> CONFIG_OPTIONS = {
.type = CONFIG_OPTION_BOOL, .type = CONFIG_OPTION_BOOL,
.data = SConfigOptionDescription::SBoolData{false}, .data = SConfigOptionDescription::SBoolData{false},
}, },
SConfigOptionDescription{
.value = "render:expand_undersized_textures",
.description = "Whether to expand textures that have not yet resized to be larger, or to just stretch them instead.",
.type = CONFIG_OPTION_BOOL,
.data = SConfigOptionDescription::SBoolData{true},
},
SConfigOptionDescription{
.value = "render:xp_mode",
.description = "Disable back buffer and bottom layer rendering.",
.type = CONFIG_OPTION_BOOL,
.data = SConfigOptionDescription::SBoolData{true},
},
SConfigOptionDescription{
.value = "render:ctm_animation",
.description = "Whether to enable a fade animation for CTM changes (hyprsunset). 2 means 'auto' (Yes on everything but Nvidia).",
.type = CONFIG_OPTION_INT,
.data = SConfigOptionDescription::SRangeData{2, 0, 2},
},
/* /*
* cursor: * cursor:

View file

@ -614,6 +614,7 @@ CConfigManager::CConfigManager() {
m_pConfig->addConfigValue("render:direct_scanout", Hyprlang::INT{0}); m_pConfig->addConfigValue("render:direct_scanout", Hyprlang::INT{0});
m_pConfig->addConfigValue("render:expand_undersized_textures", Hyprlang::INT{1}); m_pConfig->addConfigValue("render:expand_undersized_textures", Hyprlang::INT{1});
m_pConfig->addConfigValue("render:xp_mode", Hyprlang::INT{0}); m_pConfig->addConfigValue("render:xp_mode", Hyprlang::INT{0});
m_pConfig->addConfigValue("render:ctm_animation", Hyprlang::INT{2});
m_pConfig->addConfigValue("ecosystem:no_update_news", Hyprlang::INT{0}); m_pConfig->addConfigValue("ecosystem:no_update_news", Hyprlang::INT{0});

View file

@ -1,6 +1,8 @@
#include "CTMControl.hpp" #include "CTMControl.hpp"
#include "../Compositor.hpp" #include "../Compositor.hpp"
#include "../render/Renderer.hpp"
#include "core/Output.hpp" #include "core/Output.hpp"
#include "../config/ConfigValue.hpp"
CHyprlandCTMControlResource::CHyprlandCTMControlResource(SP<CHyprlandCtmControlManagerV1> resource_) : resource(resource_) { CHyprlandCTMControlResource::CHyprlandCTMControlResource(SP<CHyprlandCtmControlManagerV1> resource_) : resource(resource_) {
if (!good()) if (!good())
@ -81,12 +83,24 @@ void CHyprlandCTMControlProtocol::destroyResource(CHyprlandCTMControlResource* r
std::erase_if(m_vManagers, [&](const auto& other) { return other.get() == res; }); std::erase_if(m_vManagers, [&](const auto& other) { return other.get() == res; });
} }
bool CHyprlandCTMControlProtocol::isCTMAnimationEnabled() {
static auto PENABLEANIM = CConfigValue<Hyprlang::INT>("render:ctm_animation");
if (*PENABLEANIM == 2)
return !g_pHyprRenderer->isNvidia();
return *PENABLEANIM;
}
CHyprlandCTMControlProtocol::SCTMData::SCTMData() { CHyprlandCTMControlProtocol::SCTMData::SCTMData() {
progress.create(g_pConfigManager->getAnimationPropertyConfig("__internal_fadeCTM"), AVARDAMAGE_NONE); progress.create(g_pConfigManager->getAnimationPropertyConfig("__internal_fadeCTM"), AVARDAMAGE_NONE);
progress.setValueAndWarp(0.F); progress.setValueAndWarp(0.F);
} }
void CHyprlandCTMControlProtocol::setCTM(PHLMONITOR monitor, const Mat3x3& ctm) { void CHyprlandCTMControlProtocol::setCTM(PHLMONITOR monitor, const Mat3x3& ctm) {
if (!isCTMAnimationEnabled()) {
monitor->setCTM(ctm);
return;
}
std::erase_if(m_mCTMDatas, [](const auto& el) { return !el.first; }); std::erase_if(m_mCTMDatas, [](const auto& el) { return !el.first; });

View file

@ -34,6 +34,7 @@ class CHyprlandCTMControlProtocol : public IWaylandProtocol {
void destroyResource(CHyprlandCTMControlResource* resource); void destroyResource(CHyprlandCTMControlResource* resource);
void setCTM(PHLMONITOR monitor, const Mat3x3& ctm); void setCTM(PHLMONITOR monitor, const Mat3x3& ctm);
bool isCTMAnimationEnabled();
// //
std::vector<SP<CHyprlandCTMControlResource>> m_vManagers; std::vector<SP<CHyprlandCTMControlResource>> m_vManagers;