mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-08-17 21:13:48 -07:00
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:
@@ -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; });
|
||||
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user