| Lloyd Pique | 70d9136 | 2018-10-18 16:02:55 -0700 | [diff] [blame] | 1 | /* |
| 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 Mouri | e4034bb | 2019-11-19 12:45:54 -0800 | [diff] [blame] | 19 | #include <TimeStats/TimeStats.h> |
| Lloyd Pique | ab039b5 | 2019-02-13 14:22:42 -0800 | [diff] [blame] | 20 | #include <utils/Timers.h> |
| Alec Mouri | e4034bb | 2019-11-19 12:45:54 -0800 | [diff] [blame] | 21 | #include <memory> |
| 22 | |
| Vishnu Nair | 0a4fb00 | 2022-08-08 02:40:42 +0000 | [diff] [blame] | 23 | #include "Feature.h" |
| 24 | |
| Lloyd Pique | 70d9136 | 2018-10-18 16:02:55 -0700 | [diff] [blame] | 25 | namespace android { |
| 26 | |
| 27 | class HWComposer; |
| 28 | |
| Lloyd Pique | b97e04f | 2018-10-18 17:07:05 -0700 | [diff] [blame] | 29 | namespace renderengine { |
| 30 | class RenderEngine; |
| 31 | } // namespace renderengine |
| 32 | |
| Lloyd Pique | 70d9136 | 2018-10-18 16:02:55 -0700 | [diff] [blame] | 33 | namespace compositionengine { |
| 34 | |
| Lloyd Pique | 45a165a | 2018-10-19 11:54:47 -0700 | [diff] [blame] | 35 | class Display; |
| 36 | |
| Lloyd Pique | ab039b5 | 2019-02-13 14:22:42 -0800 | [diff] [blame] | 37 | struct CompositionRefreshArgs; |
| Lloyd Pique | 45a165a | 2018-10-19 11:54:47 -0700 | [diff] [blame] | 38 | struct DisplayCreationArgs; |
| Lloyd Pique | feb73d7 | 2018-12-04 17:23:44 -0800 | [diff] [blame] | 39 | struct LayerCreationArgs; |
| Lloyd Pique | de19665 | 2020-01-22 17:29:58 -0800 | [diff] [blame] | 40 | struct LayerFECompositionState; |
| Lloyd Pique | 45a165a | 2018-10-19 11:54:47 -0700 | [diff] [blame] | 41 | |
| Lloyd Pique | 70d9136 | 2018-10-18 16:02:55 -0700 | [diff] [blame] | 42 | /** |
| 43 | * Encapsulates all the interfaces and implementation details for performing |
| 44 | * display output composition. |
| 45 | */ |
| 46 | class CompositionEngine { |
| 47 | public: |
| 48 | virtual ~CompositionEngine(); |
| Lloyd Pique | 441d504 | 2018-10-18 16:49:51 -0700 | [diff] [blame] | 49 | |
| Lloyd Pique | 45a165a | 2018-10-19 11:54:47 -0700 | [diff] [blame] | 50 | // Create a composition Display |
| Lloyd Pique | a38ea7e | 2019-04-16 18:10:26 -0700 | [diff] [blame] | 51 | virtual std::shared_ptr<Display> createDisplay(const DisplayCreationArgs&) = 0; |
| Lloyd Pique | de19665 | 2020-01-22 17:29:58 -0800 | [diff] [blame] | 52 | virtual std::unique_ptr<compositionengine::LayerFECompositionState> |
| 53 | createLayerFECompositionState() = 0; |
| Lloyd Pique | 45a165a | 2018-10-19 11:54:47 -0700 | [diff] [blame] | 54 | |
| Lloyd Pique | 441d504 | 2018-10-18 16:49:51 -0700 | [diff] [blame] | 55 | virtual HWComposer& getHwComposer() const = 0; |
| 56 | virtual void setHwComposer(std::unique_ptr<HWComposer>) = 0; |
| Lloyd Pique | b97e04f | 2018-10-18 17:07:05 -0700 | [diff] [blame] | 57 | |
| 58 | virtual renderengine::RenderEngine& getRenderEngine() const = 0; |
| Patrick Williams | 0a525a4 | 2022-10-26 20:20:50 +0000 | [diff] [blame] | 59 | virtual void setRenderEngine(renderengine::RenderEngine*) = 0; |
| Lloyd Pique | ab039b5 | 2019-02-13 14:22:42 -0800 | [diff] [blame] | 60 | |
| Patrick Williams | 74c0bf6 | 2022-11-02 23:59:26 +0000 | [diff] [blame] | 61 | virtual TimeStats* getTimeStats() const = 0; |
| Alec Mouri | e4034bb | 2019-11-19 12:45:54 -0800 | [diff] [blame] | 62 | virtual void setTimeStats(const std::shared_ptr<TimeStats>&) = 0; |
| 63 | |
| Lloyd Pique | ab039b5 | 2019-02-13 14:22:42 -0800 | [diff] [blame] | 64 | virtual bool needsAnotherUpdate() const = 0; |
| 65 | virtual nsecs_t getLastFrameRefreshTimestamp() const = 0; |
| 66 | |
| Lloyd Pique | d7b429f | 2019-03-07 21:11:02 -0800 | [diff] [blame] | 67 | // Presents the indicated outputs |
| 68 | virtual void present(CompositionRefreshArgs&) = 0; |
| 69 | |
| Lloyd Pique | c7b0c75 | 2019-03-07 20:59:59 -0800 | [diff] [blame] | 70 | // Updates the cursor position for the indicated outputs. |
| 71 | virtual void updateCursorAsync(CompositionRefreshArgs&) = 0; |
| 72 | |
| Lloyd Pique | ab039b5 | 2019-02-13 14:22:42 -0800 | [diff] [blame] | 73 | // TODO(b/121291683): These will become private/internal |
| 74 | virtual void preComposition(CompositionRefreshArgs&) = 0; |
| Lloyd Pique | c3cb729 | 2019-05-17 15:25:14 -0700 | [diff] [blame] | 75 | |
| Vishnu Nair | 0a4fb00 | 2022-08-08 02:40:42 +0000 | [diff] [blame] | 76 | virtual FeatureFlags getFeatureFlags() const = 0; |
| 77 | |
| Lloyd Pique | c3cb729 | 2019-05-17 15:25:14 -0700 | [diff] [blame] | 78 | // Debugging |
| 79 | virtual void dump(std::string&) const = 0; |
| Lloyd Pique | 70d9136 | 2018-10-18 16:02:55 -0700 | [diff] [blame] | 80 | }; |
| 81 | |
| 82 | } // namespace compositionengine |
| 83 | } // namespace android |