config: set no_hw_cursors to auto by default and disable on tearing

when tearing, updates to the overlay plane may be ignored by the kernel. To avoid the cursor being a slideshow, disable hw cursors
This commit is contained in:
Vaxry
2025-02-15 00:21:50 +00:00
parent 1309b59f2c
commit 2f967037aa
4 changed files with 8 additions and 6 deletions

View File

@@ -1356,7 +1356,7 @@ inline static const std::vector<SConfigOptionDescription> CONFIG_OPTIONS = {
},
SConfigOptionDescription{
.value = "cursor:no_hardware_cursors",
.description = "disables hardware cursors",
.description = "disables hardware cursors. Auto = disable when tearing",
.type = CONFIG_OPTION_CHOICE,
.data = SConfigOptionDescription::SChoiceData{0, "Disabled,Enabled,Auto"},
},

View File

@@ -621,7 +621,7 @@ CConfigManager::CConfigManager() {
m_pConfig->addConfigValue("opengl:nvidia_anti_flicker", Hyprlang::INT{1});
m_pConfig->addConfigValue("cursor:no_hardware_cursors", Hyprlang::INT{0});
m_pConfig->addConfigValue("cursor:no_hardware_cursors", Hyprlang::INT{2});
m_pConfig->addConfigValue("cursor:no_break_fs_vrr", Hyprlang::INT{2});
m_pConfig->addConfigValue("cursor:min_refresh_rate", Hyprlang::INT{24});
m_pConfig->addConfigValue("cursor:hotspot_padding", Hyprlang::INT{0});
@@ -2798,12 +2798,13 @@ const std::vector<SConfigOptionDescription>& CConfigManager::getAllDescriptions(
return CONFIG_OPTIONS;
}
bool CConfigManager::shouldUseSoftwareCursors() {
bool CConfigManager::shouldUseSoftwareCursors(PHLMONITOR pMonitor) {
static auto PNOHW = CConfigValue<Hyprlang::INT>("cursor:no_hardware_cursors");
switch (*PNOHW) {
case 0: return false;
case 1: return true;
case 2: return pMonitor->tearingState.activelyTearing;
default: break;
}

View File

@@ -189,7 +189,7 @@ class CConfigManager {
void ensureMonitorStatus();
void ensureVRR(PHLMONITOR pMonitor = nullptr);
bool shouldUseSoftwareCursors();
bool shouldUseSoftwareCursors(PHLMONITOR pMonitor);
void updateWatcher();
std::string parseKeyword(const std::string&, const std::string&);

View File

@@ -274,7 +274,7 @@ void CPointerManager::updateCursorBackend() {
continue;
}
if (state->softwareLocks > 0 || g_pConfigManager->shouldUseSoftwareCursors() || !attemptHardwareCursor(state)) {
if (state->softwareLocks > 0 || g_pConfigManager->shouldUseSoftwareCursors(m) || !attemptHardwareCursor(state)) {
Debug::log(TRACE, "Output {} rejected hardware cursors, falling back to sw", m->szName);
state->box = getCursorBoxLogicalForMonitor(state->monitor.lock());
state->hardwareFailed = true;
@@ -737,7 +737,8 @@ void CPointerManager::damageIfSoftware() {
if (mw->monitor.expired() || !mw->monitor->output)
continue;
if ((mw->softwareLocks > 0 || mw->hardwareFailed || g_pConfigManager->shouldUseSoftwareCursors()) && b.overlaps({mw->monitor->vecPosition, mw->monitor->vecSize})) {
if ((mw->softwareLocks > 0 || mw->hardwareFailed || g_pConfigManager->shouldUseSoftwareCursors(mw->monitor.lock())) &&
b.overlaps({mw->monitor->vecPosition, mw->monitor->vecSize})) {
g_pHyprRenderer->damageBox(b, mw->monitor->shouldSkipScheduleFrameOnMouseEvent());
break;
}