tearing: cleanup vars and avoid rendering before drm is ready

This commit is contained in:
vaxerski
2023-09-30 17:07:50 +01:00
parent e2b72b2975
commit a2a29a60e5
6 changed files with 37 additions and 33 deletions

View File

@@ -846,10 +846,9 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
// tearing and DS first
bool shouldTear = false;
bool canTear = *PTEARINGENABLED && g_pHyprOpenGL->m_RenderData.mouseZoomFactor == 1.0;
recheckSolitaryForMonitor(pMonitor);
if (pMonitor->nextRenderTorn) {
pMonitor->nextRenderTorn = false;
if (pMonitor->tearingState.nextRenderTorn) {
pMonitor->tearingState.nextRenderTorn = false;
if (!*PTEARINGENABLED) {
Debug::log(WARN, "Tearing commit requested but the master switch general:allow_tearing is off, ignoring");
@@ -861,18 +860,13 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
return;
}
if (!pMonitor->canTear) {
if (!pMonitor->tearingState.canTear) {
Debug::log(WARN, "Tearing commit requested but monitor doesn't support it, ignoring");
return;
}
if (pMonitor->solitaryClient)
shouldTear = true;
} else {
// if this is a non-tearing commit, and we are in a state where we should tear
// then this is a vblank commit that we should ignore
if (canTear && pMonitor->solitaryClient && pMonitor->canTear && pMonitor->solitaryClient->canBeTorn() && pMonitor->renderingFromVblankEvent)
return;
}
if (!*PNODIRECTSCANOUT && !shouldTear) {
@@ -884,12 +878,12 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
}
}
if (pMonitor->activelyTearing != shouldTear) {
if (pMonitor->tearingState.activelyTearing != shouldTear) {
// change of state
pMonitor->activelyTearing = shouldTear;
pMonitor->tearingState.activelyTearing = shouldTear;
for (auto& m : g_pCompositor->m_vMonitors) {
wlr_output_lock_software_cursors(m->output, pMonitor->activelyTearing);
wlr_output_lock_software_cursors(m->output, pMonitor->tearingState.activelyTearing);
}
}
@@ -1090,7 +1084,7 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
}
if (shouldTear)
pMonitor->ignoreNextFlipEvent = true;
pMonitor->tearingState.busy = true;
wlr_damage_ring_rotate(&pMonitor->damage);