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

Commit 91d1bbce authored by John Reck's avatar John Reck Committed by android-build-merger
Browse files

Merge "Avoid starving RT anims" am: f77c220a

am: 7269372d

Change-Id: Ife1e7ea95055d8179b4a622dc4dabce382575b5b
parents 3ae84b6e 7269372d
Loading
Loading
Loading
Loading
+13 −4
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@
#include "CanvasContext.h"
#include "EglManager.h"
#include "RenderProxy.h"
#include "utils/FatVector.h"

#include <gui/DisplayEventReceiver.h>
#include <gui/ISurfaceComposer.h>
@@ -282,11 +283,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 {