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

Commit 0b3ad46a authored by Mathias Agopian's avatar Mathias Agopian
Browse files

Attempt to fix [2152536] ANR in browser

The ANR is caused by SurfaceFlinger waiting for buffers of a removed surface to become availlable.
When it is removed from the current list, a Surface is marked as NO_INIT, which causes SF to return
immediately in the above case. For some reason, the surface here wasn't marked as NO_INIT.

This change makes the code more robust by always (irregadless or errors) setting the NO_INIT status
in all code paths where a surface is removed from the list.

Additionaly added more information in the logs, should this happen again.
parent c91af0c1
Loading
Loading
Loading
Loading
+9 −7
Original line number Diff line number Diff line
@@ -142,6 +142,7 @@ public:
    SharedBufferBase(SharedClient* sharedClient, int surface, int num);
    ~SharedBufferBase();
    uint32_t getIdentity();
    status_t getStatus() const;
    size_t getFrontBuffer() const;
    String8 dump(char const* prefix) const;

@@ -188,13 +189,14 @@ status_t SharedBufferBase::waitForCondition(T condition)
                if (condition()) {
                    LOGE("waitForCondition(%s) timed out (identity=%d), "
                        "but condition is true! We recovered but it "
                            "shouldn't happen." , 
                            T::name(), mSharedStack->identity);
                        "shouldn't happen." , T::name(),
                        mSharedStack->identity);
                    break;
                } else {
                    LOGW("waitForCondition(%s) timed out (identity=%d). "
                            "CPU may be pegged. trying again.",
                            T::name(), mSharedStack->identity);
                    LOGW("waitForCondition(%s) timed out "
                        "(identity=%d, status=%d). "
                        "CPU may be pegged. trying again.", T::name(),
                        mSharedStack->identity, mSharedStack->status);
                }
            } else {
                LOGE("waitForCondition(%s) error (%s) ",
+0 −5
Original line number Diff line number Diff line
@@ -20,17 +20,12 @@

#include <utils/Errors.h>
#include <utils/Log.h>
#include <binder/MemoryBase.h>
#include <binder/IMemory.h>

#include <ui/PixelFormat.h>
#include <ui/Surface.h>
#include <pixelflinger/pixelflinger.h>

#include "Buffer.h"
#include "BufferAllocator.h"
#include "SurfaceFlinger.h"


namespace android {

+0 −11
Original line number Diff line number Diff line
@@ -20,20 +20,11 @@
#include <stdint.h>
#include <sys/types.h>

#include <hardware/gralloc.h>

#include <utils/Atomic.h>

#include <ui/PixelFormat.h>
#include <ui/Rect.h>
#include <ui/Surface.h>

#include <pixelflinger/pixelflinger.h>

#include <private/ui/SharedBufferStack.h>
#include <private/ui/SurfaceBuffer.h>

class copybit_image_t;
struct android_native_buffer_t;

namespace android {
@@ -42,8 +33,6 @@ namespace android {
// Buffer
// ===========================================================================

class NativeBuffer;

class Buffer : public SurfaceBuffer
{
public:
+0 −2
Original line number Diff line number Diff line
@@ -15,8 +15,6 @@
** limitations under the License.
*/

#include <sys/mman.h>
#include <cutils/ashmem.h>
#include <cutils/log.h>

#include <utils/Singleton.h>
+0 −8
Original line number Diff line number Diff line
@@ -65,14 +65,6 @@ Layer::~Layer()
    // the actual buffers will be destroyed here
}

// called with SurfaceFlinger::mStateLock as soon as the layer is entered
// in the purgatory list
void Layer::onRemoved()
{
    // wake up the condition
    lcblk->setStatus(NO_INIT);
}

void Layer::destroy()
{
    for (size_t i=0 ; i<NUM_BUFFERS ; i++) {
Loading