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

Commit 8cb2188b authored by Ady Abraham's avatar Ady Abraham
Browse files

SurfaceFlinger: DispSync -> VsyncController

Refactor the old DispSync to separate between Vsync math (VsyncTracker)
and fence / vsync callback management (VsyncController)

Bug: 162888874
Test: examine systraces
Test: SF unit tests

Change-Id: Id275620380a21aeb0017e966910cbf24860cecef
parent 8735eacc
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -72,6 +72,7 @@ public:
        struct VSync {
            uint32_t count;
            nsecs_t expectedVSyncTimestamp __attribute__((aligned(8)));
            nsecs_t deadlineTimestamp __attribute__((aligned(8)));
        };

        struct Hotplug {
+1 −1
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@

#include "BufferLayerConsumer.h"
#include "Layer.h"
#include "Scheduler/DispSync.h"
#include "Scheduler/VsyncController.h"

#include <inttypes.h>

+0 −1
Original line number Diff line number Diff line
@@ -34,7 +34,6 @@
namespace android {
// ----------------------------------------------------------------------------

class DispSync;
class Layer;
class String8;

+2 −2
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@
#include "DisplayRenderArea.h"
#include "Layer.h"
#include "Promise.h"
#include "Scheduler/DispSync.h"
#include "Scheduler/VsyncController.h"
#include "SurfaceFlinger.h"

namespace android {
@@ -249,7 +249,7 @@ void RegionSamplingThread::doSample() {
        // until the next vsync deadline, defer this sampling work
        // to a later frame, when hopefully there will be more time.
        DisplayStatInfo stats;
        mScheduler.getDisplayStatInfo(&stats);
        mScheduler.getDisplayStatInfo(&stats, systemTime());
        if (std::chrono::nanoseconds(stats.vsyncTime) - now < timeForRegionSampling) {
            ATRACE_INT(lumaSamplingStepTag, static_cast<int>(samplingStep::waitForQuietFrame));
            mDiscardedFrames++;
+1 −4
Original line number Diff line number Diff line
@@ -22,16 +22,13 @@
#include <utils/Trace.h>
#include <mutex>

#include "DispSync.h"
#include "EventThread.h"
#include "VsyncController.h"

namespace android::scheduler {
using base::StringAppendF;
using namespace std::chrono_literals;

// The DispSync interface has a 'repeat this callback at rate' semantic. This object adapts
// VSyncDispatch's individually-scheduled callbacks so as to meet DispSync's existing semantic
// for now.
class CallbackRepeater {
public:
    CallbackRepeater(VSyncDispatch& dispatch, VSyncDispatch::Callback cb, const char* name,
Loading