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

Commit 35a1c9c8 authored by Leon Scroggins's avatar Leon Scroggins Committed by Android (Google) Code Review
Browse files

Merge changes from topics "checkForMultiThreadedPresentSupport", "offload_present" into main

* changes:
  AidlComposer: read flag to determine number of readers
  Offload present to a separate thread
  Revert "Remove references to MULTI_THREADED_PRESENT"
parents 43881b0f db635045
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -23,13 +23,18 @@ namespace android::ui {

// The static capacities were chosen to exceed a typical number of physical and/or virtual displays.

constexpr size_t kDisplayCapacity = 5;
template <typename Key, typename Value>
using DisplayMap = ftl::SmallMap<Key, Value, 5>;
using DisplayMap = ftl::SmallMap<Key, Value, kDisplayCapacity>;

constexpr size_t kPhysicalDisplayCapacity = 3;
template <typename Key, typename Value>
using PhysicalDisplayMap = ftl::SmallMap<Key, Value, 3>;
using PhysicalDisplayMap = ftl::SmallMap<Key, Value, kPhysicalDisplayCapacity>;

template <typename T>
using PhysicalDisplayVector = ftl::SmallVector<T, 3>;
using DisplayVector = ftl::SmallVector<T, kDisplayCapacity>;

template <typename T>
using PhysicalDisplayVector = ftl::SmallVector<T, kPhysicalDisplayCapacity>;

} // namespace android::ui
+9 −2
Original line number Diff line number Diff line
@@ -91,6 +91,9 @@ cc_library {
    ],
    local_include_dirs: ["include"],
    export_include_dirs: ["include"],
    shared_libs: [
        "server_configurable_flags",
    ],
}

cc_library {
@@ -114,6 +117,9 @@ cc_library {
        "libsurfaceflinger_common_test",
        "libsurfaceflingerflags_test",
    ],
    shared_libs: [
        "server_configurable_flags",
    ],
    local_include_dirs: ["include"],
    export_include_dirs: ["include"],
}
@@ -150,10 +156,11 @@ cc_test {
        "libsurfaceflinger_common_test",
        "libsurfaceflingerflags_test",
    ],
    shared_libs: [
        // For some reason, libvulkan isn't picked up from librenderengine
        // Probably ASAN related?
    shared_libs: [
        "libvulkan",
        "server_configurable_flags",
    ],
    sanitize: {
        hwaddress: true,
+10 −2
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@
#include <vector>

#include <compositionengine/LayerFE.h>
#include <ftl/future.h>
#include <renderengine/LayerSettings.h>
#include <ui/Fence.h>
#include <ui/FenceTime.h>
@@ -263,8 +264,15 @@ public:
    // Prepare the output, updating the OutputLayers used in the output
    virtual void prepare(const CompositionRefreshArgs&, LayerFESet&) = 0;

    // Presents the output, finalizing all composition details
    virtual void present(const CompositionRefreshArgs&) = 0;
    // Presents the output, finalizing all composition details. This may happen
    // asynchronously, in which case the returned future must be waited upon.
    virtual ftl::Future<std::monostate> present(const CompositionRefreshArgs&) = 0;

    // Whether this output can be presented from another thread.
    virtual bool supportsOffloadPresent() const = 0;

    // Make the next call to `present` run asynchronously.
    virtual void offloadPresentNextFrame() = 0;

    // Enables predicting composition strategy to run client composition earlier
    virtual void setPredictCompositionStrategy(bool) = 0;
+1 −0
Original line number Diff line number Diff line
@@ -62,6 +62,7 @@ public:
    compositionengine::Output::FrameFences presentFrame() override;
    void setExpensiveRenderingExpected(bool) override;
    void finishFrame(GpuCompositionResult&&) override;
    bool supportsOffloadPresent() const override;

    // compositionengine::Display overrides
    DisplayId getId() const override;
+8 −1
Original line number Diff line number Diff line
@@ -80,7 +80,9 @@ public:
    void setReleasedLayers(ReleasedLayers&&) override;

    void prepare(const CompositionRefreshArgs&, LayerFESet&) override;
    void present(const CompositionRefreshArgs&) override;
    ftl::Future<std::monostate> present(const CompositionRefreshArgs&) override;
    bool supportsOffloadPresent() const override { return false; }
    void offloadPresentNextFrame() override;

    void uncacheBuffers(const std::vector<uint64_t>& bufferIdsToUncache) override;
    void rebuildLayerStacks(const CompositionRefreshArgs&, LayerFESet&) override;
@@ -121,6 +123,7 @@ public:
    virtual std::future<bool> chooseCompositionStrategyAsync(
            std::optional<android::HWComposer::DeviceRequestedChanges>*);
    virtual void resetCompositionStrategy();
    virtual ftl::Future<std::monostate> presentFrameAndReleaseLayersAsync();

protected:
    std::unique_ptr<compositionengine::OutputLayer> createOutputLayer(const sp<LayerFE>&) const;
@@ -164,6 +167,7 @@ private:
    ui::Dataspace getBestDataspace(ui::Dataspace*, bool*) const;
    compositionengine::Output::ColorProfile pickColorProfile(
            const compositionengine::CompositionRefreshArgs&) const;
    void updateHwcAsyncWorker();

    std::string mName;
    std::string mNamePlusId;
@@ -177,6 +181,9 @@ private:
    std::unique_ptr<planner::Planner> mPlanner;
    std::unique_ptr<HwcAsyncWorker> mHwComposerAsyncWorker;

    bool mPredictCompositionStrategy = false;
    bool mOffloadPresent = false;

    // Whether the content must be recomposed this frame.
    bool mMustRecompose = false;
};
Loading