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

Commit 87855783 authored by Mathias Agopian's avatar Mathias Agopian
Browse files

add a layerStack attribute to Layers.

this attribute can be set through a regular transaction using
SurfaceComposerClient (just like any other attribute, eg: position or size)

Change-Id: I701a47c677ea6442ca713728a93335328cd2b172
parent 8b33f032
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -67,6 +67,7 @@ public:
        eMatrixChanged              = 0x00000010,
        eTransparentRegionChanged   = 0x00000020,
        eVisibilityChanged          = 0x00000040,
        eLayerStackChanged          = 0x00000080,
        eCropChanged                = 0x00000100,
    };

+1 −0
Original line number Diff line number Diff line
@@ -119,6 +119,7 @@ public:
    status_t    setPosition(SurfaceID id, float x, float y);
    status_t    setSize(SurfaceID id, uint32_t w, uint32_t h);
    status_t    setCrop(SurfaceID id, const Rect& crop);
    status_t    setLayerStack(SurfaceID id, uint32_t layerStack);
    status_t    destroySurface(SurfaceID sid);

private:
+2 −1
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ struct layer_state_t {

    layer_state_t()
        :   surface(0), what(0),
            x(0), y(0), z(0), w(0), h(0),
            x(0), y(0), z(0), w(0), h(0), layerStack(0),
            alpha(0), flags(0), mask(0),
            reserved(0)
    {
@@ -60,6 +60,7 @@ struct layer_state_t {
            uint32_t        z;
            uint32_t        w;
            uint32_t        h;
            uint32_t        layerStack;
            float           alpha;
            uint8_t         flags;
            uint8_t         mask;
+17 −0
Original line number Diff line number Diff line
@@ -124,6 +124,8 @@ public:
    status_t setOrientation(int orientation);
    status_t setCrop(const sp<SurfaceComposerClient>& client, SurfaceID id,
            const Rect& crop);
    status_t setLayerStack(const sp<SurfaceComposerClient>& client,
            SurfaceID id, uint32_t layerStack);

    static void closeGlobalTransaction(bool synchronous) {
        Composer::getInstance().closeGlobalTransactionImpl(synchronous);
@@ -255,6 +257,17 @@ status_t Composer::setAlpha(const sp<SurfaceComposerClient>& client,
    return NO_ERROR;
}

status_t Composer::setLayerStack(const sp<SurfaceComposerClient>& client,
        SurfaceID id, uint32_t layerStack) {
    Mutex::Autolock _l(mLock);
    layer_state_t* s = getLayerStateLocked(client, id);
    if (!s)
        return BAD_INDEX;
    s->what |= ISurfaceComposer::eLayerStackChanged;
    s->layerStack = layerStack;
    return NO_ERROR;
}

status_t Composer::setMatrix(const sp<SurfaceComposerClient>& client,
        SurfaceID id, float dsdx, float dtdx,
        float dsdy, float dtdy) {
@@ -443,6 +456,10 @@ status_t SurfaceComposerClient::setAlpha(SurfaceID id, float alpha) {
    return getComposer().setAlpha(this, id, alpha);
}

status_t SurfaceComposerClient::setLayerStack(SurfaceID id, uint32_t layerStack) {
    return getComposer().setLayerStack(this, id, layerStack);
}

status_t SurfaceComposerClient::setMatrix(SurfaceID id, float dsdx, float dtdx,
        float dsdy, float dtdy) {
    return getComposer().setMatrix(this, id, dsdx, dtdx, dsdy, dtdy);
+10 −0
Original line number Diff line number Diff line
@@ -77,6 +77,7 @@ void LayerBase::initStates(uint32_t w, uint32_t h, uint32_t flags)
    mCurrentState.active.crop.makeInvalid();
    mCurrentState.z = 0;
    mCurrentState.alpha = 0xFF;
    mCurrentState.layerStack = 0;
    mCurrentState.flags = layerFlags;
    mCurrentState.sequence = 0;
    mCurrentState.transform.set(0, 0);
@@ -169,6 +170,15 @@ bool LayerBase::setCrop(const Rect& crop) {
    return true;
}

bool LayerBase::setLayerStack(uint32_t layerStack) {
    if (mCurrentState.layerStack == layerStack)
        return false;
    mCurrentState.sequence++;
    mCurrentState.layerStack = layerStack;
    requestTransaction();
    return true;
}

void LayerBase::setVisibleRegion(const Region& visibleRegion) {
    // always called from main thread
    this->visibleRegion = visibleRegion;
Loading