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

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

Merge "Switch from allowed display configs to refresh rate range"

parents 5cef431d ed3a8cc9
Loading
Loading
Loading
Loading
+15 −86
Original line number Diff line number Diff line
@@ -852,61 +852,8 @@ public:
        return error;
    }

    virtual status_t setAllowedDisplayConfigs(const sp<IBinder>& displayToken,
                                              const std::vector<int32_t>& allowedConfigs) {
        Parcel data, reply;
        status_t result = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
        if (result != NO_ERROR) {
            ALOGE("setAllowedDisplayConfigs failed to writeInterfaceToken: %d", result);
            return result;
        }
        result = data.writeStrongBinder(displayToken);
        if (result != NO_ERROR) {
            ALOGE("setAllowedDisplayConfigs failed to writeStrongBinder: %d", result);
            return result;
        }
        result = data.writeInt32Vector(allowedConfigs);
        if (result != NO_ERROR) {
            ALOGE("setAllowedDisplayConfigs failed to writeInt32Vector: %d", result);
            return result;
        }
        result = remote()->transact(BnSurfaceComposer::SET_ALLOWED_DISPLAY_CONFIGS, data, &reply);
        if (result != NO_ERROR) {
            ALOGE("setAllowedDisplayConfigs 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;
        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,
                                                  int32_t defaultConfig, float minRefreshRate,
                                                  float maxRefreshRate) {
        Parcel data, reply;
        status_t result = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
@@ -919,9 +866,9 @@ public:
            ALOGE("setDesiredDisplayConfigSpecs: failed to write display token: %d", result);
            return result;
        }
        result = data.writeInt32(defaultModeId);
        result = data.writeInt32(defaultConfig);
        if (result != NO_ERROR) {
            ALOGE("setDesiredDisplayConfigSpecs failed to write defaultModeId: %d", result);
            ALOGE("setDesiredDisplayConfigSpecs failed to write defaultConfig: %d", result);
            return result;
        }
        result = data.writeFloat(minRefreshRate);
@@ -945,10 +892,10 @@ public:
    }

    virtual status_t getDesiredDisplayConfigSpecs(const sp<IBinder>& displayToken,
                                                  int32_t* outDefaultModeId,
                                                  int32_t* outDefaultConfig,
                                                  float* outMinRefreshRate,
                                                  float* outMaxRefreshRate) {
        if (!outDefaultModeId || !outMinRefreshRate || !outMaxRefreshRate) return BAD_VALUE;
        if (!outDefaultConfig || !outMinRefreshRate || !outMaxRefreshRate) return BAD_VALUE;
        Parcel data, reply;
        status_t result = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
        if (result != NO_ERROR) {
@@ -966,9 +913,9 @@ public:
            ALOGE("getDesiredDisplayConfigSpecs failed to transact: %d", result);
            return result;
        }
        result = reply.readInt32(outDefaultModeId);
        result = reply.readInt32(outDefaultConfig);
        if (result != NO_ERROR) {
            ALOGE("getDesiredDisplayConfigSpecs failed to read defaultModeId: %d", result);
            ALOGE("getDesiredDisplayConfigSpecs failed to read defaultConfig: %d", result);
            return result;
        }
        result = reply.readFloat(outMinRefreshRate);
@@ -1644,31 +1591,13 @@ status_t BnSurfaceComposer::onTransact(
            }
            return removeRegionSamplingListener(listener);
        }
        case SET_ALLOWED_DISPLAY_CONFIGS: {
            CHECK_INTERFACE(ISurfaceComposer, data, reply);
            sp<IBinder> displayToken = data.readStrongBinder();
            std::vector<int32_t> allowedConfigs;
            data.readInt32Vector(&allowedConfigs);
            status_t result = setAllowedDisplayConfigs(displayToken, allowedConfigs);
            reply->writeInt32(result);
            return result;
        }
        case GET_ALLOWED_DISPLAY_CONFIGS: {
            CHECK_INTERFACE(ISurfaceComposer, data, reply);
            sp<IBinder> displayToken = data.readStrongBinder();
            std::vector<int32_t> allowedConfigs;
            status_t result = getAllowedDisplayConfigs(displayToken, &allowedConfigs);
            reply->writeInt32Vector(allowedConfigs);
            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);
            int32_t defaultConfig;
            status_t result = data.readInt32(&defaultConfig);
            if (result != NO_ERROR) {
                ALOGE("setDesiredDisplayConfigSpecs: failed to read defaultModeId: %d", result);
                ALOGE("setDesiredDisplayConfigSpecs: failed to read defaultConfig: %d", result);
                return result;
            }
            float minRefreshRate;
@@ -1683,7 +1612,7 @@ status_t BnSurfaceComposer::onTransact(
                ALOGE("setDesiredDisplayConfigSpecs: failed to read maxRefreshRate: %d", result);
                return result;
            }
            result = setDesiredDisplayConfigSpecs(displayToken, defaultModeId, minRefreshRate,
            result = setDesiredDisplayConfigSpecs(displayToken, defaultConfig, minRefreshRate,
                                                  maxRefreshRate);
            if (result != NO_ERROR) {
                ALOGE("setDesiredDisplayConfigSpecs: failed to call setDesiredDisplayConfigSpecs: "
@@ -1697,11 +1626,11 @@ status_t BnSurfaceComposer::onTransact(
        case GET_DESIRED_DISPLAY_CONFIG_SPECS: {
            CHECK_INTERFACE(ISurfaceComposer, data, reply);
            sp<IBinder> displayToken = data.readStrongBinder();
            int32_t defaultModeId;
            int32_t defaultConfig;
            float minRefreshRate;
            float maxRefreshRate;

            status_t result = getDesiredDisplayConfigSpecs(displayToken, &defaultModeId,
            status_t result = getDesiredDisplayConfigSpecs(displayToken, &defaultConfig,
                                                           &minRefreshRate, &maxRefreshRate);
            if (result != NO_ERROR) {
                ALOGE("getDesiredDisplayConfigSpecs: failed to get getDesiredDisplayConfigSpecs: "
@@ -1710,9 +1639,9 @@ status_t BnSurfaceComposer::onTransact(
                return result;
            }

            result = reply->writeInt32(defaultModeId);
            result = reply->writeInt32(defaultConfig);
            if (result != NO_ERROR) {
                ALOGE("getDesiredDisplayConfigSpecs: failed to write defaultModeId: %d", result);
                ALOGE("getDesiredDisplayConfigSpecs: failed to write defaultConfig: %d", result);
                return result;
            }
            result = reply->writeFloat(minRefreshRate);
+4 −16
Original line number Diff line number Diff line
@@ -1605,34 +1605,22 @@ status_t SurfaceComposerClient::setActiveConfig(const sp<IBinder>& display, int
    return ComposerService::getComposerService()->setActiveConfig(display, id);
}

status_t SurfaceComposerClient::setAllowedDisplayConfigs(
        const sp<IBinder>& displayToken, const std::vector<int32_t>& allowedConfigs) {
    return ComposerService::getComposerService()->setAllowedDisplayConfigs(displayToken,
                                                                           allowedConfigs);
}

status_t SurfaceComposerClient::getAllowedDisplayConfigs(const sp<IBinder>& displayToken,
                                                         std::vector<int32_t>* outAllowedConfigs) {
    return ComposerService::getComposerService()->getAllowedDisplayConfigs(displayToken,
                                                                           outAllowedConfigs);
}

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

status_t SurfaceComposerClient::getDesiredDisplayConfigSpecs(const sp<IBinder>& displayToken,
                                                             int32_t* outDefaultModeId,
                                                             int32_t* outDefaultConfig,
                                                             float* outMinRefreshRate,
                                                             float* outMaxRefreshRate) {
    return ComposerService::getComposerService()->getDesiredDisplayConfigSpecs(displayToken,
                                                                               outDefaultModeId,
                                                                               outDefaultConfig,
                                                                               outMinRefreshRate,
                                                                               outMaxRefreshRate);
}
+2 −19
Original line number Diff line number Diff line
@@ -385,32 +385,17 @@ public:
     */
    virtual status_t removeRegionSamplingListener(const sp<IRegionSamplingListener>& listener) = 0;

    /*
     * Sets the allowed display configurations to be used.
     * The allowedConfigs in a vector of indexes corresponding to the configurations
     * returned from getDisplayConfigs().
     */
    virtual status_t setAllowedDisplayConfigs(const sp<IBinder>& displayToken,
                                              const std::vector<int32_t>& allowedConfigs) = 0;

    /*
     * Returns the allowed display configurations currently set.
     * The allowedConfigs in a vector of indexes corresponding to the configurations
     * returned from getDisplayConfigs().
     */
    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,
                                                  int32_t defaultConfig, float minRefreshRate,
                                                  float maxRefreshRate) = 0;

    virtual status_t getDesiredDisplayConfigSpecs(const sp<IBinder>& displayToken,
                                                  int32_t* outDefaultModeId,
                                                  int32_t* outDefaultConfig,
                                                  float* outMinRefreshRate,
                                                  float* outMaxRefreshRate) = 0;
    /*
@@ -523,8 +508,6 @@ public:
        GET_PHYSICAL_DISPLAY_IDS,
        ADD_REGION_SAMPLING_LISTENER,
        REMOVE_REGION_SAMPLING_LISTENER,
        SET_ALLOWED_DISPLAY_CONFIGS,
        GET_ALLOWED_DISPLAY_CONFIGS,
        SET_DESIRED_DISPLAY_CONFIG_SPECS,
        GET_DESIRED_DISPLAY_CONFIG_SPECS,
        GET_DISPLAY_BRIGHTNESS_SUPPORT,
+2 −14
Original line number Diff line number Diff line
@@ -117,23 +117,11 @@ public:
    // returned by getDisplayInfo
    static status_t setActiveConfig(const sp<IBinder>& display, int id);

    // Sets the allowed display configurations to be used.
    // The allowedConfigs in a vector of indexes corresponding to the configurations
    // returned from getDisplayConfigs().
    static status_t setAllowedDisplayConfigs(const sp<IBinder>& displayToken,
                                             const std::vector<int32_t>& allowedConfigs);

    // Returns the allowed display configurations currently set.
    // The allowedConfigs in a vector of indexes corresponding to the configurations
    // returned from getDisplayConfigs().
    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,
                                                 int32_t defaultConfig, 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
@@ -141,7 +129,7 @@ public:
    // 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,
                                                 int32_t* outDefaultConfig,
                                                 float* outMinRefreshRate,
                                                 float* outMaxRefreshRate);

+3 −11
Original line number Diff line number Diff line
@@ -823,21 +823,13 @@ public:
            const sp<IRegionSamplingListener>& /*listener*/) override {
        return NO_ERROR;
    }
    status_t setAllowedDisplayConfigs(const sp<IBinder>& /*displayToken*/,
                                      const std::vector<int32_t>& /*allowedConfigs*/) override {
        return NO_ERROR;
    }
    status_t getAllowedDisplayConfigs(const sp<IBinder>& /*displayToken*/,
                                      std::vector<int32_t>* /*outAllowedConfigs*/) override {
        return NO_ERROR;
    }
    status_t setDesiredDisplayConfigSpecs(const sp<IBinder>& /*displayToken*/,
                                          int32_t /*defaultModeId*/, float /*minRefreshRate*/,
                                          float /*maxRefreshRate*/) override {
                                          int32_t /*defaultConfig*/, float /*minRefreshRate*/,
                                          float /*maxRefreshRate*/) {
        return NO_ERROR;
    }
    status_t getDesiredDisplayConfigSpecs(const sp<IBinder>& /*displayToken*/,
                                          int32_t* /*outDefaultModeId*/,
                                          int32_t* /*outDefaultConfig*/,
                                          float* /*outMinRefreshRate*/,
                                          float* /*outMaxRefreshRate*/) override {
        return NO_ERROR;
Loading