1 /*
2  * Copyright 2022 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 <sstream>
20 
21 #include <gui/DisplayInfo.h>
22 #include <ui/DisplayMap.h>
23 #include <ui/LayerStack.h>
24 #include <ui/LogicalDisplayId.h>
25 #include <ui/Transform.h>
26 
27 namespace android::surfaceflinger::frontend {
28 
29 // Display information needed to populate input and calculate layer geometry.
30 struct DisplayInfo {
31     gui::DisplayInfo info;
32     ui::Transform transform;
33     bool receivesInput;
34     bool isSecure;
35     // TODO(b/259407931): can eliminate once SurfaceFlinger::sActiveDisplayRotationFlags is removed.
36     bool isPrimary;
37     bool isVirtual;
38     ui::Transform::RotationFlags rotationFlags;
39     ui::Transform::RotationFlags transformHint;
getDebugStringDisplayInfo40     std::string getDebugString() const {
41         std::stringstream debug;
42         debug << "DisplayInfo {displayId=" << info.displayId << " lw=" << info.logicalWidth
43               << " lh=" << info.logicalHeight << " transform={" << transform.dsdx() << " ,"
44               << transform.dsdy() << " ," << transform.dtdx() << " ," << transform.dtdy()
45               << "} isSecure=" << isSecure << " isPrimary=" << isPrimary
46               << " rotationFlags=" << rotationFlags << " transformHint=" << transformHint << "}";
47         return debug.str();
48     }
49 };
50 
51 using DisplayInfos = ui::DisplayMap<ui::LayerStack, DisplayInfo>;
52 
53 } // namespace android::surfaceflinger::frontend
54