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

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

Merge "SF: Move preComposition to CompositionEngine"

parents cd63ae38 ab039b55
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -18,6 +18,8 @@

#include <memory>

#include <utils/Timers.h>

namespace android {

class HWComposer;
@@ -31,6 +33,7 @@ namespace compositionengine {
class Display;
class Layer;

struct CompositionRefreshArgs;
struct DisplayCreationArgs;
struct LayerCreationArgs;

@@ -51,6 +54,12 @@ public:

    virtual renderengine::RenderEngine& getRenderEngine() const = 0;
    virtual void setRenderEngine(std::unique_ptr<renderengine::RenderEngine>) = 0;

    virtual bool needsAnotherUpdate() const = 0;
    virtual nsecs_t getLastFrameRefreshTimestamp() const = 0;

    // TODO(b/121291683): These will become private/internal
    virtual void preComposition(CompositionRefreshArgs&) = 0;
};

} // namespace compositionengine
+40 −0
Original line number Diff line number Diff line
/*
 * Copyright 2019 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#pragma once

#include <compositionengine/Display.h>
#include <compositionengine/Layer.h>

namespace android::compositionengine {

using Layers = std::vector<std::shared_ptr<compositionengine::Layer>>;
using Outputs = std::vector<std::shared_ptr<compositionengine::Output>>;

/**
 * A parameter object for refreshing a set of outputs
 */
struct CompositionRefreshArgs {
    // All the outputs being refreshed
    Outputs outputs;

    // All the layers that are potentially visible in the outputs. The order of
    // the layers is important, and should be in traversal order from back to
    // front.
    Layers layers;
};

} // namespace android::compositionengine
+2 −7
Original line number Diff line number Diff line
@@ -21,11 +21,7 @@

#include <utils/StrongPointer.h>

namespace android {

typedef int64_t nsecs_t;

namespace compositionengine {
namespace android::compositionengine {

class Display;
class LayerFE;
@@ -62,5 +58,4 @@ public:
    virtual void dump(std::string& result) const = 0;
};

} // namespace compositionengine
} // namespace android
} // namespace android::compositionengine
+10 −0
Original line number Diff line number Diff line
@@ -36,9 +36,19 @@ public:
    renderengine::RenderEngine& getRenderEngine() const override;
    void setRenderEngine(std::unique_ptr<renderengine::RenderEngine>) override;

    bool needsAnotherUpdate() const override;
    nsecs_t getLastFrameRefreshTimestamp() const override;

    void preComposition(CompositionRefreshArgs&) override;

    // Testing
    void setNeedsAnotherUpdateForTest(bool);

private:
    std::unique_ptr<HWComposer> mHwComposer;
    std::unique_ptr<renderengine::RenderEngine> mRenderEngine;
    bool mNeedsAnotherUpdate = false;
    nsecs_t mRefreshStartTime = 0;
};

std::unique_ptr<compositionengine::CompositionEngine> createCompositionEngine();
+6 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
#pragma once

#include <compositionengine/CompositionEngine.h>
#include <compositionengine/CompositionRefreshArgs.h>
#include <compositionengine/DisplayCreationArgs.h>
#include <compositionengine/LayerCreationArgs.h>
#include <gmock/gmock.h>
@@ -39,6 +40,11 @@ public:

    MOCK_CONST_METHOD0(getRenderEngine, renderengine::RenderEngine&());
    MOCK_METHOD1(setRenderEngine, void(std::unique_ptr<renderengine::RenderEngine>));

    MOCK_CONST_METHOD0(needsAnotherUpdate, bool());
    MOCK_CONST_METHOD0(getLastFrameRefreshTimestamp, nsecs_t());

    MOCK_METHOD1(preComposition, void(CompositionRefreshArgs&));
};

} // namespace android::compositionengine::mock
Loading