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

Commit 0cadba61 authored by Su Hong Koo's avatar Su Hong Koo Committed by Android (Google) Code Review
Browse files

Merge changes I40bb8f19,Ifdfb60b0,I8dbecd87 into main

* changes:
  SF: Track last client composition's acquire fence
  SF: Force GPU composition of slower follower displays
  Flag: Trunk-stable flag to force GPU composition of slower folower displays
parents 87647dc0 4ae647b5
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -62,3 +62,12 @@ inline bool operator<(LayerStack lhs, LayerStack rhs) {
}

} // namespace android::ui

namespace std {
template <>
struct hash<android::ui::LayerStack> {
    size_t operator()(const android::ui::LayerStack& layerStack) const {
        return hash<uint32_t>()(layerStack.id);
    }
};
} // namespace std
+3 −2
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@

#include <chrono>
#include <optional>
#include <unordered_set>
#include <vector>
#include "utils/Timers.h"

@@ -79,8 +80,8 @@ struct CompositionRefreshArgs {
    // frame. Only set if the color transform is changing this frame.
    std::optional<mat4> colorTransformMatrix;

    // If true, client composition is always used.
    bool devOptForceClientComposition{false};
    // If a layer is on layer stack specified here, it will client composite.
    std::unordered_set<ui::LayerStack> forcedClientCompositionLayerStacks;

    // If set, causes the dirty regions to flash with the delay
    std::optional<std::chrono::microseconds> devOptFlashDirtyRegionsDelay;
+4 −0
Original line number Diff line number Diff line
@@ -164,6 +164,10 @@ public:
    // Sets promise with its buffer's release fence
    virtual void setReleaseFence(const FenceResult& releaseFence) = 0;

    virtual void setLastClientTargetAcquireFence(const FenceResult&) = 0;

    virtual sp<Fence> getAndClearLastClientTargetAcquireFence() = 0;

    // Checks if the buffer's release fence has been set
    virtual LayerFE::ReleaseFencePromiseStatus getReleaseFencePromiseStatus() = 0;

+2 −0
Original line number Diff line number Diff line
@@ -54,6 +54,8 @@ public:
    MOCK_METHOD1(setReleaseFence, void(const FenceResult&));
    MOCK_METHOD1(setReleasedBuffer, void(sp<GraphicBuffer>));
    MOCK_METHOD0(getReleaseFencePromiseStatus, LayerFE::ReleaseFencePromiseStatus());
    MOCK_METHOD1(setLastClientTargetAcquireFence, void(const FenceResult&));
    MOCK_METHOD0(getAndClearLastClientTargetAcquireFence, sp<Fence>());
    MOCK_CONST_METHOD0(getDebugName, const char*());
    MOCK_CONST_METHOD0(getSequence, int32_t());
    MOCK_CONST_METHOD0(hasRoundedCorners, bool());
+14 −4
Original line number Diff line number Diff line
@@ -195,18 +195,24 @@ void CompositionEngine::preComposition(CompositionRefreshArgs& args) {

// If a buffer is latched but the layer is not presented, such as when
// obscured by another layer, the previous buffer needs to be released. We find
// these buffers and fire a NO_FENCE to release it. This ensures that all
// promises for buffer releases are fulfilled at the end of composition.
// these buffers and fire a NO_FENCE, or the last client composition acquire fence to release it.
// This ensures that all promises for buffer releases are fulfilled at the end of composition.
void CompositionEngine::postComposition(CompositionRefreshArgs& args) {
    SFTRACE_CALL();
    ALOGV(__FUNCTION__);

    const bool force_slower_follower_gpu_composition =
            FlagManager::getInstance().force_slower_follower_gpu_composition();
    for (auto& layerFE : args.layers) {
        if (layerFE->getReleaseFencePromiseStatus() ==
            LayerFE::ReleaseFencePromiseStatus::INITIALIZED) {
            if (force_slower_follower_gpu_composition) {
                layerFE->setReleaseFence(layerFE->getAndClearLastClientTargetAcquireFence());
            } else {
                layerFE->setReleaseFence(Fence::NO_FENCE);
            }
        }
    }

    // List of layersWithQueuedFrames does not necessarily overlap with
    // list of layers, so those layersWithQueuedFrames also need any
@@ -214,10 +220,14 @@ void CompositionEngine::postComposition(CompositionRefreshArgs& args) {
    for (auto& layerFE : args.layersWithQueuedFrames) {
        if (layerFE->getReleaseFencePromiseStatus() ==
            LayerFE::ReleaseFencePromiseStatus::INITIALIZED) {
            if (force_slower_follower_gpu_composition) {
                layerFE->setReleaseFence(layerFE->getAndClearLastClientTargetAcquireFence());
            } else {
                layerFE->setReleaseFence(Fence::NO_FENCE);
            }
        }
    }
}

FeatureFlags CompositionEngine::getFeatureFlags() const {
    return {};
Loading