forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/drivers/gpu/drm/amd/display/dc/inc/hw/dpp.h
....@@ -36,7 +36,35 @@
3636 struct dpp_caps *caps;
3737 struct pwl_params regamma_params;
3838 struct pwl_params degamma_params;
39
+ struct dpp_cursor_attributes cur_attr;
3940
41
+ struct pwl_params shaper_params;
42
+ bool cm_bypass_mode;
43
+};
44
+
45
+struct dpp_input_csc_matrix {
46
+ enum dc_color_space color_space;
47
+ uint16_t regval[12];
48
+};
49
+
50
+static const struct dpp_input_csc_matrix dpp_input_csc_matrix[] = {
51
+ {COLOR_SPACE_SRGB,
52
+ {0x2000, 0, 0, 0, 0, 0x2000, 0, 0, 0, 0, 0x2000, 0} },
53
+ {COLOR_SPACE_SRGB_LIMITED,
54
+ {0x2000, 0, 0, 0, 0, 0x2000, 0, 0, 0, 0, 0x2000, 0} },
55
+ {COLOR_SPACE_YCBCR601,
56
+ {0x2cdd, 0x2000, 0, 0xe991, 0xe926, 0x2000, 0xf4fd, 0x10ef,
57
+ 0, 0x2000, 0x38b4, 0xe3a6} },
58
+ {COLOR_SPACE_YCBCR601_LIMITED,
59
+ {0x3353, 0x2568, 0, 0xe400, 0xe5dc, 0x2568, 0xf367, 0x1108,
60
+ 0, 0x2568, 0x40de, 0xdd3a} },
61
+ {COLOR_SPACE_YCBCR709,
62
+ {0x3265, 0x2000, 0, 0xe6ce, 0xf105, 0x2000, 0xfa01, 0xa7d, 0,
63
+ 0x2000, 0x3b61, 0xe24f} },
64
+
65
+ {COLOR_SPACE_YCBCR709_LIMITED,
66
+ {0x39a6, 0x2568, 0, 0xe0d6, 0xeedd, 0x2568, 0xf925, 0x9a8, 0,
67
+ 0x2568, 0x43ee, 0xdbb2} }
4068 };
4169
4270 struct dpp_grph_csc_adjustment {
....@@ -44,7 +72,34 @@
4472 enum graphics_gamut_adjust_type gamut_adjust_type;
4573 };
4674
75
+struct cnv_color_keyer_params {
76
+ int color_keyer_en;
77
+ int color_keyer_mode;
78
+ int color_keyer_alpha_low;
79
+ int color_keyer_alpha_high;
80
+ int color_keyer_red_low;
81
+ int color_keyer_red_high;
82
+ int color_keyer_green_low;
83
+ int color_keyer_green_high;
84
+ int color_keyer_blue_low;
85
+ int color_keyer_blue_high;
86
+};
87
+
88
+/* new for dcn2: set the 8bit alpha values based on the 2 bit alpha
89
+ *ALPHA_2BIT_LUT. ALPHA_2BIT_LUT0 default: 0b00000000
90
+ *ALPHA_2BIT_LUT. ALPHA_2BIT_LUT1 default: 0b01010101
91
+ *ALPHA_2BIT_LUT. ALPHA_2BIT_LUT2 default: 0b10101010
92
+ *ALPHA_2BIT_LUT. ALPHA_2BIT_LUT3 default: 0b11111111
93
+ */
94
+struct cnv_alpha_2bit_lut {
95
+ int lut0;
96
+ int lut1;
97
+ int lut2;
98
+ int lut3;
99
+};
100
+
47101 struct dcn_dpp_state {
102
+ uint32_t is_enabled;
48103 uint32_t igam_lut_mode;
49104 uint32_t igam_input_format;
50105 uint32_t dgam_lut_mode;
....@@ -58,7 +113,29 @@
58113 uint32_t gamut_remap_c33_c34;
59114 };
60115
116
+struct CM_bias_params {
117
+ uint32_t cm_bias_cr_r;
118
+ uint32_t cm_bias_y_g;
119
+ uint32_t cm_bias_cb_b;
120
+ uint32_t cm_bias_format;
121
+};
122
+
61123 struct dpp_funcs {
124
+#if defined(CONFIG_DRM_AMD_DC_DCN3_0)
125
+ bool (*dpp_program_gamcor_lut)(
126
+ struct dpp *dpp_base, const struct pwl_params *params);
127
+
128
+ void (*dpp_set_pre_degam)(struct dpp *dpp_base,
129
+ enum dc_transfer_func_predefined tr);
130
+#endif
131
+
132
+ void (*dpp_program_cm_dealpha)(struct dpp *dpp_base,
133
+ uint32_t enable, uint32_t additive_blending);
134
+
135
+ void (*dpp_program_cm_bias)(
136
+ struct dpp *dpp_base,
137
+ struct CM_bias_params *bias_params);
138
+
62139 void (*dpp_read_state)(struct dpp *dpp, struct dcn_dpp_state *s);
63140
64141 void (*dpp_reset)(struct dpp *dpp);
....@@ -134,23 +211,27 @@
134211 enum surface_pixel_format format,
135212 enum expansion_mode mode,
136213 struct dc_csc_transform input_csc_color_matrix,
137
- enum dc_color_space input_color_space);
214
+ enum dc_color_space input_color_space,
215
+ struct cnv_alpha_2bit_lut *alpha_2bit_lut);
138216
139217 void (*dpp_full_bypass)(struct dpp *dpp_base);
140218
141219 void (*set_cursor_attributes)(
142220 struct dpp *dpp_base,
143
- enum dc_cursor_color_format color_format);
221
+ struct dc_cursor_attributes *cursor_attributes);
144222
145223 void (*set_cursor_position)(
146224 struct dpp *dpp_base,
147225 const struct dc_cursor_position *pos,
148226 const struct dc_cursor_mi_param *param,
149
- uint32_t width
227
+ uint32_t width,
228
+ uint32_t height
150229 );
230
+
151231 void (*dpp_set_hdr_multiplier)(
152232 struct dpp *dpp_base,
153233 uint32_t multiplier);
234
+
154235 void (*set_optional_cursor_attributes)(
155236 struct dpp *dpp_base,
156237 struct dpp_cursor_attributes *attr);
....@@ -160,6 +241,18 @@
160241 bool dppclk_div,
161242 bool enable);
162243
244
+ bool (*dpp_program_blnd_lut)(
245
+ struct dpp *dpp,
246
+ const struct pwl_params *params);
247
+ bool (*dpp_program_shaper_lut)(
248
+ struct dpp *dpp,
249
+ const struct pwl_params *params);
250
+ bool (*dpp_program_3dlut)(
251
+ struct dpp *dpp,
252
+ struct tetrahedral_params *params);
253
+ void (*dpp_cnv_set_alpha_keyer)(
254
+ struct dpp *dpp_base,
255
+ struct cnv_color_keyer_params *color_keyer);
163256 };
164257
165258