• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2024 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 <ftl/enum.h>
20 #include <ui/LogicalDisplayId.h>
21 
22 #include <cinttypes>
23 #include <unordered_map>
24 #include <vector>
25 
26 namespace android {
27 
28 /**
29  * The edge of the current display, where adjacent display is attached to.
30  */
31 enum class DisplayTopologyPosition : int32_t {
32     LEFT = 0,
33     TOP = 1,
34     RIGHT = 2,
35     BOTTOM = 3,
36 
37     ftl_last = BOTTOM
38 };
39 
40 /**
41  * Directed edge in the graph of adjacent displays.
42  */
43 struct DisplayTopologyAdjacentDisplay {
44     ui::LogicalDisplayId displayId = ui::LogicalDisplayId::INVALID;
45     // Position of the adjacent display, relative to the source display.
46     DisplayTopologyPosition position;
47     // The offset in DP of the adjacent display, relative to the source display.
48     float offsetDp;
49 
50     std::string dump() const;
51 };
52 
53 /**
54  * Directed Graph representation of Display Topology.
55  */
56 struct DisplayTopologyGraph {
57     ui::LogicalDisplayId primaryDisplayId = ui::LogicalDisplayId::INVALID;
58     std::unordered_map<ui::LogicalDisplayId, std::vector<DisplayTopologyAdjacentDisplay>> graph;
59     std::unordered_map<ui::LogicalDisplayId, int> displaysDensity;
60 
61     bool isValid() const;
62     std::string dump() const;
63 };
64 
65 } // namespace android
66