renderer: avoid locking during rendering

it can trigger pointermgr to render which fucks up our pass

fixes #5998
This commit is contained in:
Vaxry 2024-05-10 23:38:46 +01:00
parent 38911d6df4
commit 19186de118

View file

@ -1247,6 +1247,10 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
pMonitor->forceFullFrames = 10; pMonitor->forceFullFrames = 10;
} }
bool lockSoftware = pMonitor == g_pCompositor->getMonitorFromCursor() && *PZOOMFACTOR != 1.f;
if (lockSoftware)
g_pPointerManager->lockSoftwareForMonitor(pMonitor->self.lock());
CRegion damage, finalDamage; CRegion damage, finalDamage;
if (!beginRender(pMonitor, damage, RENDER_MODE_NORMAL)) { if (!beginRender(pMonitor, damage, RENDER_MODE_NORMAL)) {
Debug::log(ERR, "renderer: couldn't beginRender()!"); Debug::log(ERR, "renderer: couldn't beginRender()!");
@ -1341,21 +1345,16 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
if (renderCursor) { if (renderCursor) {
TRACY_GPU_ZONE("RenderCursor"); TRACY_GPU_ZONE("RenderCursor");
g_pPointerManager->renderSoftwareCursorsFor(pMonitor->self.lock(), &now, g_pHyprOpenGL->m_RenderData.damage);
bool lockSoftware = pMonitor == g_pCompositor->getMonitorFromCursor() && *PZOOMFACTOR != 1.f;
if (lockSoftware) {
g_pPointerManager->lockSoftwareForMonitor(pMonitor->self.lock());
g_pPointerManager->renderSoftwareCursorsFor(pMonitor->self.lock(), &now, g_pHyprOpenGL->m_RenderData.damage);
g_pPointerManager->unlockSoftwareForMonitor(pMonitor->self.lock());
} else
g_pPointerManager->renderSoftwareCursorsFor(pMonitor->self.lock(), &now, g_pHyprOpenGL->m_RenderData.damage);
} }
EMIT_HOOK_EVENT("render", RENDER_LAST_MOMENT); EMIT_HOOK_EVENT("render", RENDER_LAST_MOMENT);
endRender(); endRender();
if (lockSoftware)
g_pPointerManager->unlockSoftwareForMonitor(pMonitor->self.lock());
TRACY_GPU_COLLECT; TRACY_GPU_COLLECT;
if (!pMonitor->mirrors.empty()) { if (!pMonitor->mirrors.empty()) {