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

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

Merge "1) SF-DM Generalization of Refresh Rates: Adding a call to set Refresh Rate Range"

parents e6b613d2 0782b881
Loading
Loading
Loading
Loading
+71 −0
Original line number Diff line number Diff line
@@ -878,6 +878,45 @@ public:
        return reply.readInt32();
    }

    virtual status_t setDesiredDisplayConfigSpecs(const sp<IBinder>& displayToken,
                                                  int32_t defaultModeId, float minRefreshRate,
                                                  float maxRefreshRate) {
        Parcel data, reply;
        status_t result = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
        if (result != NO_ERROR) {
            ALOGE("setDesiredDisplayConfigSpecs: failed to writeInterfaceToken: %d", result);
            return result;
        }
        result = data.writeStrongBinder(displayToken);
        if (result != NO_ERROR) {
            ALOGE("setDesiredDisplayConfigSpecs: failed to write display token: %d", result);
            return result;
        }
        result = data.writeInt32(defaultModeId);
        if (result != NO_ERROR) {
            ALOGE("setDesiredDisplayConfigSpecs failed to write defaultModeId: %d", result);
            return result;
        }
        result = data.writeFloat(minRefreshRate);
        if (result != NO_ERROR) {
            ALOGE("setDesiredDisplayConfigSpecs failed to write minRefreshRate: %d", result);
            return result;
        }
        result = data.writeFloat(maxRefreshRate);
        if (result != NO_ERROR) {
            ALOGE("setDesiredDisplayConfigSpecs failed to write maxRefreshRate: %d", result);
            return result;
        }

        result = remote()->transact(BnSurfaceComposer::SET_DESIRED_DISPLAY_CONFIG_SPECS, data,
                                    &reply);
        if (result != NO_ERROR) {
            ALOGE("setDesiredDisplayConfigSpecs failed to transact: %d", result);
            return result;
        }
        return reply.readInt32();
    }

    virtual status_t getAllowedDisplayConfigs(const sp<IBinder>& displayToken,
                                              std::vector<int32_t>* outAllowedConfigs) {
        if (!outAllowedConfigs) return BAD_VALUE;
@@ -1583,6 +1622,38 @@ status_t BnSurfaceComposer::onTransact(
            reply->writeInt32(result);
            return result;
        }
        case SET_DESIRED_DISPLAY_CONFIG_SPECS: {
            CHECK_INTERFACE(ISurfaceComposer, data, reply);
            sp<IBinder> displayToken = data.readStrongBinder();
            int32_t defaultModeId;
            status_t result = data.readInt32(&defaultModeId);
            if (result != NO_ERROR) {
                ALOGE("setDesiredDisplayConfigSpecs: failed to read defaultModeId: %d", result);
                return result;
            }
            float minRefreshRate;
            result = data.readFloat(&minRefreshRate);
            if (result != NO_ERROR) {
                ALOGE("setDesiredDisplayConfigSpecs: failed to read minRefreshRate: %d", result);
                return result;
            }
            float maxRefreshRate;
            result = data.readFloat(&maxRefreshRate);
            if (result != NO_ERROR) {
                ALOGE("setDesiredDisplayConfigSpecs: failed to read maxRefreshRate: %d", result);
                return result;
            }
            result = setDesiredDisplayConfigSpecs(displayToken, defaultModeId, minRefreshRate,
                                                  maxRefreshRate);
            if (result != NO_ERROR) {
                ALOGE("setDesiredDisplayConfigSpecs: failed to call setDesiredDisplayConfigSpecs: "
                      "%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
@@ -1617,6 +1617,16 @@ status_t SurfaceComposerClient::getAllowedDisplayConfigs(const sp<IBinder>& disp
                                                                           outAllowedConfigs);
}

status_t SurfaceComposerClient::setDesiredDisplayConfigSpecs(const sp<IBinder>& displayToken,
                                                             int32_t defaultModeId,
                                                             float minRefreshRate,
                                                             float maxRefreshRate) {
    return ComposerService::getComposerService()->setDesiredDisplayConfigSpecs(displayToken,
                                                                               defaultModeId,
                                                                               minRefreshRate,
                                                                               maxRefreshRate);
}

status_t SurfaceComposerClient::getDisplayColorModes(const sp<IBinder>& display,
        Vector<ColorMode>* outColorModes) {
    return ComposerService::getComposerService()->getDisplayColorModes(display, outColorModes);
+10 −0
Original line number Diff line number Diff line
@@ -400,6 +400,15 @@ public:
     */
    virtual status_t getAllowedDisplayConfigs(const sp<IBinder>& displayToken,
                                              std::vector<int32_t>* outAllowedConfigs) = 0;
    /*
     * Sets the refresh rate boundaries for display configuration.
     * For all other parameters, default configuration is used. The index for the default is
     * corresponding to the configs returned from getDisplayConfigs().
     */
    virtual status_t setDesiredDisplayConfigSpecs(const sp<IBinder>& displayToken,
                                                  int32_t defaultModeId, float minRefreshRate,
                                                  float maxRefreshRate) = 0;

    /*
     * Gets whether brightness operations are supported on a display.
     *
@@ -512,6 +521,7 @@ public:
        REMOVE_REGION_SAMPLING_LISTENER,
        SET_ALLOWED_DISPLAY_CONFIGS,
        GET_ALLOWED_DISPLAY_CONFIGS,
        SET_DESIRED_DISPLAY_CONFIG_SPECS,
        GET_DISPLAY_BRIGHTNESS_SUPPORT,
        SET_DISPLAY_BRIGHTNESS,
        CAPTURE_SCREEN_BY_ID,
+7 −0
Original line number Diff line number Diff line
@@ -129,6 +129,13 @@ public:
    static status_t getAllowedDisplayConfigs(const sp<IBinder>& displayToken,
                                             std::vector<int32_t>* outAllowedConfigs);

    // Sets 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().
    static status_t setDesiredDisplayConfigSpecs(const sp<IBinder>& displayToken,
                                                 int32_t defaultModeId, float minRefreshRate,
                                                 float maxRefreshRate);

    // Gets the list of supported color modes for the given display
    static status_t getDisplayColorModes(const sp<IBinder>& display,
            Vector<ui::ColorMode>* outColorModes);
+5 −0
Original line number Diff line number Diff line
@@ -831,6 +831,11 @@ public:
                                      std::vector<int32_t>* /*outAllowedConfigs*/) override {
        return NO_ERROR;
    }
    status_t setDesiredDisplayConfigSpecs(const sp<IBinder>& /*displayToken*/,
                                          int32_t /*defaultModeId*/, float /*minRefreshRate*/,
                                          float /*maxRefreshRate*/) override {
        return NO_ERROR;
    }
    status_t notifyPowerHint(int32_t /*hintId*/) override { return NO_ERROR; }

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