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

Commit 9febda8e authored by Adithya Srinivasan's avatar Adithya Srinivasan
Browse files

Plumb owner pid into Layer

For shared timeline visualization, the pid of the process owning the
layer is needed to show the information in the respective process
tracks. This change stores the newly added METADATA_OWNER_PID
information sent as a part of the Layer creation args

Bug: 170911969
Test: pid section of `adb shell dumpsys SurfaceFlinger --frametimeline -<all/jank>`

Change-Id: Ib1cd9b6239501b0b92283dca19d7de3916fff604
parent 854e1b95
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -23,4 +23,6 @@ enum LayerMetadataKey {
    METADATA_WINDOW_TYPE = 2,
    METADATA_TASK_ID = 3,
    METADATA_MOUSE_CURSOR = 4,
    METADATA_ACCESSIBILITY_ID = 5,
    METADATA_OWNER_PID = 6,
}
+2 −0
Original line number Diff line number Diff line
@@ -122,6 +122,8 @@ std::string LayerMetadata::itemToString(uint32_t key, const char* separator) con
            return StringPrintf("windowType%s%d", separator, getInt32(key, 0));
        case view::LayerMetadataKey::METADATA_TASK_ID:
            return StringPrintf("taskId%s%d", separator, getInt32(key, 0));
        case view::LayerMetadataKey::METADATA_OWNER_PID:
            return StringPrintf("ownerPID%s%d", separator, getInt32(key, 0));
        default:
            return StringPrintf("%d%s%dbytes", key, separator,
                                static_cast<int>(mMap.at(key).size()));
+1 −0
Original line number Diff line number Diff line
@@ -52,6 +52,7 @@ public:
        eFXSurfaceMask = 0x000F0000,
    };

    // TODO(b/172002646):  Clean up the Surface Creation Arguments
    /*
     * Requires ACCESS_SURFACE_FLINGER permission
     */
+2 −0
Original line number Diff line number Diff line
@@ -27,6 +27,8 @@ enum {
    METADATA_WINDOW_TYPE = 2,
    METADATA_TASK_ID = 3,
    METADATA_MOUSE_CURSOR = 4,
    METADATA_ACCESSIBILITY_ID = 5,
    METADATA_OWNER_PID = 6,
};

struct LayerMetadata : public Parcelable {
+4 −4
Original line number Diff line number Diff line
@@ -442,8 +442,8 @@ void BufferQueueLayer::onFrameAvailable(const BufferItem& item) {
        }

        auto surfaceFrame =
                mFlinger->mFrameTimeline->createSurfaceFrameForToken(mOwnerUid, mName, mName,
                                                                     mFrameTimelineVsyncId);
                mFlinger->mFrameTimeline->createSurfaceFrameForToken(mOwnerPid, mOwnerUid, mName,
                                                                     mName, mFrameTimelineVsyncId);
        surfaceFrame->setActualQueueTime(systemTime());

        mQueueItems.push_back({item, std::move(surfaceFrame)});
@@ -481,8 +481,8 @@ void BufferQueueLayer::onFrameReplaced(const BufferItem& item) {
        }

        auto surfaceFrame =
                mFlinger->mFrameTimeline->createSurfaceFrameForToken(mOwnerUid, mName, mName,
                                                                     mFrameTimelineVsyncId);
                mFlinger->mFrameTimeline->createSurfaceFrameForToken(mOwnerPid, mOwnerUid, mName,
                                                                     mName, mFrameTimelineVsyncId);
        surfaceFrame->setActualQueueTime(systemTime());
        mQueueItems[mQueueItems.size() - 1].item = item;
        mQueueItems[mQueueItems.size() - 1].surfaceFrame = std::move(surfaceFrame);
Loading