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 19 #include <chrono> 20 #include <optional> 21 #include <vector> 22 23 #include <compositionengine/Display.h> 24 #include <compositionengine/LayerFE.h> 25 #include <compositionengine/OutputColorSetting.h> 26 #include <math/mat4.h> 27 #include <ui/FenceTime.h> 28 #include <ui/Transform.h> 29 30 namespace android::compositionengine { 31 32 using Layers = std::vector<sp<compositionengine::LayerFE>>; 33 using Outputs = std::vector<std::shared_ptr<compositionengine::Output>>; 34 35 /** 36 * A parameter object for refreshing a set of outputs 37 */ 38 struct CompositionRefreshArgs { 39 // All the outputs being refreshed 40 Outputs outputs; 41 42 // All the layers that are potentially visible in the outputs. The order of 43 // the layers is important, and should be in traversal order from back to 44 // front. 45 Layers layers; 46 47 // All the layers that have queued updates. 48 Layers layersWithQueuedFrames; 49 50 // If true, forces the entire display to be considered dirty and repainted 51 bool repaintEverything{false}; 52 53 // Controls how the color mode is chosen for an output 54 OutputColorSetting outputColorSetting{OutputColorSetting::kEnhanced}; 55 56 // If not Dataspace::UNKNOWN, overrides the dataspace on each output 57 ui::Dataspace colorSpaceAgnosticDataspace{ui::Dataspace::UNKNOWN}; 58 59 // Forces a color mode on the outputs being refreshed 60 ui::ColorMode forceOutputColorMode{ui::ColorMode::NATIVE}; 61 62 // Used to correctly apply an inverse-display buffer transform if applicable 63 ui::Transform::RotationFlags internalDisplayRotationFlags{ui::Transform::ROT_0}; 64 65 // If true, GPU clocks will be increased when rendering blurs 66 bool blursAreExpensive{false}; 67 68 // If true, the complete output geometry needs to be recomputed this frame 69 bool updatingOutputGeometryThisFrame{false}; 70 71 // If true, there was a geometry update this frame 72 bool updatingGeometryThisFrame{false}; 73 74 // The color matrix to use for this 75 // frame. Only set if the color transform is changing this frame. 76 std::optional<mat4> colorTransformMatrix; 77 78 // If true, client composition is always used. 79 bool devOptForceClientComposition{false}; 80 81 // If set, causes the dirty regions to flash with the delay 82 std::optional<std::chrono::microseconds> devOptFlashDirtyRegionsDelay; 83 84 // The earliest time to send the present command to the HAL 85 std::chrono::steady_clock::time_point earliestPresentTime; 86 87 // The previous present fence. Used together with earliestPresentTime 88 // to prevent an early presentation of a frame. 89 std::shared_ptr<FenceTime> previousPresentFence; 90 91 // The predicted next invalidation time 92 std::optional<std::chrono::steady_clock::time_point> nextInvalidateTime; 93 }; 94 95 } // namespace android::compositionengine 96