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

Commit 4e211773 authored by jimmyshiu's avatar jimmyshiu Committed by Jimmy Shiu
Browse files

Send load up hint for cache rendering

cache buffer rendering supposes to utilize the cpu gap after current
frame finised and before the next frame. But it could take long and
delay the next frame start time and cause jank eventually.
Sending CPU LOAD UP hint to prevent stealing time from the next frame.

Bug: 285991802
Test: PtsUiBench QHD
Change-Id: Id619a8166ae253fef815a25a35fc4b82066144a9
parent 8d984107
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -37,6 +37,15 @@ struct BorderRenderInfo {
    half4 color;
    std::vector<int32_t> layerIds;
};

// Interface of composition engine power hint callback.
struct ICEPowerCallback {
    virtual void notifyCpuLoadUp() = 0;

protected:
    ~ICEPowerCallback() = default;
};

/**
 * A parameter object for refreshing a set of outputs
 */
@@ -96,6 +105,8 @@ struct CompositionRefreshArgs {
    std::vector<BorderRenderInfo> borderInfoList;

    bool hasTrustedPresentationListener = false;

    ICEPowerCallback* powerCallback = nullptr;
};

} // namespace android::compositionengine
+3 −0
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@
// TODO(b/129481165): remove the #pragma below and fix conversion issues
#pragma clang diagnostic pop // ignored "-Wconversion -Wextra"

#include <compositionengine/CompositionRefreshArgs.h>
#include <compositionengine/ProjectionSpace.h>
#include <renderengine/BorderRenderInfo.h>
#include <ui/LayerStack.h>
@@ -167,6 +168,8 @@ struct OutputCompositionState {
    uint64_t lastOutputLayerHash = 0;
    uint64_t outputLayerHash = 0;

    ICEPowerCallback* powerCallback = nullptr;

    // Debugging
    void dump(std::string& result) const;
};
+1 −0
Original line number Diff line number Diff line
@@ -843,6 +843,7 @@ void Output::writeCompositionState(const compositionengine::CompositionRefreshAr

    editState().earliestPresentTime = refreshArgs.earliestPresentTime;
    editState().expectedPresentTime = refreshArgs.expectedPresentTime;
    editState().powerCallback = refreshArgs.powerCallback;

    compositionengine::OutputLayer* peekThroughLayer = nullptr;
    sp<GraphicBuffer> previousOverride = nullptr;
+3 −0
Original line number Diff line number Diff line
@@ -162,6 +162,9 @@ void CachedSet::render(renderengine::RenderEngine& renderEngine, TexturePool& te
                       const OutputCompositionState& outputState,
                       bool deviceHandlesColorTransform) {
    ATRACE_CALL();
    if (outputState.powerCallback) {
        outputState.powerCallback->notifyCpuLoadUp();
    }
    const Rect& viewport = outputState.layerStackSpace.getContent();
    const ui::Dataspace& outputDataspace = outputState.dataspace;
    const ui::Transform::RotationFlags orientation =
+1 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ public:
    MOCK_METHOD(void, setExpensiveRenderingExpected, (DisplayId displayId, bool expected),
                (override));
    MOCK_METHOD(bool, isUsingExpensiveRendering, (), (override));
    MOCK_METHOD(void, notifyCpuLoadUp, (), (override));
    MOCK_METHOD(void, notifyDisplayUpdateImminentAndCpuReset, (), (override));
    MOCK_METHOD(bool, usePowerHintSession, (), (override));
    MOCK_METHOD(bool, supportsPowerHintSession, (), (override));
Loading