xref: /openbmc/linux/drivers/gpu/drm/amd/display/dc/inc/hw/dpp.h (revision 82e6fdd6)
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 };
39 
40 struct dpp_grph_csc_adjustment {
41 	struct fixed31_32 temperature_matrix[CSC_TEMPERATURE_MATRIX_SIZE];
42 	enum graphics_gamut_adjust_type gamut_adjust_type;
43 };
44 
45 struct dpp_funcs {
46 	void (*dpp_reset)(struct dpp *dpp);
47 
48 	void (*dpp_set_scaler)(struct dpp *dpp,
49 			const struct scaler_data *scl_data);
50 
51 	void (*dpp_set_pixel_storage_depth)(
52 			struct dpp *dpp,
53 			enum lb_pixel_depth depth,
54 			const struct bit_depth_reduction_params *bit_depth_params);
55 
56 	bool (*dpp_get_optimal_number_of_taps)(
57 			struct dpp *dpp,
58 			struct scaler_data *scl_data,
59 			const struct scaling_taps *in_taps);
60 
61 	void (*dpp_set_gamut_remap)(
62 			struct dpp *dpp,
63 			const struct dpp_grph_csc_adjustment *adjust);
64 
65 	void (*dpp_set_csc_default)(
66 		struct dpp *dpp,
67 		enum dc_color_space colorspace);
68 
69 	void (*dpp_set_csc_adjustment)(
70 		struct dpp *dpp,
71 		const uint16_t *regval);
72 
73 	void (*dpp_power_on_regamma_lut)(
74 		struct dpp *dpp,
75 		bool power_on);
76 
77 	void (*dpp_program_regamma_lut)(
78 			struct dpp *dpp,
79 			const struct pwl_result_data *rgb,
80 			uint32_t num);
81 
82 	void (*dpp_configure_regamma_lut)(
83 			struct dpp *dpp,
84 			bool is_ram_a);
85 
86 	void (*dpp_program_regamma_lutb_settings)(
87 			struct dpp *dpp,
88 			const struct pwl_params *params);
89 
90 	void (*dpp_program_regamma_luta_settings)(
91 			struct dpp *dpp,
92 			const struct pwl_params *params);
93 
94 	void (*dpp_program_regamma_pwl)(
95 		struct dpp *dpp,
96 		const struct pwl_params *params,
97 		enum opp_regamma mode);
98 
99 	void (*dpp_program_bias_and_scale)(
100 			struct dpp *dpp,
101 			struct dc_bias_and_scale *params);
102 
103 	void (*dpp_set_degamma)(
104 			struct dpp *dpp_base,
105 			enum ipp_degamma_mode mode);
106 
107 	void (*dpp_program_input_lut)(
108 			struct dpp *dpp_base,
109 			const struct dc_gamma *gamma);
110 
111 	void (*dpp_program_degamma_pwl)(struct dpp *dpp_base,
112 									 const struct pwl_params *params);
113 
114 	void (*dpp_setup)(
115 			struct dpp *dpp_base,
116 			enum surface_pixel_format format,
117 			enum expansion_mode mode,
118 			struct csc_transform input_csc_color_matrix,
119 			enum dc_color_space input_color_space);
120 
121 	void (*dpp_full_bypass)(struct dpp *dpp_base);
122 
123 	void (*set_cursor_attributes)(
124 			struct dpp *dpp_base,
125 			enum dc_cursor_color_format color_format);
126 
127 	void (*set_cursor_position)(
128 			struct dpp *dpp_base,
129 			const struct dc_cursor_position *pos,
130 			const struct dc_cursor_mi_param *param,
131 			uint32_t width
132 			);
133 
134 };
135 
136 
137 
138 #endif
139