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

Commit d20dbdb7 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes from topic "display_policy"

* changes:
  SurfaceFlinger: add DISPLAY_EVENT_CONFIG_CHANGED
  SurfaceFlinger: add setAllowedDisplayConfigs
parents 114998a8 447052e2
Loading
Loading
Loading
Loading
+35 −0
Original line number Diff line number Diff line
@@ -807,6 +807,32 @@ 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();
    }
};

// Out-of-line virtual method definition to trigger vtable emission in this
@@ -1319,6 +1345,15 @@ 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;
        }
        default: {
            return BBinder::onTransact(code, data, reply, flags);
        }
+6 −0
Original line number Diff line number Diff line
@@ -1382,6 +1382,12 @@ 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::getDisplayColorModes(const sp<IBinder>& display,
        Vector<ColorMode>* outColorModes) {
    return ComposerService::getComposerService()->getDisplayColorModes(display, outColorModes);
+6 −0
Original line number Diff line number Diff line
@@ -52,6 +52,7 @@ public:
    enum {
        DISPLAY_EVENT_VSYNC = fourcc('v', 's', 'y', 'n'),
        DISPLAY_EVENT_HOTPLUG = fourcc('p', 'l', 'u', 'g'),
        DISPLAY_EVENT_CONFIG_CHANGED = fourcc('c', 'o', 'n', 'f'),
    };

    struct Event {
@@ -70,10 +71,15 @@ public:
            bool connected;
        };

        struct Config {
            int32_t configId;
        };

        Header header;
        union {
            VSync vsync;
            Hotplug hotplug;
            Config config;
        };
    };

+9 −1
Original line number Diff line number Diff line
@@ -360,6 +360,14 @@ public:
     * Removes a listener that was streaming median luma updates from SurfaceFlinger.
     */
    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;
};

// ----------------------------------------------------------------------------
@@ -407,7 +415,7 @@ public:
        GET_PHYSICAL_DISPLAY_IDS,
        ADD_REGION_SAMPLING_LISTENER,
        REMOVE_REGION_SAMPLING_LISTENER,

        SET_ALLOWED_DISPLAY_CONFIGS,
        // Always append new enum to the end.
    };

+6 −0
Original line number Diff line number Diff line
@@ -111,6 +111,12 @@ 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);

    // Gets the list of supported color modes for the given display
    static status_t getDisplayColorModes(const sp<IBinder>& display,
            Vector<ui::ColorMode>* outColorModes);
Loading