reenable direct scanout

This commit is contained in:
Vaxry 2024-06-26 22:21:01 +02:00
parent b10b70eab0
commit 9fc57fc321

View file

@ -1077,50 +1077,51 @@ void CHyprRenderer::calculateUVForSurface(PHLWINDOW pWindow, SP<CWLSurfaceResour
} }
bool CHyprRenderer::attemptDirectScanout(CMonitor* pMonitor) { bool CHyprRenderer::attemptDirectScanout(CMonitor* pMonitor) {
return false; // FIXME: fix when we move to new lib for backend. if (!pMonitor->mirrors.empty() || pMonitor->isMirror() || m_bDirectScanoutBlocked)
return false; // do not DS if this monitor is being mirrored. Will break the functionality.
// if (!pMonitor->mirrors.empty() || pMonitor->isMirror() || m_bDirectScanoutBlocked) if (g_pPointerManager->softwareLockedFor(pMonitor->self.lock()))
// return false; // do not DS if this monitor is being mirrored. Will break the functionality. return false;
// if (!wlr_output_is_direct_scanout_allowed(pMonitor->output)) const auto PCANDIDATE = pMonitor->solitaryClient.lock();
// return false;
// const auto PCANDIDATE = pMonitor->solitaryClient.lock(); if (!PCANDIDATE)
return false;
// if (!PCANDIDATE) const auto PSURFACE = g_pXWaylandManager->getWindowSurface(PCANDIDATE);
// return false;
// const auto PSURFACE = g_pXWaylandManager->getWindowSurface(PCANDIDATE); if (!PSURFACE || !PSURFACE->current.buffer || PSURFACE->current.buffer->size != pMonitor->vecPixelSize || PSURFACE->current.transform != pMonitor->transform)
return false;
// if (!PSURFACE || PSURFACE->current.scale != pMonitor->output->scale || PSURFACE->current.transform != pMonitor->output->transform) // we can't scanout shm buffers.
// return false; if (!PSURFACE->current.buffer->dmabuf().success)
return false;
// // finally, we should be GTG. // FIXME: make sure the buffer actually follows the available scanout dmabuf formats
// wlr_output_state_set_buffer(pMonitor->state.wlr(), &PSURFACE->buffer->base); // and comes from the appropriate device. This may implode on multi-gpu!!
// if (!wlr_output_test_state(pMonitor->output, pMonitor->state.wlr())) pMonitor->output->state->setBuffer(PSURFACE->current.buffer);
// return false;
// timespec now; timespec now;
// clock_gettime(CLOCK_MONOTONIC, &now); clock_gettime(CLOCK_MONOTONIC, &now);
// PSURFACE->frame(&now); PSURFACE->frame(&now);
// auto FEEDBACK = makeShared<CQueuedPresentationData>(PSURFACE); auto FEEDBACK = makeShared<CQueuedPresentationData>(PSURFACE);
// FEEDBACK->attachMonitor(pMonitor); FEEDBACK->attachMonitor(pMonitor);
// FEEDBACK->presented(); FEEDBACK->presented();
// FEEDBACK->setPresentationType(true); FEEDBACK->setPresentationType(true);
// PROTO::presentation->queueData(FEEDBACK); PROTO::presentation->queueData(FEEDBACK);
// if (pMonitor->state.commit()) { if (pMonitor->state.commit()) {
// if (m_pLastScanout.expired()) { if (m_pLastScanout.expired()) {
// m_pLastScanout = PCANDIDATE; m_pLastScanout = PCANDIDATE;
// Debug::log(LOG, "Entered a direct scanout to {:x}: \"{}\"", (uintptr_t)PCANDIDATE.get(), PCANDIDATE->m_szTitle); Debug::log(LOG, "Entered a direct scanout to {:x}: \"{}\"", (uintptr_t)PCANDIDATE.get(), PCANDIDATE->m_szTitle);
// } }
// } else { } else {
// m_pLastScanout.reset(); m_pLastScanout.reset();
// return false; return false;
// } }
// return true; return true;
} }
void CHyprRenderer::renderMonitor(CMonitor* pMonitor) { void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {