| Lloyd Pique | ab039b5 | 2019-02-13 14:22:42 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2019 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 Pique | f8cf14d | 2019-02-28 16:03:12 -0800 | [diff] [blame] | 19 | #include <chrono> |
| 20 | #include <optional> |
| Lloyd Pique | c29e4c6 | 2019-03-07 21:48:19 -0800 | [diff] [blame] | 21 | #include <vector> |
| Lloyd Pique | f8cf14d | 2019-02-28 16:03:12 -0800 | [diff] [blame] | 22 | |
| Lloyd Pique | ab039b5 | 2019-02-13 14:22:42 -0800 | [diff] [blame] | 23 | #include <compositionengine/Display.h> |
| Lloyd Pique | de19665 | 2020-01-22 17:29:58 -0800 | [diff] [blame] | 24 | #include <compositionengine/LayerFE.h> |
| Lloyd Pique | 6a3b446 | 2019-03-07 20:58:12 -0800 | [diff] [blame] | 25 | #include <compositionengine/OutputColorSetting.h> |
| Lloyd Pique | 3eb1b21 | 2019-03-07 21:15:40 -0800 | [diff] [blame] | 26 | #include <math/mat4.h> |
| Ady Abraham | ec7aa8a | 2021-06-28 12:37:09 -0700 | [diff] [blame] | 27 | #include <ui/FenceTime.h> |
| Snild Dolkow | 9e217d6 | 2020-04-22 15:53:42 +0200 | [diff] [blame] | 28 | #include <ui/Transform.h> |
| Lloyd Pique | ab039b5 | 2019-02-13 14:22:42 -0800 | [diff] [blame] | 29 | |
| 30 | namespace android::compositionengine { |
| 31 | |
| Lloyd Pique | de19665 | 2020-01-22 17:29:58 -0800 | [diff] [blame] | 32 | using Layers = std::vector<sp<compositionengine::LayerFE>>; |
| Lloyd Pique | ab039b5 | 2019-02-13 14:22:42 -0800 | [diff] [blame] | 33 | using Outputs = std::vector<std::shared_ptr<compositionengine::Output>>; |
| 34 | |
| Tianhao Yao | 67dd712 | 2022-02-22 17:48:33 +0000 | [diff] [blame] | 35 | struct BorderRenderInfo { |
| Tianhao Yao | 10cea3c | 2022-03-30 01:37:22 +0000 | [diff] [blame] | 36 | float width = 0; |
| 37 | half4 color; |
| Tianhao Yao | 67dd712 | 2022-02-22 17:48:33 +0000 | [diff] [blame] | 38 | std::vector<int32_t> layerIds; |
| 39 | }; |
| Lloyd Pique | ab039b5 | 2019-02-13 14:22:42 -0800 | [diff] [blame] | 40 | /** |
| 41 | * A parameter object for refreshing a set of outputs |
| 42 | */ |
| 43 | struct CompositionRefreshArgs { |
| 44 | // All the outputs being refreshed |
| 45 | Outputs outputs; |
| 46 | |
| 47 | // All the layers that are potentially visible in the outputs. The order of |
| 48 | // the layers is important, and should be in traversal order from back to |
| 49 | // front. |
| 50 | Layers layers; |
| Lloyd Pique | f8cf14d | 2019-02-28 16:03:12 -0800 | [diff] [blame] | 51 | |
| Lloyd Pique | c29e4c6 | 2019-03-07 21:48:19 -0800 | [diff] [blame] | 52 | // All the layers that have queued updates. |
| Lloyd Pique | de19665 | 2020-01-22 17:29:58 -0800 | [diff] [blame] | 53 | Layers layersWithQueuedFrames; |
| Lloyd Pique | c29e4c6 | 2019-03-07 21:48:19 -0800 | [diff] [blame] | 54 | |
| Brian Lindahl | 439afad | 2022-11-14 11:16:55 -0700 | [diff] [blame] | 55 | // All graphic buffers that will no longer be used and should be removed from caches. |
| 56 | std::vector<uint64_t> bufferIdsToUncache; |
| 57 | |
| Lloyd Pique | 6a3b446 | 2019-03-07 20:58:12 -0800 | [diff] [blame] | 58 | // Controls how the color mode is chosen for an output |
| 59 | OutputColorSetting outputColorSetting{OutputColorSetting::kEnhanced}; |
| 60 | |
| 61 | // If not Dataspace::UNKNOWN, overrides the dataspace on each output |
| 62 | ui::Dataspace colorSpaceAgnosticDataspace{ui::Dataspace::UNKNOWN}; |
| 63 | |
| 64 | // Forces a color mode on the outputs being refreshed |
| 65 | ui::ColorMode forceOutputColorMode{ui::ColorMode::NATIVE}; |
| 66 | |
| Snild Dolkow | 9e217d6 | 2020-04-22 15:53:42 +0200 | [diff] [blame] | 67 | // Used to correctly apply an inverse-display buffer transform if applicable |
| 68 | ui::Transform::RotationFlags internalDisplayRotationFlags{ui::Transform::ROT_0}; |
| 69 | |
| Lloyd Pique | c29e4c6 | 2019-03-07 21:48:19 -0800 | [diff] [blame] | 70 | // If true, the complete output geometry needs to be recomputed this frame |
| 71 | bool updatingOutputGeometryThisFrame{false}; |
| 72 | |
| Lloyd Pique | 3eb1b21 | 2019-03-07 21:15:40 -0800 | [diff] [blame] | 73 | // If true, there was a geometry update this frame |
| 74 | bool updatingGeometryThisFrame{false}; |
| 75 | |
| 76 | // The color matrix to use for this |
| 77 | // frame. Only set if the color transform is changing this frame. |
| 78 | std::optional<mat4> colorTransformMatrix; |
| 79 | |
| 80 | // If true, client composition is always used. |
| 81 | bool devOptForceClientComposition{false}; |
| 82 | |
| Lloyd Pique | f8cf14d | 2019-02-28 16:03:12 -0800 | [diff] [blame] | 83 | // If set, causes the dirty regions to flash with the delay |
| 84 | std::optional<std::chrono::microseconds> devOptFlashDirtyRegionsDelay; |
| Ady Abraham | 3645e64 | 2021-04-20 18:39:00 -0700 | [diff] [blame] | 85 | |
| 86 | // The earliest time to send the present command to the HAL |
| 87 | std::chrono::steady_clock::time_point earliestPresentTime; |
| Alec Mouri | aa83158 | 2021-06-07 16:23:01 -0700 | [diff] [blame] | 88 | |
| Ady Abraham | ec7aa8a | 2021-06-28 12:37:09 -0700 | [diff] [blame] | 89 | // The previous present fence. Used together with earliestPresentTime |
| 90 | // to prevent an early presentation of a frame. |
| 91 | std::shared_ptr<FenceTime> previousPresentFence; |
| 92 | |
| Ady Abraham | 43065bd | 2021-12-10 17:22:15 -0800 | [diff] [blame] | 93 | // The expected time for the next present |
| 94 | nsecs_t expectedPresentTime{0}; |
| 95 | |
| Dominik Laskowski | e0e0cde | 2021-07-30 10:42:05 -0700 | [diff] [blame] | 96 | // If set, a frame has been scheduled for that time. |
| 97 | std::optional<std::chrono::steady_clock::time_point> scheduledFrameTime; |
| Tianhao Yao | 67dd712 | 2022-02-22 17:48:33 +0000 | [diff] [blame] | 98 | |
| 99 | std::vector<BorderRenderInfo> borderInfoList; |
| Lloyd Pique | ab039b5 | 2019-02-13 14:22:42 -0800 | [diff] [blame] | 100 | }; |
| 101 | |
| 102 | } // namespace android::compositionengine |