mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-02 13:05:59 +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");
|
||||
|
||||
if (pMonitor->output->frame_pending || pMonitor->tearingState.activelyTearing)
|
||||
if (pMonitor->tearingState.activelyTearing)
|
||||
return;
|
||||
|
||||
if (DATA->activelyPushing) {
|
||||
DATA->forceFrames++;
|
||||
return;
|
||||
}
|
||||
|
||||
Debug::log(LOG, "onFrameNeeded");
|
||||
|
||||
DATA->noVblankTimer = true;
|
||||
onPresent(pMonitor);
|
||||
}
|
||||
|
||||
|
@ -43,7 +49,7 @@ void CFrameSchedulingManager::gpuDone(wlr_buffer* pBuffer) {
|
|||
|
||||
// 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
|
||||
DATA->gpuDoneCall = true;
|
||||
DATA->noVblankTimer = true;
|
||||
g_pHyprRenderer->renderMonitor(DATA->pMonitor);
|
||||
DATA->delayedFrameSubmitted = true;
|
||||
}
|
||||
|
@ -111,7 +117,7 @@ void CFrameSchedulingManager::onPresent(CMonitor* pMonitor) {
|
|||
Debug::log(LOG, "remder!");
|
||||
|
||||
// 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;
|
||||
wl_event_source_timer_update(DATA->event, 0);
|
||||
wl_event_source_timer_update(DATA->event, std::floor(TIMEUNTILVBLANK));
|
||||
|
@ -119,7 +125,7 @@ void CFrameSchedulingManager::onPresent(CMonitor* pMonitor) {
|
|||
|
||||
renderMonitor(DATA);
|
||||
|
||||
DATA->gpuDoneCall = false;
|
||||
DATA->noVblankTimer = false;
|
||||
}
|
||||
|
||||
CFrameSchedulingManager::SSchedulingData* CFrameSchedulingManager::dataFor(CMonitor* pMonitor) {
|
||||
|
|
|
@ -39,8 +39,8 @@ class CFrameSchedulingManager {
|
|||
// whether the frame was submitted from gpuDone
|
||||
bool delayedFrameSubmitted = false;
|
||||
|
||||
// whether this call comes from gpuDone
|
||||
bool gpuDoneCall = false;
|
||||
// don't plant a vblank timer
|
||||
bool noVblankTimer = false;
|
||||
|
||||
// we need to render a few full frames at the beginning to catch all buffers
|
||||
int forceFrames = 5;
|
||||
|
|
Loading…
Reference in a new issue