blob: 9898e35d25e265145e565a40624cccbd564e0283 [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
Lloyd Pique441d5042018-10-18 16:49:51 -070019#include <memory>
20
Lloyd Piqueab039b52019-02-13 14:22:42 -080021#include <utils/Timers.h>
22
Lloyd Pique70d91362018-10-18 16:02:55 -070023namespace android {
24
25class HWComposer;
26
Lloyd Piqueb97e04f2018-10-18 17:07:05 -070027namespace renderengine {
28class RenderEngine;
29} // namespace renderengine
30
Lloyd Pique70d91362018-10-18 16:02:55 -070031namespace compositionengine {
32
Lloyd Pique45a165a2018-10-19 11:54:47 -070033class Display;
Lloyd Piquefeb73d72018-12-04 17:23:44 -080034class Layer;
Lloyd Pique45a165a2018-10-19 11:54:47 -070035
Lloyd Piqueab039b52019-02-13 14:22:42 -080036struct CompositionRefreshArgs;
Lloyd Pique45a165a2018-10-19 11:54:47 -070037struct DisplayCreationArgs;
Lloyd Piquefeb73d72018-12-04 17:23:44 -080038struct LayerCreationArgs;
Lloyd Pique45a165a2018-10-19 11:54:47 -070039
Lloyd Pique70d91362018-10-18 16:02:55 -070040/**
41 * Encapsulates all the interfaces and implementation details for performing
42 * display output composition.
43 */
44class CompositionEngine {
45public:
46 virtual ~CompositionEngine();
Lloyd Pique441d5042018-10-18 16:49:51 -070047
Lloyd Pique45a165a2018-10-19 11:54:47 -070048 // Create a composition Display
Lloyd Piquea38ea7e2019-04-16 18:10:26 -070049 virtual std::shared_ptr<Display> createDisplay(const DisplayCreationArgs&) = 0;
50 virtual std::shared_ptr<Layer> createLayer(const LayerCreationArgs&) = 0;
Lloyd Pique45a165a2018-10-19 11:54:47 -070051
Lloyd Pique441d5042018-10-18 16:49:51 -070052 virtual HWComposer& getHwComposer() const = 0;
53 virtual void setHwComposer(std::unique_ptr<HWComposer>) = 0;
Lloyd Piqueb97e04f2018-10-18 17:07:05 -070054
55 virtual renderengine::RenderEngine& getRenderEngine() const = 0;
56 virtual void setRenderEngine(std::unique_ptr<renderengine::RenderEngine>) = 0;
Lloyd Piqueab039b52019-02-13 14:22:42 -080057
58 virtual bool needsAnotherUpdate() const = 0;
59 virtual nsecs_t getLastFrameRefreshTimestamp() const = 0;
60
Lloyd Piqued7b429f2019-03-07 21:11:02 -080061 // Presents the indicated outputs
62 virtual void present(CompositionRefreshArgs&) = 0;
63
Lloyd Piquec7b0c752019-03-07 20:59:59 -080064 // Updates the cursor position for the indicated outputs.
65 virtual void updateCursorAsync(CompositionRefreshArgs&) = 0;
66
Lloyd Piqueab039b52019-02-13 14:22:42 -080067 // TODO(b/121291683): These will become private/internal
68 virtual void preComposition(CompositionRefreshArgs&) = 0;
Lloyd Pique70d91362018-10-18 16:02:55 -070069};
70
71} // namespace compositionengine
72} // namespace android