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

Commit de0f5113 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Reroute surfaceflinger pulled atoms" into sc-dev am: a8bfb932

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/native/+/14109097

Change-Id: I967f172cff7c4ff1f1b4ef5513ece6c6eafd9f2c
parents 2fbd21f4 a8bfb932
Loading
Loading
Loading
Loading
+35 −0
Original line number Diff line number Diff line
@@ -497,6 +497,28 @@ public:
        return result;
    }

    status_t onPullAtom(const int32_t atomId, std::string* pulledData, bool* success) {
        Parcel data, reply;
        SAFE_PARCEL(data.writeInterfaceToken, ISurfaceComposer::getInterfaceDescriptor());
        SAFE_PARCEL(data.writeInt32, atomId);

        status_t err = remote()->transact(BnSurfaceComposer::ON_PULL_ATOM, data, &reply);
        if (err != NO_ERROR) {
            ALOGE("onPullAtom failed to transact: %d", err);
            return err;
        }

        int32_t size = 0;
        SAFE_PARCEL(reply.readInt32, &size);
        const void* dataPtr = reply.readInplace(size);
        if (dataPtr == nullptr) {
            return UNEXPECTED_NULL;
        }
        pulledData->assign((const char*)dataPtr, size);
        SAFE_PARCEL(reply.readBool, success);
        return NO_ERROR;
    }

    status_t enableVSyncInjections(bool enable) override {
        Parcel data, reply;
        status_t result = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
@@ -2021,6 +2043,19 @@ status_t BnSurfaceComposer::onTransact(
            }
            return overrideHdrTypes(display, hdrTypesVector);
        }
        case ON_PULL_ATOM: {
            CHECK_INTERFACE(ISurfaceComposer, data, reply);
            int32_t atomId = 0;
            SAFE_PARCEL(data.readInt32, &atomId);

            std::string pulledData;
            bool success;
            status_t err = onPullAtom(atomId, &pulledData, &success);
            SAFE_PARCEL(reply->writeByteArray, pulledData.size(),
                        reinterpret_cast<const uint8_t*>(pulledData.data()));
            SAFE_PARCEL(reply->writeBool, success);
            return err;
        }
        default: {
            return BBinder::onTransact(code, data, reply, flags);
        }
+5 −0
Original line number Diff line number Diff line
@@ -1949,6 +1949,11 @@ status_t SurfaceComposerClient::overrideHdrTypes(const sp<IBinder>& display,
    return ComposerService::getComposerService()->overrideHdrTypes(display, hdrTypes);
}

status_t SurfaceComposerClient::onPullAtom(const int32_t atomId, std::string* outData,
                                           bool* success) {
    return ComposerService::getComposerService()->onPullAtom(atomId, outData, success);
}

status_t SurfaceComposerClient::getDisplayedContentSamplingAttributes(const sp<IBinder>& display,
                                                                      ui::PixelFormat* outFormat,
                                                                      ui::Dataspace* outDataspace,
+7 −0
Original line number Diff line number Diff line
@@ -275,6 +275,12 @@ public:
    virtual status_t overrideHdrTypes(const sp<IBinder>& display,
                                      const std::vector<ui::Hdr>& hdrTypes) = 0;

    /* Pulls surfaceflinger atoms global stats and layer stats to pipe to statsd.
     *
     * Requires the calling uid be from system server.
     */
    virtual status_t onPullAtom(const int32_t atomId, std::string* outData, bool* success) = 0;

    virtual status_t enableVSyncInjections(bool enable) = 0;

    virtual status_t injectVSync(nsecs_t when) = 0;
@@ -600,6 +606,7 @@ public:
        OVERRIDE_HDR_TYPES,
        ADD_HDR_LAYER_INFO_LISTENER,
        REMOVE_HDR_LAYER_INFO_LISTENER,
        ON_PULL_ATOM,
        // Always append new enum to the end.
    };

+2 −0
Original line number Diff line number Diff line
@@ -567,6 +567,8 @@ public:
    static status_t overrideHdrTypes(const sp<IBinder>& display,
                                     const std::vector<ui::Hdr>& hdrTypes);

    static status_t onPullAtom(const int32_t atomId, std::string* outData, bool* success);

    static void setDisplayProjection(const sp<IBinder>& token, ui::Rotation orientation,
                                     const Rect& layerStackRect, const Rect& displayRect);

+4 −0
Original line number Diff line number Diff line
@@ -776,6 +776,10 @@ public:
                              const std::vector<ui::Hdr>& /*hdrTypes*/) override {
        return NO_ERROR;
    }
    status_t onPullAtom(const int32_t /*atomId*/, std::string* /*outData*/,
                        bool* /*success*/) override {
        return NO_ERROR;
    }
    status_t enableVSyncInjections(bool /*enable*/) override {
        return NO_ERROR;
    }
Loading