blob: 66ed2b6d2564d21a7433adc45a629281856e7a05 [file] [log] [blame]
Lloyd Pique32cbe282018-10-19 13:09:22 -07001/*
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 Mouric7e8ce82019-04-02 12:28:05 -070021#include <math/mat4.h>
Lloyd Pique3b5a69e2020-01-16 17:51:01 -080022
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 Pique32cbe282018-10-19 13:09:22 -070027#include <ui/GraphicTypes.h>
Lloyd Pique3b5a69e2020-01-16 17:51:01 -080028
29// TODO(b/129481165): remove the #pragma below and fix conversion issues
30#pragma clang diagnostic pop // ignored "-Wconversion"
31
Lloyd Pique32cbe282018-10-19 13:09:22 -070032#include <ui/Rect.h>
33#include <ui/Region.h>
34#include <ui/Transform.h>
35
36namespace android {
37
38namespace compositionengine::impl {
39
40struct 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 Pique66d68602019-02-13 14:23:31 -080047 // 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 Nair9b079a22020-01-21 14:36:08 -080057 // If true, the current frame reused the buffer from a previous client composition
58 bool reusedClientComposition{false};
59
Lloyd Piqueef36b002019-01-23 17:52:04 -080060 // If true, this output displays layers that are internal-only
61 bool layerStackInternal{false};
Lloyd Pique32cbe282018-10-19 13:09:22 -070062
63 // The layer stack to display on this display
Lloyd Piqueef36b002019-01-23 17:52:04 -080064 uint32_t layerStackId{~0u};
Lloyd Pique32cbe282018-10-19 13:09:22 -070065
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 Piquee8fe4742020-01-21 15:26:18 -080082 // The physical space source clip rectangle
83 Rect sourceClip;
84
85 // The physical space destination clip rectangle
86 Rect destinationClip;
Lloyd Pique32cbe282018-10-19 13:09:22 -070087
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 Pique3eb1b212019-03-07 21:15:40 -0800104 // The color transform matrix to apply
105 mat4 colorTransformMatrix;
Alec Mouric7e8ce82019-04-02 12:28:05 -0700106
Lloyd Pique32cbe282018-10-19 13:09:22 -0700107 // 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 Piquef5275482019-01-29 18:42:42 -0800113 // Current active dataspace
Lloyd Pique32cbe282018-10-19 13:09:22 -0700114 ui::Dataspace dataspace{ui::Dataspace::UNKNOWN};
115
Lloyd Piquef5275482019-01-29 18:42:42 -0800116 // Current target dataspace
117 ui::Dataspace targetDataspace{ui::Dataspace::UNKNOWN};
118
Lloyd Pique32cbe282018-10-19 13:09:22 -0700119 // Debugging
120 void dump(std::string& result) const;
121};
122
123} // namespace compositionengine::impl
124} // namespace android