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

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

Merge "[SurfaceFlinger] Add getCompositionPreference APIs to SurfaceComposer."

parents 703894cb 0256f72d
Loading
Loading
Loading
Loading
+31 −0
Original line number Diff line number Diff line
@@ -558,6 +558,25 @@ public:
        outLayers->clear();
        return reply.readParcelableVector(outLayers);
    }

    virtual status_t getCompositionPreference(ui::Dataspace* dataSpace,
                                              ui::PixelFormat* pixelFormat) const {
        Parcel data, reply;
        status_t error = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
        if (error != NO_ERROR) {
            return error;
        }
        error = remote()->transact(BnSurfaceComposer::GET_COMPOSITION_PREFERENCE, data, &reply);
        if (error != NO_ERROR) {
            return error;
        }
        error = static_cast<status_t>(reply.readInt32());
        if (error == NO_ERROR) {
            *dataSpace = static_cast<ui::Dataspace>(reply.readInt32());
            *pixelFormat = static_cast<ui::PixelFormat>(reply.readInt32());
        }
        return error;
    }
};

// Out-of-line virtual method definition to trigger vtable emission in this
@@ -881,6 +900,18 @@ status_t BnSurfaceComposer::onTransact(
            }
            return result;
        }
        case GET_COMPOSITION_PREFERENCE: {
            CHECK_INTERFACE(ISurfaceComposer, data, reply);
            ui::Dataspace dataSpace;
            ui::PixelFormat pixelFormat;
            status_t error = getCompositionPreference(&dataSpace, &pixelFormat);
            reply->writeInt32(error);
            if (error == NO_ERROR) {
                reply->writeInt32(static_cast<int32_t>(dataSpace));
                reply->writeInt32(static_cast<int32_t>(pixelFormat));
            }
            return NO_ERROR;
        }
        default: {
            return BBinder::onTransact(code, data, reply, flags);
        }
+5 −0
Original line number Diff line number Diff line
@@ -854,6 +854,11 @@ void SurfaceComposerClient::setDisplayPowerMode(const sp<IBinder>& token,
    ComposerService::getComposerService()->setPowerMode(token, mode);
}

status_t SurfaceComposerClient::getCompositionPreference(ui::Dataspace* dataSpace,
                                                         ui::PixelFormat* pixelFormat) {
    return ComposerService::getComposerService()->getCompositionPreference(dataSpace, pixelFormat);
}

status_t SurfaceComposerClient::clearAnimationFrameStats() {
    return ComposerService::getComposerService()->clearAnimationFrameStats();
}
+5 −1
Original line number Diff line number Diff line
@@ -231,6 +231,9 @@ public:
     * Requires the ACCESS_SURFACE_FLINGER permission.
     */
    virtual status_t getLayerDebugInfo(std::vector<LayerDebugInfo>* outLayers) const = 0;

    virtual status_t getCompositionPreference(ui::Dataspace* dataSpace,
                                              ui::PixelFormat* pixelFormat) const = 0;
};

// ----------------------------------------------------------------------------
@@ -267,7 +270,8 @@ public:
        ENABLE_VSYNC_INJECTIONS,
        INJECT_VSYNC,
        GET_LAYER_DEBUG_INFO,
        CREATE_SCOPED_CONNECTION
        CREATE_SCOPED_CONNECTION,
        GET_COMPOSITION_PREFERENCE,
    };

    virtual status_t onTransact(uint32_t code, const Parcel& data,
+4 −0
Original line number Diff line number Diff line
@@ -101,6 +101,10 @@ public:
    /* Triggers screen on/off or low power mode and waits for it to complete */
    static void setDisplayPowerMode(const sp<IBinder>& display, int mode);

    //
    static status_t getCompositionPreference(ui::Dataspace* dataSpace,
                                             ui::PixelFormat* pixelFormat);

    // ------------------------------------------------------------------------
    // surface creation / destruction

+4 −0
Original line number Diff line number Diff line
@@ -622,6 +622,10 @@ public:
    status_t getLayerDebugInfo(std::vector<LayerDebugInfo>* /*layers*/) const override {
        return NO_ERROR;
    }
    status_t getCompositionPreference(ui::Dataspace* /*outDataSpace*/,
                                      ui::PixelFormat* /*outPixelFormat*/) const override {
        return NO_ERROR;
    }

protected:
    IBinder* onAsBinder() override { return nullptr; }
Loading