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

Commit 6d6ffc17 authored by Huihong Luo's avatar Huihong Luo Committed by Android (Google) Code Review
Browse files

Merge "Migrate getSupportedFrameTimestamps() to AIDL"

parents 0974326c 0a81aa31
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ cc_library_shared {
    double_loadable: true,

    srcs: [
        ":libgui_frame_event_aidl",
        "BufferQueueConverter.cpp",
    ],

+7 −0
Original line number Diff line number Diff line
@@ -120,6 +120,12 @@ filegroup {
    path: "aidl/",
}

filegroup {
    name: "libgui_frame_event_aidl",
    srcs: ["aidl/android/gui/FrameEvent.aidl"],
    path: "aidl/",
}

cc_library_static {
    name: "libgui_aidl_static",
    vendor_available: true,
@@ -405,6 +411,7 @@ cc_library_static {
    ],

    srcs: [
        ":libgui_frame_event_aidl",
        "mock/GraphicBufferConsumer.cpp",
        "mock/GraphicBufferProducer.cpp",
    ],
+0 −62
Original line number Diff line number Diff line
@@ -159,49 +159,6 @@ public:
        return result != 0;
    }

    status_t getSupportedFrameTimestamps(std::vector<FrameEvent>* outSupported) const override {
        if (!outSupported) {
            return UNEXPECTED_NULL;
        }
        outSupported->clear();

        Parcel data, reply;

        status_t err = data.writeInterfaceToken(
                ISurfaceComposer::getInterfaceDescriptor());
        if (err != NO_ERROR) {
            return err;
        }

        err = remote()->transact(
                BnSurfaceComposer::GET_SUPPORTED_FRAME_TIMESTAMPS,
                data, &reply);
        if (err != NO_ERROR) {
            return err;
        }

        int32_t result = 0;
        err = reply.readInt32(&result);
        if (err != NO_ERROR) {
            return err;
        }
        if (result != NO_ERROR) {
            return result;
        }

        std::vector<int32_t> supported;
        err = reply.readInt32Vector(&supported);
        if (err != NO_ERROR) {
            return err;
        }

        outSupported->reserve(supported.size());
        for (int32_t s : supported) {
            outSupported->push_back(static_cast<FrameEvent>(s));
        }
        return NO_ERROR;
    }

    sp<IDisplayEventConnection> createDisplayEventConnection(
            VsyncSource vsyncSource, EventRegistrationFlags eventRegistration) override {
        Parcel data, reply;
@@ -993,25 +950,6 @@ status_t BnSurfaceComposer::onTransact(
            reply->writeInt32(result);
            return NO_ERROR;
        }
        case GET_SUPPORTED_FRAME_TIMESTAMPS: {
            CHECK_INTERFACE(ISurfaceComposer, data, reply);
            std::vector<FrameEvent> supportedTimestamps;
            status_t result = getSupportedFrameTimestamps(&supportedTimestamps);
            status_t err = reply->writeInt32(result);
            if (err != NO_ERROR) {
                return err;
            }
            if (result != NO_ERROR) {
                return result;
            }

            std::vector<int32_t> supported;
            supported.reserve(supportedTimestamps.size());
            for (FrameEvent s : supportedTimestamps) {
                supported.push_back(static_cast<int32_t>(s));
            }
            return reply->writeInt32Vector(supported);
        }
        case CREATE_DISPLAY_EVENT_CONNECTION: {
            CHECK_INTERFACE(ISurfaceComposer, data, reply);
            auto vsyncSource = static_cast<ISurfaceComposer::VsyncSource>(data.readInt32());
+3 −3
Original line number Diff line number Diff line
@@ -1257,10 +1257,10 @@ void Surface::querySupportedTimestampsLocked() const {
    mQueriedSupportedTimestamps = true;

    std::vector<FrameEvent> supportedFrameTimestamps;
    status_t err = composerService()->getSupportedFrameTimestamps(
            &supportedFrameTimestamps);
    binder::Status status =
            composerServiceAIDL()->getSupportedFrameTimestamps(&supportedFrameTimestamps);

    if (err != NO_ERROR) {
    if (!status.isOk()) {
        return;
    }

+35 −0
Original line number Diff line number Diff line
/*
 * Copyright 2022 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.gui;

// Identifiers for all the events that may be recorded or reported.

/** @hide */
@Backing(type="int")
enum FrameEvent {
    POSTED = 0,
    REQUESTED_PRESENT = 1,
    LATCH = 2,
    ACQUIRE = 3,
    FIRST_REFRESH_START = 4,
    LAST_REFRESH_START = 5,
    GPU_COMPOSITION_DONE = 6,
    DISPLAY_PRESENT = 7,
    DEQUEUE_READY = 8,
    RELEASE = 9,
    EVENT_COUNT = 10 // Not an actual event.
}
Loading