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

Commit 090cb44b authored by Elliott Hughes's avatar Elliott Hughes Committed by Android Git Automerger
Browse files
parents 35e9fa48 cb2de718
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -85,6 +85,10 @@ public:
        eOrientationSwapMask    = 0x01
    };

    enum {
        eSynchronous            = 0x01,
    };

    enum {
        eElectronBeamAnimationOn  = 0x01,
        eElectronBeamAnimationOff = 0x10
@@ -104,7 +108,7 @@ public:

    /* open/close transactions. requires ACCESS_SURFACE_FLINGER permission */
    virtual void setTransactionState(const Vector<ComposerState>& state,
            int orientation) = 0;
            int orientation, uint32_t flags) = 0;

    /* signal that we're done booting.
     * Requires ACCESS_SURFACE_FLINGER permission
@@ -143,8 +147,6 @@ public:
        GET_CBLK,
        SET_TRANSACTION_STATE,
        SET_ORIENTATION,
        FREEZE_DISPLAY,
        UNFREEZE_DISPLAY,
        CAPTURE_SCREEN,
        TURN_ELECTRON_BEAM_OFF,
        TURN_ELECTRON_BEAM_ON,
+1 −1
Original line number Diff line number Diff line
@@ -112,7 +112,7 @@ public:
    static void openGlobalTransaction();
        
    //! Close a composer transaction on all active SurfaceComposerClients.
    static void closeGlobalTransaction();
    static void closeGlobalTransaction(bool synchronous = false);
    
    //! Freeze the specified display but not transactions.
    static status_t freezeDisplay(DisplayID dpy, uint32_t flags = 0);
+4 −2
Original line number Diff line number Diff line
@@ -79,7 +79,7 @@ public:
    }

    virtual void setTransactionState(const Vector<ComposerState>& state,
            int orientation)
            int orientation, uint32_t flags)
    {
        Parcel data, reply;
        data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
@@ -90,6 +90,7 @@ public:
            b->write(data);
        }
        data.writeInt32(orientation);
        data.writeInt32(flags);
        remote()->transact(BnSurfaceComposer::SET_TRANSACTION_STATE, data, &reply);
    }

@@ -204,7 +205,8 @@ status_t BnSurfaceComposer::onTransact(
                state.add(s);
            }
            int orientation = data.readInt32();
            setTransactionState(state, orientation);
            uint32_t flags = data.readInt32();
            setTransactionState(state, orientation, flags);
        } break;
        case BOOT_FINISHED: {
            CHECK_INTERFACE(ISurfaceComposer, data, reply);
+25 −8
Original line number Diff line number Diff line
@@ -92,11 +92,14 @@ class Composer : public Singleton<Composer>
    mutable Mutex               mLock;
    SortedVector<ComposerState> mStates;
    int                         mOrientation;
    uint32_t                    mForceSynchronous;

    Composer() : Singleton<Composer>(),
        mOrientation(ISurfaceComposer::eOrientationUnchanged) { }
        mOrientation(ISurfaceComposer::eOrientationUnchanged),
        mForceSynchronous(0)
    { }

    void closeGlobalTransactionImpl();
    void closeGlobalTransactionImpl(bool synchronous);

    layer_state_t* getLayerStateLocked(
            const sp<SurfaceComposerClient>& client, SurfaceID id);
@@ -123,8 +126,8 @@ public:
            uint32_t tint);
    status_t setOrientation(int orientation);

    static void closeGlobalTransaction() {
        Composer::getInstance().closeGlobalTransactionImpl();
    static void closeGlobalTransaction(bool synchronous) {
        Composer::getInstance().closeGlobalTransactionImpl(synchronous);
    }
};

@@ -132,11 +135,12 @@ ANDROID_SINGLETON_STATIC_INSTANCE(Composer);

// ---------------------------------------------------------------------------

void Composer::closeGlobalTransactionImpl() {
void Composer::closeGlobalTransactionImpl(bool synchronous) {
    sp<ISurfaceComposer> sm(getComposerService());

    Vector<ComposerState> transaction;
    int orientation;
    uint32_t flags = 0;

    { // scope for the lock
        Mutex::Autolock _l(mLock);
@@ -145,9 +149,14 @@ void Composer::closeGlobalTransactionImpl() {

        orientation = mOrientation;
        mOrientation = ISurfaceComposer::eOrientationUnchanged;

        if (synchronous || mForceSynchronous) {
            flags |= ISurfaceComposer::eSynchronous;
        }
        mForceSynchronous = false;
    }

   sm->setTransactionState(transaction, orientation);
   sm->setTransactionState(transaction, orientation, flags);
}

layer_state_t* Composer::getLayerStateLocked(
@@ -188,6 +197,10 @@ status_t Composer::setSize(const sp<SurfaceComposerClient>& client,
    s->what |= ISurfaceComposer::eSizeChanged;
    s->w = w;
    s->h = h;

    // Resizing a surface makes the transaction synchronous.
    mForceSynchronous = true;

    return NO_ERROR;
}

@@ -270,6 +283,10 @@ status_t Composer::setFreezeTint(const sp<SurfaceComposerClient>& client,
status_t Composer::setOrientation(int orientation) {
    Mutex::Autolock _l(mLock);
    mOrientation = orientation;

    // Changing the orientation makes the transaction synchronous.
    mForceSynchronous = true;

    return NO_ERROR;
}

@@ -375,8 +392,8 @@ void SurfaceComposerClient::openGlobalTransaction() {
    // Currently a no-op
}

void SurfaceComposerClient::closeGlobalTransaction() {
    Composer::closeGlobalTransaction();
void SurfaceComposerClient::closeGlobalTransaction(bool synchronous) {
    Composer::closeGlobalTransaction(synchronous);
}

// ----------------------------------------------------------------------------
+3 −31
Original line number Diff line number Diff line
@@ -360,18 +360,6 @@ uint32_t Layer::doTransaction(uint32_t flags)
                mCurrentScalingMode);

        if (!isFixedSize()) {
            // we're being resized and there is a freeze display request,
            // acquire a freeze lock, so that the screen stays put
            // until we've redrawn at the new size; this is to avoid
            // glitches upon orientation changes.
            if (mFlinger->hasFreezeRequest()) {
                // if the surface is hidden, don't try to acquire the
                // freeze lock, since hidden surfaces may never redraw
                if (!(front.flags & ISurfaceComposer::eLayerHidden)) {
                    mFreezeLock = mFlinger->getFreezeLock();
                }
            }

            // this will make sure LayerBase::doTransaction doesn't update
            // the drawing state's size
            Layer::State& editDraw(mDrawingState);
@@ -385,14 +373,6 @@ uint32_t Layer::doTransaction(uint32_t flags)
                temp.requested_h);
    }

    if (temp.sequence != front.sequence) {
        if (temp.flags & ISurfaceComposer::eLayerHidden || temp.alpha == 0) {
            // this surface is now hidden, so it shouldn't hold a freeze lock
            // (it may never redraw, which is fine if it is hidden)
            mFreezeLock.clear();
        }
    }
        
    return LayerBase::doTransaction(flags);
}

@@ -466,7 +446,7 @@ void Layer::lockPageFlip(bool& recomputeVisibleRegions)
        glTexParameterx(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
        glTexParameterx(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

        // update the layer size and release freeze-lock
        // update the layer size if needed
        const Layer::State& front(drawingState());

        // FIXME: mPostedDirtyRegion = dirty & bounds
@@ -503,9 +483,6 @@ void Layer::lockPageFlip(bool& recomputeVisibleRegions)

                // recompute visible region
                recomputeVisibleRegions = true;

                // we now have the correct size, unfreeze the screen
                mFreezeLock.clear();
            }

            LOGD_IF(DEBUG_RESIZE,
@@ -538,11 +515,6 @@ void Layer::unlockPageFlip(
        dirtyRegion.andSelf(visibleRegionScreen);
        outDirtyRegion.orSelf(dirtyRegion);
    }
    if (visibleRegionScreen.isEmpty()) {
        // an invisible layer should not hold a freeze-lock
        // (because it may never be updated and therefore never release it)
        mFreezeLock.clear();
    }
}

void Layer::dump(String8& result, char* buffer, size_t SIZE) const
@@ -560,9 +532,9 @@ void Layer::dump(String8& result, char* buffer, size_t SIZE) const
    snprintf(buffer, SIZE,
            "      "
            "format=%2d, activeBuffer=[%4ux%4u:%4u,%3X],"
            " freezeLock=%p, transform-hint=0x%02x, queued-frames=%d\n",
            " transform-hint=0x%02x, queued-frames=%d\n",
            mFormat, w0, h0, s0,f0,
            getFreezeLock().get(), getTransformHint(), mQueuedFrames);
            getTransformHint(), mQueuedFrames);

    result.append(buffer);

Loading