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

Commit 10689992 authored by Stan Iliev's avatar Stan Iliev
Browse files

Fix an issue with GPU stats not enabled

Invoke Surface::enableFrameTimestamps after eglDestroySurface.
eglDestroySurface internally disables time stats. Order is
important, when CanvasContext::setSurface is invoked with
a surface, that is already current (which happens all the time).

Test: ran UiBench microbenchmark tests
Change-Id: I3d023c3a87da6329c556426d553c744e541b9dff
parent b814d6b3
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -147,7 +147,6 @@ void CanvasContext::setSurface(sp<Surface>&& surface) {
        mNativeSurface = new ReliableSurface{std::move(surface)};
        // TODO: Fix error handling & re-shorten timeout
        ANativeWindow_setDequeueTimeout(mNativeSurface.get(), 4000_ms);
        mNativeSurface->enableFrameTimestamps(true);
    } else {
        mNativeSurface = nullptr;
    }
@@ -169,6 +168,10 @@ void CanvasContext::setSurface(sp<Surface>&& surface) {
    if (hasSurface) {
        mHaveNewSurface = true;
        mSwapHistory.clear();
        // Enable frame stats after the surface has been bound to the appropriate graphics API.
        // Order is important when new and old surfaces are the same, because old surface has
        // its frame stats disabled automatically.
        mNativeSurface->enableFrameTimestamps(true);
    } else {
        mRenderThread.removeFrameCallback(this);
        mGenerationID++;