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

Commit 632bb8b6 authored by Jim Shargo's avatar Jim Shargo
Browse files

Surface: Improve logging dramatically

Adds a bunch of SURF_ALOG* macros that will automatically log the name
and ID of the underlying IGBP. Also grabs those values at connect time.

This should make it clear when multiple surfaces are being interacted
with, which ones are affected by various operations.

When a surface is disconnected, the name is suffixed with -DISCONNECTED
so that subsequent operations on a dead surface can be understood
better.

Bug: 413059222
Bug: 418318000
Bug: 420318909
Bug: 421921018
Test: n/a
Flag: EXEMPT adding logging

Change-Id: I510d964e7aae0ec4a723f50a0308ce151566c2e5
parent 09b9490d
Loading
Loading
Loading
Loading
+157 −125

File changed.

Preview size limit exceeded, changes collapsed.

+5 −4
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@
#include <utils/Condition.h>
#include <utils/Mutex.h>
#include <utils/RefBase.h>
#include <utils/String8.h>

#include <shared_mutex>
#include <unordered_set>
@@ -365,10 +366,6 @@ private:
    int dispatchSetFrameTimelineInfo(va_list args);
    int dispatchSetAdditionalOptions(va_list args);

    std::mutex mNameMutex;
    std::string mName;
    const char* getDebugName();

protected:
    virtual int dequeueBuffer(sp<GraphicBuffer>* buffer, int* fenceFd);
    virtual int cancelBuffer(sp<GraphicBuffer>&& buffer, int fenceFd);
@@ -745,6 +742,10 @@ protected:
    // the GRALLOC_USAGE_CURSOR usage flag should be set on the buffer created when this surface is
    // locked.
    bool mIsForCursor = false;

    mutable std::mutex mDebugMutex;
    String8 mDebugName GUARDED_BY(mDebugMutex) = String8("not-connected");
    uint64_t mId GUARDED_BY(mDebugMutex) = 0;
};

} // namespace android