Skip to content

Commit

Permalink
monitor: don't damage twice (#4727)
Browse files Browse the repository at this point in the history
When scaled, the ring is already fully damaged, no need to add the region
damage.

Also moved a variable that was being declared way to far for where it is
actually used.

Co-authored-by: Abilio Costa <abilio.costa@criticaltechworks.com>
  • Loading branch information
abmantis and Abilio Costa committed Feb 17, 2024
1 parent fbf5ba8 commit e3e7e1f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 1 addition & 3 deletions src/helpers/Monitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,9 +320,7 @@ void CMonitor::addDamage(const pixman_region32_t* rg) {
if (*PZOOMFACTOR != 1.f && g_pCompositor->getMonitorFromCursor() == this) {
wlr_damage_ring_add_whole(&damage);
g_pCompositor->scheduleFrameForMonitor(this);
}

if (wlr_damage_ring_add(&damage, rg))
} else if (wlr_damage_ring_add(&damage, rg))
g_pCompositor->scheduleFrameForMonitor(this);
}

Expand Down
4 changes: 2 additions & 2 deletions src/render/Renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1083,8 +1083,7 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
clock_gettime(CLOCK_MONOTONIC, &now);

// check the damage
CRegion damage;
bool hasChanged = pMonitor->output->needs_frame || pixman_region32_not_empty(&pMonitor->damage.current);
bool hasChanged = pMonitor->output->needs_frame || pixman_region32_not_empty(&pMonitor->damage.current);

if (!hasChanged && *PDAMAGETRACKINGMODE != DAMAGE_TRACKING_NONE && pMonitor->forceFullFrames == 0 && damageBlinkCleanup == 0)
return;
Expand All @@ -1100,6 +1099,7 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
if (UNLOCK_SC)
wlr_output_lock_software_cursors(pMonitor->output, true);

CRegion damage;
wlr_damage_ring_get_buffer_damage(&pMonitor->damage, m_iLastBufferAge, damage.pixman());

pMonitor->renderingActive = true;
Expand Down

0 comments on commit e3e7e1f

Please sign in to comment.