internal: few small monitor improvements (#8890)

* remove framesToSkip, its not used anymore

* only set drm format when needed after leaving direct scanout

* always set drm damage
This commit is contained in:
Ikalco 2024-12-29 17:19:12 -06:00 committed by GitHub
parent fde569db65
commit cb211d83f6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 14 additions and 37 deletions

View file

@ -434,11 +434,6 @@ void CCompositor::initAllSignals() {
Debug::log(LOG, "Session got deactivated!"); Debug::log(LOG, "Session got deactivated!");
m_bSessionActive = false; m_bSessionActive = false;
for (auto const& m : m_vMonitors) {
m->noFrameSchedule = true;
m->framesToSkip = 1;
}
} }
}, },
nullptr); nullptr);

View file

@ -90,9 +90,7 @@ class CMonitor {
SP<Aquamarine::IOutput> output; SP<Aquamarine::IOutput> output;
float refreshRate = 60; float refreshRate = 60;
int framesToSkip = 0;
int forceFullFrames = 0; int forceFullFrames = 0;
bool noFrameSchedule = false;
bool scheduledRecalc = false; bool scheduledRecalc = false;
wl_output_transform transform = WL_OUTPUT_TRANSFORM_NORMAL; wl_output_transform transform = WL_OUTPUT_TRANSFORM_NORMAL;
float xwaylandScale = 1.f; float xwaylandScale = 1.f;

View file

@ -1126,22 +1126,9 @@ void CHyprRenderer::renderMonitor(PHLMONITOR pMonitor) {
if (*PDEBUGOVERLAY == 1) if (*PDEBUGOVERLAY == 1)
g_pDebugOverlay->frameData(pMonitor); g_pDebugOverlay->frameData(pMonitor);
if (pMonitor->framesToSkip > 0) { if (!g_pCompositor->m_bSessionActive)
pMonitor->framesToSkip -= 1;
if (!pMonitor->noFrameSchedule)
g_pCompositor->scheduleFrameForMonitor(pMonitor, Aquamarine::IOutput::AQ_SCHEDULE_RENDER_MONITOR);
else
Debug::log(LOG, "NoFrameSchedule hit for {}.", pMonitor->szName);
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(pMonitor->ID);
if (pMonitor->framesToSkip > 10)
pMonitor->framesToSkip = 0;
return; return;
}
// checks //
if (pMonitor->ID == m_pMostHzMonitor->ID || if (pMonitor->ID == m_pMostHzMonitor->ID ||
*PVFR == 1) { // unfortunately with VFR we don't have the guarantee mostHz is going to be updated all the time, so we have to ignore that *PVFR == 1) { // unfortunately with VFR we don't have the guarantee mostHz is going to be updated all the time, so we have to ignore that
g_pCompositor->sanityCheckWorkspaces(); g_pCompositor->sanityCheckWorkspaces();
@ -1151,7 +1138,6 @@ void CHyprRenderer::renderMonitor(PHLMONITOR pMonitor) {
if (g_pConfigManager->m_bWantsMonitorReload) if (g_pConfigManager->m_bWantsMonitorReload)
g_pConfigManager->performMonitorReload(); g_pConfigManager->performMonitorReload();
} }
// //
if (pMonitor->scheduledRecalc) { if (pMonitor->scheduledRecalc) {
pMonitor->scheduledRecalc = false; pMonitor->scheduledRecalc = false;
@ -1194,8 +1180,10 @@ void CHyprRenderer::renderMonitor(PHLMONITOR pMonitor) {
Debug::log(LOG, "Left a direct scanout."); Debug::log(LOG, "Left a direct scanout.");
pMonitor->lastScanout.reset(); pMonitor->lastScanout.reset();
// reset DRM format, make sure it's the one we want. // reset DRM format, but only if needed since it might modeset
pMonitor->output->state->setFormat(pMonitor->prevDrmFormat); if (pMonitor->output->state->state().drmFormat != pMonitor->prevDrmFormat)
pMonitor->output->state->setFormat(pMonitor->prevDrmFormat);
pMonitor->drmFormat = pMonitor->prevDrmFormat; pMonitor->drmFormat = pMonitor->prevDrmFormat;
} }
} }
@ -1331,31 +1319,27 @@ void CHyprRenderer::renderMonitor(PHLMONITOR pMonitor) {
endRender(); endRender();
finalDamage = g_pHyprOpenGL->m_RenderData.damage;
TRACY_GPU_COLLECT; TRACY_GPU_COLLECT;
if (!pMonitor->mirrors.empty()) { CRegion frameDamage{g_pHyprOpenGL->m_RenderData.damage};
CRegion frameDamage{finalDamage};
const auto TRANSFORM = invertTransform(pMonitor->transform); const auto TRANSFORM = invertTransform(pMonitor->transform);
frameDamage.transform(wlTransformToHyprutils(TRANSFORM), pMonitor->vecTransformedSize.x, pMonitor->vecTransformedSize.y); frameDamage.transform(wlTransformToHyprutils(TRANSFORM), pMonitor->vecTransformedSize.x, pMonitor->vecTransformedSize.y);
if (*PDAMAGETRACKINGMODE == DAMAGE_TRACKING_NONE || *PDAMAGETRACKINGMODE == DAMAGE_TRACKING_MONITOR) if (*PDAMAGETRACKINGMODE == DAMAGE_TRACKING_NONE || *PDAMAGETRACKINGMODE == DAMAGE_TRACKING_MONITOR)
frameDamage.add(0, 0, (int)pMonitor->vecTransformedSize.x, (int)pMonitor->vecTransformedSize.y); frameDamage.add(0, 0, (int)pMonitor->vecTransformedSize.x, (int)pMonitor->vecTransformedSize.y);
if (*PDAMAGEBLINK) if (*PDAMAGEBLINK)
frameDamage.add(damage); frameDamage.add(damage);
if (!pMonitor->mirrors.empty())
damageMirrorsWith(pMonitor, frameDamage); damageMirrorsWith(pMonitor, frameDamage);
pMonitor->output->state->addDamage(frameDamage);
}
pMonitor->renderingActive = false; pMonitor->renderingActive = false;
EMIT_HOOK_EVENT("render", RENDER_POST); EMIT_HOOK_EVENT("render", RENDER_POST);
pMonitor->output->state->addDamage(frameDamage);
pMonitor->output->state->setPresentationMode(shouldTear ? Aquamarine::eOutputPresentationMode::AQ_OUTPUT_PRESENTATION_IMMEDIATE : pMonitor->output->state->setPresentationMode(shouldTear ? Aquamarine::eOutputPresentationMode::AQ_OUTPUT_PRESENTATION_IMMEDIATE :
Aquamarine::eOutputPresentationMode::AQ_OUTPUT_PRESENTATION_VSYNC); Aquamarine::eOutputPresentationMode::AQ_OUTPUT_PRESENTATION_VSYNC);