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 <cstdint> 20 21 #include <math/mat4.h> 22 23 // TODO(b/129481165): remove the #pragma below and fix conversion issues 24 #pragma clang diagnostic push 25 #pragma clang diagnostic ignored "-Wconversion" 26 27 #include <ui/GraphicTypes.h> 28 29 // TODO(b/129481165): remove the #pragma below and fix conversion issues 30 #pragma clang diagnostic pop // ignored "-Wconversion" 31 32 #include <ui/Rect.h> 33 #include <ui/Region.h> 34 #include <ui/Transform.h> 35 36 namespace android { 37 38 namespace compositionengine::impl { 39 40 struct OutputCompositionState { 41 // If false, composition will not per performed for this display 42 bool isEnabled{false}; 43 44 // If false, this output is not considered secure 45 bool isSecure{false}; 46 47 // If true, the current frame on this output uses client composition 48 bool usesClientComposition{false}; 49 50 // If true, the current frame on this output uses device composition 51 bool usesDeviceComposition{false}; 52 53 // If true, the client target should be flipped when performing client 54 // composition 55 bool flipClientTarget{false}; 56 57 // If true, the current frame reused the buffer from a previous client composition 58 bool reusedClientComposition{false}; 59 60 // If true, this output displays layers that are internal-only 61 bool layerStackInternal{false}; 62 63 // The layer stack to display on this display 64 uint32_t layerStackId{~0u}; 65 66 // The physical space screen bounds 67 Rect bounds; 68 69 // The logical to physical transformation to use 70 ui::Transform transform; 71 72 // The physical orientation of the display, expressed as ui::Transform 73 // orientation flags. 74 uint32_t orientation{0}; 75 76 // The logical space user visible bounds 77 Rect frame; 78 79 // The logical space user viewport rectangle 80 Rect viewport; 81 82 // The physical space source clip rectangle 83 Rect sourceClip; 84 85 // The physical space destination clip rectangle 86 Rect destinationClip; 87 88 // If true, RenderEngine filtering should be enabled 89 bool needsFiltering{false}; 90 91 // The logical coordinates for the dirty region for the display. 92 // dirtyRegion is semi-persistent state. Dirty rectangles are added to it 93 // by the FE until composition happens, at which point it is cleared. 94 Region dirtyRegion; 95 96 // The logical coordinates for the undefined region for the display. 97 // The undefined region is internal to the composition engine. It is 98 // updated every time the geometry changes. 99 Region undefinedRegion; 100 101 // True if the last composition frame had visible layers 102 bool lastCompositionHadVisibleLayers{false}; 103 104 // The color transform matrix to apply 105 mat4 colorTransformMatrix; 106 107 // Current active color mode 108 ui::ColorMode colorMode{ui::ColorMode::NATIVE}; 109 110 // Current active render intent 111 ui::RenderIntent renderIntent{ui::RenderIntent::COLORIMETRIC}; 112 113 // Current active dataspace 114 ui::Dataspace dataspace{ui::Dataspace::UNKNOWN}; 115 116 // Current target dataspace 117 ui::Dataspace targetDataspace{ui::Dataspace::UNKNOWN}; 118 119 // Debugging 120 void dump(std::string& result) const; 121 }; 122 123 } // namespace compositionengine::impl 124 } // namespace android 125