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

Commit 18570db8 authored by Mathias Agopian's avatar Mathias Agopian Committed by Android Git Automerger
Browse files

am 33029221: Merge "revert the surface purgatory list and dependent changes." into gingerbread

* commit '33029221619f14577bd0d0e7c2f815abc8f1b8ea':
  revert the surface purgatory list and dependent changes.
parents 9d0cbdad c1315657
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -63,7 +63,7 @@ void GraphicBufferAllocator::dump(String8& result) const
    const size_t c = list.size();
    const size_t c = list.size();
    for (size_t i=0 ; i<c ; i++) {
    for (size_t i=0 ; i<c ; i++) {
        const alloc_rec_t& rec(list.valueAt(i));
        const alloc_rec_t& rec(list.valueAt(i));
        snprintf(buffer, SIZE, "%10p: %7.2f KiB | %4u (%4u) x %4u | %8X | 0x%08x\n",
        snprintf(buffer, SIZE, "%10p: %7.2f KiB | %4u (%4u) x %4u | %2d | 0x%08x\n",
            list.keyAt(i), rec.size/1024.0f, 
            list.keyAt(i), rec.size/1024.0f, 
            rec.w, rec.s, rec.h, rec.format, rec.usage);
            rec.w, rec.s, rec.h, rec.format, rec.usage);
        result.append(buffer);
        result.append(buffer);
+6 −2
Original line number Original line Diff line number Diff line
@@ -120,8 +120,7 @@ void Layer::onRemoved()


sp<LayerBaseClient::Surface> Layer::createSurface() const
sp<LayerBaseClient::Surface> Layer::createSurface() const
{
{
    sp<Surface> sur(new SurfaceLayer(mFlinger, const_cast<Layer *>(this)));
    return mSurface;
    return sur;
}
}


status_t Layer::ditch()
status_t Layer::ditch()
@@ -131,6 +130,10 @@ status_t Layer::ditch()
    // the layer is not on screen anymore. free as much resources as possible
    // the layer is not on screen anymore. free as much resources as possible
    mFreezeLock.clear();
    mFreezeLock.clear();


    EGLDisplay dpy(mFlinger->graphicPlane(0).getEGLDisplay());
    mBufferManager.destroy(dpy);
    mSurface.clear();

    Mutex::Autolock _l(mLock);
    Mutex::Autolock _l(mLock);
    mWidth = mHeight = 0;
    mWidth = mHeight = 0;
    return NO_ERROR;
    return NO_ERROR;
@@ -175,6 +178,7 @@ status_t Layer::setBuffers( uint32_t w, uint32_t h,
    int layerRedsize = info.getSize(PixelFormatInfo::INDEX_RED);
    int layerRedsize = info.getSize(PixelFormatInfo::INDEX_RED);
    mNeedsDithering = layerRedsize > displayRedSize;
    mNeedsDithering = layerRedsize > displayRedSize;


    mSurface = new SurfaceLayer(mFlinger, this);
    return NO_ERROR;
    return NO_ERROR;
}
}


+1 −0
Original line number Original line Diff line number Diff line
@@ -211,6 +211,7 @@ private:
    ClientRef mUserClientRef;
    ClientRef mUserClientRef;


    // constants
    // constants
    sp<Surface> mSurface;
    PixelFormat mFormat;
    PixelFormat mFormat;
    const GLExtensions& mGLExtensions;
    const GLExtensions& mGLExtensions;
    bool mNeedsBlending;
    bool mNeedsBlending;
+6 −26
Original line number Original line Diff line number Diff line
@@ -515,21 +515,13 @@ void LayerBase::dump(String8& result, char* buffer, size_t SIZE) const
    result.append(buffer);
    result.append(buffer);
}
}


void LayerBase::shortDump(String8& result, char* scratch, size_t size) const
{
    LayerBase::dump(result, scratch, size);
}


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


int32_t LayerBaseClient::sIdentity = 1;
int32_t LayerBaseClient::sIdentity = 1;


LayerBaseClient::LayerBaseClient(SurfaceFlinger* flinger, DisplayID display,
LayerBaseClient::LayerBaseClient(SurfaceFlinger* flinger, DisplayID display,
        const sp<Client>& client)
        const sp<Client>& client)
    : LayerBase(flinger, display),
    : LayerBase(flinger, display), mClientRef(client),
      mHasSurface(false),
      mClientRef(client),
      mIdentity(uint32_t(android_atomic_inc(&sIdentity)))
      mIdentity(uint32_t(android_atomic_inc(&sIdentity)))
{
{
}
}
@@ -546,18 +538,12 @@ sp<LayerBaseClient::Surface> LayerBaseClient::getSurface()
{
{
    sp<Surface> s;
    sp<Surface> s;
    Mutex::Autolock _l(mLock);
    Mutex::Autolock _l(mLock);

    s = mClientSurface.promote();
    LOG_ALWAYS_FATAL_IF(mHasSurface,
    if (s == 0) {
            "LayerBaseClient::getSurface() has already been called");

    mHasSurface = true;
        s = createSurface();
        s = createSurface();
    mClientSurfaceBinder = s->asBinder();
        mClientSurface = s;
    return s;
    }
    }

    return s;
wp<IBinder> LayerBaseClient::getSurfaceBinder() const {
    return mClientSurfaceBinder;
}
}


sp<LayerBaseClient::Surface> LayerBaseClient::createSurface() const
sp<LayerBaseClient::Surface> LayerBaseClient::createSurface() const
@@ -580,12 +566,6 @@ void LayerBaseClient::dump(String8& result, char* buffer, size_t SIZE) const
    result.append(buffer);
    result.append(buffer);
}
}



void LayerBaseClient::shortDump(String8& result, char* scratch, size_t size) const
{
    LayerBaseClient::dump(result, scratch, size);
}

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


LayerBaseClient::Surface::Surface(
LayerBaseClient::Surface::Surface(
+1 −5
Original line number Original line Diff line number Diff line
@@ -206,7 +206,6 @@ public:
    
    
    /** always call base class first */
    /** always call base class first */
    virtual void dump(String8& result, char* scratch, size_t size) const;
    virtual void dump(String8& result, char* scratch, size_t size) const;
    virtual void shortDump(String8& result, char* scratch, size_t size) const;




    enum { // flags for doTransaction()
    enum { // flags for doTransaction()
@@ -285,7 +284,6 @@ public:
    virtual ~LayerBaseClient();
    virtual ~LayerBaseClient();


            sp<Surface> getSurface();
            sp<Surface> getSurface();
            wp<IBinder> getSurfaceBinder() const;
    virtual sp<Surface> createSurface() const;
    virtual sp<Surface> createSurface() const;
    virtual sp<LayerBaseClient> getLayerBaseClient() const {
    virtual sp<LayerBaseClient> getLayerBaseClient() const {
        return const_cast<LayerBaseClient*>(this); }
        return const_cast<LayerBaseClient*>(this); }
@@ -327,12 +325,10 @@ public:


protected:
protected:
    virtual void dump(String8& result, char* scratch, size_t size) const;
    virtual void dump(String8& result, char* scratch, size_t size) const;
    virtual void shortDump(String8& result, char* scratch, size_t size) const;


private:
private:
    mutable Mutex mLock;
    mutable Mutex mLock;
    mutable bool mHasSurface;
    mutable wp<Surface> mClientSurface;
    wp<IBinder> mClientSurfaceBinder;
    const wp<Client> mClientRef;
    const wp<Client> mClientRef;
    // only read
    // only read
    const uint32_t mIdentity;
    const uint32_t mIdentity;
Loading