0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026 #include "dm_services.h"
0027 #include "dce_calcs.h"
0028 #include "reg_helper.h"
0029 #include "basics/conversion.h"
0030 #include "dcn31_hubp.h"
0031
0032 #define REG(reg)\
0033 hubp2->hubp_regs->reg
0034
0035 #define CTX \
0036 hubp2->base.ctx
0037
0038 #undef FN
0039 #define FN(reg_name, field_name) \
0040 hubp2->hubp_shift->field_name, hubp2->hubp_mask->field_name
0041
0042 void hubp31_set_unbounded_requesting(struct hubp *hubp, bool enable)
0043 {
0044 struct dcn20_hubp *hubp2 = TO_DCN20_HUBP(hubp);
0045
0046 REG_UPDATE(DCHUBP_CNTL, HUBP_UNBOUNDED_REQ_MODE, enable);
0047 REG_UPDATE(CURSOR_CONTROL, CURSOR_REQ_MODE, enable);
0048 }
0049
0050 void hubp31_soft_reset(struct hubp *hubp, bool reset)
0051 {
0052 struct dcn20_hubp *hubp2 = TO_DCN20_HUBP(hubp);
0053
0054 REG_UPDATE(DCHUBP_CNTL, HUBP_SOFT_RESET, reset);
0055 }
0056
0057 static void hubp31_program_extended_blank(struct hubp *hubp,
0058 unsigned int min_dst_y_next_start_optimized)
0059 {
0060 struct dcn20_hubp *hubp2 = TO_DCN20_HUBP(hubp);
0061
0062 REG_UPDATE(BLANK_OFFSET_1, MIN_DST_Y_NEXT_START, min_dst_y_next_start_optimized);
0063 }
0064
0065 static struct hubp_funcs dcn31_hubp_funcs = {
0066 .hubp_enable_tripleBuffer = hubp2_enable_triplebuffer,
0067 .hubp_is_triplebuffer_enabled = hubp2_is_triplebuffer_enabled,
0068 .hubp_program_surface_flip_and_addr = hubp3_program_surface_flip_and_addr,
0069 .hubp_program_surface_config = hubp3_program_surface_config,
0070 .hubp_is_flip_pending = hubp2_is_flip_pending,
0071 .hubp_setup = hubp3_setup,
0072 .hubp_setup_interdependent = hubp2_setup_interdependent,
0073 .hubp_set_vm_system_aperture_settings = hubp3_set_vm_system_aperture_settings,
0074 .set_blank = hubp2_set_blank,
0075 .dcc_control = hubp3_dcc_control,
0076 .mem_program_viewport = min_set_viewport,
0077 .set_cursor_attributes = hubp2_cursor_set_attributes,
0078 .set_cursor_position = hubp2_cursor_set_position,
0079 .hubp_clk_cntl = hubp2_clk_cntl,
0080 .hubp_vtg_sel = hubp2_vtg_sel,
0081 .dmdata_set_attributes = hubp3_dmdata_set_attributes,
0082 .dmdata_load = hubp2_dmdata_load,
0083 .dmdata_status_done = hubp2_dmdata_status_done,
0084 .hubp_read_state = hubp3_read_state,
0085 .hubp_clear_underflow = hubp2_clear_underflow,
0086 .hubp_set_flip_control_surface_gsl = hubp2_set_flip_control_surface_gsl,
0087 .hubp_init = hubp3_init,
0088 .set_unbounded_requesting = hubp31_set_unbounded_requesting,
0089 .hubp_soft_reset = hubp31_soft_reset,
0090 .hubp_in_blank = hubp1_in_blank,
0091 .program_extended_blank = hubp31_program_extended_blank,
0092 };
0093
0094 bool hubp31_construct(
0095 struct dcn20_hubp *hubp2,
0096 struct dc_context *ctx,
0097 uint32_t inst,
0098 const struct dcn_hubp2_registers *hubp_regs,
0099 const struct dcn_hubp2_shift *hubp_shift,
0100 const struct dcn_hubp2_mask *hubp_mask)
0101 {
0102 hubp2->base.funcs = &dcn31_hubp_funcs;
0103 hubp2->base.ctx = ctx;
0104 hubp2->hubp_regs = hubp_regs;
0105 hubp2->hubp_shift = hubp_shift;
0106 hubp2->hubp_mask = hubp_mask;
0107 hubp2->base.inst = inst;
0108 hubp2->base.opp_id = OPP_ID_INVALID;
0109 hubp2->base.mpcc_id = 0xf;
0110
0111 return true;
0112 }