mirror of
https://github.com/hyprwm/Hyprland
synced 2024-12-25 18:09:48 +01:00
reenable direct scanout
This commit is contained in:
parent
57e9005abb
commit
1491a853c5
1 changed files with 34 additions and 33 deletions
|
@ -1080,50 +1080,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) {
|
||||||
|
|
Loading…
Reference in a new issue