Lloyd Pique | 32cbe28 | 2018-10-19 13:09:22 -0700 | [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 | |
| 19 | #include <cstdint> |
| 20 | |
Alec Mouri | c7e8ce8 | 2019-04-02 12:28:05 -0700 | [diff] [blame] | 21 | #include <math/mat4.h> |
Lloyd Pique | 3b5a69e | 2020-01-16 17:51:01 -0800 | [diff] [blame] | 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 | |
Lloyd Pique | 32cbe28 | 2018-10-19 13:09:22 -0700 | [diff] [blame] | 27 | #include <ui/GraphicTypes.h> |
Lloyd Pique | 3b5a69e | 2020-01-16 17:51:01 -0800 | [diff] [blame] | 28 | |
| 29 | // TODO(b/129481165): remove the #pragma below and fix conversion issues |
| 30 | #pragma clang diagnostic pop // ignored "-Wconversion" |
| 31 | |
Lloyd Pique | 32cbe28 | 2018-10-19 13:09:22 -0700 | [diff] [blame] | 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 | |
Lloyd Pique | 66d6860 | 2019-02-13 14:23:31 -0800 | [diff] [blame] | 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 | |
Vishnu Nair | 9b079a2 | 2020-01-21 14:36:08 -0800 | [diff] [blame] | 57 | // If true, the current frame reused the buffer from a previous client composition |
| 58 | bool reusedClientComposition{false}; |
| 59 | |
Lloyd Pique | ef36b00 | 2019-01-23 17:52:04 -0800 | [diff] [blame] | 60 | // If true, this output displays layers that are internal-only |
| 61 | bool layerStackInternal{false}; |
Lloyd Pique | 32cbe28 | 2018-10-19 13:09:22 -0700 | [diff] [blame] | 62 | |
| 63 | // The layer stack to display on this display |
Lloyd Pique | ef36b00 | 2019-01-23 17:52:04 -0800 | [diff] [blame] | 64 | uint32_t layerStackId{~0u}; |
Lloyd Pique | 32cbe28 | 2018-10-19 13:09:22 -0700 | [diff] [blame] | 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 | |
Lloyd Pique | e8fe474 | 2020-01-21 15:26:18 -0800 | [diff] [blame] | 82 | // The physical space source clip rectangle |
| 83 | Rect sourceClip; |
| 84 | |
| 85 | // The physical space destination clip rectangle |
| 86 | Rect destinationClip; |
Lloyd Pique | 32cbe28 | 2018-10-19 13:09:22 -0700 | [diff] [blame] | 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 | |
Lloyd Pique | 3eb1b21 | 2019-03-07 21:15:40 -0800 | [diff] [blame] | 104 | // The color transform matrix to apply |
| 105 | mat4 colorTransformMatrix; |
Alec Mouri | c7e8ce8 | 2019-04-02 12:28:05 -0700 | [diff] [blame] | 106 | |
Lloyd Pique | 32cbe28 | 2018-10-19 13:09:22 -0700 | [diff] [blame] | 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 | |
Lloyd Pique | f527548 | 2019-01-29 18:42:42 -0800 | [diff] [blame] | 113 | // Current active dataspace |
Lloyd Pique | 32cbe28 | 2018-10-19 13:09:22 -0700 | [diff] [blame] | 114 | ui::Dataspace dataspace{ui::Dataspace::UNKNOWN}; |
| 115 | |
Lloyd Pique | f527548 | 2019-01-29 18:42:42 -0800 | [diff] [blame] | 116 | // Current target dataspace |
| 117 | ui::Dataspace targetDataspace{ui::Dataspace::UNKNOWN}; |
| 118 | |
Lloyd Pique | 32cbe28 | 2018-10-19 13:09:22 -0700 | [diff] [blame] | 119 | // Debugging |
| 120 | void dump(std::string& result) const; |
| 121 | }; |
| 122 | |
| 123 | } // namespace compositionengine::impl |
| 124 | } // namespace android |