1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 #ifndef __DC_OPP_DCN20_H__
26 #define __DC_OPP_DCN20_H__
27
28 #include "dcn10/dcn10_opp.h"
29
30 #define TO_DCN20_OPP(opp)\
31 container_of(opp, struct dcn20_opp, base)
32
33 #define OPP_SF(reg_name, field_name, post_fix)\
34 .field_name = reg_name ## __ ## field_name ## post_fix
35
36 #define OPP_DPG_REG_LIST(id) \
37 SRI(DPG_CONTROL, DPG, id), \
38 SRI(DPG_DIMENSIONS, DPG, id), \
39 SRI(DPG_COLOUR_B_CB, DPG, id), \
40 SRI(DPG_COLOUR_G_Y, DPG, id), \
41 SRI(DPG_COLOUR_R_CR, DPG, id), \
42 SRI(DPG_RAMP_CONTROL, DPG, id), \
43 SRI(DPG_STATUS, DPG, id)
44
45 #define OPP_REG_LIST_DCN20(id) \
46 OPP_REG_LIST_DCN10(id), \
47 OPP_DPG_REG_LIST(id), \
48 SRI(FMT_422_CONTROL, FMT, id), \
49 SRI(OPPBUF_CONTROL1, OPPBUF, id)
50
51 #define OPP_REG_VARIABLE_LIST_DCN2_0 \
52 OPP_COMMON_REG_VARIABLE_LIST; \
53 uint32_t FMT_422_CONTROL; \
54 uint32_t DPG_CONTROL; \
55 uint32_t DPG_DIMENSIONS; \
56 uint32_t DPG_COLOUR_B_CB; \
57 uint32_t DPG_COLOUR_G_Y; \
58 uint32_t DPG_COLOUR_R_CR; \
59 uint32_t DPG_RAMP_CONTROL; \
60 uint32_t DPG_STATUS
61
62 #define OPP_DPG_MASK_SH_LIST(mask_sh) \
63 OPP_SF(DPG0_DPG_CONTROL, DPG_EN, mask_sh), \
64 OPP_SF(DPG0_DPG_CONTROL, DPG_MODE, mask_sh), \
65 OPP_SF(DPG0_DPG_CONTROL, DPG_DYNAMIC_RANGE, mask_sh), \
66 OPP_SF(DPG0_DPG_CONTROL, DPG_BIT_DEPTH, mask_sh), \
67 OPP_SF(DPG0_DPG_CONTROL, DPG_VRES, mask_sh), \
68 OPP_SF(DPG0_DPG_CONTROL, DPG_HRES, mask_sh), \
69 OPP_SF(DPG0_DPG_DIMENSIONS, DPG_ACTIVE_WIDTH, mask_sh), \
70 OPP_SF(DPG0_DPG_DIMENSIONS, DPG_ACTIVE_HEIGHT, mask_sh), \
71 OPP_SF(DPG0_DPG_COLOUR_R_CR, DPG_COLOUR0_R_CR, mask_sh), \
72 OPP_SF(DPG0_DPG_COLOUR_R_CR, DPG_COLOUR1_R_CR, mask_sh), \
73 OPP_SF(DPG0_DPG_COLOUR_B_CB, DPG_COLOUR0_B_CB, mask_sh), \
74 OPP_SF(DPG0_DPG_COLOUR_B_CB, DPG_COLOUR1_B_CB, mask_sh), \
75 OPP_SF(DPG0_DPG_COLOUR_G_Y, DPG_COLOUR0_G_Y, mask_sh), \
76 OPP_SF(DPG0_DPG_COLOUR_G_Y, DPG_COLOUR1_G_Y, mask_sh), \
77 OPP_SF(DPG0_DPG_RAMP_CONTROL, DPG_RAMP0_OFFSET, mask_sh), \
78 OPP_SF(DPG0_DPG_RAMP_CONTROL, DPG_INC0, mask_sh), \
79 OPP_SF(DPG0_DPG_RAMP_CONTROL, DPG_INC1, mask_sh), \
80 OPP_SF(DPG0_DPG_STATUS, DPG_DOUBLE_BUFFER_PENDING, mask_sh)
81
82 #define OPP_MASK_SH_LIST_DCN20(mask_sh) \
83 OPP_MASK_SH_LIST_DCN(mask_sh), \
84 OPP_DPG_MASK_SH_LIST(mask_sh), \
85 OPP_SF(OPPBUF0_OPPBUF_CONTROL, OPPBUF_DISPLAY_SEGMENTATION, mask_sh),\
86 OPP_SF(OPPBUF0_OPPBUF_CONTROL, OPPBUF_OVERLAP_PIXEL_NUM, mask_sh), \
87 OPP_SF(FMT0_FMT_422_CONTROL, FMT_LEFT_EDGE_EXTRA_PIXEL_COUNT, mask_sh)
88
89 #define OPP_DCN20_REG_FIELD_LIST(type) \
90 OPP_DCN10_REG_FIELD_LIST(type); \
91 type FMT_LEFT_EDGE_EXTRA_PIXEL_COUNT; \
92 type DPG_EN; \
93 type DPG_MODE; \
94 type DPG_DYNAMIC_RANGE; \
95 type DPG_BIT_DEPTH; \
96 type DPG_VRES; \
97 type DPG_HRES; \
98 type DPG_ACTIVE_WIDTH; \
99 type DPG_ACTIVE_HEIGHT; \
100 type DPG_COLOUR0_R_CR; \
101 type DPG_COLOUR1_R_CR; \
102 type DPG_COLOUR0_B_CB; \
103 type DPG_COLOUR1_B_CB; \
104 type DPG_COLOUR0_G_Y; \
105 type DPG_COLOUR1_G_Y; \
106 type DPG_RAMP0_OFFSET; \
107 type DPG_INC0; \
108 type DPG_INC1; \
109 type DPG_DOUBLE_BUFFER_PENDING
110
111 struct dcn20_opp_registers {
112 OPP_REG_VARIABLE_LIST_DCN2_0;
113 };
114
115 struct dcn20_opp_shift {
116 OPP_DCN20_REG_FIELD_LIST(uint8_t);
117 };
118
119 struct dcn20_opp_mask {
120 OPP_DCN20_REG_FIELD_LIST(uint32_t);
121 };
122
123 struct dcn20_opp {
124 struct output_pixel_processor base;
125
126 const struct dcn20_opp_registers *regs;
127 const struct dcn20_opp_shift *opp_shift;
128 const struct dcn20_opp_mask *opp_mask;
129
130 bool is_write_to_ram_a_safe;
131 };
132
133 void dcn20_opp_construct(struct dcn20_opp *oppn20,
134 struct dc_context *ctx,
135 uint32_t inst,
136 const struct dcn20_opp_registers *regs,
137 const struct dcn20_opp_shift *opp_shift,
138 const struct dcn20_opp_mask *opp_mask);
139
140 void opp2_set_disp_pattern_generator(
141 struct output_pixel_processor *opp,
142 enum controller_dp_test_pattern test_pattern,
143 enum dc_color_depth color_depth,
144 const struct tg_color *solid_color,
145 int width,
146 int height);
147
148 bool opp2_dpg_is_blanked(struct output_pixel_processor *opp);
149
150 void opp2_dpg_set_blank_color(
151 struct output_pixel_processor *opp,
152 const struct tg_color *color);
153
154 void opp2_program_left_edge_extra_pixel (
155 struct output_pixel_processor *opp,
156 bool count);
157
158 #endif