config: disable hw on mgpu nvidia by default (#11018)

This commit is contained in:
Vaxry
2025-07-16 11:02:20 +02:00
committed by GitHub
parent 8453fbf4eb
commit 5bfe6dc703
4 changed files with 11 additions and 2 deletions

View File

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

View File

@@ -3134,7 +3134,7 @@ bool CConfigManager::shouldUseSoftwareCursors(PHLMONITOR pMonitor) {
switch (*PNOHW) {
case 0: return false;
case 1: return true;
case 2: return pMonitor->m_tearingState.activelyTearing;
case 2: return g_pHyprRenderer->isNvidia() && g_pHyprRenderer->isMgpu();
default: break;
}

View File

@@ -56,10 +56,12 @@ static int cursorTicker(void* data) {
CHyprRenderer::CHyprRenderer() {
if (g_pCompositor->m_aqBackend->hasSession()) {
size_t drmDevices = 0;
for (auto const& dev : g_pCompositor->m_aqBackend->session->sessionDevices) {
const auto DRMV = drmGetVersion(dev->fd);
if (!DRMV)
continue;
drmDevices++;
std::string name = std::string{DRMV->name, DRMV->name_len};
std::ranges::transform(name, name.begin(), tolower);
@@ -71,6 +73,7 @@ CHyprRenderer::CHyprRenderer() {
drmFreeVersion(DRMV);
}
m_mgpu = drmDevices > 1;
} else {
Debug::log(LOG, "Aq backend has no session, omitting full DRM node checks");
@@ -2371,6 +2374,10 @@ bool CHyprRenderer::isNvidia() {
return m_nvidia;
}
bool CHyprRenderer::isMgpu() {
return m_mgpu;
}
void CHyprRenderer::addWindowToRenderUnfocused(PHLWINDOW window) {
static auto PFPS = CConfigValue<Hyprlang::INT>("misc:render_unfocused_fps");

View File

@@ -75,6 +75,7 @@ class CHyprRenderer {
void onRenderbufferDestroy(CRenderbuffer* rb);
SP<CRenderbuffer> getCurrentRBO();
bool isNvidia();
bool isMgpu();
void makeEGLCurrent();
void unsetEGL();
void addWindowToRenderUnfocused(PHLWINDOW window);
@@ -140,6 +141,7 @@ class CHyprRenderer {
SP<Aquamarine::IBuffer> m_currentBuffer = nullptr;
eRenderMode m_renderMode = RENDER_MODE_NORMAL;
bool m_nvidia = false;
bool m_mgpu = false;
struct {
bool hiddenOnTouch = false;