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