Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 12efa550 authored by John Reck's avatar John Reck
Browse files

Avoid starving RT anims

Test: Manual, usleep(16000) in DrawFrameTask and tap
on recents

Change-Id: I88bb30a2503bc908ec45650c7d36b6fb3cc750d0
parent ceb9ec6d
Loading
Loading
Loading
Loading
+13 −4
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@
#include "EglManager.h"
#include "RenderProxy.h"
#include "VulkanManager.h"
#include "utils/FatVector.h"

#include <gui/DisplayEventReceiver.h>
#include <gui/ISurfaceComposer.h>
@@ -285,11 +286,19 @@ bool RenderThread::threadLoop() {
                "RenderThread Looper POLL_ERROR!");

        nsecs_t nextWakeup;
        // Process our queue, if we have anything
        {
            FatVector<RenderTask*, 10> workQueue;
            // Process our queue, if we have anything. By first acquiring
            // all the pending events then processing them we avoid vsync
            // starvation if more tasks are queued while we are processing tasks.
            while (RenderTask* task = nextTask(&nextWakeup)) {
                workQueue.push_back(task);
            }
            for (auto task : workQueue) {
                task->run();
                // task may have deleted itself, do not reference it again
            }
        }
        if (nextWakeup == LLONG_MAX) {
            timeoutMillis = -1;
        } else {