1bbeb64d0SHarry Wentland /*
219cc1f38SRobin Singh * Copyright 2012-2021 Advanced Micro Devices, Inc.
3bbeb64d0SHarry Wentland *
4bbeb64d0SHarry Wentland * Permission is hereby granted, free of charge, to any person obtaining a
5bbeb64d0SHarry Wentland * copy of this software and associated documentation files (the "Software"),
6bbeb64d0SHarry Wentland * to deal in the Software without restriction, including without limitation
7bbeb64d0SHarry Wentland * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8bbeb64d0SHarry Wentland * and/or sell copies of the Software, and to permit persons to whom the
9bbeb64d0SHarry Wentland * Software is furnished to do so, subject to the following conditions:
10bbeb64d0SHarry Wentland *
11bbeb64d0SHarry Wentland * The above copyright notice and this permission notice shall be included in
12bbeb64d0SHarry Wentland * all copies or substantial portions of the Software.
13bbeb64d0SHarry Wentland *
14bbeb64d0SHarry Wentland * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15bbeb64d0SHarry Wentland * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16bbeb64d0SHarry Wentland * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17bbeb64d0SHarry Wentland * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18bbeb64d0SHarry Wentland * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19bbeb64d0SHarry Wentland * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20bbeb64d0SHarry Wentland * OTHER DEALINGS IN THE SOFTWARE.
21bbeb64d0SHarry Wentland *
22bbeb64d0SHarry Wentland * Authors: AMD
23bbeb64d0SHarry Wentland *
24bbeb64d0SHarry Wentland */
25bbeb64d0SHarry Wentland
26bbeb64d0SHarry Wentland #include "dcn20_hubp.h"
27bbeb64d0SHarry Wentland
28bbeb64d0SHarry Wentland #include "dm_services.h"
29bbeb64d0SHarry Wentland #include "dce_calcs.h"
30bbeb64d0SHarry Wentland #include "reg_helper.h"
31bbeb64d0SHarry Wentland #include "basics/conversion.h"
32bbeb64d0SHarry Wentland
335d72e247SHamza Mahfooz #define DC_LOGGER \
345d72e247SHamza Mahfooz ctx->logger
35b9fe5151SJaehyun Chung #define DC_LOGGER_INIT(logger)
36b9fe5151SJaehyun Chung
37bbeb64d0SHarry Wentland #define REG(reg)\
38bbeb64d0SHarry Wentland hubp2->hubp_regs->reg
39bbeb64d0SHarry Wentland
40bbeb64d0SHarry Wentland #define CTX \
41bbeb64d0SHarry Wentland hubp2->base.ctx
42bbeb64d0SHarry Wentland
43bbeb64d0SHarry Wentland #undef FN
44bbeb64d0SHarry Wentland #define FN(reg_name, field_name) \
45bbeb64d0SHarry Wentland hubp2->hubp_shift->field_name, hubp2->hubp_mask->field_name
46bbeb64d0SHarry Wentland
hubp2_set_vm_system_aperture_settings(struct hubp * hubp,struct vm_system_aperture_param * apt)47bbeb64d0SHarry Wentland void hubp2_set_vm_system_aperture_settings(struct hubp *hubp,
48bbeb64d0SHarry Wentland struct vm_system_aperture_param *apt)
49bbeb64d0SHarry Wentland {
50bbeb64d0SHarry Wentland struct dcn20_hubp *hubp2 = TO_DCN20_HUBP(hubp);
51bbeb64d0SHarry Wentland
52bbeb64d0SHarry Wentland PHYSICAL_ADDRESS_LOC mc_vm_apt_default;
53bbeb64d0SHarry Wentland PHYSICAL_ADDRESS_LOC mc_vm_apt_low;
54bbeb64d0SHarry Wentland PHYSICAL_ADDRESS_LOC mc_vm_apt_high;
55bbeb64d0SHarry Wentland
56bbeb64d0SHarry Wentland // The format of default addr is 48:12 of the 48 bit addr
57bbeb64d0SHarry Wentland mc_vm_apt_default.quad_part = apt->sys_default.quad_part >> 12;
58bbeb64d0SHarry Wentland
59bbeb64d0SHarry Wentland // The format of high/low are 48:18 of the 48 bit addr
60bbeb64d0SHarry Wentland mc_vm_apt_low.quad_part = apt->sys_low.quad_part >> 18;
61bbeb64d0SHarry Wentland mc_vm_apt_high.quad_part = apt->sys_high.quad_part >> 18;
62bbeb64d0SHarry Wentland
63bbeb64d0SHarry Wentland REG_UPDATE_2(DCN_VM_SYSTEM_APERTURE_DEFAULT_ADDR_MSB,
64bbeb64d0SHarry Wentland DCN_VM_SYSTEM_APERTURE_DEFAULT_SYSTEM, 1, /* 1 = system physical memory */
65bbeb64d0SHarry Wentland DCN_VM_SYSTEM_APERTURE_DEFAULT_ADDR_MSB, mc_vm_apt_default.high_part);
66bbeb64d0SHarry Wentland
67bbeb64d0SHarry Wentland REG_SET(DCN_VM_SYSTEM_APERTURE_DEFAULT_ADDR_LSB, 0,
68bbeb64d0SHarry Wentland DCN_VM_SYSTEM_APERTURE_DEFAULT_ADDR_LSB, mc_vm_apt_default.low_part);
69bbeb64d0SHarry Wentland
70bbeb64d0SHarry Wentland REG_SET(DCN_VM_SYSTEM_APERTURE_LOW_ADDR, 0,
71bbeb64d0SHarry Wentland MC_VM_SYSTEM_APERTURE_LOW_ADDR, mc_vm_apt_low.quad_part);
72bbeb64d0SHarry Wentland
73bbeb64d0SHarry Wentland REG_SET(DCN_VM_SYSTEM_APERTURE_HIGH_ADDR, 0,
74bbeb64d0SHarry Wentland MC_VM_SYSTEM_APERTURE_HIGH_ADDR, mc_vm_apt_high.quad_part);
75bbeb64d0SHarry Wentland
76bbeb64d0SHarry Wentland REG_SET_2(DCN_VM_MX_L1_TLB_CNTL, 0,
77bbeb64d0SHarry Wentland ENABLE_L1_TLB, 1,
78bbeb64d0SHarry Wentland SYSTEM_ACCESS_MODE, 0x3);
79bbeb64d0SHarry Wentland }
80bbeb64d0SHarry Wentland
hubp2_program_deadline(struct hubp * hubp,struct _vcs_dpi_display_dlg_regs_st * dlg_attr,struct _vcs_dpi_display_ttu_regs_st * ttu_attr)810213541dSYongqiang Sun void hubp2_program_deadline(
82bbeb64d0SHarry Wentland struct hubp *hubp,
83bbeb64d0SHarry Wentland struct _vcs_dpi_display_dlg_regs_st *dlg_attr,
84bbeb64d0SHarry Wentland struct _vcs_dpi_display_ttu_regs_st *ttu_attr)
85bbeb64d0SHarry Wentland {
86bbeb64d0SHarry Wentland struct dcn20_hubp *hubp2 = TO_DCN20_HUBP(hubp);
87bbeb64d0SHarry Wentland
88eced4bceSIlya Bakoulin /* DLG - Per hubp */
89eced4bceSIlya Bakoulin REG_SET_2(BLANK_OFFSET_0, 0,
90eced4bceSIlya Bakoulin REFCYC_H_BLANK_END, dlg_attr->refcyc_h_blank_end,
91eced4bceSIlya Bakoulin DLG_V_BLANK_END, dlg_attr->dlg_vblank_end);
92eced4bceSIlya Bakoulin
93eced4bceSIlya Bakoulin REG_SET(BLANK_OFFSET_1, 0,
94eced4bceSIlya Bakoulin MIN_DST_Y_NEXT_START, dlg_attr->min_dst_y_next_start);
95eced4bceSIlya Bakoulin
96eced4bceSIlya Bakoulin REG_SET(DST_DIMENSIONS, 0,
97eced4bceSIlya Bakoulin REFCYC_PER_HTOTAL, dlg_attr->refcyc_per_htotal);
98eced4bceSIlya Bakoulin
99eced4bceSIlya Bakoulin REG_SET_2(DST_AFTER_SCALER, 0,
100eced4bceSIlya Bakoulin REFCYC_X_AFTER_SCALER, dlg_attr->refcyc_x_after_scaler,
101eced4bceSIlya Bakoulin DST_Y_AFTER_SCALER, dlg_attr->dst_y_after_scaler);
102eced4bceSIlya Bakoulin
103eced4bceSIlya Bakoulin REG_SET(REF_FREQ_TO_PIX_FREQ, 0,
104eced4bceSIlya Bakoulin REF_FREQ_TO_PIX_FREQ, dlg_attr->ref_freq_to_pix_freq);
105eced4bceSIlya Bakoulin
106eced4bceSIlya Bakoulin /* DLG - Per luma/chroma */
107eced4bceSIlya Bakoulin REG_SET(VBLANK_PARAMETERS_1, 0,
108eced4bceSIlya Bakoulin REFCYC_PER_PTE_GROUP_VBLANK_L, dlg_attr->refcyc_per_pte_group_vblank_l);
109eced4bceSIlya Bakoulin
110eced4bceSIlya Bakoulin if (REG(NOM_PARAMETERS_0))
111eced4bceSIlya Bakoulin REG_SET(NOM_PARAMETERS_0, 0,
112eced4bceSIlya Bakoulin DST_Y_PER_PTE_ROW_NOM_L, dlg_attr->dst_y_per_pte_row_nom_l);
113eced4bceSIlya Bakoulin
114eced4bceSIlya Bakoulin if (REG(NOM_PARAMETERS_1))
115eced4bceSIlya Bakoulin REG_SET(NOM_PARAMETERS_1, 0,
116eced4bceSIlya Bakoulin REFCYC_PER_PTE_GROUP_NOM_L, dlg_attr->refcyc_per_pte_group_nom_l);
117eced4bceSIlya Bakoulin
118eced4bceSIlya Bakoulin REG_SET(NOM_PARAMETERS_4, 0,
119eced4bceSIlya Bakoulin DST_Y_PER_META_ROW_NOM_L, dlg_attr->dst_y_per_meta_row_nom_l);
120eced4bceSIlya Bakoulin
121eced4bceSIlya Bakoulin REG_SET(NOM_PARAMETERS_5, 0,
122eced4bceSIlya Bakoulin REFCYC_PER_META_CHUNK_NOM_L, dlg_attr->refcyc_per_meta_chunk_nom_l);
123eced4bceSIlya Bakoulin
124eced4bceSIlya Bakoulin REG_SET_2(PER_LINE_DELIVERY, 0,
125eced4bceSIlya Bakoulin REFCYC_PER_LINE_DELIVERY_L, dlg_attr->refcyc_per_line_delivery_l,
126eced4bceSIlya Bakoulin REFCYC_PER_LINE_DELIVERY_C, dlg_attr->refcyc_per_line_delivery_c);
127eced4bceSIlya Bakoulin
128eced4bceSIlya Bakoulin REG_SET(VBLANK_PARAMETERS_2, 0,
129eced4bceSIlya Bakoulin REFCYC_PER_PTE_GROUP_VBLANK_C, dlg_attr->refcyc_per_pte_group_vblank_c);
130eced4bceSIlya Bakoulin
131eced4bceSIlya Bakoulin if (REG(NOM_PARAMETERS_2))
132eced4bceSIlya Bakoulin REG_SET(NOM_PARAMETERS_2, 0,
133eced4bceSIlya Bakoulin DST_Y_PER_PTE_ROW_NOM_C, dlg_attr->dst_y_per_pte_row_nom_c);
134eced4bceSIlya Bakoulin
135eced4bceSIlya Bakoulin if (REG(NOM_PARAMETERS_3))
136eced4bceSIlya Bakoulin REG_SET(NOM_PARAMETERS_3, 0,
137eced4bceSIlya Bakoulin REFCYC_PER_PTE_GROUP_NOM_C, dlg_attr->refcyc_per_pte_group_nom_c);
138eced4bceSIlya Bakoulin
139eced4bceSIlya Bakoulin REG_SET(NOM_PARAMETERS_6, 0,
140eced4bceSIlya Bakoulin DST_Y_PER_META_ROW_NOM_C, dlg_attr->dst_y_per_meta_row_nom_c);
141eced4bceSIlya Bakoulin
142eced4bceSIlya Bakoulin REG_SET(NOM_PARAMETERS_7, 0,
143eced4bceSIlya Bakoulin REFCYC_PER_META_CHUNK_NOM_C, dlg_attr->refcyc_per_meta_chunk_nom_c);
144eced4bceSIlya Bakoulin
145eced4bceSIlya Bakoulin /* TTU - per hubp */
146eced4bceSIlya Bakoulin REG_SET_2(DCN_TTU_QOS_WM, 0,
147eced4bceSIlya Bakoulin QoS_LEVEL_LOW_WM, ttu_attr->qos_level_low_wm,
148eced4bceSIlya Bakoulin QoS_LEVEL_HIGH_WM, ttu_attr->qos_level_high_wm);
149eced4bceSIlya Bakoulin
150eced4bceSIlya Bakoulin /* TTU - per luma/chroma */
151eced4bceSIlya Bakoulin /* Assumed surf0 is luma and 1 is chroma */
152eced4bceSIlya Bakoulin
153eced4bceSIlya Bakoulin REG_SET_3(DCN_SURF0_TTU_CNTL0, 0,
154eced4bceSIlya Bakoulin REFCYC_PER_REQ_DELIVERY, ttu_attr->refcyc_per_req_delivery_l,
155eced4bceSIlya Bakoulin QoS_LEVEL_FIXED, ttu_attr->qos_level_fixed_l,
156eced4bceSIlya Bakoulin QoS_RAMP_DISABLE, ttu_attr->qos_ramp_disable_l);
157eced4bceSIlya Bakoulin
158eced4bceSIlya Bakoulin REG_SET_3(DCN_SURF1_TTU_CNTL0, 0,
159eced4bceSIlya Bakoulin REFCYC_PER_REQ_DELIVERY, ttu_attr->refcyc_per_req_delivery_c,
160eced4bceSIlya Bakoulin QoS_LEVEL_FIXED, ttu_attr->qos_level_fixed_c,
161eced4bceSIlya Bakoulin QoS_RAMP_DISABLE, ttu_attr->qos_ramp_disable_c);
162eced4bceSIlya Bakoulin
163eced4bceSIlya Bakoulin REG_SET_3(DCN_CUR0_TTU_CNTL0, 0,
164eced4bceSIlya Bakoulin REFCYC_PER_REQ_DELIVERY, ttu_attr->refcyc_per_req_delivery_cur0,
165eced4bceSIlya Bakoulin QoS_LEVEL_FIXED, ttu_attr->qos_level_fixed_cur0,
166eced4bceSIlya Bakoulin QoS_RAMP_DISABLE, ttu_attr->qos_ramp_disable_cur0);
167bbeb64d0SHarry Wentland
168bbeb64d0SHarry Wentland REG_SET(FLIP_PARAMETERS_1, 0,
169bbeb64d0SHarry Wentland REFCYC_PER_PTE_GROUP_FLIP_L, dlg_attr->refcyc_per_pte_group_flip_l);
170bbeb64d0SHarry Wentland }
171bbeb64d0SHarry Wentland
hubp2_vready_at_or_After_vsync(struct hubp * hubp,struct _vcs_dpi_display_pipe_dest_params_st * pipe_dest)172bbeb64d0SHarry Wentland void hubp2_vready_at_or_After_vsync(struct hubp *hubp,
173bbeb64d0SHarry Wentland struct _vcs_dpi_display_pipe_dest_params_st *pipe_dest)
174bbeb64d0SHarry Wentland {
175bbeb64d0SHarry Wentland uint32_t value = 0;
176bbeb64d0SHarry Wentland struct dcn20_hubp *hubp2 = TO_DCN20_HUBP(hubp);
177bbeb64d0SHarry Wentland /* disable_dlg_test_mode Set 9th bit to 1 to disable "dv" mode */
178bbeb64d0SHarry Wentland REG_WRITE(HUBPREQ_DEBUG_DB, 1 << 8);
179bbeb64d0SHarry Wentland /*
180bbeb64d0SHarry Wentland if (VSTARTUP_START - (VREADY_OFFSET+VUPDATE_WIDTH+VUPDATE_OFFSET)/htotal)
181bbeb64d0SHarry Wentland <= OTG_V_BLANK_END
182bbeb64d0SHarry Wentland Set HUBP_VREADY_AT_OR_AFTER_VSYNC = 1
183bbeb64d0SHarry Wentland else
184bbeb64d0SHarry Wentland Set HUBP_VREADY_AT_OR_AFTER_VSYNC = 0
185bbeb64d0SHarry Wentland */
18619cc1f38SRobin Singh if (pipe_dest->htotal != 0) {
187bbeb64d0SHarry Wentland if ((pipe_dest->vstartup_start - (pipe_dest->vready_offset+pipe_dest->vupdate_width
188bbeb64d0SHarry Wentland + pipe_dest->vupdate_offset) / pipe_dest->htotal) <= pipe_dest->vblank_end) {
189bbeb64d0SHarry Wentland value = 1;
190bbeb64d0SHarry Wentland } else
191bbeb64d0SHarry Wentland value = 0;
19219cc1f38SRobin Singh }
19319cc1f38SRobin Singh
194bbeb64d0SHarry Wentland REG_UPDATE(DCHUBP_CNTL, HUBP_VREADY_AT_OR_AFTER_VSYNC, value);
195bbeb64d0SHarry Wentland }
196bbeb64d0SHarry Wentland
hubp2_program_requestor(struct hubp * hubp,struct _vcs_dpi_display_rq_regs_st * rq_regs)197240e6d25SIsabella Basso static void hubp2_program_requestor(struct hubp *hubp,
198eced4bceSIlya Bakoulin struct _vcs_dpi_display_rq_regs_st *rq_regs)
199eced4bceSIlya Bakoulin {
200eced4bceSIlya Bakoulin struct dcn20_hubp *hubp2 = TO_DCN20_HUBP(hubp);
201eced4bceSIlya Bakoulin
202eced4bceSIlya Bakoulin REG_UPDATE(HUBPRET_CONTROL,
203eced4bceSIlya Bakoulin DET_BUF_PLANE1_BASE_ADDRESS, rq_regs->plane1_base_address);
204eced4bceSIlya Bakoulin REG_SET_4(DCN_EXPANSION_MODE, 0,
205eced4bceSIlya Bakoulin DRQ_EXPANSION_MODE, rq_regs->drq_expansion_mode,
206eced4bceSIlya Bakoulin PRQ_EXPANSION_MODE, rq_regs->prq_expansion_mode,
207eced4bceSIlya Bakoulin MRQ_EXPANSION_MODE, rq_regs->mrq_expansion_mode,
208eced4bceSIlya Bakoulin CRQ_EXPANSION_MODE, rq_regs->crq_expansion_mode);
209eced4bceSIlya Bakoulin REG_SET_8(DCHUBP_REQ_SIZE_CONFIG, 0,
210eced4bceSIlya Bakoulin CHUNK_SIZE, rq_regs->rq_regs_l.chunk_size,
211eced4bceSIlya Bakoulin MIN_CHUNK_SIZE, rq_regs->rq_regs_l.min_chunk_size,
212eced4bceSIlya Bakoulin META_CHUNK_SIZE, rq_regs->rq_regs_l.meta_chunk_size,
213eced4bceSIlya Bakoulin MIN_META_CHUNK_SIZE, rq_regs->rq_regs_l.min_meta_chunk_size,
214eced4bceSIlya Bakoulin DPTE_GROUP_SIZE, rq_regs->rq_regs_l.dpte_group_size,
215eced4bceSIlya Bakoulin MPTE_GROUP_SIZE, rq_regs->rq_regs_l.mpte_group_size,
216eced4bceSIlya Bakoulin SWATH_HEIGHT, rq_regs->rq_regs_l.swath_height,
217eced4bceSIlya Bakoulin PTE_ROW_HEIGHT_LINEAR, rq_regs->rq_regs_l.pte_row_height_linear);
218eced4bceSIlya Bakoulin REG_SET_8(DCHUBP_REQ_SIZE_CONFIG_C, 0,
219eced4bceSIlya Bakoulin CHUNK_SIZE_C, rq_regs->rq_regs_c.chunk_size,
220eced4bceSIlya Bakoulin MIN_CHUNK_SIZE_C, rq_regs->rq_regs_c.min_chunk_size,
221eced4bceSIlya Bakoulin META_CHUNK_SIZE_C, rq_regs->rq_regs_c.meta_chunk_size,
222eced4bceSIlya Bakoulin MIN_META_CHUNK_SIZE_C, rq_regs->rq_regs_c.min_meta_chunk_size,
223eced4bceSIlya Bakoulin DPTE_GROUP_SIZE_C, rq_regs->rq_regs_c.dpte_group_size,
224eced4bceSIlya Bakoulin MPTE_GROUP_SIZE_C, rq_regs->rq_regs_c.mpte_group_size,
225eced4bceSIlya Bakoulin SWATH_HEIGHT_C, rq_regs->rq_regs_c.swath_height,
226eced4bceSIlya Bakoulin PTE_ROW_HEIGHT_LINEAR_C, rq_regs->rq_regs_c.pte_row_height_linear);
227eced4bceSIlya Bakoulin }
228eced4bceSIlya Bakoulin
hubp2_setup(struct hubp * hubp,struct _vcs_dpi_display_dlg_regs_st * dlg_attr,struct _vcs_dpi_display_ttu_regs_st * ttu_attr,struct _vcs_dpi_display_rq_regs_st * rq_regs,struct _vcs_dpi_display_pipe_dest_params_st * pipe_dest)229bbeb64d0SHarry Wentland static void hubp2_setup(
230bbeb64d0SHarry Wentland struct hubp *hubp,
231bbeb64d0SHarry Wentland struct _vcs_dpi_display_dlg_regs_st *dlg_attr,
232bbeb64d0SHarry Wentland struct _vcs_dpi_display_ttu_regs_st *ttu_attr,
233bbeb64d0SHarry Wentland struct _vcs_dpi_display_rq_regs_st *rq_regs,
234bbeb64d0SHarry Wentland struct _vcs_dpi_display_pipe_dest_params_st *pipe_dest)
235bbeb64d0SHarry Wentland {
236bbeb64d0SHarry Wentland /* otg is locked when this func is called. Register are double buffered.
237bbeb64d0SHarry Wentland * disable the requestors is not needed
238bbeb64d0SHarry Wentland */
239bbeb64d0SHarry Wentland
240bbeb64d0SHarry Wentland hubp2_vready_at_or_After_vsync(hubp, pipe_dest);
241eced4bceSIlya Bakoulin hubp2_program_requestor(hubp, rq_regs);
242bbeb64d0SHarry Wentland hubp2_program_deadline(hubp, dlg_attr, ttu_attr);
243bbeb64d0SHarry Wentland
244bbeb64d0SHarry Wentland }
245bbeb64d0SHarry Wentland
hubp2_setup_interdependent(struct hubp * hubp,struct _vcs_dpi_display_dlg_regs_st * dlg_attr,struct _vcs_dpi_display_ttu_regs_st * ttu_attr)246bbeb64d0SHarry Wentland void hubp2_setup_interdependent(
247bbeb64d0SHarry Wentland struct hubp *hubp,
248bbeb64d0SHarry Wentland struct _vcs_dpi_display_dlg_regs_st *dlg_attr,
249bbeb64d0SHarry Wentland struct _vcs_dpi_display_ttu_regs_st *ttu_attr)
250bbeb64d0SHarry Wentland {
251bbeb64d0SHarry Wentland struct dcn20_hubp *hubp2 = TO_DCN20_HUBP(hubp);
252bbeb64d0SHarry Wentland
253bbeb64d0SHarry Wentland REG_SET_2(PREFETCH_SETTINGS, 0,
254bbeb64d0SHarry Wentland DST_Y_PREFETCH, dlg_attr->dst_y_prefetch,
255bbeb64d0SHarry Wentland VRATIO_PREFETCH, dlg_attr->vratio_prefetch);
256bbeb64d0SHarry Wentland
257bbeb64d0SHarry Wentland REG_SET(PREFETCH_SETTINGS_C, 0,
258bbeb64d0SHarry Wentland VRATIO_PREFETCH_C, dlg_attr->vratio_prefetch_c);
259bbeb64d0SHarry Wentland
260bbeb64d0SHarry Wentland REG_SET_2(VBLANK_PARAMETERS_0, 0,
261bbeb64d0SHarry Wentland DST_Y_PER_VM_VBLANK, dlg_attr->dst_y_per_vm_vblank,
262bbeb64d0SHarry Wentland DST_Y_PER_ROW_VBLANK, dlg_attr->dst_y_per_row_vblank);
263bbeb64d0SHarry Wentland
264bbeb64d0SHarry Wentland REG_SET_2(FLIP_PARAMETERS_0, 0,
265bbeb64d0SHarry Wentland DST_Y_PER_VM_FLIP, dlg_attr->dst_y_per_vm_flip,
266bbeb64d0SHarry Wentland DST_Y_PER_ROW_FLIP, dlg_attr->dst_y_per_row_flip);
267bbeb64d0SHarry Wentland
268bbeb64d0SHarry Wentland REG_SET(VBLANK_PARAMETERS_3, 0,
269bbeb64d0SHarry Wentland REFCYC_PER_META_CHUNK_VBLANK_L, dlg_attr->refcyc_per_meta_chunk_vblank_l);
270bbeb64d0SHarry Wentland
271bbeb64d0SHarry Wentland REG_SET(VBLANK_PARAMETERS_4, 0,
272bbeb64d0SHarry Wentland REFCYC_PER_META_CHUNK_VBLANK_C, dlg_attr->refcyc_per_meta_chunk_vblank_c);
273bbeb64d0SHarry Wentland
274bbeb64d0SHarry Wentland REG_SET(FLIP_PARAMETERS_2, 0,
275bbeb64d0SHarry Wentland REFCYC_PER_META_CHUNK_FLIP_L, dlg_attr->refcyc_per_meta_chunk_flip_l);
276bbeb64d0SHarry Wentland
277bbeb64d0SHarry Wentland REG_SET_2(PER_LINE_DELIVERY_PRE, 0,
278bbeb64d0SHarry Wentland REFCYC_PER_LINE_DELIVERY_PRE_L, dlg_attr->refcyc_per_line_delivery_pre_l,
279bbeb64d0SHarry Wentland REFCYC_PER_LINE_DELIVERY_PRE_C, dlg_attr->refcyc_per_line_delivery_pre_c);
280bbeb64d0SHarry Wentland
281bbeb64d0SHarry Wentland REG_SET(DCN_SURF0_TTU_CNTL1, 0,
282bbeb64d0SHarry Wentland REFCYC_PER_REQ_DELIVERY_PRE,
283bbeb64d0SHarry Wentland ttu_attr->refcyc_per_req_delivery_pre_l);
284bbeb64d0SHarry Wentland REG_SET(DCN_SURF1_TTU_CNTL1, 0,
285bbeb64d0SHarry Wentland REFCYC_PER_REQ_DELIVERY_PRE,
286bbeb64d0SHarry Wentland ttu_attr->refcyc_per_req_delivery_pre_c);
287bbeb64d0SHarry Wentland REG_SET(DCN_CUR0_TTU_CNTL1, 0,
288bbeb64d0SHarry Wentland REFCYC_PER_REQ_DELIVERY_PRE, ttu_attr->refcyc_per_req_delivery_pre_cur0);
289bbeb64d0SHarry Wentland REG_SET(DCN_CUR1_TTU_CNTL1, 0,
290bbeb64d0SHarry Wentland REFCYC_PER_REQ_DELIVERY_PRE, ttu_attr->refcyc_per_req_delivery_pre_cur1);
291bbeb64d0SHarry Wentland
292bbeb64d0SHarry Wentland REG_SET_2(DCN_GLOBAL_TTU_CNTL, 0,
293bbeb64d0SHarry Wentland MIN_TTU_VBLANK, ttu_attr->min_ttu_vblank,
294bbeb64d0SHarry Wentland QoS_LEVEL_FLIP, ttu_attr->qos_level_flip);
295bbeb64d0SHarry Wentland }
296bbeb64d0SHarry Wentland
297bbeb64d0SHarry Wentland /* DCN2 (GFX10), the following GFX fields are deprecated. They can be set but they will not be used:
298bbeb64d0SHarry Wentland * NUM_BANKS
299bbeb64d0SHarry Wentland * NUM_SE
300bbeb64d0SHarry Wentland * NUM_RB_PER_SE
301bbeb64d0SHarry Wentland * RB_ALIGNED
302bbeb64d0SHarry Wentland * Other things can be defaulted, since they never change:
303bbeb64d0SHarry Wentland * PIPE_ALIGNED = 0
304bbeb64d0SHarry Wentland * META_LINEAR = 0
305bbeb64d0SHarry Wentland * In GFX10, only these apply:
306bbeb64d0SHarry Wentland * PIPE_INTERLEAVE
307bbeb64d0SHarry Wentland * NUM_PIPES
308bbeb64d0SHarry Wentland * MAX_COMPRESSED_FRAGS
309bbeb64d0SHarry Wentland * SW_MODE
310bbeb64d0SHarry Wentland */
hubp2_program_tiling(struct dcn20_hubp * hubp2,const struct dc_tiling_info * info,const enum surface_pixel_format pixel_format)311bbeb64d0SHarry Wentland static void hubp2_program_tiling(
312bbeb64d0SHarry Wentland struct dcn20_hubp *hubp2,
313080950cbSKarthi Kandasamy const struct dc_tiling_info *info,
314bbeb64d0SHarry Wentland const enum surface_pixel_format pixel_format)
315bbeb64d0SHarry Wentland {
316bbeb64d0SHarry Wentland REG_UPDATE_3(DCSURF_ADDR_CONFIG,
317bbeb64d0SHarry Wentland NUM_PIPES, log_2(info->gfx9.num_pipes),
318bbeb64d0SHarry Wentland PIPE_INTERLEAVE, info->gfx9.pipe_interleave,
319bbeb64d0SHarry Wentland MAX_COMPRESSED_FRAGS, log_2(info->gfx9.max_compressed_frags));
320bbeb64d0SHarry Wentland
321bbeb64d0SHarry Wentland REG_UPDATE_4(DCSURF_TILING_CONFIG,
322bbeb64d0SHarry Wentland SW_MODE, info->gfx9.swizzle,
323bbeb64d0SHarry Wentland META_LINEAR, 0,
324bbeb64d0SHarry Wentland RB_ALIGNED, 0,
325bbeb64d0SHarry Wentland PIPE_ALIGNED, 0);
326bbeb64d0SHarry Wentland }
327bbeb64d0SHarry Wentland
hubp2_program_size(struct hubp * hubp,enum surface_pixel_format format,const struct plane_size * plane_size,struct dc_plane_dcc_param * dcc)328eced4bceSIlya Bakoulin void hubp2_program_size(
329eced4bceSIlya Bakoulin struct hubp *hubp,
330eced4bceSIlya Bakoulin enum surface_pixel_format format,
33112e2b2d4SDmytro Laktyushkin const struct plane_size *plane_size,
332eced4bceSIlya Bakoulin struct dc_plane_dcc_param *dcc)
333eced4bceSIlya Bakoulin {
334eced4bceSIlya Bakoulin struct dcn20_hubp *hubp2 = TO_DCN20_HUBP(hubp);
335eced4bceSIlya Bakoulin uint32_t pitch, meta_pitch, pitch_c, meta_pitch_c;
3368bee5c5cSIlya Bakoulin bool use_pitch_c = false;
337eced4bceSIlya Bakoulin
338eced4bceSIlya Bakoulin /* Program data and meta surface pitch (calculation from addrlib)
339eced4bceSIlya Bakoulin * 444 or 420 luma
340eced4bceSIlya Bakoulin */
3418bee5c5cSIlya Bakoulin use_pitch_c = format >= SURFACE_PIXEL_FORMAT_VIDEO_BEGIN
3428bee5c5cSIlya Bakoulin && format < SURFACE_PIXEL_FORMAT_SUBSAMPLE_END;
343db7b0216SBhawanpreet Lakha use_pitch_c = use_pitch_c
344db7b0216SBhawanpreet Lakha || (format == SURFACE_PIXEL_FORMAT_GRPH_RGBE_ALPHA);
3458bee5c5cSIlya Bakoulin if (use_pitch_c) {
34612e2b2d4SDmytro Laktyushkin ASSERT(plane_size->chroma_pitch != 0);
347eced4bceSIlya Bakoulin /* Chroma pitch zero can cause system hang! */
348eced4bceSIlya Bakoulin
34912e2b2d4SDmytro Laktyushkin pitch = plane_size->surface_pitch - 1;
35012e2b2d4SDmytro Laktyushkin meta_pitch = dcc->meta_pitch - 1;
35112e2b2d4SDmytro Laktyushkin pitch_c = plane_size->chroma_pitch - 1;
35212e2b2d4SDmytro Laktyushkin meta_pitch_c = dcc->meta_pitch_c - 1;
353eced4bceSIlya Bakoulin } else {
35412e2b2d4SDmytro Laktyushkin pitch = plane_size->surface_pitch - 1;
35512e2b2d4SDmytro Laktyushkin meta_pitch = dcc->meta_pitch - 1;
356eced4bceSIlya Bakoulin pitch_c = 0;
357eced4bceSIlya Bakoulin meta_pitch_c = 0;
358eced4bceSIlya Bakoulin }
359eced4bceSIlya Bakoulin
360eced4bceSIlya Bakoulin if (!dcc->enable) {
361eced4bceSIlya Bakoulin meta_pitch = 0;
362eced4bceSIlya Bakoulin meta_pitch_c = 0;
363eced4bceSIlya Bakoulin }
364eced4bceSIlya Bakoulin
365eced4bceSIlya Bakoulin REG_UPDATE_2(DCSURF_SURFACE_PITCH,
366eced4bceSIlya Bakoulin PITCH, pitch, META_PITCH, meta_pitch);
367eced4bceSIlya Bakoulin
3688bee5c5cSIlya Bakoulin use_pitch_c = format >= SURFACE_PIXEL_FORMAT_VIDEO_BEGIN;
369db7b0216SBhawanpreet Lakha use_pitch_c = use_pitch_c
370db7b0216SBhawanpreet Lakha || (format == SURFACE_PIXEL_FORMAT_GRPH_RGBE_ALPHA);
3718bee5c5cSIlya Bakoulin if (use_pitch_c)
372eced4bceSIlya Bakoulin REG_UPDATE_2(DCSURF_SURFACE_PITCH_C,
373eced4bceSIlya Bakoulin PITCH_C, pitch_c, META_PITCH_C, meta_pitch_c);
374eced4bceSIlya Bakoulin }
375eced4bceSIlya Bakoulin
hubp2_program_rotation(struct hubp * hubp,enum dc_rotation_angle rotation,bool horizontal_mirror)376eced4bceSIlya Bakoulin void hubp2_program_rotation(
377eced4bceSIlya Bakoulin struct hubp *hubp,
378eced4bceSIlya Bakoulin enum dc_rotation_angle rotation,
379eced4bceSIlya Bakoulin bool horizontal_mirror)
380eced4bceSIlya Bakoulin {
381eced4bceSIlya Bakoulin struct dcn20_hubp *hubp2 = TO_DCN20_HUBP(hubp);
382eced4bceSIlya Bakoulin uint32_t mirror;
383eced4bceSIlya Bakoulin
384eced4bceSIlya Bakoulin
385eced4bceSIlya Bakoulin if (horizontal_mirror)
386eced4bceSIlya Bakoulin mirror = 1;
387eced4bceSIlya Bakoulin else
388eced4bceSIlya Bakoulin mirror = 0;
389eced4bceSIlya Bakoulin
390eced4bceSIlya Bakoulin /* Program rotation angle and horz mirror - no mirror */
391eced4bceSIlya Bakoulin if (rotation == ROTATION_ANGLE_0)
392eced4bceSIlya Bakoulin REG_UPDATE_2(DCSURF_SURFACE_CONFIG,
393eced4bceSIlya Bakoulin ROTATION_ANGLE, 0,
394eced4bceSIlya Bakoulin H_MIRROR_EN, mirror);
395eced4bceSIlya Bakoulin else if (rotation == ROTATION_ANGLE_90)
396eced4bceSIlya Bakoulin REG_UPDATE_2(DCSURF_SURFACE_CONFIG,
397eced4bceSIlya Bakoulin ROTATION_ANGLE, 1,
398eced4bceSIlya Bakoulin H_MIRROR_EN, mirror);
399eced4bceSIlya Bakoulin else if (rotation == ROTATION_ANGLE_180)
400eced4bceSIlya Bakoulin REG_UPDATE_2(DCSURF_SURFACE_CONFIG,
401eced4bceSIlya Bakoulin ROTATION_ANGLE, 2,
402eced4bceSIlya Bakoulin H_MIRROR_EN, mirror);
403eced4bceSIlya Bakoulin else if (rotation == ROTATION_ANGLE_270)
404eced4bceSIlya Bakoulin REG_UPDATE_2(DCSURF_SURFACE_CONFIG,
405eced4bceSIlya Bakoulin ROTATION_ANGLE, 3,
406eced4bceSIlya Bakoulin H_MIRROR_EN, mirror);
407eced4bceSIlya Bakoulin }
408eced4bceSIlya Bakoulin
hubp2_clear_tiling(struct hubp * hubp)4091fa5c5a3SAlex Deucher void hubp2_clear_tiling(struct hubp *hubp)
4101fa5c5a3SAlex Deucher {
4111fa5c5a3SAlex Deucher struct dcn20_hubp *hubp2 = TO_DCN20_HUBP(hubp);
4121fa5c5a3SAlex Deucher
4131fa5c5a3SAlex Deucher REG_UPDATE(DCHUBP_REQ_SIZE_CONFIG, SWATH_HEIGHT, 0);
4141fa5c5a3SAlex Deucher REG_UPDATE(DCSURF_TILING_CONFIG, SW_MODE, DC_SW_LINEAR);
4151fa5c5a3SAlex Deucher
4161fa5c5a3SAlex Deucher REG_UPDATE_4(DCSURF_SURFACE_CONTROL,
4171fa5c5a3SAlex Deucher PRIMARY_SURFACE_DCC_EN, 0,
4181fa5c5a3SAlex Deucher PRIMARY_SURFACE_DCC_IND_64B_BLK, 0,
4191fa5c5a3SAlex Deucher SECONDARY_SURFACE_DCC_EN, 0,
4201fa5c5a3SAlex Deucher SECONDARY_SURFACE_DCC_IND_64B_BLK, 0);
4211fa5c5a3SAlex Deucher }
4221fa5c5a3SAlex Deucher
hubp2_dcc_control(struct hubp * hubp,bool enable,enum hubp_ind_block_size independent_64b_blks)423eced4bceSIlya Bakoulin void hubp2_dcc_control(struct hubp *hubp, bool enable,
4242c58cc6dSIlya Bakoulin enum hubp_ind_block_size independent_64b_blks)
425eced4bceSIlya Bakoulin {
426eced4bceSIlya Bakoulin uint32_t dcc_en = enable ? 1 : 0;
427eced4bceSIlya Bakoulin uint32_t dcc_ind_64b_blk = independent_64b_blks ? 1 : 0;
428eced4bceSIlya Bakoulin struct dcn20_hubp *hubp2 = TO_DCN20_HUBP(hubp);
429eced4bceSIlya Bakoulin
430eced4bceSIlya Bakoulin REG_UPDATE_4(DCSURF_SURFACE_CONTROL,
431eced4bceSIlya Bakoulin PRIMARY_SURFACE_DCC_EN, dcc_en,
432eced4bceSIlya Bakoulin PRIMARY_SURFACE_DCC_IND_64B_BLK, dcc_ind_64b_blk,
433eced4bceSIlya Bakoulin SECONDARY_SURFACE_DCC_EN, dcc_en,
434eced4bceSIlya Bakoulin SECONDARY_SURFACE_DCC_IND_64B_BLK, dcc_ind_64b_blk);
435eced4bceSIlya Bakoulin }
436eced4bceSIlya Bakoulin
hubp2_program_pixel_format(struct hubp * hubp,enum surface_pixel_format format)437eced4bceSIlya Bakoulin void hubp2_program_pixel_format(
438eced4bceSIlya Bakoulin struct hubp *hubp,
439eced4bceSIlya Bakoulin enum surface_pixel_format format)
440eced4bceSIlya Bakoulin {
441eced4bceSIlya Bakoulin struct dcn20_hubp *hubp2 = TO_DCN20_HUBP(hubp);
442eced4bceSIlya Bakoulin uint32_t red_bar = 3;
443eced4bceSIlya Bakoulin uint32_t blue_bar = 2;
444eced4bceSIlya Bakoulin
445eced4bceSIlya Bakoulin /* swap for ABGR format */
446eced4bceSIlya Bakoulin if (format == SURFACE_PIXEL_FORMAT_GRPH_ABGR8888
447eced4bceSIlya Bakoulin || format == SURFACE_PIXEL_FORMAT_GRPH_ABGR2101010
448eced4bceSIlya Bakoulin || format == SURFACE_PIXEL_FORMAT_GRPH_ABGR2101010_XR_BIAS
449050cd3d6SMario Kleiner || format == SURFACE_PIXEL_FORMAT_GRPH_ABGR16161616
450eced4bceSIlya Bakoulin || format == SURFACE_PIXEL_FORMAT_GRPH_ABGR16161616F) {
451eced4bceSIlya Bakoulin red_bar = 2;
452eced4bceSIlya Bakoulin blue_bar = 3;
453eced4bceSIlya Bakoulin }
454eced4bceSIlya Bakoulin
455eced4bceSIlya Bakoulin REG_UPDATE_2(HUBPRET_CONTROL,
456eced4bceSIlya Bakoulin CROSSBAR_SRC_CB_B, blue_bar,
457eced4bceSIlya Bakoulin CROSSBAR_SRC_CR_R, red_bar);
458eced4bceSIlya Bakoulin
459eced4bceSIlya Bakoulin /* Mapping is same as ipp programming (cnvc) */
460eced4bceSIlya Bakoulin
461eced4bceSIlya Bakoulin switch (format) {
462eced4bceSIlya Bakoulin case SURFACE_PIXEL_FORMAT_GRPH_ARGB1555:
463eced4bceSIlya Bakoulin REG_UPDATE(DCSURF_SURFACE_CONFIG,
464eced4bceSIlya Bakoulin SURFACE_PIXEL_FORMAT, 1);
465eced4bceSIlya Bakoulin break;
466eced4bceSIlya Bakoulin case SURFACE_PIXEL_FORMAT_GRPH_RGB565:
467eced4bceSIlya Bakoulin REG_UPDATE(DCSURF_SURFACE_CONFIG,
468eced4bceSIlya Bakoulin SURFACE_PIXEL_FORMAT, 3);
469eced4bceSIlya Bakoulin break;
470eced4bceSIlya Bakoulin case SURFACE_PIXEL_FORMAT_GRPH_ARGB8888:
471eced4bceSIlya Bakoulin case SURFACE_PIXEL_FORMAT_GRPH_ABGR8888:
472eced4bceSIlya Bakoulin REG_UPDATE(DCSURF_SURFACE_CONFIG,
473eced4bceSIlya Bakoulin SURFACE_PIXEL_FORMAT, 8);
474eced4bceSIlya Bakoulin break;
475eced4bceSIlya Bakoulin case SURFACE_PIXEL_FORMAT_GRPH_ARGB2101010:
476eced4bceSIlya Bakoulin case SURFACE_PIXEL_FORMAT_GRPH_ABGR2101010:
477eced4bceSIlya Bakoulin case SURFACE_PIXEL_FORMAT_GRPH_ABGR2101010_XR_BIAS:
478eced4bceSIlya Bakoulin REG_UPDATE(DCSURF_SURFACE_CONFIG,
479eced4bceSIlya Bakoulin SURFACE_PIXEL_FORMAT, 10);
480eced4bceSIlya Bakoulin break;
481eced4bceSIlya Bakoulin case SURFACE_PIXEL_FORMAT_GRPH_ARGB16161616:
482050cd3d6SMario Kleiner case SURFACE_PIXEL_FORMAT_GRPH_ABGR16161616: /*we use crossbar already*/
483eced4bceSIlya Bakoulin REG_UPDATE(DCSURF_SURFACE_CONFIG,
484050cd3d6SMario Kleiner SURFACE_PIXEL_FORMAT, 26); /* ARGB16161616_UNORM */
485eced4bceSIlya Bakoulin break;
486eced4bceSIlya Bakoulin case SURFACE_PIXEL_FORMAT_GRPH_ARGB16161616F:
487eced4bceSIlya Bakoulin case SURFACE_PIXEL_FORMAT_GRPH_ABGR16161616F:/*we use crossbar already*/
488eced4bceSIlya Bakoulin REG_UPDATE(DCSURF_SURFACE_CONFIG,
489eced4bceSIlya Bakoulin SURFACE_PIXEL_FORMAT, 24);
490eced4bceSIlya Bakoulin break;
491eced4bceSIlya Bakoulin
492eced4bceSIlya Bakoulin case SURFACE_PIXEL_FORMAT_VIDEO_420_YCbCr:
493eced4bceSIlya Bakoulin REG_UPDATE(DCSURF_SURFACE_CONFIG,
494eced4bceSIlya Bakoulin SURFACE_PIXEL_FORMAT, 65);
495eced4bceSIlya Bakoulin break;
496eced4bceSIlya Bakoulin case SURFACE_PIXEL_FORMAT_VIDEO_420_YCrCb:
497eced4bceSIlya Bakoulin REG_UPDATE(DCSURF_SURFACE_CONFIG,
498eced4bceSIlya Bakoulin SURFACE_PIXEL_FORMAT, 64);
499eced4bceSIlya Bakoulin break;
500eced4bceSIlya Bakoulin case SURFACE_PIXEL_FORMAT_VIDEO_420_10bpc_YCbCr:
501eced4bceSIlya Bakoulin REG_UPDATE(DCSURF_SURFACE_CONFIG,
502eced4bceSIlya Bakoulin SURFACE_PIXEL_FORMAT, 67);
503eced4bceSIlya Bakoulin break;
504eced4bceSIlya Bakoulin case SURFACE_PIXEL_FORMAT_VIDEO_420_10bpc_YCrCb:
505eced4bceSIlya Bakoulin REG_UPDATE(DCSURF_SURFACE_CONFIG,
506eced4bceSIlya Bakoulin SURFACE_PIXEL_FORMAT, 66);
507eced4bceSIlya Bakoulin break;
508eced4bceSIlya Bakoulin case SURFACE_PIXEL_FORMAT_VIDEO_AYCrCb8888:
509eced4bceSIlya Bakoulin REG_UPDATE(DCSURF_SURFACE_CONFIG,
510eced4bceSIlya Bakoulin SURFACE_PIXEL_FORMAT, 12);
511eced4bceSIlya Bakoulin break;
512eced4bceSIlya Bakoulin case SURFACE_PIXEL_FORMAT_GRPH_RGB111110_FIX:
513eced4bceSIlya Bakoulin REG_UPDATE(DCSURF_SURFACE_CONFIG,
514eced4bceSIlya Bakoulin SURFACE_PIXEL_FORMAT, 112);
515eced4bceSIlya Bakoulin break;
516eced4bceSIlya Bakoulin case SURFACE_PIXEL_FORMAT_GRPH_BGR101111_FIX:
517eced4bceSIlya Bakoulin REG_UPDATE(DCSURF_SURFACE_CONFIG,
518eced4bceSIlya Bakoulin SURFACE_PIXEL_FORMAT, 113);
519eced4bceSIlya Bakoulin break;
520eced4bceSIlya Bakoulin case SURFACE_PIXEL_FORMAT_VIDEO_ACrYCb2101010:
521eced4bceSIlya Bakoulin REG_UPDATE(DCSURF_SURFACE_CONFIG,
522eced4bceSIlya Bakoulin SURFACE_PIXEL_FORMAT, 114);
523eced4bceSIlya Bakoulin break;
524eced4bceSIlya Bakoulin case SURFACE_PIXEL_FORMAT_GRPH_RGB111110_FLOAT:
525eced4bceSIlya Bakoulin REG_UPDATE(DCSURF_SURFACE_CONFIG,
526eced4bceSIlya Bakoulin SURFACE_PIXEL_FORMAT, 118);
527eced4bceSIlya Bakoulin break;
528eced4bceSIlya Bakoulin case SURFACE_PIXEL_FORMAT_GRPH_BGR101111_FLOAT:
529eced4bceSIlya Bakoulin REG_UPDATE(DCSURF_SURFACE_CONFIG,
530eced4bceSIlya Bakoulin SURFACE_PIXEL_FORMAT, 119);
531eced4bceSIlya Bakoulin break;
532db7b0216SBhawanpreet Lakha case SURFACE_PIXEL_FORMAT_GRPH_RGBE:
533db7b0216SBhawanpreet Lakha REG_UPDATE_2(DCSURF_SURFACE_CONFIG,
534db7b0216SBhawanpreet Lakha SURFACE_PIXEL_FORMAT, 116,
535db7b0216SBhawanpreet Lakha ALPHA_PLANE_EN, 0);
536db7b0216SBhawanpreet Lakha break;
537db7b0216SBhawanpreet Lakha case SURFACE_PIXEL_FORMAT_GRPH_RGBE_ALPHA:
538db7b0216SBhawanpreet Lakha REG_UPDATE_2(DCSURF_SURFACE_CONFIG,
539db7b0216SBhawanpreet Lakha SURFACE_PIXEL_FORMAT, 116,
540db7b0216SBhawanpreet Lakha ALPHA_PLANE_EN, 1);
541db7b0216SBhawanpreet Lakha break;
542eced4bceSIlya Bakoulin default:
543eced4bceSIlya Bakoulin BREAK_TO_DEBUGGER();
544eced4bceSIlya Bakoulin break;
545eced4bceSIlya Bakoulin }
546eced4bceSIlya Bakoulin
547eced4bceSIlya Bakoulin /* don't see the need of program the xbar in DCN 1.0 */
548eced4bceSIlya Bakoulin }
549eced4bceSIlya Bakoulin
hubp2_program_surface_config(struct hubp * hubp,enum surface_pixel_format format,struct dc_tiling_info * tiling_info,struct plane_size * plane_size,enum dc_rotation_angle rotation,struct dc_plane_dcc_param * dcc,bool horizontal_mirror,unsigned int compat_level)550bbeb64d0SHarry Wentland void hubp2_program_surface_config(
551bbeb64d0SHarry Wentland struct hubp *hubp,
552bbeb64d0SHarry Wentland enum surface_pixel_format format,
553080950cbSKarthi Kandasamy struct dc_tiling_info *tiling_info,
55412e2b2d4SDmytro Laktyushkin struct plane_size *plane_size,
555bbeb64d0SHarry Wentland enum dc_rotation_angle rotation,
556bbeb64d0SHarry Wentland struct dc_plane_dcc_param *dcc,
557bbeb64d0SHarry Wentland bool horizontal_mirror,
558bbeb64d0SHarry Wentland unsigned int compat_level)
559bbeb64d0SHarry Wentland {
560bbeb64d0SHarry Wentland struct dcn20_hubp *hubp2 = TO_DCN20_HUBP(hubp);
561bbeb64d0SHarry Wentland
56212e2b2d4SDmytro Laktyushkin hubp2_dcc_control(hubp, dcc->enable, dcc->independent_64b_blks);
563bbeb64d0SHarry Wentland hubp2_program_tiling(hubp2, tiling_info, format);
564eced4bceSIlya Bakoulin hubp2_program_size(hubp, format, plane_size, dcc);
565eced4bceSIlya Bakoulin hubp2_program_rotation(hubp, rotation, horizontal_mirror);
566eced4bceSIlya Bakoulin hubp2_program_pixel_format(hubp, format);
567bbeb64d0SHarry Wentland }
568bbeb64d0SHarry Wentland
hubp2_get_lines_per_chunk(unsigned int cursor_width,enum dc_cursor_color_format cursor_mode)569bbeb64d0SHarry Wentland enum cursor_lines_per_chunk hubp2_get_lines_per_chunk(
570bbeb64d0SHarry Wentland unsigned int cursor_width,
571bbeb64d0SHarry Wentland enum dc_cursor_color_format cursor_mode)
572bbeb64d0SHarry Wentland {
573bbeb64d0SHarry Wentland enum cursor_lines_per_chunk line_per_chunk = CURSOR_LINE_PER_CHUNK_16;
574bbeb64d0SHarry Wentland
575bbeb64d0SHarry Wentland if (cursor_mode == CURSOR_MODE_MONO)
576bbeb64d0SHarry Wentland line_per_chunk = CURSOR_LINE_PER_CHUNK_16;
577bbeb64d0SHarry Wentland else if (cursor_mode == CURSOR_MODE_COLOR_1BIT_AND ||
578bbeb64d0SHarry Wentland cursor_mode == CURSOR_MODE_COLOR_PRE_MULTIPLIED_ALPHA ||
579bbeb64d0SHarry Wentland cursor_mode == CURSOR_MODE_COLOR_UN_PRE_MULTIPLIED_ALPHA) {
580bbeb64d0SHarry Wentland if (cursor_width >= 1 && cursor_width <= 32)
581bbeb64d0SHarry Wentland line_per_chunk = CURSOR_LINE_PER_CHUNK_16;
582bbeb64d0SHarry Wentland else if (cursor_width >= 33 && cursor_width <= 64)
583bbeb64d0SHarry Wentland line_per_chunk = CURSOR_LINE_PER_CHUNK_8;
584bbeb64d0SHarry Wentland else if (cursor_width >= 65 && cursor_width <= 128)
585bbeb64d0SHarry Wentland line_per_chunk = CURSOR_LINE_PER_CHUNK_4;
586bbeb64d0SHarry Wentland else if (cursor_width >= 129 && cursor_width <= 256)
587bbeb64d0SHarry Wentland line_per_chunk = CURSOR_LINE_PER_CHUNK_2;
588bbeb64d0SHarry Wentland } else if (cursor_mode == CURSOR_MODE_COLOR_64BIT_FP_PRE_MULTIPLIED ||
589bbeb64d0SHarry Wentland cursor_mode == CURSOR_MODE_COLOR_64BIT_FP_UN_PRE_MULTIPLIED) {
590bbeb64d0SHarry Wentland if (cursor_width >= 1 && cursor_width <= 16)
591bbeb64d0SHarry Wentland line_per_chunk = CURSOR_LINE_PER_CHUNK_16;
592bbeb64d0SHarry Wentland else if (cursor_width >= 17 && cursor_width <= 32)
593bbeb64d0SHarry Wentland line_per_chunk = CURSOR_LINE_PER_CHUNK_8;
594bbeb64d0SHarry Wentland else if (cursor_width >= 33 && cursor_width <= 64)
595bbeb64d0SHarry Wentland line_per_chunk = CURSOR_LINE_PER_CHUNK_4;
596bbeb64d0SHarry Wentland else if (cursor_width >= 65 && cursor_width <= 128)
597bbeb64d0SHarry Wentland line_per_chunk = CURSOR_LINE_PER_CHUNK_2;
598bbeb64d0SHarry Wentland else if (cursor_width >= 129 && cursor_width <= 256)
599bbeb64d0SHarry Wentland line_per_chunk = CURSOR_LINE_PER_CHUNK_1;
600bbeb64d0SHarry Wentland }
601bbeb64d0SHarry Wentland
602bbeb64d0SHarry Wentland return line_per_chunk;
603bbeb64d0SHarry Wentland }
604bbeb64d0SHarry Wentland
hubp2_cursor_set_attributes(struct hubp * hubp,const struct dc_cursor_attributes * attr)605bbeb64d0SHarry Wentland void hubp2_cursor_set_attributes(
606bbeb64d0SHarry Wentland struct hubp *hubp,
607bbeb64d0SHarry Wentland const struct dc_cursor_attributes *attr)
608bbeb64d0SHarry Wentland {
609bbeb64d0SHarry Wentland struct dcn20_hubp *hubp2 = TO_DCN20_HUBP(hubp);
610bbeb64d0SHarry Wentland enum cursor_pitch hw_pitch = hubp1_get_cursor_pitch(attr->pitch);
611bbeb64d0SHarry Wentland enum cursor_lines_per_chunk lpc = hubp2_get_lines_per_chunk(
612bbeb64d0SHarry Wentland attr->width, attr->color_format);
613bbeb64d0SHarry Wentland
614bbeb64d0SHarry Wentland hubp->curs_attr = *attr;
615bbeb64d0SHarry Wentland
616bbeb64d0SHarry Wentland REG_UPDATE(CURSOR_SURFACE_ADDRESS_HIGH,
617bbeb64d0SHarry Wentland CURSOR_SURFACE_ADDRESS_HIGH, attr->address.high_part);
618bbeb64d0SHarry Wentland REG_UPDATE(CURSOR_SURFACE_ADDRESS,
619bbeb64d0SHarry Wentland CURSOR_SURFACE_ADDRESS, attr->address.low_part);
620bbeb64d0SHarry Wentland
621bbeb64d0SHarry Wentland REG_UPDATE_2(CURSOR_SIZE,
622bbeb64d0SHarry Wentland CURSOR_WIDTH, attr->width,
623bbeb64d0SHarry Wentland CURSOR_HEIGHT, attr->height);
624bbeb64d0SHarry Wentland
625bbeb64d0SHarry Wentland REG_UPDATE_4(CURSOR_CONTROL,
626bbeb64d0SHarry Wentland CURSOR_MODE, attr->color_format,
627bbeb64d0SHarry Wentland CURSOR_2X_MAGNIFY, attr->attribute_flags.bits.ENABLE_MAGNIFICATION,
628bbeb64d0SHarry Wentland CURSOR_PITCH, hw_pitch,
629bbeb64d0SHarry Wentland CURSOR_LINES_PER_CHUNK, lpc);
630bbeb64d0SHarry Wentland
631bbeb64d0SHarry Wentland REG_SET_2(CURSOR_SETTINGS, 0,
632bbeb64d0SHarry Wentland /* no shift of the cursor HDL schedule */
633bbeb64d0SHarry Wentland CURSOR0_DST_Y_OFFSET, 0,
634bbeb64d0SHarry Wentland /* used to shift the cursor chunk request deadline */
635bbeb64d0SHarry Wentland CURSOR0_CHUNK_HDL_ADJUST, 3);
636b73353f7SMax Tseng
637b73353f7SMax Tseng hubp->att.SURFACE_ADDR_HIGH = attr->address.high_part;
638b73353f7SMax Tseng hubp->att.SURFACE_ADDR = attr->address.low_part;
639b73353f7SMax Tseng hubp->att.size.bits.width = attr->width;
640b73353f7SMax Tseng hubp->att.size.bits.height = attr->height;
641b73353f7SMax Tseng hubp->att.cur_ctl.bits.mode = attr->color_format;
6429cb0dc6cSMax Tseng
6439cb0dc6cSMax Tseng hubp->cur_rect.w = attr->width;
6449cb0dc6cSMax Tseng hubp->cur_rect.h = attr->height;
6459cb0dc6cSMax Tseng
646b73353f7SMax Tseng hubp->att.cur_ctl.bits.pitch = hw_pitch;
647b73353f7SMax Tseng hubp->att.cur_ctl.bits.line_per_chunk = lpc;
648b73353f7SMax Tseng hubp->att.cur_ctl.bits.cur_2x_magnify = attr->attribute_flags.bits.ENABLE_MAGNIFICATION;
649b73353f7SMax Tseng hubp->att.settings.bits.dst_y_offset = 0;
650b73353f7SMax Tseng hubp->att.settings.bits.chunk_hdl_adjust = 3;
651bbeb64d0SHarry Wentland }
652bbeb64d0SHarry Wentland
hubp2_dmdata_set_attributes(struct hubp * hubp,const struct dc_dmdata_attributes * attr)653bbeb64d0SHarry Wentland void hubp2_dmdata_set_attributes(
654bbeb64d0SHarry Wentland struct hubp *hubp,
655bbeb64d0SHarry Wentland const struct dc_dmdata_attributes *attr)
656bbeb64d0SHarry Wentland {
657bbeb64d0SHarry Wentland struct dcn20_hubp *hubp2 = TO_DCN20_HUBP(hubp);
658bbeb64d0SHarry Wentland
659bbeb64d0SHarry Wentland if (attr->dmdata_mode == DMDATA_HW_MODE) {
660bbeb64d0SHarry Wentland /* set to HW mode */
661bbeb64d0SHarry Wentland REG_UPDATE(DMDATA_CNTL,
662bbeb64d0SHarry Wentland DMDATA_MODE, 1);
663bbeb64d0SHarry Wentland
664bbeb64d0SHarry Wentland /* for DMDATA flip, need to use SURFACE_UPDATE_LOCK */
665bbeb64d0SHarry Wentland REG_UPDATE(DCSURF_FLIP_CONTROL, SURFACE_UPDATE_LOCK, 1);
666bbeb64d0SHarry Wentland
667bbeb64d0SHarry Wentland /* toggle DMDATA_UPDATED and set repeat and size */
668bbeb64d0SHarry Wentland REG_UPDATE(DMDATA_CNTL,
669bbeb64d0SHarry Wentland DMDATA_UPDATED, 0);
670bbeb64d0SHarry Wentland REG_UPDATE_3(DMDATA_CNTL,
671bbeb64d0SHarry Wentland DMDATA_UPDATED, 1,
672bbeb64d0SHarry Wentland DMDATA_REPEAT, attr->dmdata_repeat,
673bbeb64d0SHarry Wentland DMDATA_SIZE, attr->dmdata_size);
674bbeb64d0SHarry Wentland
675bbeb64d0SHarry Wentland /* set DMDATA address */
676bbeb64d0SHarry Wentland REG_WRITE(DMDATA_ADDRESS_LOW, attr->address.low_part);
677bbeb64d0SHarry Wentland REG_UPDATE(DMDATA_ADDRESS_HIGH,
678bbeb64d0SHarry Wentland DMDATA_ADDRESS_HIGH, attr->address.high_part);
679bbeb64d0SHarry Wentland
680bbeb64d0SHarry Wentland REG_UPDATE(DCSURF_FLIP_CONTROL, SURFACE_UPDATE_LOCK, 0);
681bbeb64d0SHarry Wentland
682bbeb64d0SHarry Wentland } else {
683bbeb64d0SHarry Wentland /* set to SW mode before loading data */
684bbeb64d0SHarry Wentland REG_SET(DMDATA_CNTL, 0,
685bbeb64d0SHarry Wentland DMDATA_MODE, 0);
686bbeb64d0SHarry Wentland /* toggle DMDATA_SW_UPDATED to start loading sequence */
687bbeb64d0SHarry Wentland REG_UPDATE(DMDATA_SW_CNTL,
688bbeb64d0SHarry Wentland DMDATA_SW_UPDATED, 0);
689bbeb64d0SHarry Wentland REG_UPDATE_3(DMDATA_SW_CNTL,
690bbeb64d0SHarry Wentland DMDATA_SW_UPDATED, 1,
691bbeb64d0SHarry Wentland DMDATA_SW_REPEAT, attr->dmdata_repeat,
692bbeb64d0SHarry Wentland DMDATA_SW_SIZE, attr->dmdata_size);
693bbeb64d0SHarry Wentland /* load data into hubp dmdata buffer */
694bbeb64d0SHarry Wentland hubp2_dmdata_load(hubp, attr->dmdata_size, attr->dmdata_sw_data);
695bbeb64d0SHarry Wentland }
696bbeb64d0SHarry Wentland
697bbeb64d0SHarry Wentland /* Note that DL_DELTA must be programmed if we want to use TTU mode */
698bbeb64d0SHarry Wentland REG_SET_3(DMDATA_QOS_CNTL, 0,
699bbeb64d0SHarry Wentland DMDATA_QOS_MODE, attr->dmdata_qos_mode,
700bbeb64d0SHarry Wentland DMDATA_QOS_LEVEL, attr->dmdata_qos_level,
701bbeb64d0SHarry Wentland DMDATA_DL_DELTA, attr->dmdata_dl_delta);
702bbeb64d0SHarry Wentland }
703bbeb64d0SHarry Wentland
hubp2_dmdata_load(struct hubp * hubp,uint32_t dmdata_sw_size,const uint32_t * dmdata_sw_data)704bbeb64d0SHarry Wentland void hubp2_dmdata_load(
705bbeb64d0SHarry Wentland struct hubp *hubp,
706bbeb64d0SHarry Wentland uint32_t dmdata_sw_size,
707bbeb64d0SHarry Wentland const uint32_t *dmdata_sw_data)
708bbeb64d0SHarry Wentland {
709bbeb64d0SHarry Wentland int i;
710bbeb64d0SHarry Wentland struct dcn20_hubp *hubp2 = TO_DCN20_HUBP(hubp);
711bbeb64d0SHarry Wentland
712bbeb64d0SHarry Wentland /* load dmdata into HUBP buffer in SW mode */
713bbeb64d0SHarry Wentland for (i = 0; i < dmdata_sw_size / 4; i++)
714bbeb64d0SHarry Wentland REG_WRITE(DMDATA_SW_DATA, dmdata_sw_data[i]);
715bbeb64d0SHarry Wentland }
716bbeb64d0SHarry Wentland
hubp2_dmdata_status_done(struct hubp * hubp)717bbeb64d0SHarry Wentland bool hubp2_dmdata_status_done(struct hubp *hubp)
718bbeb64d0SHarry Wentland {
719bbeb64d0SHarry Wentland uint32_t status;
720bbeb64d0SHarry Wentland struct dcn20_hubp *hubp2 = TO_DCN20_HUBP(hubp);
721bbeb64d0SHarry Wentland
722bbeb64d0SHarry Wentland REG_GET(DMDATA_STATUS, DMDATA_DONE, &status);
723bbeb64d0SHarry Wentland return (status == 1);
724bbeb64d0SHarry Wentland }
725bbeb64d0SHarry Wentland
hubp2_program_surface_flip_and_addr(struct hubp * hubp,const struct dc_plane_address * address,bool flip_immediate)726bbeb64d0SHarry Wentland bool hubp2_program_surface_flip_and_addr(
727bbeb64d0SHarry Wentland struct hubp *hubp,
728bbeb64d0SHarry Wentland const struct dc_plane_address *address,
729bda9afdaSDmytro Laktyushkin bool flip_immediate)
730bbeb64d0SHarry Wentland {
731bbeb64d0SHarry Wentland struct dcn20_hubp *hubp2 = TO_DCN20_HUBP(hubp);
732bbeb64d0SHarry Wentland
733bbeb64d0SHarry Wentland //program flip type
734bbeb64d0SHarry Wentland REG_UPDATE(DCSURF_FLIP_CONTROL,
735bbeb64d0SHarry Wentland SURFACE_FLIP_TYPE, flip_immediate);
736bbeb64d0SHarry Wentland
737bbeb64d0SHarry Wentland // Program VMID reg
738bbeb64d0SHarry Wentland REG_UPDATE(VMID_SETTINGS_0,
739bda9afdaSDmytro Laktyushkin VMID, address->vmid);
740bbeb64d0SHarry Wentland
741bbeb64d0SHarry Wentland
742bbeb64d0SHarry Wentland /* HW automatically latch rest of address register on write to
743bbeb64d0SHarry Wentland * DCSURF_PRIMARY_SURFACE_ADDRESS if SURFACE_UPDATE_LOCK is not used
744bbeb64d0SHarry Wentland *
745bbeb64d0SHarry Wentland * program high first and then the low addr, order matters!
746bbeb64d0SHarry Wentland */
747bbeb64d0SHarry Wentland switch (address->type) {
748bbeb64d0SHarry Wentland case PLN_ADDR_TYPE_GRAPHICS:
749bbeb64d0SHarry Wentland /* DCN1.0 does not support const color
750bbeb64d0SHarry Wentland * TODO: program DCHUBBUB_RET_PATH_DCC_CFGx_0/1
751bbeb64d0SHarry Wentland * base on address->grph.dcc_const_color
752bbeb64d0SHarry Wentland * x = 0, 2, 4, 6 for pipe 0, 1, 2, 3 for rgb and luma
753bbeb64d0SHarry Wentland * x = 1, 3, 5, 7 for pipe 0, 1, 2, 3 for chroma
754bbeb64d0SHarry Wentland */
755bbeb64d0SHarry Wentland
756bbeb64d0SHarry Wentland if (address->grph.addr.quad_part == 0)
757bbeb64d0SHarry Wentland break;
758bbeb64d0SHarry Wentland
759bbeb64d0SHarry Wentland REG_UPDATE_2(DCSURF_SURFACE_CONTROL,
760bbeb64d0SHarry Wentland PRIMARY_SURFACE_TMZ, address->tmz_surface,
761bbeb64d0SHarry Wentland PRIMARY_META_SURFACE_TMZ, address->tmz_surface);
762bbeb64d0SHarry Wentland
763bbeb64d0SHarry Wentland if (address->grph.meta_addr.quad_part != 0) {
764bbeb64d0SHarry Wentland REG_SET(DCSURF_PRIMARY_META_SURFACE_ADDRESS_HIGH, 0,
765bbeb64d0SHarry Wentland PRIMARY_META_SURFACE_ADDRESS_HIGH,
766bbeb64d0SHarry Wentland address->grph.meta_addr.high_part);
767bbeb64d0SHarry Wentland
768bbeb64d0SHarry Wentland REG_SET(DCSURF_PRIMARY_META_SURFACE_ADDRESS, 0,
769bbeb64d0SHarry Wentland PRIMARY_META_SURFACE_ADDRESS,
770bbeb64d0SHarry Wentland address->grph.meta_addr.low_part);
771bbeb64d0SHarry Wentland }
772bbeb64d0SHarry Wentland
773bbeb64d0SHarry Wentland REG_SET(DCSURF_PRIMARY_SURFACE_ADDRESS_HIGH, 0,
774bbeb64d0SHarry Wentland PRIMARY_SURFACE_ADDRESS_HIGH,
775bbeb64d0SHarry Wentland address->grph.addr.high_part);
776bbeb64d0SHarry Wentland
777bbeb64d0SHarry Wentland REG_SET(DCSURF_PRIMARY_SURFACE_ADDRESS, 0,
778bbeb64d0SHarry Wentland PRIMARY_SURFACE_ADDRESS,
779bbeb64d0SHarry Wentland address->grph.addr.low_part);
780bbeb64d0SHarry Wentland break;
781bbeb64d0SHarry Wentland case PLN_ADDR_TYPE_VIDEO_PROGRESSIVE:
782bbeb64d0SHarry Wentland if (address->video_progressive.luma_addr.quad_part == 0
783bbeb64d0SHarry Wentland || address->video_progressive.chroma_addr.quad_part == 0)
784bbeb64d0SHarry Wentland break;
785bbeb64d0SHarry Wentland
786bbeb64d0SHarry Wentland REG_UPDATE_4(DCSURF_SURFACE_CONTROL,
787bbeb64d0SHarry Wentland PRIMARY_SURFACE_TMZ, address->tmz_surface,
788bbeb64d0SHarry Wentland PRIMARY_SURFACE_TMZ_C, address->tmz_surface,
789bbeb64d0SHarry Wentland PRIMARY_META_SURFACE_TMZ, address->tmz_surface,
790bbeb64d0SHarry Wentland PRIMARY_META_SURFACE_TMZ_C, address->tmz_surface);
791bbeb64d0SHarry Wentland
792bbeb64d0SHarry Wentland if (address->video_progressive.luma_meta_addr.quad_part != 0) {
793bbeb64d0SHarry Wentland REG_SET(DCSURF_PRIMARY_META_SURFACE_ADDRESS_HIGH_C, 0,
794bbeb64d0SHarry Wentland PRIMARY_META_SURFACE_ADDRESS_HIGH_C,
795bbeb64d0SHarry Wentland address->video_progressive.chroma_meta_addr.high_part);
796bbeb64d0SHarry Wentland
797bbeb64d0SHarry Wentland REG_SET(DCSURF_PRIMARY_META_SURFACE_ADDRESS_C, 0,
798bbeb64d0SHarry Wentland PRIMARY_META_SURFACE_ADDRESS_C,
799bbeb64d0SHarry Wentland address->video_progressive.chroma_meta_addr.low_part);
800bbeb64d0SHarry Wentland
801bbeb64d0SHarry Wentland REG_SET(DCSURF_PRIMARY_META_SURFACE_ADDRESS_HIGH, 0,
802bbeb64d0SHarry Wentland PRIMARY_META_SURFACE_ADDRESS_HIGH,
803bbeb64d0SHarry Wentland address->video_progressive.luma_meta_addr.high_part);
804bbeb64d0SHarry Wentland
805bbeb64d0SHarry Wentland REG_SET(DCSURF_PRIMARY_META_SURFACE_ADDRESS, 0,
806bbeb64d0SHarry Wentland PRIMARY_META_SURFACE_ADDRESS,
807bbeb64d0SHarry Wentland address->video_progressive.luma_meta_addr.low_part);
808bbeb64d0SHarry Wentland }
809bbeb64d0SHarry Wentland
810bbeb64d0SHarry Wentland REG_SET(DCSURF_PRIMARY_SURFACE_ADDRESS_HIGH_C, 0,
811bbeb64d0SHarry Wentland PRIMARY_SURFACE_ADDRESS_HIGH_C,
812bbeb64d0SHarry Wentland address->video_progressive.chroma_addr.high_part);
813bbeb64d0SHarry Wentland
814bbeb64d0SHarry Wentland REG_SET(DCSURF_PRIMARY_SURFACE_ADDRESS_C, 0,
815bbeb64d0SHarry Wentland PRIMARY_SURFACE_ADDRESS_C,
816bbeb64d0SHarry Wentland address->video_progressive.chroma_addr.low_part);
817bbeb64d0SHarry Wentland
818bbeb64d0SHarry Wentland REG_SET(DCSURF_PRIMARY_SURFACE_ADDRESS_HIGH, 0,
819bbeb64d0SHarry Wentland PRIMARY_SURFACE_ADDRESS_HIGH,
820bbeb64d0SHarry Wentland address->video_progressive.luma_addr.high_part);
821bbeb64d0SHarry Wentland
822bbeb64d0SHarry Wentland REG_SET(DCSURF_PRIMARY_SURFACE_ADDRESS, 0,
823bbeb64d0SHarry Wentland PRIMARY_SURFACE_ADDRESS,
824bbeb64d0SHarry Wentland address->video_progressive.luma_addr.low_part);
825bbeb64d0SHarry Wentland break;
826bbeb64d0SHarry Wentland case PLN_ADDR_TYPE_GRPH_STEREO:
827bbeb64d0SHarry Wentland if (address->grph_stereo.left_addr.quad_part == 0)
828bbeb64d0SHarry Wentland break;
829bbeb64d0SHarry Wentland if (address->grph_stereo.right_addr.quad_part == 0)
830bbeb64d0SHarry Wentland break;
831bbeb64d0SHarry Wentland
832bbeb64d0SHarry Wentland REG_UPDATE_8(DCSURF_SURFACE_CONTROL,
833bbeb64d0SHarry Wentland PRIMARY_SURFACE_TMZ, address->tmz_surface,
834bbeb64d0SHarry Wentland PRIMARY_SURFACE_TMZ_C, address->tmz_surface,
835bbeb64d0SHarry Wentland PRIMARY_META_SURFACE_TMZ, address->tmz_surface,
836bbeb64d0SHarry Wentland PRIMARY_META_SURFACE_TMZ_C, address->tmz_surface,
837bbeb64d0SHarry Wentland SECONDARY_SURFACE_TMZ, address->tmz_surface,
838bbeb64d0SHarry Wentland SECONDARY_SURFACE_TMZ_C, address->tmz_surface,
839bbeb64d0SHarry Wentland SECONDARY_META_SURFACE_TMZ, address->tmz_surface,
840bbeb64d0SHarry Wentland SECONDARY_META_SURFACE_TMZ_C, address->tmz_surface);
841bbeb64d0SHarry Wentland
842bbeb64d0SHarry Wentland if (address->grph_stereo.right_meta_addr.quad_part != 0) {
843bbeb64d0SHarry Wentland
844bbeb64d0SHarry Wentland REG_SET(DCSURF_SECONDARY_META_SURFACE_ADDRESS_HIGH, 0,
845bbeb64d0SHarry Wentland SECONDARY_META_SURFACE_ADDRESS_HIGH,
846bbeb64d0SHarry Wentland address->grph_stereo.right_meta_addr.high_part);
847bbeb64d0SHarry Wentland
848bbeb64d0SHarry Wentland REG_SET(DCSURF_SECONDARY_META_SURFACE_ADDRESS, 0,
849bbeb64d0SHarry Wentland SECONDARY_META_SURFACE_ADDRESS,
850bbeb64d0SHarry Wentland address->grph_stereo.right_meta_addr.low_part);
851bbeb64d0SHarry Wentland }
852bbeb64d0SHarry Wentland if (address->grph_stereo.left_meta_addr.quad_part != 0) {
853bbeb64d0SHarry Wentland
854bbeb64d0SHarry Wentland REG_SET(DCSURF_PRIMARY_META_SURFACE_ADDRESS_HIGH, 0,
855bbeb64d0SHarry Wentland PRIMARY_META_SURFACE_ADDRESS_HIGH,
856bbeb64d0SHarry Wentland address->grph_stereo.left_meta_addr.high_part);
857bbeb64d0SHarry Wentland
858bbeb64d0SHarry Wentland REG_SET(DCSURF_PRIMARY_META_SURFACE_ADDRESS, 0,
859bbeb64d0SHarry Wentland PRIMARY_META_SURFACE_ADDRESS,
860bbeb64d0SHarry Wentland address->grph_stereo.left_meta_addr.low_part);
861bbeb64d0SHarry Wentland }
862bbeb64d0SHarry Wentland
863bbeb64d0SHarry Wentland REG_SET(DCSURF_SECONDARY_SURFACE_ADDRESS_HIGH, 0,
864bbeb64d0SHarry Wentland SECONDARY_SURFACE_ADDRESS_HIGH,
865bbeb64d0SHarry Wentland address->grph_stereo.right_addr.high_part);
866bbeb64d0SHarry Wentland
867bbeb64d0SHarry Wentland REG_SET(DCSURF_SECONDARY_SURFACE_ADDRESS, 0,
868bbeb64d0SHarry Wentland SECONDARY_SURFACE_ADDRESS,
869bbeb64d0SHarry Wentland address->grph_stereo.right_addr.low_part);
870bbeb64d0SHarry Wentland
871bbeb64d0SHarry Wentland REG_SET(DCSURF_PRIMARY_SURFACE_ADDRESS_HIGH, 0,
872bbeb64d0SHarry Wentland PRIMARY_SURFACE_ADDRESS_HIGH,
873bbeb64d0SHarry Wentland address->grph_stereo.left_addr.high_part);
874bbeb64d0SHarry Wentland
875bbeb64d0SHarry Wentland REG_SET(DCSURF_PRIMARY_SURFACE_ADDRESS, 0,
876bbeb64d0SHarry Wentland PRIMARY_SURFACE_ADDRESS,
877bbeb64d0SHarry Wentland address->grph_stereo.left_addr.low_part);
878bbeb64d0SHarry Wentland break;
879bbeb64d0SHarry Wentland default:
880bbeb64d0SHarry Wentland BREAK_TO_DEBUGGER();
881bbeb64d0SHarry Wentland break;
882bbeb64d0SHarry Wentland }
883bbeb64d0SHarry Wentland
884bbeb64d0SHarry Wentland hubp->request_address = *address;
885bbeb64d0SHarry Wentland
886bbeb64d0SHarry Wentland return true;
887bbeb64d0SHarry Wentland }
888bbeb64d0SHarry Wentland
hubp2_enable_triplebuffer(struct hubp * hubp,bool enable)889bbeb64d0SHarry Wentland void hubp2_enable_triplebuffer(
890bbeb64d0SHarry Wentland struct hubp *hubp,
891bbeb64d0SHarry Wentland bool enable)
892bbeb64d0SHarry Wentland {
893bbeb64d0SHarry Wentland struct dcn20_hubp *hubp2 = TO_DCN20_HUBP(hubp);
894bbeb64d0SHarry Wentland uint32_t triple_buffer_en = 0;
895bbeb64d0SHarry Wentland bool tri_buffer_en;
896bbeb64d0SHarry Wentland
897bbeb64d0SHarry Wentland REG_GET(DCSURF_FLIP_CONTROL2, SURFACE_TRIPLE_BUFFER_ENABLE, &triple_buffer_en);
898bbeb64d0SHarry Wentland tri_buffer_en = (triple_buffer_en == 1);
899bbeb64d0SHarry Wentland if (tri_buffer_en != enable) {
900bbeb64d0SHarry Wentland REG_UPDATE(DCSURF_FLIP_CONTROL2,
901bbeb64d0SHarry Wentland SURFACE_TRIPLE_BUFFER_ENABLE, enable ? DC_TRIPLEBUFFER_ENABLE : DC_TRIPLEBUFFER_DISABLE);
902bbeb64d0SHarry Wentland }
903bbeb64d0SHarry Wentland }
904bbeb64d0SHarry Wentland
hubp2_is_triplebuffer_enabled(struct hubp * hubp)905bbeb64d0SHarry Wentland bool hubp2_is_triplebuffer_enabled(
906bbeb64d0SHarry Wentland struct hubp *hubp)
907bbeb64d0SHarry Wentland {
908bbeb64d0SHarry Wentland struct dcn20_hubp *hubp2 = TO_DCN20_HUBP(hubp);
909bbeb64d0SHarry Wentland uint32_t triple_buffer_en = 0;
910bbeb64d0SHarry Wentland
911bbeb64d0SHarry Wentland REG_GET(DCSURF_FLIP_CONTROL2, SURFACE_TRIPLE_BUFFER_ENABLE, &triple_buffer_en);
912bbeb64d0SHarry Wentland
913bbeb64d0SHarry Wentland return (bool)triple_buffer_en;
914bbeb64d0SHarry Wentland }
915bbeb64d0SHarry Wentland
hubp2_set_flip_control_surface_gsl(struct hubp * hubp,bool enable)916bbeb64d0SHarry Wentland void hubp2_set_flip_control_surface_gsl(struct hubp *hubp, bool enable)
917bbeb64d0SHarry Wentland {
918bbeb64d0SHarry Wentland struct dcn20_hubp *hubp2 = TO_DCN20_HUBP(hubp);
919bbeb64d0SHarry Wentland
920bbeb64d0SHarry Wentland REG_UPDATE(DCSURF_FLIP_CONTROL2, SURFACE_GSL_ENABLE, enable ? 1 : 0);
921bbeb64d0SHarry Wentland }
922bbeb64d0SHarry Wentland
hubp2_is_flip_pending(struct hubp * hubp)923eced4bceSIlya Bakoulin bool hubp2_is_flip_pending(struct hubp *hubp)
924eced4bceSIlya Bakoulin {
925eced4bceSIlya Bakoulin uint32_t flip_pending = 0;
926eced4bceSIlya Bakoulin struct dcn20_hubp *hubp2 = TO_DCN20_HUBP(hubp);
927eced4bceSIlya Bakoulin struct dc_plane_address earliest_inuse_address;
928eced4bceSIlya Bakoulin
929e8cb7a4dSAric Cyr if (hubp && hubp->power_gated)
930e8cb7a4dSAric Cyr return false;
931e8cb7a4dSAric Cyr
932eced4bceSIlya Bakoulin REG_GET(DCSURF_FLIP_CONTROL,
933eced4bceSIlya Bakoulin SURFACE_FLIP_PENDING, &flip_pending);
934eced4bceSIlya Bakoulin
935eced4bceSIlya Bakoulin REG_GET(DCSURF_SURFACE_EARLIEST_INUSE,
936eced4bceSIlya Bakoulin SURFACE_EARLIEST_INUSE_ADDRESS, &earliest_inuse_address.grph.addr.low_part);
937eced4bceSIlya Bakoulin
938eced4bceSIlya Bakoulin REG_GET(DCSURF_SURFACE_EARLIEST_INUSE_HIGH,
939eced4bceSIlya Bakoulin SURFACE_EARLIEST_INUSE_ADDRESS_HIGH, &earliest_inuse_address.grph.addr.high_part);
940eced4bceSIlya Bakoulin
941eced4bceSIlya Bakoulin if (flip_pending)
942eced4bceSIlya Bakoulin return true;
943eced4bceSIlya Bakoulin
944be1fb443SAlex Hung if (hubp &&
945be1fb443SAlex Hung earliest_inuse_address.grph.addr.quad_part != hubp->request_address.grph.addr.quad_part)
946eced4bceSIlya Bakoulin return true;
947eced4bceSIlya Bakoulin
948eced4bceSIlya Bakoulin return false;
949eced4bceSIlya Bakoulin }
950eced4bceSIlya Bakoulin
hubp2_set_blank(struct hubp * hubp,bool blank)951eced4bceSIlya Bakoulin void hubp2_set_blank(struct hubp *hubp, bool blank)
952eced4bceSIlya Bakoulin {
9534866b0bfSMartin Leung hubp2_set_blank_regs(hubp, blank);
9544866b0bfSMartin Leung
9554866b0bfSMartin Leung if (blank) {
9564866b0bfSMartin Leung hubp->mpcc_id = 0xf;
9574866b0bfSMartin Leung hubp->opp_id = OPP_ID_INVALID;
9584866b0bfSMartin Leung }
9594866b0bfSMartin Leung }
9604866b0bfSMartin Leung
hubp2_set_blank_regs(struct hubp * hubp,bool blank)9614866b0bfSMartin Leung void hubp2_set_blank_regs(struct hubp *hubp, bool blank)
9624866b0bfSMartin Leung {
963eced4bceSIlya Bakoulin struct dcn20_hubp *hubp2 = TO_DCN20_HUBP(hubp);
964eced4bceSIlya Bakoulin uint32_t blank_en = blank ? 1 : 0;
965eced4bceSIlya Bakoulin
966eced4bceSIlya Bakoulin if (blank) {
967eced4bceSIlya Bakoulin uint32_t reg_val = REG_READ(DCHUBP_CNTL);
968eced4bceSIlya Bakoulin
969eced4bceSIlya Bakoulin if (reg_val) {
970eced4bceSIlya Bakoulin /* init sequence workaround: in case HUBP is
971eced4bceSIlya Bakoulin * power gated, this wait would timeout.
972eced4bceSIlya Bakoulin *
973eced4bceSIlya Bakoulin * we just wrote reg_val to non-0, if it stay 0
974eced4bceSIlya Bakoulin * it means HUBP is gated
975eced4bceSIlya Bakoulin */
976eced4bceSIlya Bakoulin REG_WAIT(DCHUBP_CNTL,
977eced4bceSIlya Bakoulin HUBP_NO_OUTSTANDING_REQ, 1,
978fe5e8f07SDillon Varone 1, 100000);
979eced4bceSIlya Bakoulin }
980eced4bceSIlya Bakoulin }
981fe5e8f07SDillon Varone
982fe5e8f07SDillon Varone REG_UPDATE_2(DCHUBP_CNTL,
983fe5e8f07SDillon Varone HUBP_BLANK_EN, blank_en,
984fe5e8f07SDillon Varone HUBP_TTU_DISABLE, 0);
985eced4bceSIlya Bakoulin }
986eced4bceSIlya Bakoulin
hubp2_cursor_set_position(struct hubp * hubp,const struct dc_cursor_position * pos,const struct dc_cursor_mi_param * param)987eced4bceSIlya Bakoulin void hubp2_cursor_set_position(
988eced4bceSIlya Bakoulin struct hubp *hubp,
989eced4bceSIlya Bakoulin const struct dc_cursor_position *pos,
990eced4bceSIlya Bakoulin const struct dc_cursor_mi_param *param)
991eced4bceSIlya Bakoulin {
992eced4bceSIlya Bakoulin struct dcn20_hubp *hubp2 = TO_DCN20_HUBP(hubp);
993a26a54fbSDavid Galiffi int x_pos = pos->x - param->viewport.x;
994a26a54fbSDavid Galiffi int y_pos = pos->y - param->viewport.y;
995eced4bceSIlya Bakoulin int x_hotspot = pos->x_hotspot;
996eced4bceSIlya Bakoulin int y_hotspot = pos->y_hotspot;
997a26a54fbSDavid Galiffi int src_x_offset = x_pos - pos->x_hotspot;
998a26a54fbSDavid Galiffi int src_y_offset = y_pos - pos->y_hotspot;
999c0057622SJaehyun Chung int cursor_height = (int)hubp->curs_attr.height;
1000c0057622SJaehyun Chung int cursor_width = (int)hubp->curs_attr.width;
1001eced4bceSIlya Bakoulin uint32_t dst_x_offset;
1002eced4bceSIlya Bakoulin uint32_t cur_en = pos->enable ? 1 : 0;
1003eced4bceSIlya Bakoulin
10041b0da5a3SDavid Zhang hubp->curs_pos = *pos;
10051b0da5a3SDavid Zhang
1006eced4bceSIlya Bakoulin /*
1007eced4bceSIlya Bakoulin * Guard aganst cursor_set_position() from being called with invalid
1008eced4bceSIlya Bakoulin * attributes
1009eced4bceSIlya Bakoulin *
1010eced4bceSIlya Bakoulin * TODO: Look at combining cursor_set_position() and
1011eced4bceSIlya Bakoulin * cursor_set_attributes() into cursor_update()
1012eced4bceSIlya Bakoulin */
1013eced4bceSIlya Bakoulin if (hubp->curs_attr.address.quad_part == 0)
1014eced4bceSIlya Bakoulin return;
1015eced4bceSIlya Bakoulin
1016a26a54fbSDavid Galiffi // Transform cursor width / height and hotspots for offset calculations
1017eced4bceSIlya Bakoulin if (param->rotation == ROTATION_ANGLE_90 || param->rotation == ROTATION_ANGLE_270) {
1018c0057622SJaehyun Chung swap(cursor_height, cursor_width);
1019a26a54fbSDavid Galiffi swap(x_hotspot, y_hotspot);
1020a26a54fbSDavid Galiffi
1021c0057622SJaehyun Chung if (param->rotation == ROTATION_ANGLE_90) {
1022a26a54fbSDavid Galiffi // hotspot = (-y, x)
1023a26a54fbSDavid Galiffi src_x_offset = x_pos - (cursor_width - x_hotspot);
1024a26a54fbSDavid Galiffi src_y_offset = y_pos - y_hotspot;
1025a26a54fbSDavid Galiffi } else if (param->rotation == ROTATION_ANGLE_270) {
1026a26a54fbSDavid Galiffi // hotspot = (y, -x)
1027a26a54fbSDavid Galiffi src_x_offset = x_pos - x_hotspot;
1028a26a54fbSDavid Galiffi src_y_offset = y_pos - (cursor_height - y_hotspot);
1029c0057622SJaehyun Chung }
1030c0057622SJaehyun Chung } else if (param->rotation == ROTATION_ANGLE_180) {
1031a26a54fbSDavid Galiffi // hotspot = (-x, -y)
10329d84c7efSMartin Tsai if (!param->mirror)
1033a26a54fbSDavid Galiffi src_x_offset = x_pos - (cursor_width - x_hotspot);
1034eced4bceSIlya Bakoulin
1035a26a54fbSDavid Galiffi src_y_offset = y_pos - (cursor_height - y_hotspot);
1036eced4bceSIlya Bakoulin }
1037eced4bceSIlya Bakoulin
1038eced4bceSIlya Bakoulin dst_x_offset = (src_x_offset >= 0) ? src_x_offset : 0;
1039eced4bceSIlya Bakoulin dst_x_offset *= param->ref_clk_khz;
1040eced4bceSIlya Bakoulin dst_x_offset /= param->pixel_clk_khz;
1041eced4bceSIlya Bakoulin
1042eced4bceSIlya Bakoulin ASSERT(param->h_scale_ratio.value);
1043eced4bceSIlya Bakoulin
1044eced4bceSIlya Bakoulin if (param->h_scale_ratio.value)
1045eced4bceSIlya Bakoulin dst_x_offset = dc_fixpt_floor(dc_fixpt_div(
1046eced4bceSIlya Bakoulin dc_fixpt_from_int(dst_x_offset),
1047eced4bceSIlya Bakoulin param->h_scale_ratio));
1048eced4bceSIlya Bakoulin
1049eced4bceSIlya Bakoulin if (src_x_offset >= (int)param->viewport.width)
1050eced4bceSIlya Bakoulin cur_en = 0; /* not visible beyond right edge*/
1051eced4bceSIlya Bakoulin
1052c0057622SJaehyun Chung if (src_x_offset + cursor_width <= 0)
1053eced4bceSIlya Bakoulin cur_en = 0; /* not visible beyond left edge*/
1054eced4bceSIlya Bakoulin
1055eced4bceSIlya Bakoulin if (src_y_offset >= (int)param->viewport.height)
1056eced4bceSIlya Bakoulin cur_en = 0; /* not visible beyond bottom edge*/
1057eced4bceSIlya Bakoulin
1058c0057622SJaehyun Chung if (src_y_offset + cursor_height <= 0)
1059eced4bceSIlya Bakoulin cur_en = 0; /* not visible beyond top edge*/
1060eced4bceSIlya Bakoulin
1061*024771f3SAric Cyr if (hubp->pos.cur_ctl.bits.cur_enable != cur_en) {
1062eced4bceSIlya Bakoulin if (cur_en && REG_READ(CURSOR_SURFACE_ADDRESS) == 0)
1063eced4bceSIlya Bakoulin hubp->funcs->set_cursor_attributes(hubp, &hubp->curs_attr);
1064eced4bceSIlya Bakoulin
1065eced4bceSIlya Bakoulin REG_UPDATE(CURSOR_CONTROL,
1066eced4bceSIlya Bakoulin CURSOR_ENABLE, cur_en);
1067*024771f3SAric Cyr }
1068eced4bceSIlya Bakoulin
1069eced4bceSIlya Bakoulin REG_SET_2(CURSOR_POSITION, 0,
1070eced4bceSIlya Bakoulin CURSOR_X_POSITION, pos->x,
1071eced4bceSIlya Bakoulin CURSOR_Y_POSITION, pos->y);
1072eced4bceSIlya Bakoulin
1073eced4bceSIlya Bakoulin REG_SET_2(CURSOR_HOT_SPOT, 0,
1074a26a54fbSDavid Galiffi CURSOR_HOT_SPOT_X, pos->x_hotspot,
1075a26a54fbSDavid Galiffi CURSOR_HOT_SPOT_Y, pos->y_hotspot);
1076eced4bceSIlya Bakoulin
1077eced4bceSIlya Bakoulin REG_SET(CURSOR_DST_OFFSET, 0,
1078eced4bceSIlya Bakoulin CURSOR_DST_X_OFFSET, dst_x_offset);
1079eced4bceSIlya Bakoulin /* TODO Handle surface pixel formats other than 4:4:4 */
1080b73353f7SMax Tseng /* Cursor Position Register Config */
1081b73353f7SMax Tseng hubp->pos.cur_ctl.bits.cur_enable = cur_en;
1082b73353f7SMax Tseng hubp->pos.position.bits.x_pos = pos->x;
1083b73353f7SMax Tseng hubp->pos.position.bits.y_pos = pos->y;
1084a26a54fbSDavid Galiffi hubp->pos.hot_spot.bits.x_hot = pos->x_hotspot;
1085a26a54fbSDavid Galiffi hubp->pos.hot_spot.bits.y_hot = pos->y_hotspot;
1086b73353f7SMax Tseng hubp->pos.dst_offset.bits.dst_x_offset = dst_x_offset;
1087b73353f7SMax Tseng /* Cursor Rectangle Cache
1088b73353f7SMax Tseng * Cursor bitmaps have different hotspot values
1089b73353f7SMax Tseng * There's a possibility that the above logic returns a negative value,
1090b73353f7SMax Tseng * so we clamp them to 0
1091b73353f7SMax Tseng */
1092b73353f7SMax Tseng if (src_x_offset < 0)
1093b73353f7SMax Tseng src_x_offset = 0;
1094b73353f7SMax Tseng if (src_y_offset < 0)
1095b73353f7SMax Tseng src_y_offset = 0;
1096b73353f7SMax Tseng /* Save necessary cursor info x, y position. w, h is saved in attribute func. */
1097f528ee14SHamza Mahfooz if (param->stream->link->psr_settings.psr_version >= DC_PSR_VERSION_SU_1 &&
1098f528ee14SHamza Mahfooz param->rotation != ROTATION_ANGLE_0) {
1099f528ee14SHamza Mahfooz hubp->cur_rect.x = 0;
1100f528ee14SHamza Mahfooz hubp->cur_rect.y = 0;
1101f528ee14SHamza Mahfooz hubp->cur_rect.w = param->stream->timing.h_addressable;
1102f528ee14SHamza Mahfooz hubp->cur_rect.h = param->stream->timing.v_addressable;
1103f528ee14SHamza Mahfooz } else {
1104b73353f7SMax Tseng hubp->cur_rect.x = src_x_offset + param->viewport.x;
1105b73353f7SMax Tseng hubp->cur_rect.y = src_y_offset + param->viewport.y;
1106eced4bceSIlya Bakoulin }
1107f528ee14SHamza Mahfooz }
1108eced4bceSIlya Bakoulin
hubp2_clk_cntl(struct hubp * hubp,bool enable)1109eced4bceSIlya Bakoulin void hubp2_clk_cntl(struct hubp *hubp, bool enable)
1110eced4bceSIlya Bakoulin {
1111eced4bceSIlya Bakoulin struct dcn20_hubp *hubp2 = TO_DCN20_HUBP(hubp);
1112eced4bceSIlya Bakoulin uint32_t clk_enable = enable ? 1 : 0;
1113eced4bceSIlya Bakoulin
1114eced4bceSIlya Bakoulin REG_UPDATE(HUBP_CLK_CNTL, HUBP_CLOCK_ENABLE, clk_enable);
1115eced4bceSIlya Bakoulin }
1116eced4bceSIlya Bakoulin
hubp2_vtg_sel(struct hubp * hubp,uint32_t otg_inst)1117eced4bceSIlya Bakoulin void hubp2_vtg_sel(struct hubp *hubp, uint32_t otg_inst)
1118eced4bceSIlya Bakoulin {
1119eced4bceSIlya Bakoulin struct dcn20_hubp *hubp2 = TO_DCN20_HUBP(hubp);
1120eced4bceSIlya Bakoulin
1121eced4bceSIlya Bakoulin REG_UPDATE(DCHUBP_CNTL, HUBP_VTG_SEL, otg_inst);
1122eced4bceSIlya Bakoulin }
1123eced4bceSIlya Bakoulin
hubp2_clear_underflow(struct hubp * hubp)1124eced4bceSIlya Bakoulin void hubp2_clear_underflow(struct hubp *hubp)
1125eced4bceSIlya Bakoulin {
1126eced4bceSIlya Bakoulin struct dcn20_hubp *hubp2 = TO_DCN20_HUBP(hubp);
1127eced4bceSIlya Bakoulin
1128eced4bceSIlya Bakoulin REG_UPDATE(DCHUBP_CNTL, HUBP_UNDERFLOW_CLEAR, 1);
1129eced4bceSIlya Bakoulin }
1130eced4bceSIlya Bakoulin
hubp2_read_state_common(struct hubp * hubp)1131eced4bceSIlya Bakoulin void hubp2_read_state_common(struct hubp *hubp)
1132eced4bceSIlya Bakoulin {
1133eced4bceSIlya Bakoulin struct dcn20_hubp *hubp2 = TO_DCN20_HUBP(hubp);
1134eced4bceSIlya Bakoulin struct dcn_hubp_state *s = &hubp2->state;
1135eced4bceSIlya Bakoulin struct _vcs_dpi_display_dlg_regs_st *dlg_attr = &s->dlg_attr;
1136eced4bceSIlya Bakoulin struct _vcs_dpi_display_ttu_regs_st *ttu_attr = &s->ttu_attr;
1137eced4bceSIlya Bakoulin struct _vcs_dpi_display_rq_regs_st *rq_regs = &s->rq_regs;
1138eced4bceSIlya Bakoulin
1139eced4bceSIlya Bakoulin /* Requester */
1140eced4bceSIlya Bakoulin REG_GET(HUBPRET_CONTROL,
1141eced4bceSIlya Bakoulin DET_BUF_PLANE1_BASE_ADDRESS, &rq_regs->plane1_base_address);
1142eced4bceSIlya Bakoulin REG_GET_4(DCN_EXPANSION_MODE,
1143eced4bceSIlya Bakoulin DRQ_EXPANSION_MODE, &rq_regs->drq_expansion_mode,
1144eced4bceSIlya Bakoulin PRQ_EXPANSION_MODE, &rq_regs->prq_expansion_mode,
1145eced4bceSIlya Bakoulin MRQ_EXPANSION_MODE, &rq_regs->mrq_expansion_mode,
1146eced4bceSIlya Bakoulin CRQ_EXPANSION_MODE, &rq_regs->crq_expansion_mode);
1147eced4bceSIlya Bakoulin
114898e95e4fSJosip Pavic REG_GET(DCN_VM_SYSTEM_APERTURE_HIGH_ADDR,
114998e95e4fSJosip Pavic MC_VM_SYSTEM_APERTURE_HIGH_ADDR, &rq_regs->aperture_high_addr);
115098e95e4fSJosip Pavic
115198e95e4fSJosip Pavic REG_GET(DCN_VM_SYSTEM_APERTURE_LOW_ADDR,
115298e95e4fSJosip Pavic MC_VM_SYSTEM_APERTURE_LOW_ADDR, &rq_regs->aperture_low_addr);
115398e95e4fSJosip Pavic
1154eced4bceSIlya Bakoulin /* DLG - Per hubp */
1155eced4bceSIlya Bakoulin REG_GET_2(BLANK_OFFSET_0,
1156eced4bceSIlya Bakoulin REFCYC_H_BLANK_END, &dlg_attr->refcyc_h_blank_end,
1157eced4bceSIlya Bakoulin DLG_V_BLANK_END, &dlg_attr->dlg_vblank_end);
1158eced4bceSIlya Bakoulin
1159eced4bceSIlya Bakoulin REG_GET(BLANK_OFFSET_1,
1160eced4bceSIlya Bakoulin MIN_DST_Y_NEXT_START, &dlg_attr->min_dst_y_next_start);
1161eced4bceSIlya Bakoulin
1162eced4bceSIlya Bakoulin REG_GET(DST_DIMENSIONS,
1163eced4bceSIlya Bakoulin REFCYC_PER_HTOTAL, &dlg_attr->refcyc_per_htotal);
1164eced4bceSIlya Bakoulin
1165eced4bceSIlya Bakoulin REG_GET_2(DST_AFTER_SCALER,
1166eced4bceSIlya Bakoulin REFCYC_X_AFTER_SCALER, &dlg_attr->refcyc_x_after_scaler,
1167eced4bceSIlya Bakoulin DST_Y_AFTER_SCALER, &dlg_attr->dst_y_after_scaler);
1168eced4bceSIlya Bakoulin
1169eced4bceSIlya Bakoulin if (REG(PREFETCH_SETTINS))
1170eced4bceSIlya Bakoulin REG_GET_2(PREFETCH_SETTINS,
1171eced4bceSIlya Bakoulin DST_Y_PREFETCH, &dlg_attr->dst_y_prefetch,
1172eced4bceSIlya Bakoulin VRATIO_PREFETCH, &dlg_attr->vratio_prefetch);
1173eced4bceSIlya Bakoulin else
1174eced4bceSIlya Bakoulin REG_GET_2(PREFETCH_SETTINGS,
1175eced4bceSIlya Bakoulin DST_Y_PREFETCH, &dlg_attr->dst_y_prefetch,
1176eced4bceSIlya Bakoulin VRATIO_PREFETCH, &dlg_attr->vratio_prefetch);
1177eced4bceSIlya Bakoulin
1178eced4bceSIlya Bakoulin REG_GET_2(VBLANK_PARAMETERS_0,
1179eced4bceSIlya Bakoulin DST_Y_PER_VM_VBLANK, &dlg_attr->dst_y_per_vm_vblank,
1180eced4bceSIlya Bakoulin DST_Y_PER_ROW_VBLANK, &dlg_attr->dst_y_per_row_vblank);
1181eced4bceSIlya Bakoulin
1182eced4bceSIlya Bakoulin REG_GET(REF_FREQ_TO_PIX_FREQ,
1183eced4bceSIlya Bakoulin REF_FREQ_TO_PIX_FREQ, &dlg_attr->ref_freq_to_pix_freq);
1184eced4bceSIlya Bakoulin
1185eced4bceSIlya Bakoulin /* DLG - Per luma/chroma */
1186eced4bceSIlya Bakoulin REG_GET(VBLANK_PARAMETERS_1,
1187eced4bceSIlya Bakoulin REFCYC_PER_PTE_GROUP_VBLANK_L, &dlg_attr->refcyc_per_pte_group_vblank_l);
1188eced4bceSIlya Bakoulin
1189eced4bceSIlya Bakoulin REG_GET(VBLANK_PARAMETERS_3,
1190eced4bceSIlya Bakoulin REFCYC_PER_META_CHUNK_VBLANK_L, &dlg_attr->refcyc_per_meta_chunk_vblank_l);
1191eced4bceSIlya Bakoulin
1192eced4bceSIlya Bakoulin if (REG(NOM_PARAMETERS_0))
1193eced4bceSIlya Bakoulin REG_GET(NOM_PARAMETERS_0,
1194eced4bceSIlya Bakoulin DST_Y_PER_PTE_ROW_NOM_L, &dlg_attr->dst_y_per_pte_row_nom_l);
1195eced4bceSIlya Bakoulin
1196eced4bceSIlya Bakoulin if (REG(NOM_PARAMETERS_1))
1197eced4bceSIlya Bakoulin REG_GET(NOM_PARAMETERS_1,
1198eced4bceSIlya Bakoulin REFCYC_PER_PTE_GROUP_NOM_L, &dlg_attr->refcyc_per_pte_group_nom_l);
1199eced4bceSIlya Bakoulin
1200eced4bceSIlya Bakoulin REG_GET(NOM_PARAMETERS_4,
1201eced4bceSIlya Bakoulin DST_Y_PER_META_ROW_NOM_L, &dlg_attr->dst_y_per_meta_row_nom_l);
1202eced4bceSIlya Bakoulin
1203eced4bceSIlya Bakoulin REG_GET(NOM_PARAMETERS_5,
1204eced4bceSIlya Bakoulin REFCYC_PER_META_CHUNK_NOM_L, &dlg_attr->refcyc_per_meta_chunk_nom_l);
1205eced4bceSIlya Bakoulin
1206eced4bceSIlya Bakoulin REG_GET_2(PER_LINE_DELIVERY_PRE,
1207eced4bceSIlya Bakoulin REFCYC_PER_LINE_DELIVERY_PRE_L, &dlg_attr->refcyc_per_line_delivery_pre_l,
1208eced4bceSIlya Bakoulin REFCYC_PER_LINE_DELIVERY_PRE_C, &dlg_attr->refcyc_per_line_delivery_pre_c);
1209eced4bceSIlya Bakoulin
1210eced4bceSIlya Bakoulin REG_GET_2(PER_LINE_DELIVERY,
1211eced4bceSIlya Bakoulin REFCYC_PER_LINE_DELIVERY_L, &dlg_attr->refcyc_per_line_delivery_l,
1212eced4bceSIlya Bakoulin REFCYC_PER_LINE_DELIVERY_C, &dlg_attr->refcyc_per_line_delivery_c);
1213eced4bceSIlya Bakoulin
1214eced4bceSIlya Bakoulin if (REG(PREFETCH_SETTINS_C))
1215eced4bceSIlya Bakoulin REG_GET(PREFETCH_SETTINS_C,
1216eced4bceSIlya Bakoulin VRATIO_PREFETCH_C, &dlg_attr->vratio_prefetch_c);
1217eced4bceSIlya Bakoulin else
1218eced4bceSIlya Bakoulin REG_GET(PREFETCH_SETTINGS_C,
1219eced4bceSIlya Bakoulin VRATIO_PREFETCH_C, &dlg_attr->vratio_prefetch_c);
1220eced4bceSIlya Bakoulin
1221eced4bceSIlya Bakoulin REG_GET(VBLANK_PARAMETERS_2,
1222eced4bceSIlya Bakoulin REFCYC_PER_PTE_GROUP_VBLANK_C, &dlg_attr->refcyc_per_pte_group_vblank_c);
1223eced4bceSIlya Bakoulin
1224eced4bceSIlya Bakoulin REG_GET(VBLANK_PARAMETERS_4,
1225eced4bceSIlya Bakoulin REFCYC_PER_META_CHUNK_VBLANK_C, &dlg_attr->refcyc_per_meta_chunk_vblank_c);
1226eced4bceSIlya Bakoulin
1227eced4bceSIlya Bakoulin if (REG(NOM_PARAMETERS_2))
1228eced4bceSIlya Bakoulin REG_GET(NOM_PARAMETERS_2,
1229eced4bceSIlya Bakoulin DST_Y_PER_PTE_ROW_NOM_C, &dlg_attr->dst_y_per_pte_row_nom_c);
1230eced4bceSIlya Bakoulin
1231eced4bceSIlya Bakoulin if (REG(NOM_PARAMETERS_3))
1232eced4bceSIlya Bakoulin REG_GET(NOM_PARAMETERS_3,
1233eced4bceSIlya Bakoulin REFCYC_PER_PTE_GROUP_NOM_C, &dlg_attr->refcyc_per_pte_group_nom_c);
1234eced4bceSIlya Bakoulin
1235eced4bceSIlya Bakoulin REG_GET(NOM_PARAMETERS_6,
1236eced4bceSIlya Bakoulin DST_Y_PER_META_ROW_NOM_C, &dlg_attr->dst_y_per_meta_row_nom_c);
1237eced4bceSIlya Bakoulin
1238eced4bceSIlya Bakoulin REG_GET(NOM_PARAMETERS_7,
1239eced4bceSIlya Bakoulin REFCYC_PER_META_CHUNK_NOM_C, &dlg_attr->refcyc_per_meta_chunk_nom_c);
1240eced4bceSIlya Bakoulin
1241eced4bceSIlya Bakoulin /* TTU - per hubp */
1242eced4bceSIlya Bakoulin REG_GET_2(DCN_TTU_QOS_WM,
1243eced4bceSIlya Bakoulin QoS_LEVEL_LOW_WM, &ttu_attr->qos_level_low_wm,
1244eced4bceSIlya Bakoulin QoS_LEVEL_HIGH_WM, &ttu_attr->qos_level_high_wm);
1245eced4bceSIlya Bakoulin
1246eced4bceSIlya Bakoulin REG_GET_2(DCN_GLOBAL_TTU_CNTL,
1247eced4bceSIlya Bakoulin MIN_TTU_VBLANK, &ttu_attr->min_ttu_vblank,
1248eced4bceSIlya Bakoulin QoS_LEVEL_FLIP, &ttu_attr->qos_level_flip);
1249eced4bceSIlya Bakoulin
1250eced4bceSIlya Bakoulin /* TTU - per luma/chroma */
1251eced4bceSIlya Bakoulin /* Assumed surf0 is luma and 1 is chroma */
1252eced4bceSIlya Bakoulin
1253eced4bceSIlya Bakoulin REG_GET_3(DCN_SURF0_TTU_CNTL0,
1254eced4bceSIlya Bakoulin REFCYC_PER_REQ_DELIVERY, &ttu_attr->refcyc_per_req_delivery_l,
1255eced4bceSIlya Bakoulin QoS_LEVEL_FIXED, &ttu_attr->qos_level_fixed_l,
1256eced4bceSIlya Bakoulin QoS_RAMP_DISABLE, &ttu_attr->qos_ramp_disable_l);
1257eced4bceSIlya Bakoulin
1258eced4bceSIlya Bakoulin REG_GET(DCN_SURF0_TTU_CNTL1,
1259eced4bceSIlya Bakoulin REFCYC_PER_REQ_DELIVERY_PRE,
1260eced4bceSIlya Bakoulin &ttu_attr->refcyc_per_req_delivery_pre_l);
1261eced4bceSIlya Bakoulin
1262eced4bceSIlya Bakoulin REG_GET_3(DCN_SURF1_TTU_CNTL0,
1263eced4bceSIlya Bakoulin REFCYC_PER_REQ_DELIVERY, &ttu_attr->refcyc_per_req_delivery_c,
1264eced4bceSIlya Bakoulin QoS_LEVEL_FIXED, &ttu_attr->qos_level_fixed_c,
1265eced4bceSIlya Bakoulin QoS_RAMP_DISABLE, &ttu_attr->qos_ramp_disable_c);
1266eced4bceSIlya Bakoulin
1267eced4bceSIlya Bakoulin REG_GET(DCN_SURF1_TTU_CNTL1,
1268eced4bceSIlya Bakoulin REFCYC_PER_REQ_DELIVERY_PRE,
1269eced4bceSIlya Bakoulin &ttu_attr->refcyc_per_req_delivery_pre_c);
1270eced4bceSIlya Bakoulin
1271eced4bceSIlya Bakoulin /* Rest of hubp */
1272eced4bceSIlya Bakoulin REG_GET(DCSURF_SURFACE_CONFIG,
1273eced4bceSIlya Bakoulin SURFACE_PIXEL_FORMAT, &s->pixel_format);
1274eced4bceSIlya Bakoulin
1275eced4bceSIlya Bakoulin REG_GET(DCSURF_SURFACE_EARLIEST_INUSE_HIGH,
1276eced4bceSIlya Bakoulin SURFACE_EARLIEST_INUSE_ADDRESS_HIGH, &s->inuse_addr_hi);
1277eced4bceSIlya Bakoulin
1278eced4bceSIlya Bakoulin REG_GET(DCSURF_SURFACE_EARLIEST_INUSE,
1279eced4bceSIlya Bakoulin SURFACE_EARLIEST_INUSE_ADDRESS, &s->inuse_addr_lo);
1280eced4bceSIlya Bakoulin
1281eced4bceSIlya Bakoulin REG_GET_2(DCSURF_PRI_VIEWPORT_DIMENSION,
1282eced4bceSIlya Bakoulin PRI_VIEWPORT_WIDTH, &s->viewport_width,
1283eced4bceSIlya Bakoulin PRI_VIEWPORT_HEIGHT, &s->viewport_height);
1284eced4bceSIlya Bakoulin
1285eced4bceSIlya Bakoulin REG_GET_2(DCSURF_SURFACE_CONFIG,
1286eced4bceSIlya Bakoulin ROTATION_ANGLE, &s->rotation_angle,
1287eced4bceSIlya Bakoulin H_MIRROR_EN, &s->h_mirror_en);
1288eced4bceSIlya Bakoulin
1289eced4bceSIlya Bakoulin REG_GET(DCSURF_TILING_CONFIG,
1290eced4bceSIlya Bakoulin SW_MODE, &s->sw_mode);
1291eced4bceSIlya Bakoulin
1292eced4bceSIlya Bakoulin REG_GET(DCSURF_SURFACE_CONTROL,
1293eced4bceSIlya Bakoulin PRIMARY_SURFACE_DCC_EN, &s->dcc_en);
1294eced4bceSIlya Bakoulin
1295eced4bceSIlya Bakoulin REG_GET_3(DCHUBP_CNTL,
1296eced4bceSIlya Bakoulin HUBP_BLANK_EN, &s->blank_en,
1297eced4bceSIlya Bakoulin HUBP_TTU_DISABLE, &s->ttu_disable,
1298eced4bceSIlya Bakoulin HUBP_UNDERFLOW_STATUS, &s->underflow_status);
1299eced4bceSIlya Bakoulin
1300d3698ceaSLeo (Hanghong) Ma REG_GET(HUBP_CLK_CNTL,
1301d3698ceaSLeo (Hanghong) Ma HUBP_CLOCK_ENABLE, &s->clock_en);
1302d3698ceaSLeo (Hanghong) Ma
1303eced4bceSIlya Bakoulin REG_GET(DCN_GLOBAL_TTU_CNTL,
1304eced4bceSIlya Bakoulin MIN_TTU_VBLANK, &s->min_ttu_vblank);
1305eced4bceSIlya Bakoulin
1306eced4bceSIlya Bakoulin REG_GET_2(DCN_TTU_QOS_WM,
1307eced4bceSIlya Bakoulin QoS_LEVEL_LOW_WM, &s->qos_level_low_wm,
1308eced4bceSIlya Bakoulin QoS_LEVEL_HIGH_WM, &s->qos_level_high_wm);
1309eced4bceSIlya Bakoulin
131098e95e4fSJosip Pavic REG_GET(DCSURF_PRIMARY_SURFACE_ADDRESS,
131198e95e4fSJosip Pavic PRIMARY_SURFACE_ADDRESS, &s->primary_surface_addr_lo);
131298e95e4fSJosip Pavic
131398e95e4fSJosip Pavic REG_GET(DCSURF_PRIMARY_SURFACE_ADDRESS_HIGH,
131498e95e4fSJosip Pavic PRIMARY_SURFACE_ADDRESS, &s->primary_surface_addr_hi);
131598e95e4fSJosip Pavic
131698e95e4fSJosip Pavic REG_GET(DCSURF_PRIMARY_META_SURFACE_ADDRESS,
131798e95e4fSJosip Pavic PRIMARY_META_SURFACE_ADDRESS, &s->primary_meta_addr_lo);
131898e95e4fSJosip Pavic
131998e95e4fSJosip Pavic REG_GET(DCSURF_PRIMARY_META_SURFACE_ADDRESS_HIGH,
132098e95e4fSJosip Pavic PRIMARY_META_SURFACE_ADDRESS, &s->primary_meta_addr_hi);
1321eced4bceSIlya Bakoulin }
1322eced4bceSIlya Bakoulin
hubp2_read_state(struct hubp * hubp)1323eced4bceSIlya Bakoulin void hubp2_read_state(struct hubp *hubp)
1324eced4bceSIlya Bakoulin {
1325eced4bceSIlya Bakoulin struct dcn20_hubp *hubp2 = TO_DCN20_HUBP(hubp);
1326eced4bceSIlya Bakoulin struct dcn_hubp_state *s = &hubp2->state;
1327eced4bceSIlya Bakoulin struct _vcs_dpi_display_rq_regs_st *rq_regs = &s->rq_regs;
1328eced4bceSIlya Bakoulin
1329eced4bceSIlya Bakoulin hubp2_read_state_common(hubp);
1330eced4bceSIlya Bakoulin
1331eced4bceSIlya Bakoulin REG_GET_8(DCHUBP_REQ_SIZE_CONFIG,
1332eced4bceSIlya Bakoulin CHUNK_SIZE, &rq_regs->rq_regs_l.chunk_size,
1333eced4bceSIlya Bakoulin MIN_CHUNK_SIZE, &rq_regs->rq_regs_l.min_chunk_size,
1334eced4bceSIlya Bakoulin META_CHUNK_SIZE, &rq_regs->rq_regs_l.meta_chunk_size,
1335eced4bceSIlya Bakoulin MIN_META_CHUNK_SIZE, &rq_regs->rq_regs_l.min_meta_chunk_size,
1336eced4bceSIlya Bakoulin DPTE_GROUP_SIZE, &rq_regs->rq_regs_l.dpte_group_size,
1337eced4bceSIlya Bakoulin MPTE_GROUP_SIZE, &rq_regs->rq_regs_l.mpte_group_size,
1338eced4bceSIlya Bakoulin SWATH_HEIGHT, &rq_regs->rq_regs_l.swath_height,
1339eced4bceSIlya Bakoulin PTE_ROW_HEIGHT_LINEAR, &rq_regs->rq_regs_l.pte_row_height_linear);
1340eced4bceSIlya Bakoulin
1341eced4bceSIlya Bakoulin REG_GET_8(DCHUBP_REQ_SIZE_CONFIG_C,
1342eced4bceSIlya Bakoulin CHUNK_SIZE_C, &rq_regs->rq_regs_c.chunk_size,
1343eced4bceSIlya Bakoulin MIN_CHUNK_SIZE_C, &rq_regs->rq_regs_c.min_chunk_size,
1344eced4bceSIlya Bakoulin META_CHUNK_SIZE_C, &rq_regs->rq_regs_c.meta_chunk_size,
1345eced4bceSIlya Bakoulin MIN_META_CHUNK_SIZE_C, &rq_regs->rq_regs_c.min_meta_chunk_size,
1346eced4bceSIlya Bakoulin DPTE_GROUP_SIZE_C, &rq_regs->rq_regs_c.dpte_group_size,
1347eced4bceSIlya Bakoulin MPTE_GROUP_SIZE_C, &rq_regs->rq_regs_c.mpte_group_size,
1348eced4bceSIlya Bakoulin SWATH_HEIGHT_C, &rq_regs->rq_regs_c.swath_height,
1349eced4bceSIlya Bakoulin PTE_ROW_HEIGHT_LINEAR_C, &rq_regs->rq_regs_c.pte_row_height_linear);
1350eced4bceSIlya Bakoulin
13517eb9d1e0SAlvin Lee if (REG(DCHUBP_CNTL))
13527eb9d1e0SAlvin Lee s->hubp_cntl = REG_READ(DCHUBP_CNTL);
13537eb9d1e0SAlvin Lee
13547eb9d1e0SAlvin Lee if (REG(DCSURF_FLIP_CONTROL))
13557eb9d1e0SAlvin Lee s->flip_control = REG_READ(DCSURF_FLIP_CONTROL);
13567eb9d1e0SAlvin Lee
1357eced4bceSIlya Bakoulin }
1358eced4bceSIlya Bakoulin
hubp2_validate_dml_output(struct hubp * hubp,struct dc_context * ctx,struct _vcs_dpi_display_rq_regs_st * dml_rq_regs,struct _vcs_dpi_display_dlg_regs_st * dml_dlg_attr,struct _vcs_dpi_display_ttu_regs_st * dml_ttu_attr)1359240e6d25SIsabella Basso static void hubp2_validate_dml_output(struct hubp *hubp,
1360b9fe5151SJaehyun Chung struct dc_context *ctx,
1361b9fe5151SJaehyun Chung struct _vcs_dpi_display_rq_regs_st *dml_rq_regs,
1362b9fe5151SJaehyun Chung struct _vcs_dpi_display_dlg_regs_st *dml_dlg_attr,
1363b9fe5151SJaehyun Chung struct _vcs_dpi_display_ttu_regs_st *dml_ttu_attr)
1364b9fe5151SJaehyun Chung {
1365b9fe5151SJaehyun Chung struct dcn20_hubp *hubp2 = TO_DCN20_HUBP(hubp);
1366b9fe5151SJaehyun Chung struct _vcs_dpi_display_rq_regs_st rq_regs = {0};
1367b9fe5151SJaehyun Chung struct _vcs_dpi_display_dlg_regs_st dlg_attr = {0};
1368b9fe5151SJaehyun Chung struct _vcs_dpi_display_ttu_regs_st ttu_attr = {0};
1369b9fe5151SJaehyun Chung DC_LOGGER_INIT(ctx->logger);
1370a4cea116SJaehyun Chung DC_LOG_DEBUG("DML Validation | Running Validation");
1371b9fe5151SJaehyun Chung
1372b9fe5151SJaehyun Chung /* Requestor Regs */
1373b9fe5151SJaehyun Chung REG_GET(HUBPRET_CONTROL,
1374b9fe5151SJaehyun Chung DET_BUF_PLANE1_BASE_ADDRESS, &rq_regs.plane1_base_address);
1375b9fe5151SJaehyun Chung REG_GET_4(DCN_EXPANSION_MODE,
1376b9fe5151SJaehyun Chung DRQ_EXPANSION_MODE, &rq_regs.drq_expansion_mode,
1377b9fe5151SJaehyun Chung PRQ_EXPANSION_MODE, &rq_regs.prq_expansion_mode,
1378b9fe5151SJaehyun Chung MRQ_EXPANSION_MODE, &rq_regs.mrq_expansion_mode,
1379b9fe5151SJaehyun Chung CRQ_EXPANSION_MODE, &rq_regs.crq_expansion_mode);
1380b9fe5151SJaehyun Chung REG_GET_8(DCHUBP_REQ_SIZE_CONFIG,
1381b9fe5151SJaehyun Chung CHUNK_SIZE, &rq_regs.rq_regs_l.chunk_size,
1382b9fe5151SJaehyun Chung MIN_CHUNK_SIZE, &rq_regs.rq_regs_l.min_chunk_size,
1383b9fe5151SJaehyun Chung META_CHUNK_SIZE, &rq_regs.rq_regs_l.meta_chunk_size,
1384b9fe5151SJaehyun Chung MIN_META_CHUNK_SIZE, &rq_regs.rq_regs_l.min_meta_chunk_size,
1385b9fe5151SJaehyun Chung DPTE_GROUP_SIZE, &rq_regs.rq_regs_l.dpte_group_size,
1386b9fe5151SJaehyun Chung MPTE_GROUP_SIZE, &rq_regs.rq_regs_l.mpte_group_size,
1387b9fe5151SJaehyun Chung SWATH_HEIGHT, &rq_regs.rq_regs_l.swath_height,
1388b9fe5151SJaehyun Chung PTE_ROW_HEIGHT_LINEAR, &rq_regs.rq_regs_l.pte_row_height_linear);
1389b9fe5151SJaehyun Chung REG_GET_8(DCHUBP_REQ_SIZE_CONFIG_C,
1390b9fe5151SJaehyun Chung CHUNK_SIZE_C, &rq_regs.rq_regs_c.chunk_size,
1391b9fe5151SJaehyun Chung MIN_CHUNK_SIZE_C, &rq_regs.rq_regs_c.min_chunk_size,
1392b9fe5151SJaehyun Chung META_CHUNK_SIZE_C, &rq_regs.rq_regs_c.meta_chunk_size,
1393b9fe5151SJaehyun Chung MIN_META_CHUNK_SIZE_C, &rq_regs.rq_regs_c.min_meta_chunk_size,
1394b9fe5151SJaehyun Chung DPTE_GROUP_SIZE_C, &rq_regs.rq_regs_c.dpte_group_size,
1395b9fe5151SJaehyun Chung MPTE_GROUP_SIZE_C, &rq_regs.rq_regs_c.mpte_group_size,
1396b9fe5151SJaehyun Chung SWATH_HEIGHT_C, &rq_regs.rq_regs_c.swath_height,
1397b9fe5151SJaehyun Chung PTE_ROW_HEIGHT_LINEAR_C, &rq_regs.rq_regs_c.pte_row_height_linear);
1398b9fe5151SJaehyun Chung
1399b9fe5151SJaehyun Chung if (rq_regs.plane1_base_address != dml_rq_regs->plane1_base_address)
1400b9fe5151SJaehyun Chung DC_LOG_DEBUG("DML Validation | HUBPRET_CONTROL:DET_BUF_PLANE1_BASE_ADDRESS - Expected: %u Actual: %u\n",
1401b9fe5151SJaehyun Chung dml_rq_regs->plane1_base_address, rq_regs.plane1_base_address);
1402b9fe5151SJaehyun Chung if (rq_regs.drq_expansion_mode != dml_rq_regs->drq_expansion_mode)
1403b9fe5151SJaehyun Chung DC_LOG_DEBUG("DML Validation | DCN_EXPANSION_MODE:DRQ_EXPANSION_MODE - Expected: %u Actual: %u\n",
1404b9fe5151SJaehyun Chung dml_rq_regs->drq_expansion_mode, rq_regs.drq_expansion_mode);
1405b9fe5151SJaehyun Chung if (rq_regs.prq_expansion_mode != dml_rq_regs->prq_expansion_mode)
1406b9fe5151SJaehyun Chung DC_LOG_DEBUG("DML Validation | DCN_EXPANSION_MODE:MRQ_EXPANSION_MODE - Expected: %u Actual: %u\n",
1407b9fe5151SJaehyun Chung dml_rq_regs->prq_expansion_mode, rq_regs.prq_expansion_mode);
1408b9fe5151SJaehyun Chung if (rq_regs.mrq_expansion_mode != dml_rq_regs->mrq_expansion_mode)
1409b9fe5151SJaehyun Chung DC_LOG_DEBUG("DML Validation | DCN_EXPANSION_MODE:DET_BUF_PLANE1_BASE_ADDRESS - Expected: %u Actual: %u\n",
1410b9fe5151SJaehyun Chung dml_rq_regs->mrq_expansion_mode, rq_regs.mrq_expansion_mode);
1411b9fe5151SJaehyun Chung if (rq_regs.crq_expansion_mode != dml_rq_regs->crq_expansion_mode)
1412b9fe5151SJaehyun Chung DC_LOG_DEBUG("DML Validation | DCN_EXPANSION_MODE:CRQ_EXPANSION_MODE - Expected: %u Actual: %u\n",
1413b9fe5151SJaehyun Chung dml_rq_regs->crq_expansion_mode, rq_regs.crq_expansion_mode);
1414b9fe5151SJaehyun Chung
1415b9fe5151SJaehyun Chung if (rq_regs.rq_regs_l.chunk_size != dml_rq_regs->rq_regs_l.chunk_size)
1416b9fe5151SJaehyun Chung DC_LOG_DEBUG("DML Validation | DCHUBP_REQ_SIZE_CONFIG_C:CHUNK_SIZE - Expected: %u Actual: %u\n",
1417b9fe5151SJaehyun Chung dml_rq_regs->rq_regs_l.chunk_size, rq_regs.rq_regs_l.chunk_size);
1418b9fe5151SJaehyun Chung if (rq_regs.rq_regs_l.min_chunk_size != dml_rq_regs->rq_regs_l.min_chunk_size)
1419b9fe5151SJaehyun Chung DC_LOG_DEBUG("DML Validation | DCHUBP_REQ_SIZE_CONFIG_C:MIN_CHUNK_SIZE - Expected: %u Actual: %u\n",
1420b9fe5151SJaehyun Chung dml_rq_regs->rq_regs_l.min_chunk_size, rq_regs.rq_regs_l.min_chunk_size);
1421b9fe5151SJaehyun Chung if (rq_regs.rq_regs_l.meta_chunk_size != dml_rq_regs->rq_regs_l.meta_chunk_size)
1422b9fe5151SJaehyun Chung DC_LOG_DEBUG("DML Validation | DCHUBP_REQ_SIZE_CONFIG_C:META_CHUNK_SIZE - Expected: %u Actual: %u\n",
1423b9fe5151SJaehyun Chung dml_rq_regs->rq_regs_l.meta_chunk_size, rq_regs.rq_regs_l.meta_chunk_size);
1424b9fe5151SJaehyun Chung if (rq_regs.rq_regs_l.min_meta_chunk_size != dml_rq_regs->rq_regs_l.min_meta_chunk_size)
1425b9fe5151SJaehyun Chung DC_LOG_DEBUG("DML Validation | DCHUBP_REQ_SIZE_CONFIG_C:MIN_META_CHUNK_SIZE - Expected: %u Actual: %u\n",
1426b9fe5151SJaehyun Chung dml_rq_regs->rq_regs_l.min_meta_chunk_size, rq_regs.rq_regs_l.min_meta_chunk_size);
1427b9fe5151SJaehyun Chung if (rq_regs.rq_regs_l.dpte_group_size != dml_rq_regs->rq_regs_l.dpte_group_size)
1428b9fe5151SJaehyun Chung DC_LOG_DEBUG("DML Validation | DCHUBP_REQ_SIZE_CONFIG_C:DPTE_GROUP_SIZE - Expected: %u Actual: %u\n",
1429b9fe5151SJaehyun Chung dml_rq_regs->rq_regs_l.dpte_group_size, rq_regs.rq_regs_l.dpte_group_size);
1430b9fe5151SJaehyun Chung if (rq_regs.rq_regs_l.mpte_group_size != dml_rq_regs->rq_regs_l.mpte_group_size)
1431b9fe5151SJaehyun Chung DC_LOG_DEBUG("DML Validation | DCHUBP_REQ_SIZE_CONFIG_C:MPTE_GROUP_SIZE - Expected: %u Actual: %u\n",
1432b9fe5151SJaehyun Chung dml_rq_regs->rq_regs_l.mpte_group_size, rq_regs.rq_regs_l.mpte_group_size);
1433b9fe5151SJaehyun Chung if (rq_regs.rq_regs_l.swath_height != dml_rq_regs->rq_regs_l.swath_height)
1434b9fe5151SJaehyun Chung DC_LOG_DEBUG("DML Validation | DCHUBP_REQ_SIZE_CONFIG_C:SWATH_HEIGHT - Expected: %u Actual: %u\n",
1435b9fe5151SJaehyun Chung dml_rq_regs->rq_regs_l.swath_height, rq_regs.rq_regs_l.swath_height);
1436b9fe5151SJaehyun Chung if (rq_regs.rq_regs_l.pte_row_height_linear != dml_rq_regs->rq_regs_l.pte_row_height_linear)
1437b9fe5151SJaehyun Chung DC_LOG_DEBUG("DML Validation | DCHUBP_REQ_SIZE_CONFIG_C:PTE_ROW_HEIGHT_LINEAR - Expected: %u Actual: %u\n",
1438b9fe5151SJaehyun Chung dml_rq_regs->rq_regs_l.pte_row_height_linear, rq_regs.rq_regs_l.pte_row_height_linear);
1439b9fe5151SJaehyun Chung
1440b9fe5151SJaehyun Chung if (rq_regs.rq_regs_c.chunk_size != dml_rq_regs->rq_regs_c.chunk_size)
1441b9fe5151SJaehyun Chung DC_LOG_DEBUG("DML Validation | DCHUBP_REQ_SIZE_CONFIG:CHUNK_SIZE_C - Expected: %u Actual: %u\n",
1442b9fe5151SJaehyun Chung dml_rq_regs->rq_regs_c.chunk_size, rq_regs.rq_regs_c.chunk_size);
1443b9fe5151SJaehyun Chung if (rq_regs.rq_regs_c.min_chunk_size != dml_rq_regs->rq_regs_c.min_chunk_size)
1444b9fe5151SJaehyun Chung DC_LOG_DEBUG("DML Validation | DCHUBP_REQ_SIZE_CONFIG:MIN_CHUNK_SIZE_C - Expected: %u Actual: %u\n",
1445b9fe5151SJaehyun Chung dml_rq_regs->rq_regs_c.min_chunk_size, rq_regs.rq_regs_c.min_chunk_size);
1446b9fe5151SJaehyun Chung if (rq_regs.rq_regs_c.meta_chunk_size != dml_rq_regs->rq_regs_c.meta_chunk_size)
1447b9fe5151SJaehyun Chung DC_LOG_DEBUG("DML Validation | DCHUBP_REQ_SIZE_CONFIG:META_CHUNK_SIZE_C - Expected: %u Actual: %u\n",
1448b9fe5151SJaehyun Chung dml_rq_regs->rq_regs_c.meta_chunk_size, rq_regs.rq_regs_c.meta_chunk_size);
1449b9fe5151SJaehyun Chung if (rq_regs.rq_regs_c.min_meta_chunk_size != dml_rq_regs->rq_regs_c.min_meta_chunk_size)
1450b9fe5151SJaehyun Chung DC_LOG_DEBUG("DML Validation | DCHUBP_REQ_SIZE_CONFIG:MIN_META_CHUNK_SIZE_C - Expected: %u Actual: %u\n",
1451b9fe5151SJaehyun Chung dml_rq_regs->rq_regs_c.min_meta_chunk_size, rq_regs.rq_regs_c.min_meta_chunk_size);
1452b9fe5151SJaehyun Chung if (rq_regs.rq_regs_c.dpte_group_size != dml_rq_regs->rq_regs_c.dpte_group_size)
1453b9fe5151SJaehyun Chung DC_LOG_DEBUG("DML Validation | DCHUBP_REQ_SIZE_CONFIG:DPTE_GROUP_SIZE_C - Expected: %u Actual: %u\n",
1454b9fe5151SJaehyun Chung dml_rq_regs->rq_regs_c.dpte_group_size, rq_regs.rq_regs_c.dpte_group_size);
1455b9fe5151SJaehyun Chung if (rq_regs.rq_regs_c.mpte_group_size != dml_rq_regs->rq_regs_c.mpte_group_size)
1456b9fe5151SJaehyun Chung DC_LOG_DEBUG("DML Validation | DCHUBP_REQ_SIZE_CONFIG:MPTE_GROUP_SIZE_C - Expected: %u Actual: %u\n",
1457b9fe5151SJaehyun Chung dml_rq_regs->rq_regs_c.mpte_group_size, rq_regs.rq_regs_c.mpte_group_size);
1458b9fe5151SJaehyun Chung if (rq_regs.rq_regs_c.swath_height != dml_rq_regs->rq_regs_c.swath_height)
1459b9fe5151SJaehyun Chung DC_LOG_DEBUG("DML Validation | DCHUBP_REQ_SIZE_CONFIG:SWATH_HEIGHT_C - Expected: %u Actual: %u\n",
1460b9fe5151SJaehyun Chung dml_rq_regs->rq_regs_c.swath_height, rq_regs.rq_regs_c.swath_height);
1461b9fe5151SJaehyun Chung if (rq_regs.rq_regs_c.pte_row_height_linear != dml_rq_regs->rq_regs_c.pte_row_height_linear)
1462b9fe5151SJaehyun Chung DC_LOG_DEBUG("DML Validation | DCHUBP_REQ_SIZE_CONFIG:PTE_ROW_HEIGHT_LINEAR_C - Expected: %u Actual: %u\n",
1463b9fe5151SJaehyun Chung dml_rq_regs->rq_regs_c.pte_row_height_linear, rq_regs.rq_regs_c.pte_row_height_linear);
1464b9fe5151SJaehyun Chung
1465b9fe5151SJaehyun Chung /* DLG - Per hubp */
1466b9fe5151SJaehyun Chung REG_GET_2(BLANK_OFFSET_0,
1467b9fe5151SJaehyun Chung REFCYC_H_BLANK_END, &dlg_attr.refcyc_h_blank_end,
1468b9fe5151SJaehyun Chung DLG_V_BLANK_END, &dlg_attr.dlg_vblank_end);
1469b9fe5151SJaehyun Chung REG_GET(BLANK_OFFSET_1,
1470b9fe5151SJaehyun Chung MIN_DST_Y_NEXT_START, &dlg_attr.min_dst_y_next_start);
1471b9fe5151SJaehyun Chung REG_GET(DST_DIMENSIONS,
1472b9fe5151SJaehyun Chung REFCYC_PER_HTOTAL, &dlg_attr.refcyc_per_htotal);
1473b9fe5151SJaehyun Chung REG_GET_2(DST_AFTER_SCALER,
1474b9fe5151SJaehyun Chung REFCYC_X_AFTER_SCALER, &dlg_attr.refcyc_x_after_scaler,
1475b9fe5151SJaehyun Chung DST_Y_AFTER_SCALER, &dlg_attr.dst_y_after_scaler);
1476b9fe5151SJaehyun Chung REG_GET(REF_FREQ_TO_PIX_FREQ,
1477b9fe5151SJaehyun Chung REF_FREQ_TO_PIX_FREQ, &dlg_attr.ref_freq_to_pix_freq);
1478b9fe5151SJaehyun Chung
1479b9fe5151SJaehyun Chung if (dlg_attr.refcyc_h_blank_end != dml_dlg_attr->refcyc_h_blank_end)
1480b9fe5151SJaehyun Chung DC_LOG_DEBUG("DML Validation | BLANK_OFFSET_0:REFCYC_H_BLANK_END - Expected: %u Actual: %u\n",
1481b9fe5151SJaehyun Chung dml_dlg_attr->refcyc_h_blank_end, dlg_attr.refcyc_h_blank_end);
1482b9fe5151SJaehyun Chung if (dlg_attr.dlg_vblank_end != dml_dlg_attr->dlg_vblank_end)
1483b9fe5151SJaehyun Chung DC_LOG_DEBUG("DML Validation | BLANK_OFFSET_0:DLG_V_BLANK_END - Expected: %u Actual: %u\n",
1484b9fe5151SJaehyun Chung dml_dlg_attr->dlg_vblank_end, dlg_attr.dlg_vblank_end);
1485b9fe5151SJaehyun Chung if (dlg_attr.min_dst_y_next_start != dml_dlg_attr->min_dst_y_next_start)
1486b9fe5151SJaehyun Chung DC_LOG_DEBUG("DML Validation | BLANK_OFFSET_1:MIN_DST_Y_NEXT_START - Expected: %u Actual: %u\n",
1487b9fe5151SJaehyun Chung dml_dlg_attr->min_dst_y_next_start, dlg_attr.min_dst_y_next_start);
1488b9fe5151SJaehyun Chung if (dlg_attr.refcyc_per_htotal != dml_dlg_attr->refcyc_per_htotal)
1489b9fe5151SJaehyun Chung DC_LOG_DEBUG("DML Validation | DST_DIMENSIONS:REFCYC_PER_HTOTAL - Expected: %u Actual: %u\n",
1490b9fe5151SJaehyun Chung dml_dlg_attr->refcyc_per_htotal, dlg_attr.refcyc_per_htotal);
1491b9fe5151SJaehyun Chung if (dlg_attr.refcyc_x_after_scaler != dml_dlg_attr->refcyc_x_after_scaler)
1492b9fe5151SJaehyun Chung DC_LOG_DEBUG("DML Validation | DST_AFTER_SCALER:REFCYC_X_AFTER_SCALER - Expected: %u Actual: %u\n",
1493b9fe5151SJaehyun Chung dml_dlg_attr->refcyc_x_after_scaler, dlg_attr.refcyc_x_after_scaler);
1494b9fe5151SJaehyun Chung if (dlg_attr.dst_y_after_scaler != dml_dlg_attr->dst_y_after_scaler)
1495b9fe5151SJaehyun Chung DC_LOG_DEBUG("DML Validation | DST_AFTER_SCALER:DST_Y_AFTER_SCALER - Expected: %u Actual: %u\n",
1496b9fe5151SJaehyun Chung dml_dlg_attr->dst_y_after_scaler, dlg_attr.dst_y_after_scaler);
1497b9fe5151SJaehyun Chung if (dlg_attr.ref_freq_to_pix_freq != dml_dlg_attr->ref_freq_to_pix_freq)
1498b9fe5151SJaehyun Chung DC_LOG_DEBUG("DML Validation | REF_FREQ_TO_PIX_FREQ:REF_FREQ_TO_PIX_FREQ - Expected: %u Actual: %u\n",
1499b9fe5151SJaehyun Chung dml_dlg_attr->ref_freq_to_pix_freq, dlg_attr.ref_freq_to_pix_freq);
1500b9fe5151SJaehyun Chung
1501b9fe5151SJaehyun Chung /* DLG - Per luma/chroma */
1502b9fe5151SJaehyun Chung REG_GET(VBLANK_PARAMETERS_1,
1503b9fe5151SJaehyun Chung REFCYC_PER_PTE_GROUP_VBLANK_L, &dlg_attr.refcyc_per_pte_group_vblank_l);
1504b9fe5151SJaehyun Chung if (REG(NOM_PARAMETERS_0))
1505b9fe5151SJaehyun Chung REG_GET(NOM_PARAMETERS_0,
1506b9fe5151SJaehyun Chung DST_Y_PER_PTE_ROW_NOM_L, &dlg_attr.dst_y_per_pte_row_nom_l);
1507b9fe5151SJaehyun Chung if (REG(NOM_PARAMETERS_1))
1508b9fe5151SJaehyun Chung REG_GET(NOM_PARAMETERS_1,
1509b9fe5151SJaehyun Chung REFCYC_PER_PTE_GROUP_NOM_L, &dlg_attr.refcyc_per_pte_group_nom_l);
1510b9fe5151SJaehyun Chung REG_GET(NOM_PARAMETERS_4,
1511b9fe5151SJaehyun Chung DST_Y_PER_META_ROW_NOM_L, &dlg_attr.dst_y_per_meta_row_nom_l);
1512b9fe5151SJaehyun Chung REG_GET(NOM_PARAMETERS_5,
1513b9fe5151SJaehyun Chung REFCYC_PER_META_CHUNK_NOM_L, &dlg_attr.refcyc_per_meta_chunk_nom_l);
1514b9fe5151SJaehyun Chung REG_GET_2(PER_LINE_DELIVERY,
1515b9fe5151SJaehyun Chung REFCYC_PER_LINE_DELIVERY_L, &dlg_attr.refcyc_per_line_delivery_l,
1516b9fe5151SJaehyun Chung REFCYC_PER_LINE_DELIVERY_C, &dlg_attr.refcyc_per_line_delivery_c);
1517b9fe5151SJaehyun Chung REG_GET_2(PER_LINE_DELIVERY_PRE,
1518b9fe5151SJaehyun Chung REFCYC_PER_LINE_DELIVERY_PRE_L, &dlg_attr.refcyc_per_line_delivery_pre_l,
1519b9fe5151SJaehyun Chung REFCYC_PER_LINE_DELIVERY_PRE_C, &dlg_attr.refcyc_per_line_delivery_pre_c);
1520b9fe5151SJaehyun Chung REG_GET(VBLANK_PARAMETERS_2,
1521b9fe5151SJaehyun Chung REFCYC_PER_PTE_GROUP_VBLANK_C, &dlg_attr.refcyc_per_pte_group_vblank_c);
1522b9fe5151SJaehyun Chung if (REG(NOM_PARAMETERS_2))
1523b9fe5151SJaehyun Chung REG_GET(NOM_PARAMETERS_2,
1524b9fe5151SJaehyun Chung DST_Y_PER_PTE_ROW_NOM_C, &dlg_attr.dst_y_per_pte_row_nom_c);
1525b9fe5151SJaehyun Chung if (REG(NOM_PARAMETERS_3))
1526b9fe5151SJaehyun Chung REG_GET(NOM_PARAMETERS_3,
1527b9fe5151SJaehyun Chung REFCYC_PER_PTE_GROUP_NOM_C, &dlg_attr.refcyc_per_pte_group_nom_c);
1528b9fe5151SJaehyun Chung REG_GET(NOM_PARAMETERS_6,
1529b9fe5151SJaehyun Chung DST_Y_PER_META_ROW_NOM_C, &dlg_attr.dst_y_per_meta_row_nom_c);
1530b9fe5151SJaehyun Chung REG_GET(NOM_PARAMETERS_7,
1531b9fe5151SJaehyun Chung REFCYC_PER_META_CHUNK_NOM_C, &dlg_attr.refcyc_per_meta_chunk_nom_c);
1532b9fe5151SJaehyun Chung REG_GET(VBLANK_PARAMETERS_3,
1533b9fe5151SJaehyun Chung REFCYC_PER_META_CHUNK_VBLANK_L, &dlg_attr.refcyc_per_meta_chunk_vblank_l);
1534b9fe5151SJaehyun Chung REG_GET(VBLANK_PARAMETERS_4,
1535b9fe5151SJaehyun Chung REFCYC_PER_META_CHUNK_VBLANK_C, &dlg_attr.refcyc_per_meta_chunk_vblank_c);
1536b9fe5151SJaehyun Chung
1537b9fe5151SJaehyun Chung if (dlg_attr.refcyc_per_pte_group_vblank_l != dml_dlg_attr->refcyc_per_pte_group_vblank_l)
1538b9fe5151SJaehyun Chung DC_LOG_DEBUG("DML Validation | VBLANK_PARAMETERS_1:REFCYC_PER_PTE_GROUP_VBLANK_L - Expected: %u Actual: %u\n",
1539b9fe5151SJaehyun Chung dml_dlg_attr->refcyc_per_pte_group_vblank_l, dlg_attr.refcyc_per_pte_group_vblank_l);
1540b9fe5151SJaehyun Chung if (dlg_attr.dst_y_per_pte_row_nom_l != dml_dlg_attr->dst_y_per_pte_row_nom_l)
1541b9fe5151SJaehyun Chung DC_LOG_DEBUG("DML Validation | NOM_PARAMETERS_0:DST_Y_PER_PTE_ROW_NOM_L - Expected: %u Actual: %u\n",
1542b9fe5151SJaehyun Chung dml_dlg_attr->dst_y_per_pte_row_nom_l, dlg_attr.dst_y_per_pte_row_nom_l);
1543b9fe5151SJaehyun Chung if (dlg_attr.refcyc_per_pte_group_nom_l != dml_dlg_attr->refcyc_per_pte_group_nom_l)
1544b9fe5151SJaehyun Chung DC_LOG_DEBUG("DML Validation | NOM_PARAMETERS_1:REFCYC_PER_PTE_GROUP_NOM_L - Expected: %u Actual: %u\n",
1545b9fe5151SJaehyun Chung dml_dlg_attr->refcyc_per_pte_group_nom_l, dlg_attr.refcyc_per_pte_group_nom_l);
1546b9fe5151SJaehyun Chung if (dlg_attr.dst_y_per_meta_row_nom_l != dml_dlg_attr->dst_y_per_meta_row_nom_l)
1547b9fe5151SJaehyun Chung DC_LOG_DEBUG("DML Validation | NOM_PARAMETERS_4:DST_Y_PER_META_ROW_NOM_L - Expected: %u Actual: %u\n",
1548b9fe5151SJaehyun Chung dml_dlg_attr->dst_y_per_meta_row_nom_l, dlg_attr.dst_y_per_meta_row_nom_l);
1549b9fe5151SJaehyun Chung if (dlg_attr.refcyc_per_meta_chunk_nom_l != dml_dlg_attr->refcyc_per_meta_chunk_nom_l)
1550b9fe5151SJaehyun Chung DC_LOG_DEBUG("DML Validation | NOM_PARAMETERS_5:REFCYC_PER_META_CHUNK_NOM_L - Expected: %u Actual: %u\n",
1551b9fe5151SJaehyun Chung dml_dlg_attr->refcyc_per_meta_chunk_nom_l, dlg_attr.refcyc_per_meta_chunk_nom_l);
1552b9fe5151SJaehyun Chung if (dlg_attr.refcyc_per_line_delivery_l != dml_dlg_attr->refcyc_per_line_delivery_l)
1553b9fe5151SJaehyun Chung DC_LOG_DEBUG("DML Validation | PER_LINE_DELIVERY:REFCYC_PER_LINE_DELIVERY_L - Expected: %u Actual: %u\n",
1554b9fe5151SJaehyun Chung dml_dlg_attr->refcyc_per_line_delivery_l, dlg_attr.refcyc_per_line_delivery_l);
1555b9fe5151SJaehyun Chung if (dlg_attr.refcyc_per_line_delivery_c != dml_dlg_attr->refcyc_per_line_delivery_c)
1556b9fe5151SJaehyun Chung DC_LOG_DEBUG("DML Validation | PER_LINE_DELIVERY:REFCYC_PER_LINE_DELIVERY_C - Expected: %u Actual: %u\n",
1557b9fe5151SJaehyun Chung dml_dlg_attr->refcyc_per_line_delivery_c, dlg_attr.refcyc_per_line_delivery_c);
1558b9fe5151SJaehyun Chung if (dlg_attr.refcyc_per_pte_group_vblank_c != dml_dlg_attr->refcyc_per_pte_group_vblank_c)
1559b9fe5151SJaehyun Chung DC_LOG_DEBUG("DML Validation | VBLANK_PARAMETERS_2:REFCYC_PER_PTE_GROUP_VBLANK_C - Expected: %u Actual: %u\n",
1560b9fe5151SJaehyun Chung dml_dlg_attr->refcyc_per_pte_group_vblank_c, dlg_attr.refcyc_per_pte_group_vblank_c);
1561b9fe5151SJaehyun Chung if (dlg_attr.dst_y_per_pte_row_nom_c != dml_dlg_attr->dst_y_per_pte_row_nom_c)
1562b9fe5151SJaehyun Chung DC_LOG_DEBUG("DML Validation | NOM_PARAMETERS_2:DST_Y_PER_PTE_ROW_NOM_C - Expected: %u Actual: %u\n",
1563b9fe5151SJaehyun Chung dml_dlg_attr->dst_y_per_pte_row_nom_c, dlg_attr.dst_y_per_pte_row_nom_c);
1564b9fe5151SJaehyun Chung if (dlg_attr.refcyc_per_pte_group_nom_c != dml_dlg_attr->refcyc_per_pte_group_nom_c)
1565b9fe5151SJaehyun Chung DC_LOG_DEBUG("DML Validation | NOM_PARAMETERS_3:REFCYC_PER_PTE_GROUP_NOM_C - Expected: %u Actual: %u\n",
1566b9fe5151SJaehyun Chung dml_dlg_attr->refcyc_per_pte_group_nom_c, dlg_attr.refcyc_per_pte_group_nom_c);
1567b9fe5151SJaehyun Chung if (dlg_attr.dst_y_per_meta_row_nom_c != dml_dlg_attr->dst_y_per_meta_row_nom_c)
1568b9fe5151SJaehyun Chung DC_LOG_DEBUG("DML Validation | NOM_PARAMETERS_6:DST_Y_PER_META_ROW_NOM_C - Expected: %u Actual: %u\n",
1569b9fe5151SJaehyun Chung dml_dlg_attr->dst_y_per_meta_row_nom_c, dlg_attr.dst_y_per_meta_row_nom_c);
1570b9fe5151SJaehyun Chung if (dlg_attr.refcyc_per_meta_chunk_nom_c != dml_dlg_attr->refcyc_per_meta_chunk_nom_c)
1571b9fe5151SJaehyun Chung DC_LOG_DEBUG("DML Validation | NOM_PARAMETERS_7:REFCYC_PER_META_CHUNK_NOM_C - Expected: %u Actual: %u\n",
1572b9fe5151SJaehyun Chung dml_dlg_attr->refcyc_per_meta_chunk_nom_c, dlg_attr.refcyc_per_meta_chunk_nom_c);
1573b9fe5151SJaehyun Chung if (dlg_attr.refcyc_per_line_delivery_pre_l != dml_dlg_attr->refcyc_per_line_delivery_pre_l)
1574b9fe5151SJaehyun Chung DC_LOG_DEBUG("DML Validation | PER_LINE_DELIVERY_PRE:REFCYC_PER_LINE_DELIVERY_PRE_L - Expected: %u Actual: %u\n",
1575b9fe5151SJaehyun Chung dml_dlg_attr->refcyc_per_line_delivery_pre_l, dlg_attr.refcyc_per_line_delivery_pre_l);
1576b9fe5151SJaehyun Chung if (dlg_attr.refcyc_per_line_delivery_pre_c != dml_dlg_attr->refcyc_per_line_delivery_pre_c)
1577b9fe5151SJaehyun Chung DC_LOG_DEBUG("DML Validation | PER_LINE_DELIVERY_PRE:REFCYC_PER_LINE_DELIVERY_PRE_C - Expected: %u Actual: %u\n",
1578b9fe5151SJaehyun Chung dml_dlg_attr->refcyc_per_line_delivery_pre_c, dlg_attr.refcyc_per_line_delivery_pre_c);
1579b9fe5151SJaehyun Chung if (dlg_attr.refcyc_per_meta_chunk_vblank_l != dml_dlg_attr->refcyc_per_meta_chunk_vblank_l)
1580b9fe5151SJaehyun Chung DC_LOG_DEBUG("DML Validation | VBLANK_PARAMETERS_3:REFCYC_PER_META_CHUNK_VBLANK_L - Expected: %u Actual: %u\n",
1581b9fe5151SJaehyun Chung dml_dlg_attr->refcyc_per_meta_chunk_vblank_l, dlg_attr.refcyc_per_meta_chunk_vblank_l);
1582b9fe5151SJaehyun Chung if (dlg_attr.refcyc_per_meta_chunk_vblank_c != dml_dlg_attr->refcyc_per_meta_chunk_vblank_c)
1583b9fe5151SJaehyun Chung DC_LOG_DEBUG("DML Validation | VBLANK_PARAMETERS_4:REFCYC_PER_META_CHUNK_VBLANK_C - Expected: %u Actual: %u\n",
1584b9fe5151SJaehyun Chung dml_dlg_attr->refcyc_per_meta_chunk_vblank_c, dlg_attr.refcyc_per_meta_chunk_vblank_c);
1585b9fe5151SJaehyun Chung
1586b9fe5151SJaehyun Chung /* TTU - per hubp */
1587b9fe5151SJaehyun Chung REG_GET_2(DCN_TTU_QOS_WM,
1588b9fe5151SJaehyun Chung QoS_LEVEL_LOW_WM, &ttu_attr.qos_level_low_wm,
1589b9fe5151SJaehyun Chung QoS_LEVEL_HIGH_WM, &ttu_attr.qos_level_high_wm);
1590b9fe5151SJaehyun Chung
1591b9fe5151SJaehyun Chung if (ttu_attr.qos_level_low_wm != dml_ttu_attr->qos_level_low_wm)
1592b9fe5151SJaehyun Chung DC_LOG_DEBUG("DML Validation | DCN_TTU_QOS_WM:QoS_LEVEL_LOW_WM - Expected: %u Actual: %u\n",
1593b9fe5151SJaehyun Chung dml_ttu_attr->qos_level_low_wm, ttu_attr.qos_level_low_wm);
1594b9fe5151SJaehyun Chung if (ttu_attr.qos_level_high_wm != dml_ttu_attr->qos_level_high_wm)
1595b9fe5151SJaehyun Chung DC_LOG_DEBUG("DML Validation | DCN_TTU_QOS_WM:QoS_LEVEL_HIGH_WM - Expected: %u Actual: %u\n",
1596b9fe5151SJaehyun Chung dml_ttu_attr->qos_level_high_wm, ttu_attr.qos_level_high_wm);
1597b9fe5151SJaehyun Chung
1598b9fe5151SJaehyun Chung /* TTU - per luma/chroma */
1599b9fe5151SJaehyun Chung /* Assumed surf0 is luma and 1 is chroma */
1600b9fe5151SJaehyun Chung REG_GET_3(DCN_SURF0_TTU_CNTL0,
1601b9fe5151SJaehyun Chung REFCYC_PER_REQ_DELIVERY, &ttu_attr.refcyc_per_req_delivery_l,
1602b9fe5151SJaehyun Chung QoS_LEVEL_FIXED, &ttu_attr.qos_level_fixed_l,
1603b9fe5151SJaehyun Chung QoS_RAMP_DISABLE, &ttu_attr.qos_ramp_disable_l);
1604b9fe5151SJaehyun Chung REG_GET_3(DCN_SURF1_TTU_CNTL0,
1605b9fe5151SJaehyun Chung REFCYC_PER_REQ_DELIVERY, &ttu_attr.refcyc_per_req_delivery_c,
1606b9fe5151SJaehyun Chung QoS_LEVEL_FIXED, &ttu_attr.qos_level_fixed_c,
1607b9fe5151SJaehyun Chung QoS_RAMP_DISABLE, &ttu_attr.qos_ramp_disable_c);
1608b9fe5151SJaehyun Chung REG_GET_3(DCN_CUR0_TTU_CNTL0,
1609b9fe5151SJaehyun Chung REFCYC_PER_REQ_DELIVERY, &ttu_attr.refcyc_per_req_delivery_cur0,
1610b9fe5151SJaehyun Chung QoS_LEVEL_FIXED, &ttu_attr.qos_level_fixed_cur0,
1611b9fe5151SJaehyun Chung QoS_RAMP_DISABLE, &ttu_attr.qos_ramp_disable_cur0);
1612b9fe5151SJaehyun Chung REG_GET(FLIP_PARAMETERS_1,
1613b9fe5151SJaehyun Chung REFCYC_PER_PTE_GROUP_FLIP_L, &dlg_attr.refcyc_per_pte_group_flip_l);
1614b9fe5151SJaehyun Chung REG_GET(DCN_CUR0_TTU_CNTL1,
1615b9fe5151SJaehyun Chung REFCYC_PER_REQ_DELIVERY_PRE, &ttu_attr.refcyc_per_req_delivery_pre_cur0);
1616b9fe5151SJaehyun Chung REG_GET(DCN_CUR1_TTU_CNTL1,
1617b9fe5151SJaehyun Chung REFCYC_PER_REQ_DELIVERY_PRE, &ttu_attr.refcyc_per_req_delivery_pre_cur1);
1618b9fe5151SJaehyun Chung REG_GET(DCN_SURF0_TTU_CNTL1,
1619b9fe5151SJaehyun Chung REFCYC_PER_REQ_DELIVERY_PRE, &ttu_attr.refcyc_per_req_delivery_pre_l);
1620b9fe5151SJaehyun Chung REG_GET(DCN_SURF1_TTU_CNTL1,
1621b9fe5151SJaehyun Chung REFCYC_PER_REQ_DELIVERY_PRE, &ttu_attr.refcyc_per_req_delivery_pre_c);
1622b9fe5151SJaehyun Chung
1623b9fe5151SJaehyun Chung if (ttu_attr.refcyc_per_req_delivery_l != dml_ttu_attr->refcyc_per_req_delivery_l)
1624b9fe5151SJaehyun Chung DC_LOG_DEBUG("DML Validation | DCN_SURF0_TTU_CNTL0:REFCYC_PER_REQ_DELIVERY - Expected: %u Actual: %u\n",
1625b9fe5151SJaehyun Chung dml_ttu_attr->refcyc_per_req_delivery_l, ttu_attr.refcyc_per_req_delivery_l);
1626b9fe5151SJaehyun Chung if (ttu_attr.qos_level_fixed_l != dml_ttu_attr->qos_level_fixed_l)
1627b9fe5151SJaehyun Chung DC_LOG_DEBUG("DML Validation | DCN_SURF0_TTU_CNTL0:QoS_LEVEL_FIXED - Expected: %u Actual: %u\n",
1628b9fe5151SJaehyun Chung dml_ttu_attr->qos_level_fixed_l, ttu_attr.qos_level_fixed_l);
1629b9fe5151SJaehyun Chung if (ttu_attr.qos_ramp_disable_l != dml_ttu_attr->qos_ramp_disable_l)
1630b9fe5151SJaehyun Chung DC_LOG_DEBUG("DML Validation | DCN_SURF0_TTU_CNTL0:QoS_RAMP_DISABLE - Expected: %u Actual: %u\n",
1631b9fe5151SJaehyun Chung dml_ttu_attr->qos_ramp_disable_l, ttu_attr.qos_ramp_disable_l);
1632b9fe5151SJaehyun Chung if (ttu_attr.refcyc_per_req_delivery_c != dml_ttu_attr->refcyc_per_req_delivery_c)
1633b9fe5151SJaehyun Chung DC_LOG_DEBUG("DML Validation | DCN_SURF1_TTU_CNTL0:REFCYC_PER_REQ_DELIVERY - Expected: %u Actual: %u\n",
1634b9fe5151SJaehyun Chung dml_ttu_attr->refcyc_per_req_delivery_c, ttu_attr.refcyc_per_req_delivery_c);
1635b9fe5151SJaehyun Chung if (ttu_attr.qos_level_fixed_c != dml_ttu_attr->qos_level_fixed_c)
1636b9fe5151SJaehyun Chung DC_LOG_DEBUG("DML Validation | DCN_SURF1_TTU_CNTL0:QoS_LEVEL_FIXED - Expected: %u Actual: %u\n",
1637b9fe5151SJaehyun Chung dml_ttu_attr->qos_level_fixed_c, ttu_attr.qos_level_fixed_c);
1638b9fe5151SJaehyun Chung if (ttu_attr.qos_ramp_disable_c != dml_ttu_attr->qos_ramp_disable_c)
1639b9fe5151SJaehyun Chung DC_LOG_DEBUG("DML Validation | DCN_SURF1_TTU_CNTL0:QoS_RAMP_DISABLE - Expected: %u Actual: %u\n",
1640b9fe5151SJaehyun Chung dml_ttu_attr->qos_ramp_disable_c, ttu_attr.qos_ramp_disable_c);
1641b9fe5151SJaehyun Chung if (ttu_attr.refcyc_per_req_delivery_cur0 != dml_ttu_attr->refcyc_per_req_delivery_cur0)
1642b9fe5151SJaehyun Chung DC_LOG_DEBUG("DML Validation | DCN_CUR0_TTU_CNTL0:REFCYC_PER_REQ_DELIVERY - Expected: %u Actual: %u\n",
1643b9fe5151SJaehyun Chung dml_ttu_attr->refcyc_per_req_delivery_cur0, ttu_attr.refcyc_per_req_delivery_cur0);
1644b9fe5151SJaehyun Chung if (ttu_attr.qos_level_fixed_cur0 != dml_ttu_attr->qos_level_fixed_cur0)
1645b9fe5151SJaehyun Chung DC_LOG_DEBUG("DML Validation | DCN_CUR0_TTU_CNTL0:QoS_LEVEL_FIXED - Expected: %u Actual: %u\n",
1646b9fe5151SJaehyun Chung dml_ttu_attr->qos_level_fixed_cur0, ttu_attr.qos_level_fixed_cur0);
1647b9fe5151SJaehyun Chung if (ttu_attr.qos_ramp_disable_cur0 != dml_ttu_attr->qos_ramp_disable_cur0)
1648b9fe5151SJaehyun Chung DC_LOG_DEBUG("DML Validation | DCN_CUR0_TTU_CNTL0:QoS_RAMP_DISABLE - Expected: %u Actual: %u\n",
1649b9fe5151SJaehyun Chung dml_ttu_attr->qos_ramp_disable_cur0, ttu_attr.qos_ramp_disable_cur0);
1650b9fe5151SJaehyun Chung if (dlg_attr.refcyc_per_pte_group_flip_l != dml_dlg_attr->refcyc_per_pte_group_flip_l)
1651b9fe5151SJaehyun Chung DC_LOG_DEBUG("DML Validation | FLIP_PARAMETERS_1:REFCYC_PER_PTE_GROUP_FLIP_L - Expected: %u Actual: %u\n",
1652b9fe5151SJaehyun Chung dml_dlg_attr->refcyc_per_pte_group_flip_l, dlg_attr.refcyc_per_pte_group_flip_l);
1653b9fe5151SJaehyun Chung if (ttu_attr.refcyc_per_req_delivery_pre_cur0 != dml_ttu_attr->refcyc_per_req_delivery_pre_cur0)
1654b9fe5151SJaehyun Chung DC_LOG_DEBUG("DML Validation | DCN_CUR0_TTU_CNTL1:REFCYC_PER_REQ_DELIVERY_PRE - Expected: %u Actual: %u\n",
1655b9fe5151SJaehyun Chung dml_ttu_attr->refcyc_per_req_delivery_pre_cur0, ttu_attr.refcyc_per_req_delivery_pre_cur0);
1656b9fe5151SJaehyun Chung if (ttu_attr.refcyc_per_req_delivery_pre_cur1 != dml_ttu_attr->refcyc_per_req_delivery_pre_cur1)
1657b9fe5151SJaehyun Chung DC_LOG_DEBUG("DML Validation | DCN_CUR1_TTU_CNTL1:REFCYC_PER_REQ_DELIVERY_PRE - Expected: %u Actual: %u\n",
1658b9fe5151SJaehyun Chung dml_ttu_attr->refcyc_per_req_delivery_pre_cur1, ttu_attr.refcyc_per_req_delivery_pre_cur1);
1659b9fe5151SJaehyun Chung if (ttu_attr.refcyc_per_req_delivery_pre_l != dml_ttu_attr->refcyc_per_req_delivery_pre_l)
1660b9fe5151SJaehyun Chung DC_LOG_DEBUG("DML Validation | DCN_SURF0_TTU_CNTL1:REFCYC_PER_REQ_DELIVERY_PRE - Expected: %u Actual: %u\n",
1661b9fe5151SJaehyun Chung dml_ttu_attr->refcyc_per_req_delivery_pre_l, ttu_attr.refcyc_per_req_delivery_pre_l);
1662b9fe5151SJaehyun Chung if (ttu_attr.refcyc_per_req_delivery_pre_c != dml_ttu_attr->refcyc_per_req_delivery_pre_c)
1663b9fe5151SJaehyun Chung DC_LOG_DEBUG("DML Validation | DCN_SURF1_TTU_CNTL1:REFCYC_PER_REQ_DELIVERY_PRE - Expected: %u Actual: %u\n",
1664b9fe5151SJaehyun Chung dml_ttu_attr->refcyc_per_req_delivery_pre_c, ttu_attr.refcyc_per_req_delivery_pre_c);
1665b9fe5151SJaehyun Chung }
1666b9fe5151SJaehyun Chung
1667bbeb64d0SHarry Wentland static struct hubp_funcs dcn20_hubp_funcs = {
1668bbeb64d0SHarry Wentland .hubp_enable_tripleBuffer = hubp2_enable_triplebuffer,
1669bbeb64d0SHarry Wentland .hubp_is_triplebuffer_enabled = hubp2_is_triplebuffer_enabled,
1670bbeb64d0SHarry Wentland .hubp_program_surface_flip_and_addr = hubp2_program_surface_flip_and_addr,
1671bbeb64d0SHarry Wentland .hubp_program_surface_config = hubp2_program_surface_config,
1672eced4bceSIlya Bakoulin .hubp_is_flip_pending = hubp2_is_flip_pending,
1673bbeb64d0SHarry Wentland .hubp_setup = hubp2_setup,
1674bbeb64d0SHarry Wentland .hubp_setup_interdependent = hubp2_setup_interdependent,
1675bbeb64d0SHarry Wentland .hubp_set_vm_system_aperture_settings = hubp2_set_vm_system_aperture_settings,
1676eced4bceSIlya Bakoulin .set_blank = hubp2_set_blank,
16774866b0bfSMartin Leung .set_blank_regs = hubp2_set_blank_regs,
1678eced4bceSIlya Bakoulin .dcc_control = hubp2_dcc_control,
167901130f52SAric Cyr .hubp_reset = hubp_reset,
1680bbeb64d0SHarry Wentland .mem_program_viewport = min_set_viewport,
1681bbeb64d0SHarry Wentland .set_cursor_attributes = hubp2_cursor_set_attributes,
1682eced4bceSIlya Bakoulin .set_cursor_position = hubp2_cursor_set_position,
1683eced4bceSIlya Bakoulin .hubp_clk_cntl = hubp2_clk_cntl,
1684eced4bceSIlya Bakoulin .hubp_vtg_sel = hubp2_vtg_sel,
1685bbeb64d0SHarry Wentland .dmdata_set_attributes = hubp2_dmdata_set_attributes,
1686bbeb64d0SHarry Wentland .dmdata_load = hubp2_dmdata_load,
1687bbeb64d0SHarry Wentland .dmdata_status_done = hubp2_dmdata_status_done,
1688eced4bceSIlya Bakoulin .hubp_read_state = hubp2_read_state,
1689eced4bceSIlya Bakoulin .hubp_clear_underflow = hubp2_clear_underflow,
16904850ce69SCharlene Liu .hubp_set_flip_control_surface_gsl = hubp2_set_flip_control_surface_gsl,
16914850ce69SCharlene Liu .hubp_init = hubp1_init,
1692b9fe5151SJaehyun Chung .validate_dml_output = hubp2_validate_dml_output,
16932da94e28SWesley Chalmers .hubp_in_blank = hubp1_in_blank,
16942da94e28SWesley Chalmers .hubp_soft_reset = hubp1_soft_reset,
16957afa0033SQingqing Zhuo .hubp_set_flip_int = hubp1_set_flip_int,
16961fa5c5a3SAlex Deucher .hubp_clear_tiling = hubp2_clear_tiling,
1697bbeb64d0SHarry Wentland };
1698bbeb64d0SHarry Wentland
16994850ce69SCharlene Liu
hubp2_construct(struct dcn20_hubp * hubp2,struct dc_context * ctx,uint32_t inst,const struct dcn_hubp2_registers * hubp_regs,const struct dcn_hubp2_shift * hubp_shift,const struct dcn_hubp2_mask * hubp_mask)1700bbeb64d0SHarry Wentland bool hubp2_construct(
1701bbeb64d0SHarry Wentland struct dcn20_hubp *hubp2,
1702bbeb64d0SHarry Wentland struct dc_context *ctx,
1703bbeb64d0SHarry Wentland uint32_t inst,
1704bbeb64d0SHarry Wentland const struct dcn_hubp2_registers *hubp_regs,
1705bbeb64d0SHarry Wentland const struct dcn_hubp2_shift *hubp_shift,
1706bbeb64d0SHarry Wentland const struct dcn_hubp2_mask *hubp_mask)
1707bbeb64d0SHarry Wentland {
1708bbeb64d0SHarry Wentland hubp2->base.funcs = &dcn20_hubp_funcs;
1709bbeb64d0SHarry Wentland hubp2->base.ctx = ctx;
1710bbeb64d0SHarry Wentland hubp2->hubp_regs = hubp_regs;
1711bbeb64d0SHarry Wentland hubp2->hubp_shift = hubp_shift;
1712bbeb64d0SHarry Wentland hubp2->hubp_mask = hubp_mask;
1713bbeb64d0SHarry Wentland hubp2->base.inst = inst;
1714043f5bb6SWesley Chalmers hubp2->base.opp_id = OPP_ID_INVALID;
1715bbeb64d0SHarry Wentland hubp2->base.mpcc_id = 0xf;
1716bbeb64d0SHarry Wentland
1717bbeb64d0SHarry Wentland return true;
1718bbeb64d0SHarry Wentland }
1719