mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-26 10:25:58 +01:00
fix a VRAM leak in destroyMonitorResources
This commit is contained in:
parent
33d264eaa7
commit
abc2d442dd
2 changed files with 7 additions and 3 deletions
|
@ -1287,6 +1287,8 @@ void CHyprOpenGLImpl::clearWithTex() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprOpenGLImpl::destroyMonitorResources(CMonitor* pMonitor) {
|
void CHyprOpenGLImpl::destroyMonitorResources(CMonitor* pMonitor) {
|
||||||
|
wlr_output_attach_render(pMonitor->output, nullptr);
|
||||||
|
|
||||||
g_pHyprOpenGL->m_mMonitorRenderResources[pMonitor].mirrorFB.release();
|
g_pHyprOpenGL->m_mMonitorRenderResources[pMonitor].mirrorFB.release();
|
||||||
g_pHyprOpenGL->m_mMonitorRenderResources[pMonitor].primaryFB.release();
|
g_pHyprOpenGL->m_mMonitorRenderResources[pMonitor].primaryFB.release();
|
||||||
g_pHyprOpenGL->m_mMonitorRenderResources[pMonitor].mirrorSwapFB.release();
|
g_pHyprOpenGL->m_mMonitorRenderResources[pMonitor].mirrorSwapFB.release();
|
||||||
|
@ -1298,4 +1300,6 @@ void CHyprOpenGLImpl::destroyMonitorResources(CMonitor* pMonitor) {
|
||||||
g_pHyprOpenGL->m_mMonitorBGTextures.erase(pMonitor);
|
g_pHyprOpenGL->m_mMonitorBGTextures.erase(pMonitor);
|
||||||
|
|
||||||
Debug::log(LOG, "Monitor %s -> destroyed all render data", pMonitor->szName.c_str());
|
Debug::log(LOG, "Monitor %s -> destroyed all render data", pMonitor->szName.c_str());
|
||||||
|
|
||||||
|
wlr_output_rollback(pMonitor->output);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1159,9 +1159,6 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
|
||||||
wlr_output_enable_adaptive_sync(pMonitor->output, 0);
|
wlr_output_enable_adaptive_sync(pMonitor->output, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// update renderer
|
|
||||||
g_pHyprOpenGL->destroyMonitorResources(pMonitor);
|
|
||||||
|
|
||||||
if (!wlr_output_commit(pMonitor->output)) {
|
if (!wlr_output_commit(pMonitor->output)) {
|
||||||
Debug::log(ERR, "Couldn't commit output named %s", pMonitor->output->name);
|
Debug::log(ERR, "Couldn't commit output named %s", pMonitor->output->name);
|
||||||
return true;
|
return true;
|
||||||
|
@ -1193,6 +1190,9 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
|
||||||
|
|
||||||
wlr_output_enable(pMonitor->output, true);
|
wlr_output_enable(pMonitor->output, true);
|
||||||
|
|
||||||
|
// update renderer (here because it will call rollback, so we cannot do this before committing)
|
||||||
|
g_pHyprOpenGL->destroyMonitorResources(pMonitor);
|
||||||
|
|
||||||
// updato wlroots
|
// updato wlroots
|
||||||
Events::listener_change(nullptr, nullptr);
|
Events::listener_change(nullptr, nullptr);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue