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

Commit 38d25005 authored by Robert Carr's avatar Robert Carr
Browse files

Layer: Don't need atomic for transaction flags

Following queued transaction changes we don't need an atomic here
since setPosition etc all execute on the main thread.

Test: Existing tests pass. simpleperf
Bug: 186200583
Change-Id: I965d3883d30ce1eb3c452742535281f3e2719424
parent 13a864c4
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@
#include <gui/BufferQueue.h>
#include <private/gui/SyncFeatures.h>
#include <renderengine/Image.h>
#include "TunnelModeEnabledReporter.h"

#include "EffectLayer.h"
#include "FrameTracer/FrameTracer.h"
+4 −2
Original line number Diff line number Diff line
@@ -847,11 +847,13 @@ void Layer::commitTransaction(State& stateToCommit) {
}

uint32_t Layer::getTransactionFlags(uint32_t flags) {
    return mTransactionFlags.fetch_and(~flags) & flags;
    auto ret = mTransactionFlags & flags;
    mTransactionFlags &= ~flags;
    return ret;
}

uint32_t Layer::setTransactionFlags(uint32_t flags) {
    return mTransactionFlags.fetch_or(flags);
    return mTransactionFlags |= flags;
}

bool Layer::setPosition(float x, float y) {
+1 −1
Original line number Diff line number Diff line
@@ -960,7 +960,7 @@ protected:

    // these are protected by an external lock (mStateLock)
    State mCurrentState;
    std::atomic<uint32_t> mTransactionFlags{0};
    uint32_t mTransactionFlags{0};

    // Timestamp history for UIAutomation. Thread safe.
    FrameTracker mFrameTracker;