• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 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 #ifndef ANDROID_EXYNOS_HWC_MODULE_H_
18 #define ANDROID_EXYNOS_HWC_MODULE_H_
19 
20 #include <array>
21 
22 #include "ExynosHWC.h"
23 #include "DeconHeader.h"
24 
25 #define G2D_MAX_SRC_NUM 3
26 
27 #define VSYNC_DEV_PREFIX "/sys/devices/platform/"
28 #define PSR_DEV_NAME  "1c300000.decon_f/psr_info"
29 #define VSYNC_DEV_NAME_EXT  "19050000.decon_t/vsync"
30 #define DP_LINK_NAME	"130b0000.displayport"
31 #define DP_UEVENT_NAME	"change@/devices/platform/%s/extcon/extcon0"
32 #define DP_CABLE_STATE_NAME "/sys/devices/platform/%s/extcon/extcon0/cable.0/state"
33 #define BRIGHTNESS_SYSFS_NODE "/sys/class/backlight/panel%d-backlight/brightness"
34 #define MAX_BRIGHTNESS_SYSFS_NODE "/sys/class/backlight/panel%d-backlight/max_brightness"
35 
36 #define EARLY_WAKUP_NODE_0_BASE "/sys/devices/platform/1c300000.drmdecon/early_wakeup"
37 
38 #define IDMA(x) static_cast<decon_idma_type>(x)
39 
40 #define MPP_G2D_CAPACITY    3.5
41 
42 enum {
43     HWC_DISPLAY_NONE_BIT = 0
44 };
45 
46 /*
47  * pre_assign_info: all display_descriptors that want to reserve
48  */
49 struct exynos_mpp_t {
50     int physicalType;
51     int logicalType;
52     char name[16];
53     uint32_t physical_index;
54     uint32_t logical_index;
55     uint32_t pre_assign_info;
56 };
57 
58 const dpp_channel_map_t IDMA_CHANNEL_MAP[] = {
59     /* GF physical index is switched to change assign order */
60     /* DECON_IDMA is not used */
61     {MPP_DPP_GF,     0, IDMA(0),   IDMA(0)},
62     {MPP_DPP_VGRFS,  0, IDMA(1),   IDMA(1)},
63     {MPP_DPP_GF,     1, IDMA(2),   IDMA(2)},
64     {MPP_DPP_VGRFS,  1, IDMA(3),   IDMA(3)},
65     {MPP_DPP_GF,     2, IDMA(4),   IDMA(4)},
66     {MPP_DPP_VGRFS,  2, IDMA(5),   IDMA(5)},
67     {MPP_P_TYPE_MAX, 0, IDMA(6),   IDMA(6)}, // not idma but..
68     {static_cast<mpp_phycal_type_t>(MAX_DECON_DMA_TYPE), 0, MAX_DECON_DMA_TYPE, IDMA(7)}
69 };
70 
71 #define MAX_NAME_SIZE   32
72 struct exynos_display_t {
73     uint32_t type;
74     uint32_t index;
75     std::string display_name;
76     std::string decon_node_name;
77     std::string vsync_node_name;
78 };
79 
80 #define PRIMARY_MAIN_BASE_WIN   2
81 #define EXTERNAL_MAIN_BASE_WIN  4
82 
83 /******** Description about display bit ********/
84 /*   DISPLAY BIT = 1 << (DISPLAY_MODE_MASK_LEN * display mode
85  *                       + SECOND_DISPLAY_START_BIT * display index
86  *                       + display type);
87  *   ex) HWC_DISPLAY_EXTERNAL2_BIT = 1 << (DISPLAY_MODE_MASK_LEN * display mode(0)
88  *                                         + SECOND_DISPLAY_START_BIT * display index(1)
89  *                                         + displayy type(1))
90  *                                 = 1 << 5
91  *   PRIMARY MAIN MODE :
92  *      0 bit : HWC_DISPLAY_PRIMARY_BIT,
93  *      1 bit : HWC_DISPLAY_EXTERNAL_BIT,
94  *      2 bit : HWC_DISPLAY_VIRTUAL_BIT,
95  *      5 bit : HWC_DISPLAY_EXTERNAL2_BIT,
96  *   EXTERNAL MAIN MODE :
97  *      8 bit : EXTERNAL_MAIN_DISPLAY_PRIMARY_BIT,
98  *      9 bit : EXTERNAL_MAIN_DISPLAY_EXTERNAL_BIT,
99  *      10 bit : EXTERNAL_MAIN_DISPLAY_VIRTUAL_BIT,
100  ***************************************************/
101 
102 #define DISPLAY_MODE_MASK_LEN    8
103 #define DISPLAY_MODE_MASK_BIT    0xff
104 #define SECOND_DISPLAY_START_BIT   4
105 
106 enum {
107     DISPLAY_MODE_PRIMARY_MAIN = 0,  /* This is default mode */
108     DISPLAY_MODE_EXTERNAL_MAIN,
109     DISPLAY_MODE_NUM
110 };
111 
112 /*
113  * This is base window index of primary display for each display mode.
114  * External display base window is always 0
115  */
116 const uint32_t PRIMARY_DISP_BASE_WIN[] = {PRIMARY_MAIN_BASE_WIN, EXTERNAL_MAIN_BASE_WIN};
117 
118 #define EXTERNAL_MAIN_DISPLAY_START_BIT (DISPLAY_MODE_MASK_LEN * DISPLAY_MODE_EXTERNAL_MAIN)
119 enum {
120     EXTERNAL_MAIN_DISPLAY_PRIMARY_BIT = 1 << (EXTERNAL_MAIN_DISPLAY_START_BIT + HWC_DISPLAY_PRIMARY),
121     EXTERNAL_MAIN_DISPLAY_EXTERNAL_BIT = 1 << (EXTERNAL_MAIN_DISPLAY_START_BIT + HWC_DISPLAY_EXTERNAL),
122     EXTERNAL_MAIN_DISPLAY_VIRTUAL_BIT = 1 << (EXTERNAL_MAIN_DISPLAY_START_BIT + HWC_DISPLAY_VIRTUAL),
123 };
124 
125 enum {
126     HWC_DISPLAY_SECONDARY_BIT = 1 << (SECOND_DISPLAY_START_BIT + HWC_DISPLAY_PRIMARY),
127 };
128 
129 const exynos_mpp_t AVAILABLE_OTF_MPP_UNITS[] = {
130     {MPP_DPP_GF, MPP_LOGICAL_DPP_GF, "DPP_GF0", 0, 0, HWC_DISPLAY_PRIMARY_BIT},
131     {MPP_DPP_GF, MPP_LOGICAL_DPP_GF, "DPP_GF1", 1, 0, HWC_DISPLAY_PRIMARY_BIT},
132     {MPP_DPP_GF, MPP_LOGICAL_DPP_GF, "DPP_GF2", 2, 0, HWC_DISPLAY_SECONDARY_BIT},
133     {MPP_DPP_VGRFS, MPP_LOGICAL_DPP_VGRFS, "DPP_VGRFS0", 0, 0, HWC_DISPLAY_PRIMARY_BIT},
134     {MPP_DPP_VGRFS, MPP_LOGICAL_DPP_VGRFS, "DPP_VGRFS1", 1, 0, HWC_DISPLAY_PRIMARY_BIT},
135     {MPP_DPP_VGRFS, MPP_LOGICAL_DPP_VGRFS, "DPP_VGRFS2", 2, 0, HWC_DISPLAY_PRIMARY_BIT}
136 };
137 
138 const exynos_mpp_t AVAILABLE_M2M_MPP_UNITS[] = {
139 #ifndef DISABLE_M2M_MPPS
140     {MPP_G2D, MPP_LOGICAL_G2D_YUV, "G2D0-YUV_PRI", 0, 0, HWC_DISPLAY_PRIMARY_BIT},
141     {MPP_G2D, MPP_LOGICAL_G2D_YUV, "G2D0-YUV_PRI", 0, 1, HWC_DISPLAY_PRIMARY_BIT},
142     {MPP_G2D, MPP_LOGICAL_G2D_YUV, "G2D0-YUV_EXT", 0, 2, HWC_DISPLAY_EXTERNAL_BIT},
143     {MPP_G2D, MPP_LOGICAL_G2D_RGB, "G2D0-RGB_PRI", 0, 3, HWC_DISPLAY_PRIMARY_BIT},
144     {MPP_G2D, MPP_LOGICAL_G2D_RGB, "G2D0-RGB_EXT", 0, 4, HWC_DISPLAY_EXTERNAL_BIT},
145     {MPP_G2D, MPP_LOGICAL_G2D_COMBO, "G2D0-COMBO_VIR", 0, 5, HWC_DISPLAY_VIRTUAL_BIT}
146 #endif
147 };
148 
149 const std::array<exynos_display_t, 2> AVAILABLE_DISPLAY_UNITS = {{
150     {HWC_DISPLAY_PRIMARY, 0, "PrimaryDisplay", "/dev/dri/card0", ""},
151     {HWC_DISPLAY_PRIMARY, 1, "SecondaryDisplay", "/dev/dri/card0", ""}
152 }};
153 
154 #endif
155