From 279b06044c583bfaa207d6fbd373c752967a4a2e Mon Sep 17 00:00:00 2001 From: Lee Bousfield Date: Sat, 22 Mar 2025 11:01:14 -0500 Subject: screencopy, render: Use explicit sync for screencopy (#9697) * screencopy, render: Use explicit sync for screencopy * screencopy: Check if explicit sync is enabled * screencopy: Don't require explicit KMS enabled --- src/render/Renderer.cpp | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'src/render/Renderer.cpp') diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index a89fd329..cf77c000 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -1447,8 +1447,6 @@ static hdr_output_metadata createHDRMetadata(SImageDescription settings, A } bool CHyprRenderer::commitPendingAndDoExplicitSync(PHLMONITOR pMonitor) { - pMonitor->commitSeq++; - static auto PPASS = CConfigValue("render:cm_fs_passthrough"); const bool PHDR = pMonitor->imageDescription.transferFunction == CM_TRANSFER_FUNCTION_ST2084_PQ; @@ -2250,37 +2248,39 @@ void CHyprRenderer::endRender() { if (m_eRenderMode == RENDER_MODE_FULL_FAKE) return; - if (m_eRenderMode == RENDER_MODE_NORMAL) { + if (m_eRenderMode == RENDER_MODE_NORMAL) PMONITOR->output->state->setBuffer(m_pCurrentBuffer); - auto explicitOptions = getExplicitSyncSettings(PMONITOR->output); + auto explicitOptions = getExplicitSyncSettings(PMONITOR->output); - if (PMONITOR->inTimeline && explicitOptions.explicitEnabled && explicitOptions.explicitKMSEnabled) { - PMONITOR->eglSync = g_pHyprOpenGL->createEGLSync(); - if (!PMONITOR->eglSync) { - Debug::log(ERR, "renderer: couldn't create an EGLSync for out in endRender"); - return; - } + if (PMONITOR->inTimeline && explicitOptions.explicitEnabled) { + PMONITOR->eglSync = g_pHyprOpenGL->createEGLSync(); + if (!PMONITOR->eglSync) { + Debug::log(ERR, "renderer: couldn't create an EGLSync for out in endRender"); + return; + } - bool ok = PMONITOR->inTimeline->importFromSyncFileFD(PMONITOR->commitSeq, PMONITOR->eglSync->fd()); - if (!ok) { - Debug::log(ERR, "renderer: couldn't import from sync file fd in endRender"); - return; - } + PMONITOR->inTimelinePoint++; + bool ok = PMONITOR->inTimeline->importFromSyncFileFD(PMONITOR->inTimelinePoint, PMONITOR->eglSync->fd()); + if (!ok) { + Debug::log(ERR, "renderer: couldn't import from sync file fd in endRender"); + return; + } - PMONITOR->inFence = CFileDescriptor{PMONITOR->inTimeline->exportAsSyncFileFD(PMONITOR->commitSeq)}; + if (m_eRenderMode == RENDER_MODE_NORMAL && explicitOptions.explicitKMSEnabled) { + PMONITOR->inFence = CFileDescriptor{PMONITOR->inTimeline->exportAsSyncFileFD(PMONITOR->inTimelinePoint)}; if (!PMONITOR->inFence.isValid()) { Debug::log(ERR, "renderer: couldn't export from sync timeline in endRender"); return; } PMONITOR->output->state->setExplicitInFence(PMONITOR->inFence.get()); - } else { - if (isNvidia() && *PNVIDIAANTIFLICKER) - glFinish(); - else - glFlush(); } + } else { + if (isNvidia() && *PNVIDIAANTIFLICKER) + glFinish(); + else + glFlush(); } } -- cgit v1.2.3