renderer: skip redundant render-path work

This commit is contained in:
Pppp1116 2026-04-03 13:27:57 +01:00 committed by Vaxry
parent 4c42269ce6
commit 2b9696eb72
2 changed files with 18 additions and 8 deletions

View file

@ -1118,6 +1118,7 @@ void CMonitor::addDamage(const CBox& box) {
if (m_cursorZoom->value() != 1.f && g_pCompositor->getMonitorFromCursor() == m_self) {
m_damage.damageEntire();
g_pCompositor->scheduleFrameForMonitor(m_self.lock(), Aquamarine::IOutput::AQ_SCHEDULE_DAMAGE);
return;
}
if (m_damage.damage(box))
@ -2419,7 +2420,7 @@ CMonitorState::CMonitorState(CMonitor* owner) : m_owner(owner) {
}
void CMonitorState::ensureBufferPresent() {
const auto STATE = m_owner->m_output->state->state();
const auto& STATE = m_owner->m_output->state->state();
if (!STATE.enabled) {
Log::logger->log(Log::TRACE, "CMonitorState::ensureBufferPresent: Ignoring, monitor is not enabled");
return;
@ -2459,13 +2460,18 @@ bool CMonitorState::test() {
}
bool CMonitorState::updateSwapchain() {
auto options = m_owner->m_output->swapchain->currentOptions();
const auto& OPTIONS = m_owner->m_output->swapchain->currentOptions();
const auto& STATE = m_owner->m_output->state->state();
const auto& MODE = STATE.mode ? STATE.mode : STATE.customMode;
if (!MODE) {
Log::logger->log(Log::WARN, "updateSwapchain: No mode?");
return true;
}
if (OPTIONS.format == m_owner->m_drmFormat && OPTIONS.scanout && OPTIONS.length == 3 && OPTIONS.size == MODE->pixelSize)
return true;
auto options = OPTIONS;
options.format = m_owner->m_drmFormat;
options.scanout = true;
options.length = 3;

View file

@ -1940,8 +1940,9 @@ void IHyprRenderer::renderMonitor(PHLMONITOR pMonitor, bool commit) {
pMonitor->m_renderingActive = true;
// we need to cleanup fading out when rendering the appropriate context
g_pCompositor->cleanupFadingOut(pMonitor->m_id);
// Most frames have no fading-out windows or layers for this monitor.
if (!g_pCompositor->m_windowsFadingOut.empty() || !g_pCompositor->m_surfacesFadingOut.empty())
g_pCompositor->cleanupFadingOut(pMonitor->m_id);
// TODO: this is getting called with extents being 0,0,0,0 should it be?
// potentially can save on resources.
@ -1957,10 +1958,9 @@ void IHyprRenderer::renderMonitor(PHLMONITOR pMonitor, bool commit) {
zoomLock = true;
}
if (pMonitor == g_pCompositor->getMonitorFromCursor())
m_renderData.mouseZoomFactor = 1.f;
if (ZOOMFACTOR != 1.f && pMonitor == g_pCompositor->getMonitorFromCursor())
m_renderData.mouseZoomFactor = std::clamp(ZOOMFACTOR, 1.f, INFINITY);
else
m_renderData.mouseZoomFactor = 1.f;
if (pMonitor->m_zoomAnimProgress->value() != 1) {
m_renderData.mouseZoomFactor = 2.0 - pMonitor->m_zoomAnimProgress->value(); // 2x zoom -> 1x zoom
@ -2537,11 +2537,15 @@ void IHyprRenderer::damageSurface(SP<CWLSurfaceResource> pSurface, double x, dou
damageBox.translate({x, y});
CRegion damageBoxForEach;
const auto EXTENTS = damageBox.getExtents();
CRegion damageBoxForEach;
for (auto const& m : g_pCompositor->m_monitors) {
if (!m->m_output)
continue;
if (!EXTENTS.overlaps(m->logicalBox()))
continue;
damageBoxForEach.set(damageBox);
damageBoxForEach.translate({-m->m_position.x, -m->m_position.y}).scale(m->m_scale);