mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-02 17:26:00 +01:00
work
This commit is contained in:
parent
e5f379cd40
commit
0d478497f8
2 changed files with 12 additions and 6 deletions
|
@ -25,11 +25,17 @@ void CFrameSchedulingManager::onFrameNeeded(CMonitor* pMonitor) {
|
||||||
|
|
||||||
RASSERT(DATA, "No data in gpuDone");
|
RASSERT(DATA, "No data in gpuDone");
|
||||||
|
|
||||||
if (pMonitor->output->frame_pending || pMonitor->tearingState.activelyTearing)
|
if (pMonitor->tearingState.activelyTearing)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (DATA->activelyPushing) {
|
||||||
|
DATA->forceFrames++;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Debug::log(LOG, "onFrameNeeded");
|
Debug::log(LOG, "onFrameNeeded");
|
||||||
|
|
||||||
|
DATA->noVblankTimer = true;
|
||||||
onPresent(pMonitor);
|
onPresent(pMonitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +49,7 @@ void CFrameSchedulingManager::gpuDone(wlr_buffer* pBuffer) {
|
||||||
|
|
||||||
// delayed frame, let's render immediately, our shit will be presented soon
|
// delayed frame, let's render immediately, our shit will be presented soon
|
||||||
// if we finish rendering before the next vblank somehow, kernel will be mad, but oh well
|
// if we finish rendering before the next vblank somehow, kernel will be mad, but oh well
|
||||||
DATA->gpuDoneCall = true;
|
DATA->noVblankTimer = true;
|
||||||
g_pHyprRenderer->renderMonitor(DATA->pMonitor);
|
g_pHyprRenderer->renderMonitor(DATA->pMonitor);
|
||||||
DATA->delayedFrameSubmitted = true;
|
DATA->delayedFrameSubmitted = true;
|
||||||
}
|
}
|
||||||
|
@ -111,7 +117,7 @@ void CFrameSchedulingManager::onPresent(CMonitor* pMonitor) {
|
||||||
Debug::log(LOG, "remder!");
|
Debug::log(LOG, "remder!");
|
||||||
|
|
||||||
// we can't do this on wayland
|
// we can't do this on wayland
|
||||||
if (!wlr_backend_is_wl(pMonitor->output->backend) && !DATA->gpuDoneCall) {
|
if (!wlr_backend_is_wl(pMonitor->output->backend) && !DATA->noVblankTimer) {
|
||||||
const float TIMEUNTILVBLANK = 1000.0 / pMonitor->refreshRate;
|
const float TIMEUNTILVBLANK = 1000.0 / pMonitor->refreshRate;
|
||||||
wl_event_source_timer_update(DATA->event, 0);
|
wl_event_source_timer_update(DATA->event, 0);
|
||||||
wl_event_source_timer_update(DATA->event, std::floor(TIMEUNTILVBLANK));
|
wl_event_source_timer_update(DATA->event, std::floor(TIMEUNTILVBLANK));
|
||||||
|
@ -119,7 +125,7 @@ void CFrameSchedulingManager::onPresent(CMonitor* pMonitor) {
|
||||||
|
|
||||||
renderMonitor(DATA);
|
renderMonitor(DATA);
|
||||||
|
|
||||||
DATA->gpuDoneCall = false;
|
DATA->noVblankTimer = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
CFrameSchedulingManager::SSchedulingData* CFrameSchedulingManager::dataFor(CMonitor* pMonitor) {
|
CFrameSchedulingManager::SSchedulingData* CFrameSchedulingManager::dataFor(CMonitor* pMonitor) {
|
||||||
|
|
|
@ -39,8 +39,8 @@ class CFrameSchedulingManager {
|
||||||
// whether the frame was submitted from gpuDone
|
// whether the frame was submitted from gpuDone
|
||||||
bool delayedFrameSubmitted = false;
|
bool delayedFrameSubmitted = false;
|
||||||
|
|
||||||
// whether this call comes from gpuDone
|
// don't plant a vblank timer
|
||||||
bool gpuDoneCall = false;
|
bool noVblankTimer = false;
|
||||||
|
|
||||||
// we need to render a few full frames at the beginning to catch all buffers
|
// we need to render a few full frames at the beginning to catch all buffers
|
||||||
int forceFrames = 5;
|
int forceFrames = 5;
|
||||||
|
|
Loading…
Reference in a new issue