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:
vaxerski
2024-12-30 11:57:55 +01:00
parent cb211d83f6
commit 8c14c2a5f4
4 changed files with 34 additions and 0 deletions

View File

@@ -1,6 +1,8 @@
#include "CTMControl.hpp"
#include "../Compositor.hpp"
#include "../render/Renderer.hpp"
#include "core/Output.hpp"
#include "../config/ConfigValue.hpp"
CHyprlandCTMControlResource::CHyprlandCTMControlResource(SP<CHyprlandCtmControlManagerV1> resource_) : resource(resource_) {
if (!good())
@@ -81,12 +83,24 @@ void CHyprlandCTMControlProtocol::destroyResource(CHyprlandCTMControlResource* r
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() {
progress.create(g_pConfigManager->getAnimationPropertyConfig("__internal_fadeCTM"), AVARDAMAGE_NONE);
progress.setValueAndWarp(0.F);
}
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; });

View File

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