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

Commit 47a740b5 authored by Mathias Agopian's avatar Mathias Agopian Committed by Android Git Automerger
Browse files

am 801d0b33: am 025822a0: Merge "keep a list of visible sorted surfaces" into gingerbread

Merge commit '801d0b33'

* commit '801d0b33':
  keep a list of visible sorted surfaces
parents b219a83f 801d0b33
Loading
Loading
Loading
Loading
+28 −12
Original line number Original line Diff line number Diff line
@@ -521,6 +521,10 @@ void SurfaceFlinger::handleTransaction(uint32_t transactionFlags)
{
{
    Vector< sp<LayerBase> > ditchedLayers;
    Vector< sp<LayerBase> > ditchedLayers;


    /*
     * Perform and commit the transaction
     */

    { // scope for the lock
    { // scope for the lock
        Mutex::Autolock _l(mStateLock);
        Mutex::Autolock _l(mStateLock);
        const nsecs_t now = systemTime();
        const nsecs_t now = systemTime();
@@ -528,9 +532,13 @@ void SurfaceFlinger::handleTransaction(uint32_t transactionFlags)
        handleTransactionLocked(transactionFlags, ditchedLayers);
        handleTransactionLocked(transactionFlags, ditchedLayers);
        mLastTransactionTime = systemTime() - now;
        mLastTransactionTime = systemTime() - now;
        mDebugInTransaction = 0;
        mDebugInTransaction = 0;
        // here the transaction has been committed
    }
    }


    // do this without lock held
    /*
     * Clean-up all layers that went away
     * (do this without the lock held)
     */
    const size_t count = ditchedLayers.size();
    const size_t count = ditchedLayers.size();
    for (size_t i=0 ; i<count ; i++) {
    for (size_t i=0 ; i<count ; i++) {
        if (ditchedLayers[i] != 0) {
        if (ditchedLayers[i] != 0) {
@@ -773,6 +781,19 @@ void SurfaceFlinger::handlePageFlip()
        if (visibleRegions) {
        if (visibleRegions) {
            Region opaqueRegion;
            Region opaqueRegion;
            computeVisibleRegions(currentLayers, mDirtyRegion, opaqueRegion);
            computeVisibleRegions(currentLayers, mDirtyRegion, opaqueRegion);

            /*
             *  rebuild the visible layer list
             */
            mVisibleLayersSortedByZ.clear();
            const LayerVector& currentLayers(mDrawingState.layersSortedByZ);
            size_t count = currentLayers.size();
            mVisibleLayersSortedByZ.setCapacity(count);
            for (size_t i=0 ; i<count ; i++) {
                if (!currentLayers[i]->visibleRegionScreen.isEmpty())
                    mVisibleLayersSortedByZ.add(currentLayers[i]);
            }

            mWormholeRegion = screenRegion.subtract(opaqueRegion);
            mWormholeRegion = screenRegion.subtract(opaqueRegion);
            mVisibleRegionsDirty = false;
            mVisibleRegionsDirty = false;
        }
        }
@@ -869,21 +890,16 @@ void SurfaceFlinger::composeSurfaces(const Region& dirty)
        // draw something...
        // draw something...
        drawWormhole();
        drawWormhole();
    }
    }
    const SurfaceFlinger& flinger(*this);
    const Vector< sp<LayerBase> >& layers(mVisibleLayersSortedByZ);
    const LayerVector& drawingLayers(mDrawingState.layersSortedByZ);
    const size_t count = layers.size();
    const size_t count = drawingLayers.size();
    sp<LayerBase> const* const layers = drawingLayers.array();
    for (size_t i=0 ; i<count ; ++i) {
    for (size_t i=0 ; i<count ; ++i) {
        const sp<LayerBase>& layer = layers[i];
        const sp<LayerBase>& layer(layers[i]);
        const Region& visibleRegion(layer->visibleRegionScreen);
        const Region clip(dirty.intersect(layer->visibleRegionScreen));
        if (!visibleRegion.isEmpty())  {
            const Region clip(dirty.intersect(visibleRegion));
        if (!clip.isEmpty()) {
        if (!clip.isEmpty()) {
            layer->draw(clip);
            layer->draw(clip);
        }
        }
    }
    }
}
}
}


void SurfaceFlinger::unlockClients()
void SurfaceFlinger::unlockClients()
{
{
+2 −3
Original line number Original line Diff line number Diff line
@@ -40,9 +40,6 @@


#include "MessageQueue.h"
#include "MessageQueue.h"


struct copybit_device_t;
struct overlay_device_t;

namespace android {
namespace android {


// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
@@ -379,6 +376,8 @@ private:
                bool                        mFreezeDisplay;
                bool                        mFreezeDisplay;
                int32_t                     mFreezeCount;
                int32_t                     mFreezeCount;
                nsecs_t                     mFreezeDisplayTime;
                nsecs_t                     mFreezeDisplayTime;
                Vector< sp<LayerBase> >     mVisibleLayersSortedByZ;



                // don't use a lock for these, we don't care
                // don't use a lock for these, we don't care
                int                         mDebugRegion;
                int                         mDebugRegion;