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

Commit 6088d51f authored by Steven Thomas's avatar Steven Thomas Committed by Android (Google) Code Review
Browse files

Merge "2) SF-DM Generalization of Refresh Rates: Adding config variable and getter methods"

parents 2e153088 234bb16b
Loading
Loading
Loading
Loading
+83 −9
Original line number Diff line number Diff line
@@ -878,6 +878,33 @@ public:
        return reply.readInt32();
    }

    virtual status_t getAllowedDisplayConfigs(const sp<IBinder>& displayToken,
                                              std::vector<int32_t>* outAllowedConfigs) {
        if (!outAllowedConfigs) return BAD_VALUE;
        Parcel data, reply;
        status_t result = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
        if (result != NO_ERROR) {
            ALOGE("getAllowedDisplayConfigs failed to writeInterfaceToken: %d", result);
            return result;
        }
        result = data.writeStrongBinder(displayToken);
        if (result != NO_ERROR) {
            ALOGE("getAllowedDisplayConfigs failed to writeStrongBinder: %d", result);
            return result;
        }
        result = remote()->transact(BnSurfaceComposer::GET_ALLOWED_DISPLAY_CONFIGS, data, &reply);
        if (result != NO_ERROR) {
            ALOGE("getAllowedDisplayConfigs failed to transact: %d", result);
            return result;
        }
        result = reply.readInt32Vector(outAllowedConfigs);
        if (result != NO_ERROR) {
            ALOGE("getAllowedDisplayConfigs failed to readInt32Vector: %d", result);
            return result;
        }
        return reply.readInt32();
    }

    virtual status_t setDesiredDisplayConfigSpecs(const sp<IBinder>& displayToken,
                                                  int32_t defaultModeId, float minRefreshRate,
                                                  float maxRefreshRate) {
@@ -917,28 +944,41 @@ public:
        return reply.readInt32();
    }

    virtual status_t getAllowedDisplayConfigs(const sp<IBinder>& displayToken,
                                              std::vector<int32_t>* outAllowedConfigs) {
        if (!outAllowedConfigs) return BAD_VALUE;
    virtual status_t getDesiredDisplayConfigSpecs(const sp<IBinder>& displayToken,
                                                  int32_t* outDefaultModeId,
                                                  float* outMinRefreshRate,
                                                  float* outMaxRefreshRate) {
        if (!outDefaultModeId || !outMinRefreshRate || !outMaxRefreshRate) return BAD_VALUE;
        Parcel data, reply;
        status_t result = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
        if (result != NO_ERROR) {
            ALOGE("getAllowedDisplayConfigs failed to writeInterfaceToken: %d", result);
            ALOGE("getDesiredDisplayConfigSpecs failed to writeInterfaceToken: %d", result);
            return result;
        }
        result = data.writeStrongBinder(displayToken);
        if (result != NO_ERROR) {
            ALOGE("getAllowedDisplayConfigs failed to writeStrongBinder: %d", result);
            ALOGE("getDesiredDisplayConfigSpecs failed to writeStrongBinder: %d", result);
            return result;
        }
        result = remote()->transact(BnSurfaceComposer::GET_ALLOWED_DISPLAY_CONFIGS, data, &reply);
        result = remote()->transact(BnSurfaceComposer::GET_DESIRED_DISPLAY_CONFIG_SPECS, data,
                                    &reply);
        if (result != NO_ERROR) {
            ALOGE("getAllowedDisplayConfigs failed to transact: %d", result);
            ALOGE("getDesiredDisplayConfigSpecs failed to transact: %d", result);
            return result;
        }
        result = reply.readInt32Vector(outAllowedConfigs);
        result = reply.readInt32(outDefaultModeId);
        if (result != NO_ERROR) {
            ALOGE("getAllowedDisplayConfigs failed to readInt32Vector: %d", result);
            ALOGE("getDesiredDisplayConfigSpecs failed to read defaultModeId: %d", result);
            return result;
        }
        result = reply.readFloat(outMinRefreshRate);
        if (result != NO_ERROR) {
            ALOGE("getDesiredDisplayConfigSpecs failed to read minRefreshRate: %d", result);
            return result;
        }
        result = reply.readFloat(outMaxRefreshRate);
        if (result != NO_ERROR) {
            ALOGE("getDesiredDisplayConfigSpecs failed to read maxRefreshRate: %d", result);
            return result;
        }
        return reply.readInt32();
@@ -1654,6 +1694,40 @@ status_t BnSurfaceComposer::onTransact(
            reply->writeInt32(result);
            return result;
        }
        case GET_DESIRED_DISPLAY_CONFIG_SPECS: {
            CHECK_INTERFACE(ISurfaceComposer, data, reply);
            sp<IBinder> displayToken = data.readStrongBinder();
            int32_t defaultModeId;
            float minRefreshRate;
            float maxRefreshRate;

            status_t result = getDesiredDisplayConfigSpecs(displayToken, &defaultModeId,
                                                           &minRefreshRate, &maxRefreshRate);
            if (result != NO_ERROR) {
                ALOGE("getDesiredDisplayConfigSpecs: failed to get getDesiredDisplayConfigSpecs: "
                      "%d",
                      result);
                return result;
            }

            result = reply->writeInt32(defaultModeId);
            if (result != NO_ERROR) {
                ALOGE("getDesiredDisplayConfigSpecs: failed to write defaultModeId: %d", result);
                return result;
            }
            result = reply->writeFloat(minRefreshRate);
            if (result != NO_ERROR) {
                ALOGE("getDesiredDisplayConfigSpecs: failed to write minRefreshRate: %d", result);
                return result;
            }
            result = reply->writeFloat(maxRefreshRate);
            if (result != NO_ERROR) {
                ALOGE("getDesiredDisplayConfigSpecs: failed to write maxRefreshRate: %d", result);
                return result;
            }
            reply->writeInt32(result);
            return result;
        }
        case GET_DISPLAY_BRIGHTNESS_SUPPORT: {
            CHECK_INTERFACE(ISurfaceComposer, data, reply);
            sp<IBinder> displayToken;
+10 −0
Original line number Diff line number Diff line
@@ -1627,6 +1627,16 @@ status_t SurfaceComposerClient::setDesiredDisplayConfigSpecs(const sp<IBinder>&
                                                                               maxRefreshRate);
}

status_t SurfaceComposerClient::getDesiredDisplayConfigSpecs(const sp<IBinder>& displayToken,
                                                             int32_t* outDefaultModeId,
                                                             float* outMinRefreshRate,
                                                             float* outMaxRefreshRate) {
    return ComposerService::getComposerService()->getDesiredDisplayConfigSpecs(displayToken,
                                                                               outDefaultModeId,
                                                                               outMinRefreshRate,
                                                                               outMaxRefreshRate);
}

status_t SurfaceComposerClient::getDisplayColorModes(const sp<IBinder>& display,
        Vector<ColorMode>* outColorModes) {
    return ComposerService::getComposerService()->getDisplayColorModes(display, outColorModes);
+5 −0
Original line number Diff line number Diff line
@@ -409,6 +409,10 @@ public:
                                                  int32_t defaultModeId, float minRefreshRate,
                                                  float maxRefreshRate) = 0;

    virtual status_t getDesiredDisplayConfigSpecs(const sp<IBinder>& displayToken,
                                                  int32_t* outDefaultModeId,
                                                  float* outMinRefreshRate,
                                                  float* outMaxRefreshRate) = 0;
    /*
     * Gets whether brightness operations are supported on a display.
     *
@@ -522,6 +526,7 @@ public:
        SET_ALLOWED_DISPLAY_CONFIGS,
        GET_ALLOWED_DISPLAY_CONFIGS,
        SET_DESIRED_DISPLAY_CONFIG_SPECS,
        GET_DESIRED_DISPLAY_CONFIG_SPECS,
        GET_DISPLAY_BRIGHTNESS_SUPPORT,
        SET_DISPLAY_BRIGHTNESS,
        CAPTURE_SCREEN_BY_ID,
+9 −0
Original line number Diff line number Diff line
@@ -135,6 +135,15 @@ public:
    static status_t setDesiredDisplayConfigSpecs(const sp<IBinder>& displayToken,
                                                 int32_t defaultModeId, float minRefreshRate,
                                                 float maxRefreshRate);
    // Gets the refresh rate boundaries for display configuration.
    // For all other parameters, default configuration is used. The index for the default is
    // corresponting to the configs returned from getDisplayConfigs().
    // The reason is passed in for telemetry tracking, and it corresponds to the list of all
    // the policy rules that were used.
    static status_t getDesiredDisplayConfigSpecs(const sp<IBinder>& displayToken,
                                                 int32_t* outDefaultModeId,
                                                 float* outMinRefreshRate,
                                                 float* outMaxRefreshRate);

    // Gets the list of supported color modes for the given display
    static status_t getDisplayColorModes(const sp<IBinder>& display,
+6 −0
Original line number Diff line number Diff line
@@ -836,6 +836,12 @@ public:
                                          float /*maxRefreshRate*/) override {
        return NO_ERROR;
    }
    status_t getDesiredDisplayConfigSpecs(const sp<IBinder>& /*displayToken*/,
                                          int32_t* /*outDefaultModeId*/,
                                          float* /*outMinRefreshRate*/,
                                          float* /*outMaxRefreshRate*/) override {
        return NO_ERROR;
    };
    status_t notifyPowerHint(int32_t /*hintId*/) override { return NO_ERROR; }

    status_t setGlobalShadowSettings(const half4& /*ambientColor*/, const half4& /*spotColor*/,
Loading