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

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

revert the surface purgatory list and dependent changes.

6d0f6cb Revert "Fix [3513017] in lockscreen but showing empty launcher (live wallpaper) only"
6154412 Revert "partially fix [3306150] HTML5 video with H/W acceleration blackout (DO NOT MERGE)"
37c2a37 fix [3408713] Dialog window invisible sometimes

It looks like there is a surface leak, it's unclear where it is.
Without those reverts, this would cause a leak of the associated buffers
which is far more problematic. this change might hide the surface leak.

Bug: 4078032
Change-Id: Iedcda3ffcdd2f69d41047b5c3134c1e867ff90d7
parent f4e1ef07
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -63,7 +63,7 @@ void GraphicBufferAllocator::dump(String8& result) const
    const size_t c = list.size();
    for (size_t i=0 ; i<c ; 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, 
            rec.w, rec.s, rec.h, rec.format, rec.usage);
        result.append(buffer);
+6 −2
Original line number Diff line number Diff line
@@ -120,8 +120,7 @@ void Layer::onRemoved()

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

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
    mFreezeLock.clear();

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

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

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

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

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

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


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

int32_t LayerBaseClient::sIdentity = 1;

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

    LOG_ALWAYS_FATAL_IF(mHasSurface,
            "LayerBaseClient::getSurface() has already been called");

    mHasSurface = true;
    s = mClientSurface.promote();
    if (s == 0) {
        s = createSurface();
    mClientSurfaceBinder = s->asBinder();
    return s;
        mClientSurface = s;
    }

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

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


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

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

LayerBaseClient::Surface::Surface(
+1 −5
Original line number Diff line number Diff line
@@ -206,7 +206,6 @@ public:
    
    /** always call base class first */
    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()
@@ -285,7 +284,6 @@ public:
    virtual ~LayerBaseClient();

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

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

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