xref: /aosp_15_r20/frameworks/native/include/input/DisplayTopologyGraph.h (revision 38e8c45f13ce32b0dcecb25141ffecaf386fa17f)
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     DisplayTopologyPosition position;
46     float offsetPx;
47 };
48 
49 /**
50  * Directed Graph representation of Display Topology.
51  */
52 struct DisplayTopologyGraph {
53     ui::LogicalDisplayId primaryDisplayId = ui::LogicalDisplayId::INVALID;
54     std::unordered_map<ui::LogicalDisplayId, std::vector<DisplayTopologyAdjacentDisplay>> graph;
55 };
56 
57 } // namespace android
58