Skip to content

Commit

Permalink
fences: make use of AQ CFileDescriptor fences
Browse files Browse the repository at this point in the history
adapt to CFileDescriptor usage of AQ fences.
  • Loading branch information
gulafaran committed Feb 3, 2025
1 parent e7734c2 commit 996ce2b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/helpers/Monitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1332,7 +1332,7 @@ bool CMonitor::attemptDirectScanout() {

if (DOEXPLICIT) {
Debug::log(TRACE, "attemptDirectScanout: setting IN_FENCE for aq to {}", explicitWaitFD.get());
output->state->setExplicitInFence(explicitWaitFD.get());
output->state->setExplicitInFence(std::move(explicitWaitFD));
}

bool ok = output->commit();
Expand Down Expand Up @@ -1443,7 +1443,7 @@ CMonitorState::CMonitorState(CMonitor* owner) : m_pOwner(owner) {
}

void CMonitorState::ensureBufferPresent() {
const auto STATE = m_pOwner->output->state->state();
const auto& STATE = m_pOwner->output->state->state();
if (!STATE.enabled) {
Debug::log(TRACE, "CMonitorState::ensureBufferPresent: Ignoring, monitor is not enabled");
return;
Expand Down
12 changes: 3 additions & 9 deletions src/render/Renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1461,13 +1461,6 @@ static hdr_output_metadata createHDRMetadata(SImageDescription settings, Aquamar
}

bool CHyprRenderer::commitPendingAndDoExplicitSync(PHLMONITOR pMonitor) {
// apply timelines for explicit sync
// save inFD otherwise reset will reset it
CFileDescriptor inFD{pMonitor->output->state->state().explicitInFence};
pMonitor->output->state->resetExplicitFences();
if (inFD.isValid())
pMonitor->output->state->setExplicitInFence(inFD.get());

static auto PHDR = CConfigValue<Hyprlang::INT>("experimental:hdr");

const bool SUPPORTSPQ = pMonitor->output->parsedEDID.hdrMetadata.has_value() ? pMonitor->output->parsedEDID.hdrMetadata->supportsPQ : false;
Expand Down Expand Up @@ -1514,7 +1507,8 @@ bool CHyprRenderer::commitPendingAndDoExplicitSync(PHLMONITOR pMonitor) {
pMonitor->output->state->setCTM(pMonitor->ctm);
}

bool ok = pMonitor->state.commit();
bool ok = pMonitor->state.commit();
const auto& inFD = pMonitor->output->state->state().explicitInFence;
if (!ok) {
if (inFD.isValid()) {
Debug::log(TRACE, "Monitor state commit failed, retrying without a fence");
Expand Down Expand Up @@ -2288,7 +2282,7 @@ void CHyprRenderer::endRender() {
return;
}

PMONITOR->output->state->setExplicitInFence(fd.take());
PMONITOR->output->state->setExplicitInFence(std::move(fd));
} else {
if (isNvidia() && *PNVIDIAANTIFLICKER)
glFinish();
Expand Down

0 comments on commit 996ce2b

Please sign in to comment.