blob: 7c10fa57ecf759ab5bc49b78bb1d0d881d0510ab [file] [log] [blame]
Lloyd Pique70d91362018-10-18 16:02:55 -07001/*
2 * Copyright 2018 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#pragma once
18
Alec Mourie4034bb2019-11-19 12:45:54 -080019#include <TimeStats/TimeStats.h>
Lloyd Piqueab039b52019-02-13 14:22:42 -080020#include <utils/Timers.h>
Alec Mourie4034bb2019-11-19 12:45:54 -080021#include <memory>
22
Vishnu Nair0a4fb002022-08-08 02:40:42 +000023#include "Feature.h"
24
Lloyd Pique70d91362018-10-18 16:02:55 -070025namespace android {
26
27class HWComposer;
28
Lloyd Piqueb97e04f2018-10-18 17:07:05 -070029namespace renderengine {
30class RenderEngine;
31} // namespace renderengine
32
Lloyd Pique70d91362018-10-18 16:02:55 -070033namespace compositionengine {
34
Lloyd Pique45a165a2018-10-19 11:54:47 -070035class Display;
36
Lloyd Piqueab039b52019-02-13 14:22:42 -080037struct CompositionRefreshArgs;
Lloyd Pique45a165a2018-10-19 11:54:47 -070038struct DisplayCreationArgs;
Lloyd Piquefeb73d72018-12-04 17:23:44 -080039struct LayerCreationArgs;
Lloyd Piquede196652020-01-22 17:29:58 -080040struct LayerFECompositionState;
Lloyd Pique45a165a2018-10-19 11:54:47 -070041
Lloyd Pique70d91362018-10-18 16:02:55 -070042/**
43 * Encapsulates all the interfaces and implementation details for performing
44 * display output composition.
45 */
46class CompositionEngine {
47public:
48 virtual ~CompositionEngine();
Lloyd Pique441d5042018-10-18 16:49:51 -070049
Lloyd Pique45a165a2018-10-19 11:54:47 -070050 // Create a composition Display
Lloyd Piquea38ea7e2019-04-16 18:10:26 -070051 virtual std::shared_ptr<Display> createDisplay(const DisplayCreationArgs&) = 0;
Lloyd Piquede196652020-01-22 17:29:58 -080052 virtual std::unique_ptr<compositionengine::LayerFECompositionState>
53 createLayerFECompositionState() = 0;
Lloyd Pique45a165a2018-10-19 11:54:47 -070054
Lloyd Pique441d5042018-10-18 16:49:51 -070055 virtual HWComposer& getHwComposer() const = 0;
56 virtual void setHwComposer(std::unique_ptr<HWComposer>) = 0;
Lloyd Piqueb97e04f2018-10-18 17:07:05 -070057
58 virtual renderengine::RenderEngine& getRenderEngine() const = 0;
Patrick Williams0a525a42022-10-26 20:20:50 +000059 virtual void setRenderEngine(renderengine::RenderEngine*) = 0;
Lloyd Piqueab039b52019-02-13 14:22:42 -080060
Patrick Williams74c0bf62022-11-02 23:59:26 +000061 virtual TimeStats* getTimeStats() const = 0;
Alec Mourie4034bb2019-11-19 12:45:54 -080062 virtual void setTimeStats(const std::shared_ptr<TimeStats>&) = 0;
63
Lloyd Piqueab039b52019-02-13 14:22:42 -080064 virtual bool needsAnotherUpdate() const = 0;
65 virtual nsecs_t getLastFrameRefreshTimestamp() const = 0;
66
Lloyd Piqued7b429f2019-03-07 21:11:02 -080067 // Presents the indicated outputs
68 virtual void present(CompositionRefreshArgs&) = 0;
69
Lloyd Piquec7b0c752019-03-07 20:59:59 -080070 // Updates the cursor position for the indicated outputs.
71 virtual void updateCursorAsync(CompositionRefreshArgs&) = 0;
72
Lloyd Piqueab039b52019-02-13 14:22:42 -080073 // TODO(b/121291683): These will become private/internal
74 virtual void preComposition(CompositionRefreshArgs&) = 0;
Lloyd Piquec3cb7292019-05-17 15:25:14 -070075
Vishnu Nair0a4fb002022-08-08 02:40:42 +000076 virtual FeatureFlags getFeatureFlags() const = 0;
77
Lloyd Piquec3cb7292019-05-17 15:25:14 -070078 // Debugging
79 virtual void dump(std::string&) const = 0;
Lloyd Pique70d91362018-10-18 16:02:55 -070080};
81
82} // namespace compositionengine
83} // namespace android