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

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

Merge "Migrate display related methods to AIDL part 3" into tm-dev

parents 5b3c56fa 0fd1af9e
Loading
Loading
Loading
Loading
+0 −50
Original line number Original line Diff line number Diff line
@@ -226,18 +226,6 @@ public:
        return result;
        return result;
    }
    }


    status_t getDisplayState(const sp<IBinder>& display, ui::DisplayState* state) override {
        Parcel data, reply;
        data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
        data.writeStrongBinder(display);
        remote()->transact(BnSurfaceComposer::GET_DISPLAY_STATE, data, &reply);
        const status_t result = reply.readInt32();
        if (result == NO_ERROR) {
            memcpy(state, reply.readInplace(sizeof(ui::DisplayState)), sizeof(ui::DisplayState));
        }
        return result;
    }

    status_t getStaticDisplayInfo(const sp<IBinder>& display,
    status_t getStaticDisplayInfo(const sp<IBinder>& display,
                                  ui::StaticDisplayInfo* info) override {
                                  ui::StaticDisplayInfo* info) override {
        Parcel data, reply;
        Parcel data, reply;
@@ -260,20 +248,6 @@ public:
        return reply.read(*info);
        return reply.read(*info);
    }
    }


    status_t getDisplayStats(const sp<IBinder>& display, DisplayStatInfo* stats) override {
        Parcel data, reply;
        data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
        data.writeStrongBinder(display);
        remote()->transact(BnSurfaceComposer::GET_DISPLAY_STATS, data, &reply);
        status_t result = reply.readInt32();
        if (result == NO_ERROR) {
            memcpy(stats,
                    reply.readInplace(sizeof(DisplayStatInfo)),
                    sizeof(DisplayStatInfo));
        }
        return result;
    }

    status_t getDisplayNativePrimaries(const sp<IBinder>& display,
    status_t getDisplayNativePrimaries(const sp<IBinder>& display,
                                       ui::DisplayPrimaries& primaries) override {
                                       ui::DisplayPrimaries& primaries) override {
        Parcel data, reply;
        Parcel data, reply;
@@ -1171,18 +1145,6 @@ status_t BnSurfaceComposer::onTransact(
            reply->writeStrongBinder(IInterface::asBinder(connection));
            reply->writeStrongBinder(IInterface::asBinder(connection));
            return NO_ERROR;
            return NO_ERROR;
        }
        }
        case GET_DISPLAY_STATE: {
            CHECK_INTERFACE(ISurfaceComposer, data, reply);
            ui::DisplayState state;
            const sp<IBinder> display = data.readStrongBinder();
            const status_t result = getDisplayState(display, &state);
            reply->writeInt32(result);
            if (result == NO_ERROR) {
                memcpy(reply->writeInplace(sizeof(ui::DisplayState)), &state,
                       sizeof(ui::DisplayState));
            }
            return NO_ERROR;
        }
        case GET_STATIC_DISPLAY_INFO: {
        case GET_STATIC_DISPLAY_INFO: {
            CHECK_INTERFACE(ISurfaceComposer, data, reply);
            CHECK_INTERFACE(ISurfaceComposer, data, reply);
            ui::StaticDisplayInfo info;
            ui::StaticDisplayInfo info;
@@ -1203,18 +1165,6 @@ status_t BnSurfaceComposer::onTransact(
            SAFE_PARCEL(reply->write, info);
            SAFE_PARCEL(reply->write, info);
            return NO_ERROR;
            return NO_ERROR;
        }
        }
        case GET_DISPLAY_STATS: {
            CHECK_INTERFACE(ISurfaceComposer, data, reply);
            DisplayStatInfo stats;
            sp<IBinder> display = data.readStrongBinder();
            status_t result = getDisplayStats(display, &stats);
            reply->writeInt32(result);
            if (result == NO_ERROR) {
                memcpy(reply->writeInplace(sizeof(DisplayStatInfo)),
                        &stats, sizeof(DisplayStatInfo));
            }
            return NO_ERROR;
        }
        case GET_DISPLAY_NATIVE_PRIMARIES: {
        case GET_DISPLAY_NATIVE_PRIMARIES: {
            CHECK_INTERFACE(ISurfaceComposer, data, reply);
            CHECK_INTERFACE(ISurfaceComposer, data, reply);
            ui::DisplayPrimaries primaries;
            ui::DisplayPrimaries primaries;
+5 −5
Original line number Original line Diff line number Diff line
@@ -27,13 +27,13 @@


#include <inttypes.h>
#include <inttypes.h>


#include <android/gui/DisplayStatInfo.h>
#include <android/native_window.h>
#include <android/native_window.h>


#include <utils/Log.h>
#include <utils/Log.h>
#include <utils/Trace.h>
#include <utils/Trace.h>
#include <utils/NativeHandle.h>
#include <utils/NativeHandle.h>


#include <ui/DisplayStatInfo.h>
#include <ui/DynamicDisplayInfo.h>
#include <ui/DynamicDisplayInfo.h>
#include <ui/Fence.h>
#include <ui/Fence.h>
#include <ui/GraphicBuffer.h>
#include <ui/GraphicBuffer.h>
@@ -179,10 +179,10 @@ status_t Surface::getLastQueuedBuffer(sp<GraphicBuffer>* outBuffer,
status_t Surface::getDisplayRefreshCycleDuration(nsecs_t* outRefreshDuration) {
status_t Surface::getDisplayRefreshCycleDuration(nsecs_t* outRefreshDuration) {
    ATRACE_CALL();
    ATRACE_CALL();


    DisplayStatInfo stats;
    gui::DisplayStatInfo stats;
    status_t result = composerService()->getDisplayStats(nullptr, &stats);
    binder::Status status = composerServiceAIDL()->getDisplayStats(nullptr, &stats);
    if (result != NO_ERROR) {
    if (!status.isOk()) {
        return result;
        return status.transactionError();
    }
    }


    *outRefreshDuration = stats.vsyncPeriod;
    *outRefreshDuration = stats.vsyncPeriod;
+12 −1
Original line number Original line Diff line number Diff line
@@ -19,6 +19,7 @@
#include <stdint.h>
#include <stdint.h>
#include <sys/types.h>
#include <sys/types.h>


#include <android/gui/DisplayState.h>
#include <android/gui/IWindowInfosListener.h>
#include <android/gui/IWindowInfosListener.h>
#include <utils/Errors.h>
#include <utils/Errors.h>
#include <utils/Log.h>
#include <utils/Log.h>
@@ -43,6 +44,7 @@
#include <gui/WindowInfo.h>
#include <gui/WindowInfo.h>
#include <private/gui/ParcelUtils.h>
#include <private/gui/ParcelUtils.h>
#include <ui/DisplayMode.h>
#include <ui/DisplayMode.h>
#include <ui/DisplayState.h>
#include <ui/DynamicDisplayInfo.h>
#include <ui/DynamicDisplayInfo.h>


#include <private/gui/ComposerService.h>
#include <private/gui/ComposerService.h>
@@ -2127,7 +2129,16 @@ status_t SurfaceComposerClient::injectVSync(nsecs_t when) {


status_t SurfaceComposerClient::getDisplayState(const sp<IBinder>& display,
status_t SurfaceComposerClient::getDisplayState(const sp<IBinder>& display,
                                                ui::DisplayState* state) {
                                                ui::DisplayState* state) {
    return ComposerService::getComposerService()->getDisplayState(display, state);
    gui::DisplayState ds;
    binder::Status status =
            ComposerServiceAIDL::getComposerService()->getDisplayState(display, &ds);
    if (status.isOk()) {
        state->layerStack = ui::LayerStack::fromValue(ds.layerStack);
        state->orientation = static_cast<ui::Rotation>(ds.orientation);
        state->layerStackSpaceRect =
                ui::Size(ds.layerStackSpaceRect.width, ds.layerStackSpaceRect.height);
    }
    return status.transactionError();
}
}


status_t SurfaceComposerClient::getStaticDisplayInfo(const sp<IBinder>& display,
status_t SurfaceComposerClient::getStaticDisplayInfo(const sp<IBinder>& display,
+23 −0
Original line number Original line 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;

/** @hide */
parcelable DisplayStatInfo {
    long vsyncTime;
    long vsyncPeriod;
}
+27 −0
Original line number Original line 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;

import android.gui.Rotation;
import android.gui.Size;

/** @hide */
parcelable DisplayState {
    int layerStack;
    Rotation orientation = Rotation.Rotation0;
    Size layerStackSpaceRect;
}
Loading