1 /*
2  * Copyright 2018 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 <math/mat4.h>
20 #include <ui/GraphicTypes.h>
21 #include <ui/Rect.h>
22 #include <ui/Region.h>
23 #include <ui/Transform.h>
24 
25 namespace android {
26 namespace renderengine {
27 
28 // DisplaySettings contains the settings that are applicable when drawing all
29 // layers for a given display.
30 struct DisplaySettings {
31     // Rectangle describing the physical display. We will project from the
32     // logical clip onto this rectangle.
33     Rect physicalDisplay = Rect::INVALID_RECT;
34 
35     // Rectangle bounded by the x,y- clipping planes in the logical display, so
36     // that the orthographic projection matrix can be computed. When
37     // constructing this matrix, z-coordinate bound are assumed to be at z=0 and
38     // z=1.
39     Rect clip = Rect::INVALID_RECT;
40 
41     // Global transform to apply to all layers.
42     mat4 globalTransform = mat4();
43 
44     // Maximum luminance pulled from the display's HDR capabilities.
45     float maxLuminance = 1.0f;
46 
47     // Output dataspace that will be populated if wide color gamut is used, or
48     // DataSpace::UNKNOWN otherwise.
49     ui::Dataspace outputDataspace = ui::Dataspace::UNKNOWN;
50 
51     // Additional color transform to apply in linear space after transforming
52     // to the output dataspace.
53     mat4 colorTransform = mat4();
54 
55     // Region that will be cleared to (0, 0, 0, 1) prior to rendering.
56     // RenderEngine will transform the clearRegion passed in here, by
57     // globalTransform, so that it will be in the same coordinate space as the
58     // rendered layers.
59     Region clearRegion = Region::INVALID_REGION;
60 
61     // The orientation of the physical display.
62     uint32_t orientation = ui::Transform::ROT_0;
63 };
64 
65 } // namespace renderengine
66 } // namespace android
67