Merge tag 'devicetree-fixes-for-5.11-1' of git://git.kernel.org/pub/scm/linux/kernel...
[linux-2.6-microblaze.git] / drivers / gpu / drm / amd / display / dc / inc / hw / hubp.h
1 /*
2  * Copyright 2012-15 Advanced Micro Devices, Inc.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20  * OTHER DEALINGS IN THE SOFTWARE.
21  *
22  * Authors: AMD
23  *
24  */
25
26 #ifndef __DAL_HUBP_H__
27 #define __DAL_HUBP_H__
28
29 #include "mem_input.h"
30
31 #define OPP_ID_INVALID 0xf
32
33
34 enum cursor_pitch {
35         CURSOR_PITCH_64_PIXELS = 0,
36         CURSOR_PITCH_128_PIXELS,
37         CURSOR_PITCH_256_PIXELS
38 };
39
40 enum cursor_lines_per_chunk {
41         CURSOR_LINE_PER_CHUNK_1 = 0, /* new for DCN2 */
42         CURSOR_LINE_PER_CHUNK_2 = 1,
43         CURSOR_LINE_PER_CHUNK_4,
44         CURSOR_LINE_PER_CHUNK_8,
45         CURSOR_LINE_PER_CHUNK_16
46 };
47
48 enum hubp_ind_block_size {
49         hubp_ind_block_unconstrained = 0,
50         hubp_ind_block_64b,
51         hubp_ind_block_128b,
52         hubp_ind_block_64b_no_128bcl,
53 };
54
55 struct hubp {
56         const struct hubp_funcs *funcs;
57         struct dc_context *ctx;
58         struct dc_plane_address request_address;
59         int inst;
60
61         /* run time states */
62         int opp_id;
63         int mpcc_id;
64         struct dc_cursor_attributes curs_attr;
65         bool power_gated;
66 };
67
68 struct surface_flip_registers {
69         uint32_t DCSURF_SURFACE_CONTROL;
70         uint32_t DCSURF_PRIMARY_META_SURFACE_ADDRESS_HIGH;
71         uint32_t DCSURF_PRIMARY_META_SURFACE_ADDRESS;
72         uint32_t DCSURF_PRIMARY_SURFACE_ADDRESS_HIGH;
73         uint32_t DCSURF_PRIMARY_SURFACE_ADDRESS;
74         uint32_t DCSURF_PRIMARY_META_SURFACE_ADDRESS_HIGH_C;
75         uint32_t DCSURF_PRIMARY_META_SURFACE_ADDRESS_C;
76         uint32_t DCSURF_PRIMARY_SURFACE_ADDRESS_HIGH_C;
77         uint32_t DCSURF_PRIMARY_SURFACE_ADDRESS_C;
78         uint32_t DCSURF_SECONDARY_META_SURFACE_ADDRESS_HIGH;
79         uint32_t DCSURF_SECONDARY_META_SURFACE_ADDRESS;
80         uint32_t DCSURF_SECONDARY_SURFACE_ADDRESS_HIGH;
81         uint32_t DCSURF_SECONDARY_SURFACE_ADDRESS;
82         bool tmz_surface;
83         bool immediate;
84         uint8_t vmid;
85         bool grph_stereo;
86 };
87
88 struct hubp_funcs {
89         void (*hubp_setup)(
90                         struct hubp *hubp,
91                         struct _vcs_dpi_display_dlg_regs_st *dlg_regs,
92                         struct _vcs_dpi_display_ttu_regs_st *ttu_regs,
93                         struct _vcs_dpi_display_rq_regs_st *rq_regs,
94                         struct _vcs_dpi_display_pipe_dest_params_st *pipe_dest);
95
96         void (*hubp_setup_interdependent)(
97                         struct hubp *hubp,
98                         struct _vcs_dpi_display_dlg_regs_st *dlg_regs,
99                         struct _vcs_dpi_display_ttu_regs_st *ttu_regs);
100
101         void (*dcc_control)(struct hubp *hubp, bool enable,
102                         enum hubp_ind_block_size blk_size);
103
104         void (*mem_program_viewport)(
105                         struct hubp *hubp,
106                         const struct rect *viewport,
107                         const struct rect *viewport_c);
108
109         bool (*hubp_program_surface_flip_and_addr)(
110                 struct hubp *hubp,
111                 const struct dc_plane_address *address,
112                 bool flip_immediate);
113
114         void (*hubp_program_pte_vm)(
115                 struct hubp *hubp,
116                 enum surface_pixel_format format,
117                 union dc_tiling_info *tiling_info,
118                 enum dc_rotation_angle rotation);
119
120         void (*hubp_set_vm_system_aperture_settings)(
121                         struct hubp *hubp,
122                         struct vm_system_aperture_param *apt);
123
124         void (*hubp_set_vm_context0_settings)(
125                         struct hubp *hubp,
126                         const struct vm_context0_param *vm0);
127
128         void (*hubp_program_surface_config)(
129                 struct hubp *hubp,
130                 enum surface_pixel_format format,
131                 union dc_tiling_info *tiling_info,
132                 struct plane_size *plane_size,
133                 enum dc_rotation_angle rotation,
134                 struct dc_plane_dcc_param *dcc,
135                 bool horizontal_mirror,
136                 unsigned int compa_level);
137
138         bool (*hubp_is_flip_pending)(struct hubp *hubp);
139
140         void (*set_blank)(struct hubp *hubp, bool blank);
141         void (*set_hubp_blank_en)(struct hubp *hubp, bool blank);
142
143         void (*set_cursor_attributes)(
144                         struct hubp *hubp,
145                         const struct dc_cursor_attributes *attr);
146
147         void (*set_cursor_position)(
148                         struct hubp *hubp,
149                         const struct dc_cursor_position *pos,
150                         const struct dc_cursor_mi_param *param);
151
152         void (*hubp_disconnect)(struct hubp *hubp);
153
154         void (*hubp_clk_cntl)(struct hubp *hubp, bool enable);
155         void (*hubp_vtg_sel)(struct hubp *hubp, uint32_t otg_inst);
156         void (*hubp_read_state)(struct hubp *hubp);
157         void (*hubp_clear_underflow)(struct hubp *hubp);
158         void (*hubp_disable_control)(struct hubp *hubp, bool disable_hubp);
159         unsigned int (*hubp_get_underflow_status)(struct hubp *hubp);
160         void (*hubp_init)(struct hubp *hubp);
161
162         void (*dmdata_set_attributes)(
163                         struct hubp *hubp,
164                         const struct dc_dmdata_attributes *attr);
165
166         void (*dmdata_load)(
167                         struct hubp *hubp,
168                         uint32_t dmdata_sw_size,
169                         const uint32_t *dmdata_sw_data);
170         bool (*dmdata_status_done)(struct hubp *hubp);
171         void (*hubp_enable_tripleBuffer)(
172                 struct hubp *hubp,
173                 bool enable);
174
175         bool (*hubp_is_triplebuffer_enabled)(
176                 struct hubp *hubp);
177
178         void (*hubp_set_flip_control_surface_gsl)(
179                 struct hubp *hubp,
180                 bool enable);
181
182         void (*validate_dml_output)(
183                         struct hubp *hubp,
184                         struct dc_context *ctx,
185                         struct _vcs_dpi_display_rq_regs_st *dml_rq_regs,
186                         struct _vcs_dpi_display_dlg_regs_st *dml_dlg_attr,
187                         struct _vcs_dpi_display_ttu_regs_st *dml_ttu_attr);
188         void (*set_unbounded_requesting)(
189                 struct hubp *hubp,
190                 bool enable);
191
192 };
193
194 #endif