xref: /dflybsd-src/sys/dev/drm/amd/display/dc/inc/hw/dpp.h (revision b843c749addef9340ee7d4e250b09fdd492602a1)
1*b843c749SSergey Zigachev /*
2*b843c749SSergey Zigachev  * Copyright 2012-15 Advanced Micro Devices, Inc.
3*b843c749SSergey Zigachev  *
4*b843c749SSergey Zigachev  * Permission is hereby granted, free of charge, to any person obtaining a
5*b843c749SSergey Zigachev  * copy of this software and associated documentation files (the "Software"),
6*b843c749SSergey Zigachev  * to deal in the Software without restriction, including without limitation
7*b843c749SSergey Zigachev  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8*b843c749SSergey Zigachev  * and/or sell copies of the Software, and to permit persons to whom the
9*b843c749SSergey Zigachev  * Software is furnished to do so, subject to the following conditions:
10*b843c749SSergey Zigachev  *
11*b843c749SSergey Zigachev  * The above copyright notice and this permission notice shall be included in
12*b843c749SSergey Zigachev  * all copies or substantial portions of the Software.
13*b843c749SSergey Zigachev  *
14*b843c749SSergey Zigachev  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15*b843c749SSergey Zigachev  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16*b843c749SSergey Zigachev  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17*b843c749SSergey Zigachev  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18*b843c749SSergey Zigachev  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19*b843c749SSergey Zigachev  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20*b843c749SSergey Zigachev  * OTHER DEALINGS IN THE SOFTWARE.
21*b843c749SSergey Zigachev  *
22*b843c749SSergey Zigachev  * Authors: AMD
23*b843c749SSergey Zigachev  *
24*b843c749SSergey Zigachev  */
25*b843c749SSergey Zigachev 
26*b843c749SSergey Zigachev 
27*b843c749SSergey Zigachev #ifndef __DAL_DPP_H__
28*b843c749SSergey Zigachev #define __DAL_DPP_H__
29*b843c749SSergey Zigachev 
30*b843c749SSergey Zigachev #include "transform.h"
31*b843c749SSergey Zigachev 
32*b843c749SSergey Zigachev struct dpp {
33*b843c749SSergey Zigachev 	const struct dpp_funcs *funcs;
34*b843c749SSergey Zigachev 	struct dc_context *ctx;
35*b843c749SSergey Zigachev 	int inst;
36*b843c749SSergey Zigachev 	struct dpp_caps *caps;
37*b843c749SSergey Zigachev 	struct pwl_params regamma_params;
38*b843c749SSergey Zigachev 	struct pwl_params degamma_params;
39*b843c749SSergey Zigachev 
40*b843c749SSergey Zigachev };
41*b843c749SSergey Zigachev 
42*b843c749SSergey Zigachev struct dpp_grph_csc_adjustment {
43*b843c749SSergey Zigachev 	struct fixed31_32 temperature_matrix[CSC_TEMPERATURE_MATRIX_SIZE];
44*b843c749SSergey Zigachev 	enum graphics_gamut_adjust_type gamut_adjust_type;
45*b843c749SSergey Zigachev };
46*b843c749SSergey Zigachev 
47*b843c749SSergey Zigachev struct dcn_dpp_state {
48*b843c749SSergey Zigachev 	uint32_t igam_lut_mode;
49*b843c749SSergey Zigachev 	uint32_t igam_input_format;
50*b843c749SSergey Zigachev 	uint32_t dgam_lut_mode;
51*b843c749SSergey Zigachev 	uint32_t rgam_lut_mode;
52*b843c749SSergey Zigachev 	uint32_t gamut_remap_mode;
53*b843c749SSergey Zigachev 	uint32_t gamut_remap_c11_c12;
54*b843c749SSergey Zigachev 	uint32_t gamut_remap_c13_c14;
55*b843c749SSergey Zigachev 	uint32_t gamut_remap_c21_c22;
56*b843c749SSergey Zigachev 	uint32_t gamut_remap_c23_c24;
57*b843c749SSergey Zigachev 	uint32_t gamut_remap_c31_c32;
58*b843c749SSergey Zigachev 	uint32_t gamut_remap_c33_c34;
59*b843c749SSergey Zigachev };
60*b843c749SSergey Zigachev 
61*b843c749SSergey Zigachev struct dpp_funcs {
62*b843c749SSergey Zigachev 	void (*dpp_read_state)(struct dpp *dpp, struct dcn_dpp_state *s);
63*b843c749SSergey Zigachev 
64*b843c749SSergey Zigachev 	void (*dpp_reset)(struct dpp *dpp);
65*b843c749SSergey Zigachev 
66*b843c749SSergey Zigachev 	void (*dpp_set_scaler)(struct dpp *dpp,
67*b843c749SSergey Zigachev 			const struct scaler_data *scl_data);
68*b843c749SSergey Zigachev 
69*b843c749SSergey Zigachev 	void (*dpp_set_pixel_storage_depth)(
70*b843c749SSergey Zigachev 			struct dpp *dpp,
71*b843c749SSergey Zigachev 			enum lb_pixel_depth depth,
72*b843c749SSergey Zigachev 			const struct bit_depth_reduction_params *bit_depth_params);
73*b843c749SSergey Zigachev 
74*b843c749SSergey Zigachev 	bool (*dpp_get_optimal_number_of_taps)(
75*b843c749SSergey Zigachev 			struct dpp *dpp,
76*b843c749SSergey Zigachev 			struct scaler_data *scl_data,
77*b843c749SSergey Zigachev 			const struct scaling_taps *in_taps);
78*b843c749SSergey Zigachev 
79*b843c749SSergey Zigachev 	void (*dpp_set_gamut_remap)(
80*b843c749SSergey Zigachev 			struct dpp *dpp,
81*b843c749SSergey Zigachev 			const struct dpp_grph_csc_adjustment *adjust);
82*b843c749SSergey Zigachev 
83*b843c749SSergey Zigachev 	void (*dpp_set_csc_default)(
84*b843c749SSergey Zigachev 		struct dpp *dpp,
85*b843c749SSergey Zigachev 		enum dc_color_space colorspace);
86*b843c749SSergey Zigachev 
87*b843c749SSergey Zigachev 	void (*dpp_set_csc_adjustment)(
88*b843c749SSergey Zigachev 		struct dpp *dpp,
89*b843c749SSergey Zigachev 		const uint16_t *regval);
90*b843c749SSergey Zigachev 
91*b843c749SSergey Zigachev 	void (*dpp_power_on_regamma_lut)(
92*b843c749SSergey Zigachev 		struct dpp *dpp,
93*b843c749SSergey Zigachev 		bool power_on);
94*b843c749SSergey Zigachev 
95*b843c749SSergey Zigachev 	void (*dpp_program_regamma_lut)(
96*b843c749SSergey Zigachev 			struct dpp *dpp,
97*b843c749SSergey Zigachev 			const struct pwl_result_data *rgb,
98*b843c749SSergey Zigachev 			uint32_t num);
99*b843c749SSergey Zigachev 
100*b843c749SSergey Zigachev 	void (*dpp_configure_regamma_lut)(
101*b843c749SSergey Zigachev 			struct dpp *dpp,
102*b843c749SSergey Zigachev 			bool is_ram_a);
103*b843c749SSergey Zigachev 
104*b843c749SSergey Zigachev 	void (*dpp_program_regamma_lutb_settings)(
105*b843c749SSergey Zigachev 			struct dpp *dpp,
106*b843c749SSergey Zigachev 			const struct pwl_params *params);
107*b843c749SSergey Zigachev 
108*b843c749SSergey Zigachev 	void (*dpp_program_regamma_luta_settings)(
109*b843c749SSergey Zigachev 			struct dpp *dpp,
110*b843c749SSergey Zigachev 			const struct pwl_params *params);
111*b843c749SSergey Zigachev 
112*b843c749SSergey Zigachev 	void (*dpp_program_regamma_pwl)(
113*b843c749SSergey Zigachev 		struct dpp *dpp,
114*b843c749SSergey Zigachev 		const struct pwl_params *params,
115*b843c749SSergey Zigachev 		enum opp_regamma mode);
116*b843c749SSergey Zigachev 
117*b843c749SSergey Zigachev 	void (*dpp_program_bias_and_scale)(
118*b843c749SSergey Zigachev 			struct dpp *dpp,
119*b843c749SSergey Zigachev 			struct dc_bias_and_scale *params);
120*b843c749SSergey Zigachev 
121*b843c749SSergey Zigachev 	void (*dpp_set_degamma)(
122*b843c749SSergey Zigachev 			struct dpp *dpp_base,
123*b843c749SSergey Zigachev 			enum ipp_degamma_mode mode);
124*b843c749SSergey Zigachev 
125*b843c749SSergey Zigachev 	void (*dpp_program_input_lut)(
126*b843c749SSergey Zigachev 			struct dpp *dpp_base,
127*b843c749SSergey Zigachev 			const struct dc_gamma *gamma);
128*b843c749SSergey Zigachev 
129*b843c749SSergey Zigachev 	void (*dpp_program_degamma_pwl)(struct dpp *dpp_base,
130*b843c749SSergey Zigachev 									 const struct pwl_params *params);
131*b843c749SSergey Zigachev 
132*b843c749SSergey Zigachev 	void (*dpp_setup)(
133*b843c749SSergey Zigachev 			struct dpp *dpp_base,
134*b843c749SSergey Zigachev 			enum surface_pixel_format format,
135*b843c749SSergey Zigachev 			enum expansion_mode mode,
136*b843c749SSergey Zigachev 			struct dc_csc_transform input_csc_color_matrix,
137*b843c749SSergey Zigachev 			enum dc_color_space input_color_space);
138*b843c749SSergey Zigachev 
139*b843c749SSergey Zigachev 	void (*dpp_full_bypass)(struct dpp *dpp_base);
140*b843c749SSergey Zigachev 
141*b843c749SSergey Zigachev 	void (*set_cursor_attributes)(
142*b843c749SSergey Zigachev 			struct dpp *dpp_base,
143*b843c749SSergey Zigachev 			enum dc_cursor_color_format color_format);
144*b843c749SSergey Zigachev 
145*b843c749SSergey Zigachev 	void (*set_cursor_position)(
146*b843c749SSergey Zigachev 			struct dpp *dpp_base,
147*b843c749SSergey Zigachev 			const struct dc_cursor_position *pos,
148*b843c749SSergey Zigachev 			const struct dc_cursor_mi_param *param,
149*b843c749SSergey Zigachev 			uint32_t width
150*b843c749SSergey Zigachev 			);
151*b843c749SSergey Zigachev 	void (*dpp_set_hdr_multiplier)(
152*b843c749SSergey Zigachev 			struct dpp *dpp_base,
153*b843c749SSergey Zigachev 			uint32_t multiplier);
154*b843c749SSergey Zigachev 	void (*set_optional_cursor_attributes)(
155*b843c749SSergey Zigachev 			struct dpp *dpp_base,
156*b843c749SSergey Zigachev 			struct dpp_cursor_attributes *attr);
157*b843c749SSergey Zigachev 
158*b843c749SSergey Zigachev 	void (*dpp_dppclk_control)(
159*b843c749SSergey Zigachev 			struct dpp *dpp_base,
160*b843c749SSergey Zigachev 			bool dppclk_div,
161*b843c749SSergey Zigachev 			bool enable);
162*b843c749SSergey Zigachev 
163*b843c749SSergey Zigachev };
164*b843c749SSergey Zigachev 
165*b843c749SSergey Zigachev 
166*b843c749SSergey Zigachev 
167*b843c749SSergey Zigachev #endif
168