xref: /dragonfly/sys/dev/drm/amd/display/dc/inc/hw/hubp.h (revision b843c749addef9340ee7d4e250b09fdd492602a1)
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 
32 enum cursor_pitch {
33           CURSOR_PITCH_64_PIXELS = 0,
34           CURSOR_PITCH_128_PIXELS,
35           CURSOR_PITCH_256_PIXELS
36 };
37 
38 enum cursor_lines_per_chunk {
39           CURSOR_LINE_PER_CHUNK_2 = 1,
40           CURSOR_LINE_PER_CHUNK_4,
41           CURSOR_LINE_PER_CHUNK_8,
42           CURSOR_LINE_PER_CHUNK_16
43 };
44 
45 struct hubp {
46           const struct hubp_funcs *funcs;
47           struct dc_context *ctx;
48           struct dc_plane_address request_address;
49           int inst;
50 
51           /* run time states */
52           int opp_id;
53           int mpcc_id;
54           struct dc_cursor_attributes curs_attr;
55           bool power_gated;
56 };
57 
58 struct hubp_funcs {
59           void (*hubp_setup)(
60                               struct hubp *hubp,
61                               struct _vcs_dpi_display_dlg_regs_st *dlg_regs,
62                               struct _vcs_dpi_display_ttu_regs_st *ttu_regs,
63                               struct _vcs_dpi_display_rq_regs_st *rq_regs,
64                               struct _vcs_dpi_display_pipe_dest_params_st *pipe_dest);
65 
66           void (*dcc_control)(struct hubp *hubp, bool enable,
67                               bool independent_64b_blks);
68           void (*mem_program_viewport)(
69                               struct hubp *hubp,
70                               const struct rect *viewport,
71                               const struct rect *viewport_c);
72 
73           bool (*hubp_program_surface_flip_and_addr)(
74                     struct hubp *hubp,
75                     const struct dc_plane_address *address,
76                     bool flip_immediate);
77 
78           void (*hubp_program_pte_vm)(
79                     struct hubp *hubp,
80                     enum surface_pixel_format format,
81                     union dc_tiling_info *tiling_info,
82                     enum dc_rotation_angle rotation);
83 
84           void (*hubp_set_vm_system_aperture_settings)(
85                               struct hubp *hubp,
86                               struct vm_system_aperture_param *apt);
87 
88           void (*hubp_set_vm_context0_settings)(
89                               struct hubp *hubp,
90                               const struct vm_context0_param *vm0);
91 
92           void (*hubp_program_surface_config)(
93                     struct hubp *hubp,
94                     enum surface_pixel_format format,
95                     union dc_tiling_info *tiling_info,
96                     union plane_size *plane_size,
97                     enum dc_rotation_angle rotation,
98                     struct dc_plane_dcc_param *dcc,
99                     bool horizontal_mirror);
100 
101           bool (*hubp_is_flip_pending)(struct hubp *hubp);
102 
103           void (*hubp_update_dchub)(struct hubp *hubp,
104                                         struct dchub_init_data *dh_data);
105 
106           void (*set_blank)(struct hubp *hubp, bool blank);
107           void (*set_hubp_blank_en)(struct hubp *hubp, bool blank);
108 
109           void (*set_cursor_attributes)(
110                               struct hubp *hubp,
111                               const struct dc_cursor_attributes *attr);
112 
113           void (*set_cursor_position)(
114                               struct hubp *hubp,
115                               const struct dc_cursor_position *pos,
116                               const struct dc_cursor_mi_param *param);
117 
118           void (*hubp_disconnect)(struct hubp *hubp);
119 
120           void (*hubp_clk_cntl)(struct hubp *hubp, bool enable);
121           void (*hubp_vtg_sel)(struct hubp *hubp, uint32_t otg_inst);
122           void (*hubp_read_state)(struct hubp *hubp);
123           void (*hubp_disable_control)(struct hubp *hubp, bool disable_hubp);
124           unsigned int (*hubp_get_underflow_status)(struct hubp *hubp);
125 
126 };
127 
128 #endif
129